Repository navigation
reverse_proxy: use interfaces to modify the behaviors of the transports - #7353
Merged
Merged
Conversation
mholt
approved these changes
Nov 17, 2025
mholt
left a comment
Member
There was a problem hiding this comment.
I think I like this much better. Thank you Weidi!
Comment on lines
+115
to
+124
| // DefaultBufferSizes enables request buffering for fastcgi if not configured. | ||
| // This is because most fastcgi servers are php-fpm that require the content length to be set to read the body, golang | ||
| // std has fastcgi implementation that doesn't need this value to process the body, but we can safely assume that's | ||
| // not used. | ||
| // http3 requests have a negative content length for GET and HEAD requests, if that header is not sent. | ||
| // see: https://github.com/caddyserver/caddy/issues/6678#issuecomment-2472224182 | ||
| // Though it appears even if CONTENT_LENGTH is invalid, php-fpm can handle just fine if the body is empty (no Stdin records sent). | ||
| // php-fpm will hang if there is any data in the body though, https://github.com/caddyserver/caddy/issues/5420#issuecomment-2415943516 | ||
|
|
||
| // TODO: better default buffering for fastcgi requests without content length, in theory a value of 1 should be enough, make it bigger anyway |
Member
There was a problem hiding this comment.
Technically the newline between the comments breaks the godoc
Suggested change
| // DefaultBufferSizes enables request buffering for fastcgi if not configured. | |
| // This is because most fastcgi servers are php-fpm that require the content length to be set to read the body, golang | |
| // std has fastcgi implementation that doesn't need this value to process the body, but we can safely assume that's | |
| // not used. | |
| // http3 requests have a negative content length for GET and HEAD requests, if that header is not sent. | |
| // see: https://github.com/caddyserver/caddy/issues/6678#issuecomment-2472224182 | |
| // Though it appears even if CONTENT_LENGTH is invalid, php-fpm can handle just fine if the body is empty (no Stdin records sent). | |
| // php-fpm will hang if there is any data in the body though, https://github.com/caddyserver/caddy/issues/5420#issuecomment-2415943516 | |
| // TODO: better default buffering for fastcgi requests without content length, in theory a value of 1 should be enough, make it bigger anyway | |
| // DefaultBufferSizes enables request buffering for fastcgi if not configured. | |
| // This is because most fastcgi servers are php-fpm that require the content length to be set to read the body, golang | |
| // std has fastcgi implementation that doesn't need this value to process the body, but we can safely assume that's | |
| // not used. | |
| // http3 requests have a negative content length for GET and HEAD requests, if that header is not sent. | |
| // see: https://github.com/caddyserver/caddy/issues/6678#issuecomment-2472224182 | |
| // Though it appears even if CONTENT_LENGTH is invalid, php-fpm can handle just fine if the body is empty (no Stdin records sent). | |
| // php-fpm will hang if there is any data in the body though, https://github.com/caddyserver/caddy/issues/5420#issuecomment-2415943516 | |
| // TODO: better default buffering for fastcgi requests without content length, in theory a value of 1 should be enough, make it bigger anyway |
Member
There was a problem hiding this comment.
Dangit, nice catch Francis. Thanks
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some behaviors of the transports used by reverse proxy rely on type assertion to an actual type to modify the behavior of the transports,
By using interfaces, it's possible for third party transport implementations to implement them to automatically get the behaviors we want.
Assistance Disclosure
No AI was used.