Project

General

Profile

Bug #7957 ยป str_modify.rb

script to reproduce the issue (requires unicorn) - normalperson (Eric Wong), 02/25/2013 09:54 PM

 
1
require 'unicorn'
2
hp = Unicorn::HttpParser.new
3
hp.add_parse("PUT / HTTP/1.1\r\nHost:example.com\r\n" \
4
             "Transfer-Encoding: chunked\r\n\r\n")
5
dst = ""
6
hp.filter_body(dst, "50\r\n" + ("a" * 41))
7
tmp = dst.dup # this line causes dst to be come shared
8

    
9
# this will raise: can't set length of shared string (RuntimeError)
10
# if dst is used as an IO#write arg
11
hp.filter_body(dst, ("*" * 39) << "\r\n")