Aric Stewart : wininet: Correct the case where Content-Length is set as well as Transfer-Encoding == chunked.

Alexandre Julliard julliard at winehq.org
Fri Apr 18 07:27:16 CDT 2008


Module: wine
Branch: master
Commit: bade2a31a60af7e9520b89aa5c3491eae19b2c22
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bade2a31a60af7e9520b89aa5c3491eae19b2c22

Author: Aric Stewart <aric at codeweavers.com>
Date:   Thu Apr 17 13:05:41 2008 -0500

wininet: Correct the case where Content-Length is set as well as Transfer-Encoding == chunked.

---

 dlls/wininet/http.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index e2ee9af..53e0331 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -3239,6 +3239,8 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
         {
             DWORD dwBufferSize;
             DWORD dwStatusCode;
+            WCHAR encoding[20];
+            static const WCHAR szChunked[] = {'c','h','u','n','k','e','d',0};
 
             INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext,
                                 INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0);
@@ -3264,6 +3266,15 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
             if (lpwhr->dwContentLength == 0)
                 HTTP_FinishedReading(lpwhr);
 
+            /* Correct the case where both a Content-Length and Transfer-encoding = chuncked are set */
+
+            dwBufferSize = sizeof(encoding);
+            if (HTTP_HttpQueryInfoW(lpwhr, HTTP_QUERY_TRANSFER_ENCODING, encoding, &dwBufferSize, NULL) &&
+                !strcmpiW(encoding, szChunked))
+            {
+                lpwhr->dwContentLength = -1;
+            }
+
             dwBufferSize = sizeof(dwStatusCode);
             if (!HTTP_HttpQueryInfoW(lpwhr,HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_STATUS_CODE,
                                      &dwStatusCode,&dwBufferSize,NULL))




More information about the wine-cvs mailing list