Module: wine Branch: master Commit: 10389b272d427114e613baee98ec9ed68c0e1ee6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=10389b272d427114e613baee98...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Jul 19 12:02:18 2013 +0200
wininet: Ignore missing status text in response headers.
---
dlls/wininet/http.c | 14 +++++++++----- dlls/wininet/tests/http.c | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index a0e4973..03fbf10 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -141,6 +141,8 @@ static const WCHAR szVia[] = { 'V','i','a',0 }; static const WCHAR szWarning[] = { 'W','a','r','n','i','n','g',0 }; static const WCHAR szWWW_Authenticate[] = { 'W','W','W','-','A','u','t','h','e','n','t','i','c','a','t','e',0 };
+static const WCHAR emptyW[] = {0}; + #define HTTP_REFERER szReferer #define HTTP_ACCEPT szAccept #define HTTP_USERAGENT szUser_Agent @@ -3874,6 +3876,8 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel, DWORD len; WCHAR* bufferW;
+ TRACE("%p %x\n", hHttpRequest, dwInfoLevel); + if((dwInfoLevel & HTTP_QUERY_FLAG_NUMBER) || (dwInfoLevel & HTTP_QUERY_FLAG_SYSTEMTIME)) { @@ -5857,9 +5861,8 @@ static DWORD HTTP_GetResponseHeaders(http_request_t *request, INT *len)
/* split the status code from the status text */ status_text = strchrW( status_code, ' ' ); - if( !status_text ) - goto lend; - *status_text++=0; + if( status_text ) + *status_text++=0;
request->status_code = atoiW(status_code);
@@ -5891,11 +5894,12 @@ static DWORD HTTP_GetResponseHeaders(http_request_t *request, INT *len) heap_free(request->statusText);
request->version = heap_strdupW(buffer); - request->statusText = heap_strdupW(status_text); + request->statusText = heap_strdupW(status_text ? status_text : emptyW);
/* Restore the spaces */ *(status_code-1) = ' '; - *(status_text-1) = ' '; + if (status_text) + *(status_text-1) = ' ';
/* Parse each response line */ do diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index c3dd7dd..6022955 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -3590,6 +3590,20 @@ static const http_status_test_t http_status_tests[] = { "\r\nx", 404, "Fail" + }, + { + "HTTP/1.1 200\r\n" + "Content-Length: 1\r\n" + "\r\nx", + 200, + "" + }, + { + "HTTP/1.1 410 \r\n" + "Content-Length: 1\r\n" + "\r\nx", + 410, + "" } };