From: Matt Summers Date: Mon, 12 Jun 2017 00:00:00 +0000 Subject: AUTH_FILE option uses incorrect line ending in HTTP request Origin: https://bugs.launchpad.net/ubuntu/+source/corkscrew/+bug/1697507 Using the AUTH_FILE option reads the provided file and uses it to add the "Proxy-Authorization" header to the request made to the proxy. This uses an invalid newline for an HTTP request. \n is used, should be \r\n. What happens: When used with apache as a forward proxy, for example, this causes a 400 error to be returned from the server. Using nc and crafting a request to use \r\n instead, this works. LP: #1697507 --- corkscrew.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corkscrew.c b/corkscrew.c index 665f652..97d2b25 100644 --- a/corkscrew.c +++ b/corkscrew.c @@ -231,7 +231,7 @@ char *argv[]; strncat(uri, destport, sizeof(uri) - strlen(uri) - 1); strncat(uri, " HTTP/1.0", sizeof(uri) - strlen(uri) - 1); if ((argc == 6) || (argc == 7)) { - strncat(uri, "\nProxy-Authorization: Basic ", sizeof(uri) - strlen(uri) - 1); + strncat(uri, "\r\nProxy-Authorization: Basic ", sizeof(uri) - strlen(uri) - 1); strncat(uri, base64_encode(up), sizeof(uri) - strlen(uri) - 1); } strncat(uri, linefeed, sizeof(uri) - strlen(uri) - 1);