Skip to content

Failure to parse 200 status code not followed by SP #29

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

Closed
donniebishop opened this issue Dec 3, 2016 · 6 comments
Closed

Failure to parse 200 status code not followed by SP #29

donniebishop opened this issue Dec 3, 2016 · 6 comments

Comments

@donniebishop
Copy link

I was trying to use hyper and reqwest on a project yesterday to communicate to a server internal to my workplace. When trying to create a client using either crate, it returns an HTTP(Status) error, stating "Invalid Status provided".

Here's the strace of the executable, changed only to remove private server details from the request and response headers:

sendto(3, "GET /{OMITTED} HTTP/1.1\r\nHost: {OMITTED}\r\nAccept: */*\r\nUser-Agent: reqwest/0.1.0\r\n\r\n", 103, 0, NULL, 0) = 103
read(3, "HTTP/1.1 200\r\nServer: nginx/1.4.6 (Ubuntu)\r\nDate: Fri, 02 Dec 2016 21:18:20 GMT\r\nContent-Type: text/html\r\nTransfer-Encoding: chunked\r\nConnection: keep-alive\r\nContent-Language: en\r\n\r\n1fba\r\n<html>\n<head>

{Output Truncated}

write(1, "Failed because: Invalid Status provided\n", 40Failed because: Invalid Status provided
) = 40
+++ exited with 0 +++

After discussing this in the rust IRC, we've suspect that httparse might be failing on the fact that the custom webserver is returning "HTTP/1.1 200\r\n", with no SP or Reason Phrase following the status code before the CRLF.

CCing @joshtriplett on this, as well, since he helped me find the issue

@joshtriplett
Copy link

Note that curl's HTTP parsing accepts this response. While such a response voilates the HTTP spec, curl seems to tolerate it, and I would suggest that httparse should as well.

@seanmonstar
Copy link
Owner

seanmonstar commented Dec 3, 2016 via email

@seanmonstar
Copy link
Owner

This has been included in the newly published v1.2.1.

@donniebishop
Copy link
Author

Great turnaround for this Sean! Thanks!

Will this functionality be ported downstream into hyper and subsequently reqwest?

@seanmonstar
Copy link
Owner

Both of those depend on essentially 1.x of httparse, so running a cargo update in your project should bring it up to date.

@donniebishop
Copy link
Author

donniebishop commented Dec 4, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants