]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#360,!305] Host header is included for all request types.
authorMarcin Siodelski <marcin@isc.org>
Tue, 16 Apr 2019 19:57:07 +0000 (21:57 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Mon, 29 Apr 2019 13:37:12 +0000 (15:37 +0200)
src/lib/http/post_request.cc
src/lib/http/post_request.h
src/lib/http/post_request_json.cc
src/lib/http/post_request_json.h

index e40c67f7c2a964fd40a7fe8bccbb04ef63bb2a5b..f7a8090fe9ef00ef84612ed04657592a471a86d1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -19,8 +19,9 @@ PostHttpRequest::PostHttpRequest()
 }
 
 PostHttpRequest::PostHttpRequest(const Method& method, const std::string& uri,
-                                 const HttpVersion& version)
-    : HttpRequest(method, uri, version) {
+                                 const HttpVersion& version,
+                                 const HostHttpHeader& host_header)
+    : HttpRequest(method, uri, version, host_header) {
     requireHttpMethod(Method::HTTP_POST);
     requireHeader("Content-Length");
     requireHeader("Content-Type");
index 733a4ae975cfd5fbaf0c1f342d84092f9b71a220..1426087944319754b6cca81b41c8c4b62b78454e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -37,7 +37,10 @@ public:
     /// @param method HTTP method, e.g. POST.
     /// @param uri URI.
     /// @param version HTTP version.
-    PostHttpRequest(const Method& method, const std::string& uri, const HttpVersion& version);
+    /// @param host_header Host header to be included in the request. The default
+    /// is the empty Host header.
+    PostHttpRequest(const Method& method, const std::string& uri, const HttpVersion& version,
+                    const HostHttpHeader& host_header = HostHttpHeader());
 
 };
 
index 163a6e7f0c172f3c7c167847026fee061e5c068d..887af204e9f6945437b69c1ae43d12d449b337c1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -19,8 +19,9 @@ PostHttpRequestJson::PostHttpRequestJson()
 }
 
 PostHttpRequestJson::PostHttpRequestJson(const Method& method, const std::string& uri,
-                                         const HttpVersion& version)
-    : PostHttpRequest(method, uri, version) {
+                                         const HttpVersion& version,
+                                         const HostHttpHeader& host_header)
+    : PostHttpRequest(method, uri, version, host_header) {
     requireHeaderValue("Content-Type", "application/json");
     context()->headers_.push_back(HttpHeaderContext("Content-Type", "application/json"));
 }
index e3d9829ff60b4555155b37f3b3519738d17f30dd..f4f37b3edd302d2be1481d559ccc409fbe0bdde2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2016-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2016-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -50,8 +50,11 @@ public:
     /// @param method HTTP method, e.g. POST.
     /// @param uri URI.
     /// @param version HTTP version.
+    /// @param host_header Host header to be included in the request. The default
+    /// is the empty Host header.
     explicit PostHttpRequestJson(const Method& method, const std::string& uri,
-                                 const HttpVersion& version);
+                                 const HttpVersion& version,
+                                 const HostHttpHeader& host_header = HostHttpHeader());
 
     /// @brief Complete parsing of the HTTP request.
     ///