HerikLyma / CPPWebFramework

​The C++ Web Framework (CWF) is a MVC web framework, Open Source, under MIT License, using C++ with Qt to be used in the development of web applications.
MIT License
445 stars 119 forks source link

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

Closed LiChen23333 closed 12 months ago

LiChen23333 commented 1 year ago

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

num8er commented 1 year ago

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 commented 1 year ago

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

---- 回复的原邮件 ---- | 发件人 | Anar @.> | | 日期 | 2023年08月28日 08:07 | | 收件人 | @.> | | 抄送至 | @.>@.> | | 主题 | Re: [HerikLyma/CPPWebFramework] 修改了HttpParser::doParseHttpHeader解析header大小写未匹配的问题 (PR #39) |

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

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

num8er commented 1 year ago

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的原因。