Skip to content

How to use http/1.1 protocol #50

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
cyal1 opened this issue Sep 13, 2021 · 3 comments · Fixed by #56 or #74
Closed

How to use http/1.1 protocol #50

cyal1 opened this issue Sep 13, 2021 · 3 comments · Fixed by #56 or #74
Assignees
Labels
Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Enhancement Most issues will probably ask for additions or changes.

Comments

@cyal1
Copy link

cyal1 commented Sep 13, 2021

How to use http/1.1 protocol

@Mzack9999 Mzack9999 added the Type: Question A query or seeking clarification on parts of the spec. Probably doesn't need the attention of all. label Sep 13, 2021
@Mzack9999
Copy link
Member

@cyal1 Thanks for opening this issue. The HTTP protocol is something negotiated by the client and not enforced by the server. To force it, you should explicitly set your client to use HTTP 1.X, and, I suppose, it's also necessary to skip alpn/npn negotiation. For example, with curl, the following command performs the request with HTTP 1.1:

curl https://localhost:8000 -v --http1.1 -k

@cyal1
Copy link
Author

cyal1 commented Sep 18, 2021

hello, I want the service only support http/1.1

@Mzack9999
Copy link
Member

net/http supports natively http/2 upgrade upon client request. I guess in this case we would need to add a CLI flag to specify explicitly which protocol to use as it needs to be set through TLSNextProto in the http server settings:

srv := &http.Server{
    Addr:         "127.0.0.1:8000",
    TLSNextProto: make(map[string]func(*http.Server, *tls.Conn, http.Handler)),
}

@Mzack9999 Mzack9999 linked a pull request Oct 16, 2021 that will close this issue
@forgedhallpass forgedhallpass added Type: Enhancement Most issues will probably ask for additions or changes. Status: In Progress This issue is being worked on, and has someone assigned. Status: Review Needed The issue has a PR attached to it which needs to be reviewed and removed Type: Question A query or seeking clarification on parts of the spec. Probably doesn't need the attention of all. Status: In Progress This issue is being worked on, and has someone assigned. labels Oct 26, 2021
@ehsandeep ehsandeep added Status: Completed Nothing further to be done with this issue. Awaiting to be closed. and removed Status: Review Needed The issue has a PR attached to it which needs to be reviewed labels Oct 30, 2021
@ehsandeep ehsandeep linked a pull request Apr 18, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Enhancement Most issues will probably ask for additions or changes.
Projects
None yet
4 participants