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: add remote address to request context #4208

Merged
merged 2 commits into from
Dec 16, 2023

Conversation

oncilla
Copy link
Contributor

@oncilla oncilla commented Dec 14, 2023

Add the remote address of the underlying packet connection to the HTTP request context. This is useful for applications that need access to the actual remote address (wrapped in a net.Addr) rather than just its string representation.

Fixes #4198

Add the remote address of the underlying packet connection to the
HTTP request context. This is useful for applications that need access
to the actual remote address (wrapped in a net.Addr) rather than just
its string representation.

Fixes quic-go#4198
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.

Code lgtm. Could you add a test please in integrationtests/self/http_test.go?

I was not sure how deep we want to go to assure the right value is set.
For now, it asserts that a net.Addr is present in the context.

Due to the dynamic nature of the requests, it is a bit harder to know
exactly how the remote address will look like. IPv4 vs IPv6, random high
port. I think it is fine to only assert that the value is present.
@oncilla
Copy link
Contributor Author

oncilla commented Dec 14, 2023

Done.

I was not sure how deep we want to go to assure the right value is set.
For now, it asserts that a net.Addr is present in the context.

Due to the dynamic nature of the requests, it is a bit harder to know
exactly how the remote address will look like. IPv4 vs IPv6, random high
port. I think it is fine to only assert that the value is present.

@marten-seemann
Copy link
Member

I was not sure how deep we want to go to assure the right value is set. For now, it asserts that a net.Addr is present in the context.

Due to the dynamic nature of the requests, it is a bit harder to know exactly how the remote address will look like. IPv4 vs IPv6, random high port. I think it is fine to only assert that the value is present.

Makes sense, thank you!

Copy link

codecov bot commented Dec 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6ffb905) 83.75% compared to head (7d28c30) 83.73%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4208      +/-   ##
==========================================
- Coverage   83.75%   83.73%   -0.02%     
==========================================
  Files         150      150              
  Lines       15470    15471       +1     
==========================================
- Hits        12956    12954       -2     
- Misses       2016     2019       +3     
  Partials      498      498              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marten-seemann marten-seemann merged commit 06c6a84 into quic-go:master Dec 16, 2023
19 checks passed
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.

proposal: attach remote address to context in HTTP3 request
2 participants