Uh oh!
There was an error while loading. Please reload this page.
Fix wrong Content-Length with non ASCII-8BIT strings. - #12
Conversation
There was a problem hiding this comment.
Shouldn't this be content instead of @content, to prevent calling nil.bytesize
There was a problem hiding this comment.
Nope, @content presence is already checked above, there's no chance for it to be nil.
rcarvalho
commented
Jul 18, 2012
Thanks for that fix, guys. Is anyone still taking ownership of this code? I see that they still haven't merged your fix in. You wouldn't have happened to publish a new version to rubygems.org would you? I guess I could just fork and merge in your changes myself. |
…ngth with non ASCII-8BIT strings
jay2u
commented
Nov 23, 2012
This is actually still an issue. We are using a monkey patch to fix this at the moment (after spending quite some time finding the origin of this problem) only to find out there was already a pull request for this... Any reason this cannot be merged into the master branch? Don't get me wrong. Thanks for a great piece of software otherwise. Brilliant stuff... |
halida
commented
Nov 25, 2013
The newest gem version 0.2.1 still has this problem, consider release new version? |
philayres
commented
Jan 19, 2014
@halida - I just found this too. I worked around the issue directly in my code with: Its a shame that the current version of the gem doesn't handle this. Time for a new version. |
jay2u
commented
Feb 19, 2014
@philayres Yes that would work but only with ASCII_8BIT. The issue here, amongst other things, is trying to avoid unicode body payloads becoming truncated. |
I was implementing a proxy and noticed I was getting a truncated result, after some time thinking it was my fault I thought about the Content-Length being wrong, and apparently evma_httpserver uses #length instead of #bytesize.
Putting #bytesize everything works properly.
Sorry for the change in the gemspec but it wasn't building with this error:
I also faced another problem with header names, it would be really best if you used the common names and not weirdly different names, for instance: Content-Length instead of Content-length. If it's wanted I could write a patch for this and send another pull request. (EDIT: #10 this does what I meant)
Thanks.