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
447 stars 119 forks source link

When using postman to test transfer files, problems will occur #30

Closed yixinshark closed 3 years ago

yixinshark commented 3 years ago

image

using postman for testing Post method and has a file。 When parsing files, 30s blocking often occurs. After tracking the code, I found that it took time in the place of HttpReadRequest::readBody, and jumped out from the place of "if(spendTime >= maximumTime)". Hope to get your reply, thank you!

yixinshark commented 3 years ago

Content-Type:multipart/form-data; boundary= User-Agent: PostmanRuntime/7.26.2

yixinshark commented 3 years ago

I modified two places: --- a/CPPWebFramework/cwf/httpparser.cpp +++ b/CPPWebFramework/cwf/httpparser.cpp @@ -201,7 +201,7 @@ void HttpParser::doParseFiles() if(!temp.contains(HTTP::WEBKIT) && !temp.contains("--------")) body += temp + "\n"; }

diff --git a/CPPWebFramework/cwf/httpreadrequest.cpp b/CPPWebFramework/cwf/httpreadrequest.cpp index ac8bbe0..18e2dab 100644 --- a/CPPWebFramework/cwf/httpreadrequest.cpp +++ b/CPPWebFramework/cwf/httpreadrequest.cpp @@ -61,7 +61,7 @@ void HttpReadRequest::run() buildSocket(); maxUploadFile = configuration.getMaxUploadFile(); socket->setReadBufferSize(maxUploadFile);

HerikLyma commented 3 years ago

Hello @yixinshark .

Thank you very much for reporting it. Can you please, open a pull request?

Best regards Herik Lima