streaming upload "content-length: 0" overwrite bug
Closed this issue · 1 comments
krukid commented
The patch has broken streaming uploads to my Goliath server:
#155
Test case here:
https://gist.github.com/2022252
Offending code at EventMachine::HttpClient#send_request
:
#...
# Set the Content-Length if file is given
head['content-length'] = File.size(file) if file # !!! will be overwritten
# Set the Content-Length if body is given,
# or we're doing an empty post or put
if body
head['content-length'] = body.bytesize
elsif @req.method == 'POST' or @req.method == 'PUT'
# wont happen if body is set and we already set content-length above
head['content-length'] = 0 # !!! this overwrites content-length for streaming uploads
end
#...
With correct "Content-Length" value attached scenario passes.
igrigorik commented
Thanks for reporting this!