1
0
forked from cat/WebBase

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( asio::async_write(
sock, asio::buffer(responseText), sock, asio::buffer(responseText),
[this, self = shared_from_this()](std::error_code, std::size_t) { [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(); waitForClientClose();
}); });
} }

View File

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

View File

@@ -22,13 +22,7 @@ void Webserver::initResponses() {
auto result = Helpers::processFormData(self->bodyContent, auto result = Helpers::processFormData(self->bodyContent,
self->headers["Content-Type"]); self->headers["Content-Type"]);
std::stringstream resp; std::stringstream resp;
resp << "You have sent\n" resp << self->bodyContent;
<< "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";
self->sendResponse("200 OK", "text/text", resp.str()); self->sendResponse("200 OK", "text/text", resp.str());
}; };
} }