diff options
-rw-r--r-- | src/libwaitress/waitress.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c index 9cf9b47..334591c 100644 --- a/src/libwaitress/waitress.c +++ b/src/libwaitress/waitress.c @@ -914,23 +914,20 @@ static WaitressReturn_t WaitressSendRequest (WaitressHandle_t *waith) { /* send request */ if (WaitressProxyEnabled (waith) && !waith->url.tls) { snprintf (buf, WAITRESS_BUFFER_SIZE, - "%s http://%s:%s/%s HTTP/" WAITRESS_HTTP_VERSION "\r\n", + "%s http://%s:%s/%s HTTP/" WAITRESS_HTTP_VERSION "\r\n" + "Host: %s\r\nUser-Agent: " PACKAGE "\r\nConnection: Close\r\n", (waith->method == WAITRESS_METHOD_GET ? "GET" : "POST"), waith->url.host, - WaitressDefaultPort (&waith->url), path); + WaitressDefaultPort (&waith->url), path, waith->url.host); } else { snprintf (buf, WAITRESS_BUFFER_SIZE, - "%s /%s HTTP/" WAITRESS_HTTP_VERSION "\r\n", + "%s /%s HTTP/" WAITRESS_HTTP_VERSION "\r\n" + "Host: %s\r\nUser-Agent: " PACKAGE "\r\nConnection: Close\r\n", (waith->method == WAITRESS_METHOD_GET ? "GET" : "POST"), - path); + path, waith->url.host); } WRITE_RET (buf, strlen (buf)); - snprintf (buf, WAITRESS_BUFFER_SIZE, - "Host: %s\r\nUser-Agent: " PACKAGE "\r\nConnection: Close\r\n", - waith->url.host); - WRITE_RET (buf, strlen (buf)); - if (waith->method == WAITRESS_METHOD_POST && waith->postData != NULL) { snprintf (buf, WAITRESS_BUFFER_SIZE, "Content-Length: %zu\r\n", strlen (waith->postData)); |