clean comment and stuff

This commit is contained in:
lperrey
2022-08-18 12:44:09 +02:00
parent 9b0fcc1520
commit 469eca8aa9
27 changed files with 100 additions and 325 deletions

View File

@@ -36,8 +36,6 @@ void Client::_parse_multipart_body(size_t pos)
}
start_pos += sizeof("boundary=")-1;
boundary = boundary.substr(start_pos);
std::cerr << "boundary =|" << boundary << "|\n";
// Search boundary
start_pos = raw_request.find("--" + boundary, pos);
@@ -48,7 +46,7 @@ void Client::_parse_multipart_body(size_t pos)
}
start_pos += sizeof("--")-1 + boundary.size() + CRLF_SIZE;
while (1) // TODO : test loop for multi body
while (1)
{
end_pos = raw_request.find("--" + boundary, start_pos);
if (end_pos == NPOS)
@@ -56,9 +54,6 @@ void Client::_parse_multipart_body(size_t pos)
status = 400; std::cerr << "_parse_multipart_body() error 3\n";
return;
}
/* // Maye useful for multi body (remove "start_pos - CRLF_SIZE" if used)
end_pos = raw_request.rfind(CRLF, end_pos); if (end_pos == NPOS) {status = 400; return; } */
new_body.body = raw_request.substr(start_pos, end_pos - start_pos - CRLF_SIZE);
// Split headers from body
@@ -74,7 +69,6 @@ void Client::_parse_multipart_body(size_t pos)
}
tmp_pos += CRLF_SIZE*2;
new_body.body.erase(0, tmp_pos);
// ::print_map(new_body.headers);
}
else
{ // No headers case
@@ -94,10 +88,5 @@ void Client::_parse_multipart_body(size_t pos)
&& raw_request[start_pos] == '-'
&& raw_request[start_pos+1] == '-')
break;
/* ::print_special(raw_request);
std::cerr << "start_pos = " << start_pos << "\n";
std::cerr << "raw_request.size() = " << raw_request.size() << "\n";
std::cerr << raw_request.substr(start_pos); */
}
}