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

修改了HttpParser::doParseHttpHeader解析header大小写未匹配的问题 #39

Closed

Conversation

LiChen23333
Copy link

我是在使用了vite 的proxy 进行接口转发时发现的此类问题,应该是vite的代理将我原来的header全部转为小写了,例如将
Content-Length:256368 转为了content-length:256368
这样无法正确读取到body的总长度,因此body长度一旦超过tcp窗口的最大值,则无法正确运行httpreadrequest.cpp 中 HttpReadRequest::readBody的逻辑,导致我无法继续接收下一个tcp包的body数据,所以我的post body被截断了。

Content-Length:256368 转为了content-length:256368
这样无法正确读取到body的总长度,因此body长度一旦超过tcp窗口的最大值,则无法正确运行httpreadrequest.cpp 中 HttpReadRequest::readBody的逻辑,导致我无法继续接收下一个tcp包的body数据,所以我的post body被截断了。
@num8er
Copy link

num8er commented Aug 28, 2023

Instead of trying to make serverside code to be universal with clients, I would recommend make PR on client code which sends headers lowercased.

With other words:
Client must send header field names correctly. Content-Type, Content-Length

Otherwise it shows that clientside code maintainer does not know how to write correct header names.
Give them RFC to read:
https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.1.5 - Content-Type
https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2 - Content-Length

IMHO this PR should not exist.

@LiChen23333
Copy link
Author

LiChen23333 commented Aug 28, 2023 via email

@num8er
Copy link

num8er commented Aug 28, 2023

Good.
I suggest to close this PR.
But up to You.
I still believe protocols must be strict.
So client code should follow protocol.

是的 我也认为http头应该在客户端格式化,我的前端代码已经进行了大小写格式化,但是在经过vite代理转发时它帮我处理为了小写,我再找一找vite的原因。

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.

2 participants