фича: автообновление сессии

This commit is contained in:
2025-01-17 19:09:44 +03:00
parent a4214fd007
commit 3537965393
16 changed files with 170 additions and 96 deletions

View File

@@ -51,7 +51,7 @@ namespace http::server {
Url::~Url() = default;
Request::Request() = default;
Request::Request(bool secure): isSecure(secure) {}
void Request::reset() {
method = "";
@@ -59,9 +59,9 @@ namespace http::server {
if (url != nullptr) {
url.reset(nullptr);
}
is_keep_alive = false;
http_version_major = 0;
http_version_minor = 0;
isKeepAlive = false;
httpVersionMajor = 0;
httpVersionMinor = 0;
headers.clear();
payload.clear();
}
@@ -151,8 +151,8 @@ namespace http::server {
}
case http_version_slash:
if (input == '/') {
req.http_version_major = 0;
req.http_version_minor = 0;
req.httpVersionMajor = 0;
req.httpVersionMinor = 0;
state_ = http_version_major_start;
return indeterminate;
} else {
@@ -160,7 +160,7 @@ namespace http::server {
}
case http_version_major_start:
if (is_digit(input)) {
req.http_version_major = req.http_version_major * 10 + input - '0';
req.httpVersionMajor = req.httpVersionMajor * 10 + input - '0';
state_ = http_version_major;
return indeterminate;
} else {
@@ -171,14 +171,14 @@ namespace http::server {
state_ = http_version_minor_start;
return indeterminate;
} else if (is_digit(input)) {
req.http_version_major = req.http_version_major * 10 + input - '0';
req.httpVersionMajor = req.httpVersionMajor * 10 + input - '0';
return indeterminate;
} else {
return bad;
}
case http_version_minor_start:
if (is_digit(input)) {
req.http_version_minor = req.http_version_minor * 10 + input - '0';
req.httpVersionMinor = req.httpVersionMinor * 10 + input - '0';
state_ = http_version_minor;
return indeterminate;
} else {
@@ -189,7 +189,7 @@ namespace http::server {
state_ = expecting_newline_1;
return indeterminate;
} else if (is_digit(input)) {
req.http_version_minor = req.http_version_minor * 10 + input - '0';
req.httpVersionMinor = req.httpVersionMinor * 10 + input - '0';
return indeterminate;
} else {
return bad;