-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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: sniff Content-Type when flushing the ResponseWriter #4412
http3: sniff Content-Type when flushing the ResponseWriter #4412
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4412 +/- ##
==========================================
- Coverage 84.79% 84.78% -0.01%
==========================================
Files 154 154
Lines 14645 14647 +2
==========================================
Hits 12418 12418
- Misses 1715 1716 +1
- Partials 512 513 +1 ☔ View full report in Codecov by Sentry. |
# Conflicts: # http3/response_writer.go
@WeidiDeng The large refactor for HTTP Datagram support (#4452) was merged. Do you want to update this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a lot cleaner now.
Do I understand correctly that the only thing that this PR changes is that the sniffing algorithm is now also run when flushing, whereas before it was only run on Write
?
This PR is the only thing left for the v0.43 release. |
Co-authored-by: Marten Seemann <martenseemann@gmail.com>
@WeidiDeng Can you confirm this? |
@marten-seemann Yes, I confirm that's the change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @WeidiDeng!
When caddy log is enabled, it can be observed
Content-Type
sniffing no longer works for http3, but works for h1/2. This is caused because when logging is enabled, caddy wraps all response writers withresponseRecorder
which will callWriteHeader
first.Stdlib will try set
Content-Type
header in the same logic, for http1,*chunkWriter
is wrapped by*response
to write the actual data. http2 will set this header in the same way.Because this header is set once, it won't be overwritten automatically