stream_file :content_length opts bug
Reported by Serhiy Boiko | July 21st, 2008 @ 01:51 PM | in 0.9.4
In current head(and 0.9.3) implementation parameter :content_length expects to receive Numeric value. But when headers updated in method body, params :content_length isn't casted to String.
On render phase for each headers called :each method. It works for String and doesn't for Number. It's first issue. I propose simply to call :to_s method in:
'CONTENT-LENGTH' => opts[:content_length].to_s
Second issue concerned with obligatority of :content_length opts. You should provide this params, or receive #
Comments and changes to this ticket
-

Serhiy Boiko July 21st, 2008 @ 01:56 PM
- → Tag changed from to merb-core render trivial
In description of second issue, I have pasted html-braces and second part has been hidden. So, here is what has been disappeared:
Second issue concerned with obligatority of :content_length opts. You should provide this params, or receive NoMethodError: undefined method `each' for nil:NilClass.
Maybe method should check presence of this parameter and raise an exception if :content_length isn't setted.
-
Michael Klishin (antares) July 22nd, 2008 @ 05:46 AM
- → Milestone changed from to 0.9.4
- → State changed from new to open
- → Assigned user changed from to Michael Klishin (antares)
Merb acts per Rack specification for headers and the body. I am not completely sure but looks like WSGI has the same sort of problem: some params that should be obligatory are actually not according to 1.0 spec most web servers and frameworks use.
Will do an investigation.
-
Michael Klishin (antares) July 22nd, 2008 @ 05:47 AM
When I say params in the comment above I mean headers.
-
Michael Klishin (antares) August 2nd, 2008 @ 06:42 PM
- → Milestone changed from 0.9.4 to 0.9.5
-
Michael Klishin (antares) August 10th, 2008 @ 03:16 AM
- → Milestone changed from 0.9.5 to 0.9.4
- → State changed from open to resolved
Fixed in head, will make it into 0.9.4. Rack spec says header values must respond to :each and yield strings so we now call .to_s on the integer.
Closing, it's soon-to-be-pushed.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
