summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrofl0r <rofl0r@users.noreply.github.com>2020-08-11 16:35:40 +0100
committerrofl0r <rofl0r@users.noreply.github.com>2020-09-08 14:50:20 +0100
commit835f0bdd983c193dd708771164856db8ccae6e42 (patch)
tree1d0b508ef370029582499d0328b1d916c345652b
parent78cc5b72b18a3c0d196126bfbc5d3b6473386da9 (diff)
add support for outgoing connections with HTTP/1.1
since there are numerous changes in HTTP/1.1, the proxyserver will stick to using HTTP/1.0 for internal usage, however when a connection is requested with HTTP/1.x from now on we will duplicate the minor revision the client requested, because apparently some servers refuse to accept HTTP/1.0 addresses #152.
-rw-r--r--src/reqs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/reqs.c b/src/reqs.c
index 370b375..76209db 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -266,28 +266,34 @@ establish_http_connection (struct conn_s *connptr, struct request_s *request)
/* host is an IPv6 address literal, so surround it with
* [] */
return write_message (connptr->server_fd,
- "%s %s HTTP/1.0\r\n"
+ "%s %s HTTP/1.%u\r\n"
"Host: [%s]%s\r\n"
"Connection: close\r\n",
request->method, request->path,
+ connptr->protocol.major != 1 ? 0 :
+ connptr->protocol.minor,
request->host, portbuff);
} else if (connptr->upstream_proxy &&
connptr->upstream_proxy->type == PT_HTTP &&
connptr->upstream_proxy->ua.authstr) {
return write_message (connptr->server_fd,
- "%s %s HTTP/1.0\r\n"
+ "%s %s HTTP/1.%u\r\n"
"Host: %s%s\r\n"
"Connection: close\r\n"
"Proxy-Authorization: Basic %s\r\n",
request->method, request->path,
+ connptr->protocol.major != 1 ? 0 :
+ connptr->protocol.minor,
request->host, portbuff,
connptr->upstream_proxy->ua.authstr);
} else {
return write_message (connptr->server_fd,
- "%s %s HTTP/1.0\r\n"
+ "%s %s HTTP/1.%u\r\n"
"Host: %s%s\r\n"
"Connection: close\r\n",
request->method, request->path,
+ connptr->protocol.major != 1 ? 0 :
+ connptr->protocol.minor,
request->host, portbuff);
}
}