summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/html-error.c3
-rw-r--r--src/reqs.c12
2 files changed, 11 insertions, 4 deletions
diff --git a/src/html-error.c b/src/html-error.c
index 071d415..fcb0b94 100644
--- a/src/html-error.c
+++ b/src/html-error.c
@@ -136,7 +136,7 @@ send_html_file (FILE *infile, struct conn_s *connptr)
int send_http_headers (struct conn_s *connptr, int code, const char *message)
{
const char headers[] =
- "HTTP/1.0 %d %s\r\n"
+ "HTTP/1.%u %d %s\r\n"
"Server: %s/%s\r\n"
"Content-Type: text/html\r\n"
"%s"
@@ -155,6 +155,7 @@ int send_http_headers (struct conn_s *connptr, int code, const char *message)
const char *add = code == 407 ? p_auth_str : (code == 401 ? w_auth_str : "");
return (write_message (connptr->client_fd, headers,
+ connptr->protocol.major != 1 ? 0 : connptr->protocol.minor,
code, message, PACKAGE, VERSION,
add));
}
diff --git a/src/reqs.c b/src/reqs.c
index 6531be2..f6fd2be 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -268,28 +268,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);
}
}