Skip to content

Return the response HTTP version to the user #164

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
grosch opened this issue Feb 17, 2020 · 4 comments · Fixed by #182
Closed

Return the response HTTP version to the user #164

grosch opened this issue Feb 17, 2020 · 4 comments · Fixed by #182
Labels
kind/enhancement Improvements to existing feature.

Comments

@grosch
Copy link

grosch commented Feb 17, 2020

var head = HTTPRequestHead(version: HTTPVersion(major: 1, minor: 1), method: request.method, uri: request.url.uri)

Why is this hardcoding 1.1? There are still severs that return 1.0, and when doing caching it's important to know whether it's a 1.0 or 1.1 type reply because that changes what you send back in to do validation.

@Lukasa
Copy link
Collaborator

Lukasa commented Feb 17, 2020

Because we only emit HTTP/1.1 requests, regardless of what the server responds with.

@grosch
Copy link
Author

grosch commented Feb 17, 2020

So I'm probably looking in the wrong area then. I'm trying to find out what version the server responded with.

@tanner0101

@tanner0101
Copy link
Member

The HTTP version struct is indeed not passed along in the response either: https://github.com/swift-server/async-http-client/blob/master/Sources/AsyncHTTPClient/HTTPHandler.swift#L343-L346

I assume this is because it wouldn't make sense for a server to respond with 1.0 when a 1.1 request was sent. But I don't have an RFC reference to back that claim up.

@Lukasa
Copy link
Collaborator

Lukasa commented Feb 18, 2020

Servers are free to respond with a 1.0 response to a 1.1 request. This seems like something we should communicate back to the user.

@Lukasa Lukasa added the kind/enhancement Improvements to existing feature. label Feb 18, 2020
@Lukasa Lukasa changed the title Why hardcode HTTP 1.1? Return the response HTTP version to the user Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements to existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants