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

krukid opened this Issue Mar 12, 2012 · 1 comment


None yet
2 participants

krukid commented Mar 12, 2012

The patch has broken streaming uploads to my Goliath server:

Test case here:

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


With correct "Content-Length" value attached scenario passes.

@igrigorik igrigorik closed this in a28801b Mar 13, 2012


igrigorik commented Mar 13, 2012

Thanks for reporting this!

@igrigorik igrigorik referenced this issue Mar 13, 2012


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