Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion include/crow/multipart.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,19 @@ namespace crow
return std::string();
}

// cpp17(cpp 20 have) does not have ends_with, so we need to implement it ourselves
bool ends_with(const std::string& str, const std::string& suffix) {
if (suffix.size() > str.size()) return false;
return std::equal(suffix.rbegin(), suffix.rend(), str.rbegin());
}

void parse_body(std::string body)
{
std::string delimiter = dd + boundary;

if(!ends_with(body, crlf))
{
body += crlf;
}
// TODO(EDev): Exit on error
while (body != (crlf))
{
Expand Down
Loading