Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

streaming upload "content-length: 0" overwrite bug #176

Closed
krukid opened this Issue Mar 12, 2012 · 1 comment

Comments

Projects
None yet
2 participants

krukid commented Mar 12, 2012

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 igrigorik closed this in a28801b Mar 13, 2012

Owner

igrigorik commented Mar 13, 2012

Thanks for reporting this!

@igrigorik igrigorik referenced this issue Mar 13, 2012

Closed

PUT Streaming #177

thoughtless pushed a commit to thoughtless/em-http-request that referenced this issue Mar 15, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment