Minor fix

This commit is contained in:
G.H.O.S.T 2024-12-31 00:53:24 +01:00
parent 10cb404519
commit 9a9f3a3e18
Signed by: G.H.O.S.T
GPG Key ID: 3BD93EABD1407B82
2 changed files with 6 additions and 4 deletions

View File

@ -10,8 +10,6 @@
#include <code/seafire/protocol/rfc7231/date.hxx> #include <code/seafire/protocol/rfc7231/date.hxx>
#include <code/seafire/protocol/rfc7231/server.hxx> #include <code/seafire/protocol/rfc7231/server.hxx>
#include <chrono>
namespace code::seafire::server namespace code::seafire::server
{ {
@ -196,17 +194,22 @@ namespace code::seafire::server
auto c = get<protocol::rfc7230::connection_t>(get_request()); auto c = get<protocol::rfc7230::connection_t>(get_request());
if (c && c->close()) { if (c && c->close()) {
trace() << "close requested by request!";
return false; return false;
} }
if (get_request().version() == protocol::http_1_0 && c) { if (get_request().version() == protocol::http_1_0 && c) {
trace() << "close requested by protocol version";
return c->keep_alive(); return c->keep_alive();
} }
if (get_request().version() == protocol::http_1_1) { if (get_request().version() == protocol::http_1_1) {
trace() << "keep-live requested by protocol version";
return true; return true;
} }
trace() << "defaulting to close";
return false; return false;
} }
@ -289,8 +292,6 @@ namespace code::seafire::server
return; return;
} }
// handle Expect: 100-continue
if (auto expect = request_.headers().get_one("expect"); expect) { if (auto expect = request_.headers().get_one("expect"); expect) {
if (request_.version() == protocol::http_1_1 && *expect == "100-continue") { if (request_.version() == protocol::http_1_1 && *expect == "100-continue") {
static std::string const response{ static std::string const response{

View File

@ -16,6 +16,7 @@
#include <asio.hpp> #include <asio.hpp>
#include <chrono>
#include <iostream> #include <iostream>
#include <memory> #include <memory>
#include <mutex> #include <mutex>