On Friday, June 21, 2013 7:21:14 AM UTC-7, Matt Sergeant wrote:

>
> On Fri, Jun 21, 2013 at 4:58 AM, Austin William Wright <
> [email protected] <javascript:>> wrote:
>
>> I believe this is correct behavior. Once $Content-Length amount of bytes 
>> have been sent, the response is finished, and the next item in a connection 
>> should be the "HTTP/1.1" header to mark a new response.
>>
>> The error code basically means "Unexpected start of a response".
>>
>
> I have mixed feelings - I agree that maybe you should get that error 
> somehow, but it also doesn't give you all the data correctly, so there's a 
> middle ground that might be nice to strike.
>
> Matt.
>

How would you do that though? How is the library supposed to know the 
difference between "accidentally sent an invalid new response" and 
"accidentally overran the existing response where a new one should have 
started"?

Try this example: Send an entity body of these 18 bytes (JSON string): 
"x\nHTTP/1.0 200\r\n\r\n" but send a Content-Length of 2. You should get a 
different error, because the content that overflows looks like a valid HTTP 
response-line. I tried it with curl too, which gives similar errors: `curl 
-v http://localhost:8080/ http://localhost:8080/`

There's no way you can fix this on the client library, but perhaps Node.js 
should do some sanity checking to make sure the response isn't being run 
longer than the advertised Content-Length. (Which should be disable-able, 
for testing and other experimentation.)

Austin Wright.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to