summaryrefslogtreecommitdiff
path: root/minion/src/http/request.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'minion/src/http/request.cpp')
-rw-r--r--minion/src/http/request.cpp42
1 files changed, 40 insertions, 2 deletions
diff --git a/minion/src/http/request.cpp b/minion/src/http/request.cpp
index 9a35d37..9baf7cc 100644
--- a/minion/src/http/request.cpp
+++ b/minion/src/http/request.cpp
@@ -55,7 +55,7 @@ auto str_to_http_request_method(const char *http_request_method_str) -> HTTPRequ
}
HTTPRequest::HTTPRequest(
- size_t connection_id,
+ int connection_id,
HTTPRequestMethod method,
char *http_version, // NOLINT(bugprone-easily-swappable-parameters)
char *path,
@@ -71,12 +71,23 @@ HTTPRequest::HTTPRequest(
{
}
+HTTPRequest::HTTPRequest(HTTPRequest &&other) noexcept
+ : _connection_id(other._connection_id),
+ _method(other._method),
+ _http_version(other._http_version),
+ _path(other._path),
+ _data_length(other._data_length),
+ _data(other._data)
+{
+ other._data = nullptr;
+}
+
HTTPRequest::~HTTPRequest() noexcept
{
free(_data);
}
-auto HTTPRequest::connection_id() const noexcept -> size_t
+auto HTTPRequest::connection_id() const noexcept -> int
{
return _connection_id;
}
@@ -105,3 +116,30 @@ auto HTTPRequest::data() const noexcept -> const char *
{
return _data;
}
+
+auto HTTPRequest::operator=(HTTPRequest &&other) noexcept -> HTTPRequest &
+{
+ if (this != &other)
+ {
+ free(_data);
+ _data = other._data;
+ other._data = nullptr;
+ }
+
+ return *this;
+}
+
+HTTPRequest HTTPRequest::create_invalid() noexcept
+{
+ return HTTPRequest();
+}
+
+HTTPRequest::HTTPRequest() noexcept
+ : _connection_id(-1),
+ _method(HTTPRequestMethod(-1)),
+ _http_version(""),
+ _path(""),
+ _data_length(0),
+ _data(nullptr)
+{
+}