Template
1
0

Tiding up

This commit is contained in:
2025-07-07 03:42:12 +03:00
parent 7741351f8b
commit 95e475ef2a
3 changed files with 2 additions and 11 deletions

View File

@@ -31,7 +31,7 @@ void HTTPrequest::sendResponse(std::string status, std::string mime,
asio::async_write(
sock, asio::buffer(responseText),
[this, self = shared_from_this()](std::error_code, std::size_t) {
sock.shutdown(asio::ip::tcp::socket::shutdown_send);
sock.shutdown(asio::ip::tcp::socket::shutdown_both);
waitForClientClose();
});
}

View File

@@ -5,9 +5,6 @@
#include <istream>
#include <string>
// TODO: Remove boundary from the body. Do keep other stuff like
// file type and name
void HTTPrequest::processHTTPHeader() {
std::shared_ptr<HTTPrequest> self(shared_from_this());

View File

@@ -22,13 +22,7 @@ void Webserver::initResponses() {
auto result = Helpers::processFormData(self->bodyContent,
self->headers["Content-Type"]);
std::stringstream resp;
resp << "You have sent\n"
<< "filePassword = " << result["filePassword"].data << "\n"
<< "name = " << result["name"].data << "\n"
<< "numb = " << result["numb"].data << "\n"
<< "time = " << result["time"].data << "\n"
<< "uploadedFile = " << result["uploadedFile"].data << " as filetype "
<< result["uploadedFile"].headers["Content-Type"] << "\n";
resp << self->bodyContent;
self->sendResponse("200 OK", "text/text", resp.str());
};
}