New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client doesn't handle HTTP continue #74
Comments
Which version of em-http? Can you try building and running this scenario through the latest in master? |
I was using 0.3.0. When I use the master branch, I get an error:
|
Using master, the headers callback is invoked with the header values that are read prior to the |
Interesting. I'm trying to wrap my head around the actual exchange -- is this even a valid response pattern? |
If I understand http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.2.3 correctly, it appears to be valid. And apparently, there's no way to turn this behavior off when you're using HTTP 1.1:
Here is the raw full request, for reference. That's not my server, so please be kind to it. :)
|
The response within the last example is very different from the first one.. In the first, 100 also returned a keep-alive header, as well as a content-length (which is what's confusing me). |
My apologies. I'm using em-http-request to proxy an HTTP call to ws.serviceobjects.com. The first response that I provided is the response from my proxy, not the response from ws.serviceobjects.com. Sorry for the indirection. |
That passes on this end.. It returns a 100, which is probably not what you're looking for, but it doesn't seem to blow up. Reading through the IIS forums, this seems to me more like a "bug" in IIS than intended behavior in the spec: http://forums.iis.net/p/1162153/1922653.aspx The client is definitely not setting an expects header, so as per suggested workaround.. in theory doing a 1.0 signature in the request could solve this. Having said that, what a pita! Still trying to wrap my head around how to handle this.. if at all. |
Ugh. Yeah. That's annoying. As far as I can tell, the HTTP spec seems to indicate that IIS 5 isn't doing something "wrong" by behaving this way. Still, I'm not sure how pervasive this server behavior is, and therefore if it's worth fixing. As it is now, it seems like the client can't be used with any server that responds with an HTTP 100 because the response headers and body are not parsed. I think the ideal scenario is to make this test pass:
Barring that, maybe I could look at adding support for forcing a request to HTTP/1.0. Though honestly, I'm not sure what other ramifications that would have, if any. |
The one major different between 1.0 and 1.1 is the keepalive sematics.. but something tells me that's not an issue here, since until very recently (still unreleased in master), keepalive was not an option in em-http. Relevant bits out of the spec: - Upon receiving a request which includes an Expect request-header field with the "100-continue" expectation, an origin server MUST either respond with 100 (Continue) status and continue to read from the input stream, or respond with a final status code. The origin server MUST NOT wait for the request body before sending the 100 (Continue) response. If it responds with a final status code, it MAY close the transport connection or it MAY continue to read and discard the rest of the request. It MUST NOT perform the requested method if it returns a final status code. - An origin server SHOULD NOT send a 100 (Continue) response if the request message does not include an Expect request-header field with the "100-continue" expectation, and MUST NOT send a 100 (Continue) response if such a request comes from an HTTP/1.0 (or earlier) client. There is an exception to this rule: for compatibility with RFC 2068, a server MAY send a 100 (Continue) status in response to an HTTP/1.1 PUT or POST request that does not include an Expect request-header field with the "100- continue" expectation. This exception, the purpose of which is to minimize any client processing delays associated with an undeclared wait for 100 (Continue) status, applies only to HTTP/1.1 requests, and not to requests with any other HTTP- version value. So, assuming we're keeping the client at 1.1, you're right.. we're hitting the RFC 2068 exception. Ugh. I wish whoever wrote this stuff would actually have to implement it as well. ;-) |
fix rfc2616 / rfc2068 conflict for 100-continue behavior, closed by e22e948 |
I meant to thank you sooner for looking at this and fixing it. Thanks! |
We have a server that is returning the below response. The client reads everything before the
HTTP/1.1 500 Internal Server Error
line as the response header. That line and everything below is contained in the response body.The text was updated successfully, but these errors were encountered: