Http/1.1 -> HTTP/1.1

This commit is contained in:
sha512sum 2024-07-04 21:07:38 +00:00
parent 7c00dc1860
commit f1501b0b17
4 changed files with 4 additions and 4 deletions

View file

@ -14,7 +14,7 @@ struct HttpRequest {
std::string body = {};
[[nodiscard]] inline auto ToString() const -> std::string {
std::ostringstream stream;
stream << fmt::format("{} {} Http/1.1\r\n", this->method, this->url.path());
stream << fmt::format("{} {} HTTP/1.1\r\n", this->method, this->url.path());
for(const auto& header : this->headers) {
stream << fmt::format("{}: {}\r\n", header.first, header.second);
};

View file

@ -13,7 +13,7 @@ struct HttpResponse {
std::string body = {};
[[nodiscard]] inline auto ToString() const -> std::string {
std::ostringstream stream;
stream << fmt::format("Http/1.1 {} {}\r\n", this->statusCode, this->statusMessage);
stream << fmt::format("HTTP/1.1 {} {}\r\n", this->statusCode, this->statusMessage);
for(const auto& header : this->headers) {
stream << fmt::format("{}: {}\r\n", header.first, header.second);
};

View file

@ -15,7 +15,7 @@ struct HttpStream {
this->socket, boost::asio::buffer(method.data(), method.size()), boost::asio::transfer_all(), boost::asio::use_awaitable);
};
inline auto SetStatus(std::string status) -> Task<void> {
status = fmt::format("Http/1.1 {}\r\n", std::move(status));
status = fmt::format("HTTP/1.1 {}\r\n", std::move(status));
co_await boost::asio::async_write(
this->socket, boost::asio::buffer(status.data(), status.size()), boost::asio::transfer_all(), boost::asio::use_awaitable);
};

View file

@ -72,7 +72,7 @@ struct Server : StopBlocker {
...);
}(std::index_sequence_for<Ts...>());
constexpr std::string_view error404 =
"Http/1.1 404 Not Found\r\n"
"HTTP/1.1 404 Not Found\r\n"
"Content-Length: 0\r\n"
"\r\n";
if(!flag) {