aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/clients/httpclientcommon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenhttp/clients/httpclientcommon.cpp')
-rw-r--r--src/zenhttp/clients/httpclientcommon.cpp33
1 files changed, 15 insertions, 18 deletions
diff --git a/src/zenhttp/clients/httpclientcommon.cpp b/src/zenhttp/clients/httpclientcommon.cpp
index 248ae9d70..9ded23375 100644
--- a/src/zenhttp/clients/httpclientcommon.cpp
+++ b/src/zenhttp/clients/httpclientcommon.cpp
@@ -394,31 +394,28 @@ namespace detail {
{
// Yes, we do a substring of the non-lowercase value string as we want the exact boundary string
std::string_view BoundaryName = std::string_view(ContentTypeHeaderValue).substr(BoundaryPos + 9);
+ size_t BoundaryEnd = std::string::npos;
+ while (!BoundaryName.empty() && BoundaryName[0] == ' ')
+ {
+ BoundaryName = BoundaryName.substr(1);
+ }
if (!BoundaryName.empty())
{
- size_t BoundaryEnd = std::string::npos;
- while (BoundaryName[0] == ' ')
- {
- BoundaryName = BoundaryName.substr(1);
- }
- if (!BoundaryName.empty())
+ if (BoundaryName.size() > 2 && BoundaryName.front() == '"' && BoundaryName.back() == '"')
{
- if (BoundaryName.size() > 2 && BoundaryName.front() == '"' && BoundaryName.back() == '"')
+ BoundaryEnd = BoundaryName.find('"', 1);
+ if (BoundaryEnd != std::string::npos)
{
- BoundaryEnd = BoundaryName.find('"', 1);
- if (BoundaryEnd != std::string::npos)
- {
- BoundaryBeginMatcher.Init(fmt::format("\r\n--{}", BoundaryName.substr(1, BoundaryEnd - 1)));
- return true;
- }
- }
- else
- {
- BoundaryEnd = BoundaryName.find_first_of(" \r\n");
- BoundaryBeginMatcher.Init(fmt::format("\r\n--{}", BoundaryName.substr(0, BoundaryEnd)));
+ BoundaryBeginMatcher.Init(fmt::format("\r\n--{}", BoundaryName.substr(1, BoundaryEnd - 1)));
return true;
}
}
+ else
+ {
+ BoundaryEnd = BoundaryName.find_first_of(" \r\n");
+ BoundaryBeginMatcher.Init(fmt::format("\r\n--{}", BoundaryName.substr(0, BoundaryEnd)));
+ return true;
+ }
}
}
}