diff options
author | HampusM <hampus@hampusmat.com> | 2022-05-14 12:57:01 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-05-14 12:57:01 +0200 |
commit | 39e2964b0315faeac0c9f8431334ba10093b9490 (patch) | |
tree | 9cae9425845b32eac5c0b5c1e93601f09e718a21 /minion/src/http | |
parent | cd00813c0740930d389f935f0c2d7d8a11eef02d (diff) |
refactor(minion): create network connection class
Diffstat (limited to 'minion/src/http')
-rw-r--r-- | minion/src/http/request.cpp | 12 | ||||
-rw-r--r-- | minion/src/http/request.hpp | 8 |
2 files changed, 11 insertions, 9 deletions
diff --git a/minion/src/http/request.cpp b/minion/src/http/request.cpp index 9baf7cc..650f57f 100644 --- a/minion/src/http/request.cpp +++ b/minion/src/http/request.cpp @@ -55,14 +55,14 @@ auto str_to_http_request_method(const char *http_request_method_str) -> HTTPRequ } HTTPRequest::HTTPRequest( - int connection_id, + NetworkConnection connection, HTTPRequestMethod method, char *http_version, // NOLINT(bugprone-easily-swappable-parameters) char *path, int data_length, char *data ) noexcept - : _connection_id(connection_id), + : _connection(connection), _method(method), _http_version(http_version), _path(path), @@ -72,7 +72,7 @@ HTTPRequest::HTTPRequest( } HTTPRequest::HTTPRequest(HTTPRequest &&other) noexcept - : _connection_id(other._connection_id), + : _connection(other._connection), _method(other._method), _http_version(other._http_version), _path(other._path), @@ -87,9 +87,9 @@ HTTPRequest::~HTTPRequest() noexcept free(_data); } -auto HTTPRequest::connection_id() const noexcept -> int +auto HTTPRequest::connection() noexcept -> NetworkConnection & { - return _connection_id; + return _connection; } auto HTTPRequest::method() const noexcept -> HTTPRequestMethod @@ -135,7 +135,7 @@ HTTPRequest HTTPRequest::create_invalid() noexcept } HTTPRequest::HTTPRequest() noexcept - : _connection_id(-1), + : _connection(-1), _method(HTTPRequestMethod(-1)), _http_version(""), _path(""), diff --git a/minion/src/http/request.hpp b/minion/src/http/request.hpp index 8524dc6..dae66f2 100644 --- a/minion/src/http/request.hpp +++ b/minion/src/http/request.hpp @@ -1,5 +1,7 @@ #pragma once +#include "network_connection.hpp" + #include <stddef.h> enum HTTPRequestMethod @@ -25,7 +27,7 @@ class HTTPRequest { public: explicit HTTPRequest( - int connection_id, + NetworkConnection connection, HTTPRequestMethod method, char *http_version, char *path, @@ -39,7 +41,7 @@ public: ~HTTPRequest() noexcept; - auto connection_id() const noexcept -> int; + auto connection() noexcept -> NetworkConnection &; auto method() const noexcept -> HTTPRequestMethod; @@ -58,7 +60,7 @@ public: static HTTPRequest create_invalid() noexcept; private: - const int _connection_id; + NetworkConnection _connection; const HTTPRequestMethod _method; char *_http_version; char *_path; |