diff --git a/include/frnetlib/Http.h b/include/frnetlib/Http.h index 38c1eb2..a7904ba 100644 --- a/include/frnetlib/Http.h +++ b/include/frnetlib/Http.h @@ -79,6 +79,8 @@ namespace fr }; Http(); + Http(Http &&); + Http(const Http &); virtual ~Http() = default; /*! @@ -280,6 +282,11 @@ namespace fr */ std::vector> parse_argument_list(const std::string &str); + /*! + * Parses a header line in a HTTP request/response + * + * @param str The header. E.g: header: value + */ void parse_header_line(const std::string &str); //Other request info diff --git a/include/frnetlib/HttpResponse.h b/include/frnetlib/HttpResponse.h index b587b9d..6e1d30b 100644 --- a/include/frnetlib/HttpResponse.h +++ b/include/frnetlib/HttpResponse.h @@ -16,9 +16,10 @@ namespace fr { public: //Constructors - HttpResponse() = default; - HttpResponse(HttpResponse &&other) = default; - virtual ~HttpResponse() = default; + HttpResponse(){}; + HttpResponse(HttpResponse &&other); + HttpResponse(const HttpResponse &); + virtual ~HttpResponse(){} /*! * Parse a HTTP response. diff --git a/src/Http.cpp b/src/Http.cpp index 70a576b..45508bd 100644 --- a/src/Http.cpp +++ b/src/Http.cpp @@ -19,6 +19,29 @@ namespace fr clear(); } + Http::Http(Http &&o) + : header_data(std::move(o.header_data)), + post_data(std::move(o.post_data)), + get_data(std::move(o.get_data)), + body(std::move(o.body)), + request_type(o.request_type), + uri(std::move(o.uri)), + status(o.status) + { + } + + Http::Http(const Http &o) + : header_data(o.header_data), + post_data(o.post_data), + get_data(o.get_data), + body(o.body), + request_type(o.request_type), + uri(o.uri), + status(o.status) + { + + } + Http::RequestType Http::get_type() const { return request_type; diff --git a/src/HttpResponse.cpp b/src/HttpResponse.cpp index 423cd1c..33cbd2d 100644 --- a/src/HttpResponse.cpp +++ b/src/HttpResponse.cpp @@ -7,6 +7,20 @@ namespace fr { + HttpResponse::HttpResponse(HttpResponse &&other) + : header_ended(other.header_ended), + content_length(other.content_length) + { + + } + + HttpResponse::HttpResponse(const HttpResponse &other) + : header_ended(other.header_ended), + content_length(other.content_length) + { + + } + bool HttpResponse::parse(const std::string &response_data) { body += response_data;