summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Michael Brummer <jan.brummer@tabos.org>2021-10-19 22:32:41 +0200
committerJan-Michael Brummer <jan.brummer@tabos.org>2021-10-19 22:32:41 +0200
commitb43d394f76bf85c41c1d9967ae180e525724bdd4 (patch)
tree7be9d73eaa3bf6070b35a7a9e77b5b46076b7e20
parentbcde153760ee885d2c633994e78ac447f8ec0713 (diff)
downloadlibproxy-git-b43d394f76bf85c41c1d9967ae180e525724bdd4.tar.gz
Add host port to request header
The request header in get_pac() currently misses the host port and thus breaks every proxy running on another port. See https://gitlab.gnome.org/GNOME/glib-networking/-/issues/138 for example. Add this missing port in case it is not http default port 80.
-rw-r--r--libproxy/url.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libproxy/url.cpp b/libproxy/url.cpp
index 76ae47f..6925745 100644
--- a/libproxy/url.cpp
+++ b/libproxy/url.cpp
@@ -457,7 +457,7 @@ char* url::get_pac() {
// Build the request string
request = "GET " + (m_path.size() > 0 ? m_path : "/") + m_query + " HTTP/1.1\r\n";
- request += "Host: " + m_host + "\r\n";
+ request += "Host: " + m_host + (m_port != 80 ? ":" + std::to_string(m_port) : "") + "\r\n";
request += "Accept: " + string(PAC_MIME_TYPE) + "\r\n";
request += "Connection: close\r\n";
request += "\r\n";