-
Notifications
You must be signed in to change notification settings - Fork 530
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
feat: add server DisableHeaderNamesNormalizing option #839
feat: add server DisableHeaderNamesNormalizing option #839
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #839 +/- ##
===========================================
- Coverage 80.30% 80.25% -0.05%
===========================================
Files 97 97
Lines 9602 9620 +18
===========================================
+ Hits 7711 7721 +10
- Misses 1408 1413 +5
- Partials 483 486 +3
☔ View full report in Codecov by Sentry. |
4835aac
to
6dc350f
Compare
6dc350f
to
e26d309
Compare
pkg/protocol/http1/server.go
Outdated
@@ -179,6 +180,12 @@ func (s Server) Serve(c context.Context, conn network.Conn) (err error) { | |||
internalStats.Record(ti, stats.ReadHeaderFinish, err) | |||
}) | |||
} | |||
|
|||
if s.DisableHeaderNamesNormalizing { | |||
ctx.Request.Header.DisableNormalizing() |
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.
可以统一放在ctx从池子初始化的地方做,这个应该是一个”只需做一次的配置“,放在这里会影响每一个请求。
另外这个配置需要区分req/resp吗?
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.
我确定下
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.
done,另外区分了 request 和 response 配置
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.
之前应该想的有问题,这个配置最终生效在ctx.Request.Header的field上,这个是一个每次请求结束都会被重置的字段,看起来应该只能是每次解析请求前配置一次
move to #940 |
What type of PR is this?
feat
Check the PR title.
<type>(optional scope): <description>
.(Optional) Translate the PR title into Chinese.
(Optional) Which issue(s) this PR fixes:
(Optional) The PR that updates user documentation: