]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
YaHTTP: Send correct Host header for IPv6 address 8815/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Wed, 12 Feb 2020 14:29:01 +0000 (15:29 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Wed, 12 Feb 2020 14:29:01 +0000 (15:29 +0100)
ext/yahttp/yahttp/reqresp.hpp

index d9e7a197282c5a257264f0f51e0c9c965e5ca07f..1d310923a9c3a8f6c8e84d243e3ddc841545f90f 100644 (file)
@@ -249,7 +249,7 @@ public:
     }
     void setup(const std::string& method_, const std::string& url_) {
       this->url.parse(url_);
-      this->headers["host"] = this->url.host;
+      this->headers["host"] = this->url.host.find(":") == std::string::npos ? this->url.host : "[" + this->url.host + "]";
       this->method = method_;
       std::transform(this->method.begin(), this->method.end(), this->method.begin(), ::toupper);
       this->headers["user-agent"] = "YaHTTP v1.0";