Loading src/http.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -2606,8 +2606,14 @@ void libhttppp::HttpForm::parse(libhttppp::HttpRequest &request){ throw excep; } // Use content-length if available, otherwise fall back to RecvData size // (HTTP/2 and HTTP/3 may omit Content-Length) size_t bodyLen = request.getContentLength(); if(bodyLen == 0) bodyLen = request.RecvData.size(); for(auto *cval=ctype->getfirstValue(); cval; cval=cval->nextvalue()){ if(request.getContentLength() <= request.RecvData.size()){ if(bodyLen <= request.RecvData.size()){ if(cval->getvalue().find("multipart/form-data") != std::string::npos){ _contentType = "multipart/form-data"; for(auto *cbod=ctype->getfirstValue(); cbod; cbod=cbod->nextvalue()){ Loading @@ -2632,7 +2638,7 @@ void libhttppp::HttpForm::parse(libhttppp::HttpRequest &request){ } if(cval->getvalue().find("application/x-www-form-urlencoded") != std::string::npos){ _contentType = "application/x-www-form-urlencoded"; _parseUrlDecode(request.RecvData.data(), request.getContentLength()); _parseUrlDecode(request.RecvData.data(), bodyLen); } } } Loading src/httpd.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -619,6 +619,12 @@ void libhttppp::HttpEvent::Http3StreamEvent(netplus::socket *sock, tempreq.RecvData.append(bodyData.data(), bodyData.size()); } // Ensure content-length is set from actual body size (H3 framing // provides the length, but application code may rely on the header) if (!bodyData.empty() && !tempreq.getHeaderData("content-length")) { tempreq.setHeaderData("content-length")->push_back(std::to_string(bodyData.size())); } // Call user's RequestEvent RequestEvent(tempreq, 0, 0); Loading Loading
src/http.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -2606,8 +2606,14 @@ void libhttppp::HttpForm::parse(libhttppp::HttpRequest &request){ throw excep; } // Use content-length if available, otherwise fall back to RecvData size // (HTTP/2 and HTTP/3 may omit Content-Length) size_t bodyLen = request.getContentLength(); if(bodyLen == 0) bodyLen = request.RecvData.size(); for(auto *cval=ctype->getfirstValue(); cval; cval=cval->nextvalue()){ if(request.getContentLength() <= request.RecvData.size()){ if(bodyLen <= request.RecvData.size()){ if(cval->getvalue().find("multipart/form-data") != std::string::npos){ _contentType = "multipart/form-data"; for(auto *cbod=ctype->getfirstValue(); cbod; cbod=cbod->nextvalue()){ Loading @@ -2632,7 +2638,7 @@ void libhttppp::HttpForm::parse(libhttppp::HttpRequest &request){ } if(cval->getvalue().find("application/x-www-form-urlencoded") != std::string::npos){ _contentType = "application/x-www-form-urlencoded"; _parseUrlDecode(request.RecvData.data(), request.getContentLength()); _parseUrlDecode(request.RecvData.data(), bodyLen); } } } Loading
src/httpd.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -619,6 +619,12 @@ void libhttppp::HttpEvent::Http3StreamEvent(netplus::socket *sock, tempreq.RecvData.append(bodyData.data(), bodyData.size()); } // Ensure content-length is set from actual body size (H3 framing // provides the length, but application code may rely on the header) if (!bodyData.empty() && !tempreq.getHeaderData("content-length")) { tempreq.setHeaderData("content-length")->push_back(std::to_string(bodyData.size())); } // Call user's RequestEvent RequestEvent(tempreq, 0, 0); Loading