proxy: Add received response in case of an error
authorMartin Fleisz <martin.fleisz@thincast.com>
Tue, 7 Jan 2020 12:30:28 +0000 (13:30 +0100)
committerakallabeth <akallabeth@users.noreply.github.com>
Wed, 8 Jan 2020 16:45:10 +0000 (17:45 +0100)
libfreerdp/core/proxy.c

index 1bd8fc4..634dfaa 100644 (file)
@@ -388,6 +388,18 @@ BOOL proxy_connect(rdpSettings* settings, BIO* bufferedBio, const char* proxyUse
        }
 }
 
+static const char* get_response_header(char* response)
+{
+       char* current_pos = strchr(response, '\r');
+       if (!current_pos)
+               current_pos = strchr(response, '\n');
+
+       if (current_pos)
+               *current_pos = '\0';
+
+       return response;
+}
+
 static BOOL http_proxy_connect(BIO* bufferedBio, const char* hostname, UINT16 port)
 {
        int status;
@@ -425,7 +437,7 @@ static BOOL http_proxy_connect(BIO* bufferedBio, const char* hostname, UINT16 po
        {
                if (resultsize >= sizeof(recv_buf) - 1)
                {
-                       WLog_ERR(TAG, "HTTP Reply headers too long.");
+                       WLog_ERR(TAG, "HTTP Reply headers too long: %s", get_response_header(recv_buf));
                        return FALSE;
                }