diff options
author | Kenny MacDermid <kenny.macdermid@gmail.com> | 2014-01-03 21:29:27 -0400 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2014-04-04 12:57:24 +0200 |
commit | e0441f5fbe0f028038d66048113438aa8a938946 (patch) | |
tree | 887e630893408beb872da52c7124998ac1fae65a | |
parent | 7b27ff386a33d57bf6e5ab9f35d0369d8a267c56 (diff) | |
download | pianobar-e0441f5fbe0f028038d66048113438aa8a938946.tar.gz pianobar-e0441f5fbe0f028038d66048113438aa8a938946.tar.bz2 pianobar-e0441f5fbe0f028038d66048113438aa8a938946.zip |
Send headers in first packet.
Splitting up the writes causes the Host header to end up in a
different packet than the requst line, making it harder to proxy.
-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)); |