From aa216d549846fe075d7f0c3ef09513d5159bbe1a Mon Sep 17 00:00:00 2001
From: evilenzo <lingertell@protonmail.com>
Date: Mon, 13 Dec 2021 19:55:31 +0300
Subject: [PATCH 1/2] Missing operators and ctors for http_request and
 http_response

---
 Release/include/cpprest/http_msg.h | 117 ++++++++++++++++++++++++++++-
 1 file changed, 115 insertions(+), 2 deletions(-)

diff --git a/Release/include/cpprest/http_msg.h b/Release/include/cpprest/http_msg.h
index 55c0433c94..10d3e5f018 100644
--- a/Release/include/cpprest/http_msg.h
+++ b/Release/include/cpprest/http_msg.h
@@ -503,6 +503,8 @@ class _http_response final : public http::details::http_msg_base
 
     _http_response(http::status_code code) : m_status_code(code) {}
 
+    virtual _http_response() = default;
+
     http::status_code status_code() const { return m_status_code; }
 
     void set_status_code(http::status_code code) { m_status_code = code; }
@@ -548,6 +550,60 @@ class http_response
     /// <returns>A new HTTP response.</returns>
     http_response(http::status_code code) : _m_impl(std::make_shared<details::_http_response>(code)) {}
 
+    /// <summary>
+    /// Constructs a response object
+    /// </summary>
+    /// <returns>A new HTTP response.</returns>
+    http_response(const http_response& _Other) : _m_impl(_Other._m_impl) {}
+
+    /// <summary>
+    /// Constructs a response object
+    /// </summary>
+    /// <returns>A new HTTP response.</returns>
+    http_response(http_response&& _Other) : _m_impl(std::move(_Other._m_impl)) {}
+
+    /// <summary>Replaces the contents of one <c>http_request</c> object with another.</summary>
+    /// <param name="_Other">The source <c>http_request</c> object.</param>
+    /// <remarks>
+    /// As <c>http_request</c> behaves like a smart pointer, after a copy assignment, this <c>http_request</c>
+    /// objects represents the same actual http_request as <paramref name="_Other"/> does.
+    /// </remarks>
+    /// <returns>A new HTTP response.</returns>
+    http_response& operator=(const http_response& _Other)
+    {
+        if (this != &_Other)
+        {
+            _m_impl = _Other._m_impl;
+        }
+        return *this;
+    }
+
+    /// <summary>
+    /// Destructor frees any held resources.
+    /// </summary>
+    ~http_response() = default;
+
+    /// <summary>Replaces the contents of one <c>http_request</c> object with another.</summary>
+    /// <param name="_Other">The source <c>http_request</c> object.</param>
+    /// <remarks>
+    /// As <c>http_request</c> behaves like a smart pointer, after a copy assignment, this <c>http_request</c>
+    /// objects represents the same actual http_request as <paramref name="_Other"/> does.
+    /// </remarks>
+    /// <returns>A new HTTP response.</returns>
+    http_response& operator=(http_response&& _Other)
+    {
+        if (this != &_Other)
+        {
+            _m_impl = std::move(_Other._m_impl);
+        }
+        return *this;
+    }
+
+    /// <summary>
+    /// Destructor frees any held resources.
+    /// </summary>
+    ~http_response() = default;
+
     /// <summary>
     /// Gets the status code of the response message.
     /// </summary>
@@ -853,7 +909,7 @@ class _http_request final : public http::details::http_msg_base, public std::ena
 
     _ASYNCRTIMP _http_request(std::unique_ptr<http::details::_http_server_context> server_context);
 
-    virtual ~_http_request() {}
+    virtual ~_http_request() = default;
 
     http::method& method() { return m_method; }
 
@@ -951,10 +1007,67 @@ class http_request
     /// <param name="mtd">Request method.</param>
     http_request(http::method mtd) : _m_impl(std::make_shared<http::details::_http_request>(std::move(mtd))) {}
 
+    /// <summary>
+    ///     Constructs a <c>http_request</c> object.
+    /// </summary>
+    /// <param name="_Other">
+    ///     The source <c>http_request</c> object.
+    /// </param>
+    http_request(const http_request& _Other) : _m_impl(_Other._m_impl) {}
+
+    /// <summary>
+    ///     Constructs a <c>http_request</c> object.
+    /// </summary>
+    /// <param name="_Other">
+    ///     The source <c>http_request</c> object.
+    /// </param>
+    http_request(http_request&& _Other) : _m_impl(_Other._m_impl) {}
+
+
+    /// <summary>
+    ///     Replaces the contents of one <c>http_request</c> object with another.
+    /// </summary>
+    /// <param name="_Other">
+    ///     The source <c>http_request</c> object.
+    /// </param>
+    /// <remarks>
+    ///     As <c>http_request</c> behaves like a smart pointer, after a copy assignment, this <c>http_request</c>
+    ///     objects represents the same actual http_request as <paramref name="_Other"/> does.
+    /// </remarks>
+    /**/
+    http_request& operator=(const http_request& _Other)
+    {
+        if (this != &_Other)
+        {
+            _m_impl = _Other._m_impl;
+        }
+        return *this;
+    }
+
+    /// <summary>
+    ///     Replaces the contents of one <c>http_request</c> object with another.
+    /// </summary>
+    /// <param name="_Other">
+    ///     The source <c>http_request</c> object.
+    /// </param>
+    /// <remarks>
+    ///     As <c>http_request</c> behaves like a smart pointer, after a copy assignment, this <c>http_request</c>
+    ///     objects represents the same actual http_request as <paramref name="_Other"/> does.
+    /// </remarks>
+    /**/
+    http_request& operator=(http_request&& _Other)
+    {
+        if (this != &_Other)
+        {
+            _m_impl = std::move(_Other._m_impl);
+        }
+        return *this;
+    }
+
     /// <summary>
     /// Destructor frees any held resources.
     /// </summary>
-    ~http_request() {}
+    ~http_request() = default;
 
     /// <summary>
     /// Get the method (GET/PUT/POST/DELETE) of the request message.

From a8dccb3293ee61e83773d3bbc7a56f6391410e13 Mon Sep 17 00:00:00 2001
From: evilenzo <lingertell@protonmail.com>
Date: Sun, 26 Dec 2021 01:50:42 +0300
Subject: [PATCH 2/2] Remove all redundant code and make compiler generate copy
 and move functions

---
 Release/include/cpprest/http_msg.h | 116 -----------------------------
 1 file changed, 116 deletions(-)

diff --git a/Release/include/cpprest/http_msg.h b/Release/include/cpprest/http_msg.h
index 10d3e5f018..353281ffbc 100644
--- a/Release/include/cpprest/http_msg.h
+++ b/Release/include/cpprest/http_msg.h
@@ -550,60 +550,6 @@ class http_response
     /// <returns>A new HTTP response.</returns>
     http_response(http::status_code code) : _m_impl(std::make_shared<details::_http_response>(code)) {}
 
-    /// <summary>
-    /// Constructs a response object
-    /// </summary>
-    /// <returns>A new HTTP response.</returns>
-    http_response(const http_response& _Other) : _m_impl(_Other._m_impl) {}
-
-    /// <summary>
-    /// Constructs a response object
-    /// </summary>
-    /// <returns>A new HTTP response.</returns>
-    http_response(http_response&& _Other) : _m_impl(std::move(_Other._m_impl)) {}
-
-    /// <summary>Replaces the contents of one <c>http_request</c> object with another.</summary>
-    /// <param name="_Other">The source <c>http_request</c> object.</param>
-    /// <remarks>
-    /// As <c>http_request</c> behaves like a smart pointer, after a copy assignment, this <c>http_request</c>
-    /// objects represents the same actual http_request as <paramref name="_Other"/> does.
-    /// </remarks>
-    /// <returns>A new HTTP response.</returns>
-    http_response& operator=(const http_response& _Other)
-    {
-        if (this != &_Other)
-        {
-            _m_impl = _Other._m_impl;
-        }
-        return *this;
-    }
-
-    /// <summary>
-    /// Destructor frees any held resources.
-    /// </summary>
-    ~http_response() = default;
-
-    /// <summary>Replaces the contents of one <c>http_request</c> object with another.</summary>
-    /// <param name="_Other">The source <c>http_request</c> object.</param>
-    /// <remarks>
-    /// As <c>http_request</c> behaves like a smart pointer, after a copy assignment, this <c>http_request</c>
-    /// objects represents the same actual http_request as <paramref name="_Other"/> does.
-    /// </remarks>
-    /// <returns>A new HTTP response.</returns>
-    http_response& operator=(http_response&& _Other)
-    {
-        if (this != &_Other)
-        {
-            _m_impl = std::move(_Other._m_impl);
-        }
-        return *this;
-    }
-
-    /// <summary>
-    /// Destructor frees any held resources.
-    /// </summary>
-    ~http_response() = default;
-
     /// <summary>
     /// Gets the status code of the response message.
     /// </summary>
@@ -1007,68 +953,6 @@ class http_request
     /// <param name="mtd">Request method.</param>
     http_request(http::method mtd) : _m_impl(std::make_shared<http::details::_http_request>(std::move(mtd))) {}
 
-    /// <summary>
-    ///     Constructs a <c>http_request</c> object.
-    /// </summary>
-    /// <param name="_Other">
-    ///     The source <c>http_request</c> object.
-    /// </param>
-    http_request(const http_request& _Other) : _m_impl(_Other._m_impl) {}
-
-    /// <summary>
-    ///     Constructs a <c>http_request</c> object.
-    /// </summary>
-    /// <param name="_Other">
-    ///     The source <c>http_request</c> object.
-    /// </param>
-    http_request(http_request&& _Other) : _m_impl(_Other._m_impl) {}
-
-
-    /// <summary>
-    ///     Replaces the contents of one <c>http_request</c> object with another.
-    /// </summary>
-    /// <param name="_Other">
-    ///     The source <c>http_request</c> object.
-    /// </param>
-    /// <remarks>
-    ///     As <c>http_request</c> behaves like a smart pointer, after a copy assignment, this <c>http_request</c>
-    ///     objects represents the same actual http_request as <paramref name="_Other"/> does.
-    /// </remarks>
-    /**/
-    http_request& operator=(const http_request& _Other)
-    {
-        if (this != &_Other)
-        {
-            _m_impl = _Other._m_impl;
-        }
-        return *this;
-    }
-
-    /// <summary>
-    ///     Replaces the contents of one <c>http_request</c> object with another.
-    /// </summary>
-    /// <param name="_Other">
-    ///     The source <c>http_request</c> object.
-    /// </param>
-    /// <remarks>
-    ///     As <c>http_request</c> behaves like a smart pointer, after a copy assignment, this <c>http_request</c>
-    ///     objects represents the same actual http_request as <paramref name="_Other"/> does.
-    /// </remarks>
-    /**/
-    http_request& operator=(http_request&& _Other)
-    {
-        if (this != &_Other)
-        {
-            _m_impl = std::move(_Other._m_impl);
-        }
-        return *this;
-    }
-
-    /// <summary>
-    /// Destructor frees any held resources.
-    /// </summary>
-    ~http_request() = default;
-
     /// <summary>
     /// Get the method (GET/PUT/POST/DELETE) of the request message.
     /// </summary>