diff --git a/lib/inc/drogon/MultiPart.h b/lib/inc/drogon/MultiPart.h index eb6531ed..021bdd5e 100644 --- a/lib/inc/drogon/MultiPart.h +++ b/lib/inc/drogon/MultiPart.h @@ -178,8 +178,9 @@ class DROGON_EXPORT MultiPartParser int parse(const HttpRequestPtr &req, const char *boundaryData, size_t boundaryLen); - int parseEntity(const char *begin, const char *end); - HttpRequestPtr requestPtr_; + int parseEntity(const HttpRequestPtr &req, + const char *begin, + const char *end); }; /// In order to be compatible with old interfaces diff --git a/lib/src/MultiPart.cc b/lib/src/MultiPart.cc index 43c9fbbc..fc6848cf 100644 --- a/lib/src/MultiPart.cc +++ b/lib/src/MultiPart.cc @@ -104,7 +104,9 @@ static std::pair parseLine( return std::make_pair(std::string_view(), std::string_view()); } -int MultiPartParser::parseEntity(const char *begin, const char *end) +int MultiPartParser::parseEntity(const HttpRequestPtr &req, + const char *begin, + const char *end) { static const char entityName[] = "name="; static const char fileName[] = "filename="; @@ -174,7 +176,7 @@ int MultiPartParser::parseEntity(const char *begin, const char *end) fileNameEnd = std::find(fileNamePos, valueEnd, ';'); } std::string fName{fileNamePos, fileNameEnd}; - filePtr->setRequest(requestPtr_); + filePtr->setRequest(req); filePtr->setItemName(std::move(name)); filePtr->setFileName(std::move(fName)); filePtr->setFile(headEnd + 2, @@ -218,7 +220,6 @@ int MultiPartParser::parse(const HttpRequestPtr &req, std::string_view boundary{boundaryData, boundaryLen}; if (boundary.size() > 2 && boundary[0] == '\"') boundary = boundary.substr(1, boundary.size() - 2); - requestPtr_ = req; std::string_view::size_type pos1, pos2; pos1 = 0; auto content = static_cast(req.get())->bodyView(); @@ -241,7 +242,7 @@ int MultiPartParser::parse(const HttpRequestPtr &req, pos2 -= 4; flag = true; } - if (parseEntity(content.data() + pos1, content.data() + pos2) != 0) + if (parseEntity(req, content.data() + pos1, content.data() + pos2) != 0) return -1; if (flag) pos2 += 4; diff --git a/trantor b/trantor index b4e9c8b8..c9228011 160000 --- a/trantor +++ b/trantor @@ -1 +1 @@ -Subproject commit b4e9c8b86300419a1792b73cf60747c9c350686d +Subproject commit c92280119a6ebaf71fe6aca0d128222edd028b22