Skip to content
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

http3: set tls.Config.ServerName for outgoing requests, if unset #3867

Merged
merged 3 commits into from
Jun 1, 2023
Merged

Conversation

Glonee
Copy link
Contributor

@Glonee Glonee commented May 31, 2023

@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

Merging #3867 (739b92c) into master (fce0261) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #3867      +/-   ##
==========================================
- Coverage   83.91%   83.88%   -0.03%     
==========================================
  Files         146      146              
  Lines       14383    14390       +7     
==========================================
+ Hits        12069    12070       +1     
- Misses       1873     1877       +4     
- Partials      441      443       +2     
Impacted Files Coverage Δ
http3/client.go 85.80% <100.00%> (+0.32%) ⬆️

... and 3 files with indirect coverage changes

@marten-seemann
Copy link
Member

@kgersen Could you check if this PR fixes the regression you reported?

@kgersen
Copy link

kgersen commented May 31, 2023

partially. it works for simple cases. but when the connection is reused, for instance when following a redirect, it panics:

go run example/client/main.go -q https://www.google.com/

ok

but

go run example/client/main.go -q https://google.com/

panic: connection already exists.

it's the default behavior of std lib http client to follow redirects so http3 client should too.

I haven't looked further why this panic occurs. if @Glonee can look at too ? otherwise I'll try to fix it.

v0.34.0 was fine and handled the redirect fine.

side note: the new 'Transport' (quic.Transport) introduced in v0.35.0 add a bit of confusion. In std lib, Transport is usually understood as http.Transport (or http2.Transport), ie the implementation of HTTP/x protocol over TCP. Here it's called http3.RoundTripper and quic.Transport is something not specific to HTTP/3.
It's fine, it is just names and different packages but it's not very consistent with the stdlib.

@marten-seemann
Copy link
Member

@kgersen Thanks for testing.

panic: connection already exists.

The panic comes from here: https://github.com/quic-go/quic-go/blob/v0.35.0/multiplexer.go#L59. It shows that the http3 package is not using the quic.Transport correctly. That's a very annoying oversight, and shouldn't have made it into the final release. We definitely should have a test case for that (I'll create one right away).

side note: the new 'Transport' (quic.Transport) introduced in v0.35.0 add a bit of confusion. In std lib, Transport is usually understood as http.Transport (or http2.Transport), ie the implementation of HTTP/x protocol over TCP. Here it's called http3.RoundTripper and quic.Transport is something not specific to HTTP/3.

Noted. Improving documentation (both GoDoc and README) is on my TODO list.

@Glonee
Copy link
Contributor Author

Glonee commented May 31, 2023

@kgersen Can you check if the problem still exist?

@kgersen
Copy link

kgersen commented May 31, 2023

seems ok. thanks.
Both the provided example and our product (once we adapted / changed from using net.UDPConn to using quic.Transport) worked fine.
We didn't launch extensive tests, just our basic ones. I'll conduct more tests next week.

@marten-seemann
Copy link
Member

@Glonee Can you split the last 2 commits into a separate PR? It would also be great if we had a HTTP integration test that dials two QUIC connections. Any idea?

@Glonee
Copy link
Contributor Author

Glonee commented May 31, 2023

@marten-seemann localhost and 127.0.0.1 are considered as different server names. Maybe we can dial to localhost and 127.0.0.1 to make two QUIC connections?

@marten-seemann
Copy link
Member

Sounds like a good idea. You could change the self-signed certificate to be valid for both the IP and localhost:

DNSNames: []string{"localhost"},

http3/client_test.go Outdated Show resolved Hide resolved
http3/client_test.go Outdated Show resolved Hide resolved
http3/client.go Outdated Show resolved Hide resolved
@marten-seemann marten-seemann changed the title set tls.Config.ServerName in the http3/client.go/newClient() http3: set tls.Config.ServerName for outgoing requests, if unset May 31, 2023
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
Copy link
Member

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Glonee!

@marten-seemann marten-seemann merged commit 21549fc into quic-go:master Jun 1, 2023
17 checks passed
@Glonee Glonee deleted the h3 branch June 1, 2023 06:47
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

Successfully merging this pull request may close these issues.

v0.35.0 broke http3.RoundTripper and servername from url logic
3 participants