Skip to content

HTTP/1.0 support #287

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

Open
Shnatsel opened this issue Feb 27, 2021 · 4 comments
Open

HTTP/1.0 support #287

Shnatsel opened this issue Feb 27, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@Shnatsel
Copy link

On some websites, e.g. http://thomsonreuters.co.uk, surf fails with the following error:

Unsupported HTTP version

Firefox, curl and ureq (a blocking Rust client) work fine.

11820 websites out of the top million from Feb 3 Tranco list are affected.

Tested using this code. Test tool output from all affected websites: surf-unsupported-http-version.tar.gz

I've only tested the async-h1 backend; I don't know if the other backends are affected.

@Fishrock123
Copy link
Member

Fishrock123 commented Mar 1, 2021

async-h1 is a HTTP 1.1 parser.

Opt-in HTTP 1.0 support was recently-ish merged however, but you'll need to set that up yourself: http-rs/async-h1#170

That is server-only, there is no client support presently.

@Shnatsel
Copy link
Author

Shnatsel commented Mar 1, 2021

It would be nice to expose this option in surf and accept HTTP 1.0 by default, since literally every other client I've tested seems to do so.

@Fishrock123
Copy link
Member

(Note, this is barely over 1% of websites.)

It's of low importance to newer HTTP clients, but we may have an option to support it depending what implications it has.

@d4h0
Copy link

d4h0 commented Sep 21, 2021

I've only tested the async-h1 backend; I don't know if the other backends are affected.

At least with the hyper backend, this problem doesn't seem to exist:

$ longboard -c h1 GET http://thomsonreuters.co.uk
Error: Unsupported HTTP version

$ longboard -c hyper GET http://thomsonreuters.co.uk
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
response headers
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
{
    "content-type": "application/octet-stream",
    "server": "BigIP",
    "connection": "Keep-Alive",
    "location": "http://www.thomsonreuters.co.uk/",
    "content-length": "0",
}
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
status
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
301: Moved Permanently
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
response body (application/octet-stream)   <EMPTY>

It's of low importance to newer HTTP clients, but we may have an option to support it depending what implications it has.

To me, it seems like a big problem if 1% of all websites won't work with surf/h1. Basically, there is a 1% chance that I have to rewrite my code and use a different library, if I use async-std and surf (I use tokio and surf/hyper, so it's not a problem for me personally)

@Fishrock123 Fishrock123 added the enhancement New feature or request label Sep 21, 2021
@Fishrock123 Fishrock123 changed the title "Unsupported HTTP version" error on some websites - appears to be HTTP 1.0 HTTP/1.0 support Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants