From 3e9c06cf792bc6e88c7dcfdee407e802b6df0ffc Mon Sep 17 00:00:00 2001 From: yhirose Date: Thu, 18 Jun 2020 12:18:43 -0400 Subject: [PATCH] Fixed #527 --- httplib.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/httplib.h b/httplib.h index 13da9fe..cb020f0 100644 --- a/httplib.h +++ b/httplib.h @@ -2781,9 +2781,12 @@ inline bool parse_multipart_boundary(const std::string &content_type, std::string &boundary) { auto pos = content_type.find("boundary="); if (pos == std::string::npos) { return false; } - boundary = content_type.substr(pos + 9); - return true; + if (boundary.length() >= 2 && boundary.front() == '"' && + boundary.back() == '"') { + boundary = boundary.substr(1, boundary.size() - 2); + } + return !boundary.empty(); } inline bool parse_range_header(const std::string &s, Ranges &ranges) {