diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 86154a506d7..478763ecbc1 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -3080,6 +3080,20 @@ static INT HTTP_GetResponseHeaders(LPWININETHTTPREQW lpwhr) } while (!strcmpW(status_code, szHundred)); /* ignore "100 Continue" responses */ + /* Add status code */ + HTTP_ProcessHeader(lpwhr, szStatus, status_code, + HTTP_ADDHDR_FLAG_REPLACE); + + HeapFree(GetProcessHeap(),0,lpwhr->lpszVersion); + HeapFree(GetProcessHeap(),0,lpwhr->lpszStatusText); + + lpwhr->lpszVersion= WININET_strdupW(buffer); + lpwhr->lpszStatusText = WININET_strdupW(status_text); + + /* Restore the spaces */ + *(status_code-1) = ' '; + *(status_text-1) = ' '; + /* regenerate raw headers */ while (cchRawHeaders + buflen + strlenW(szCrLf) > cchMaxRawHeaders) { @@ -3092,15 +3106,6 @@ static INT HTTP_GetResponseHeaders(LPWININETHTTPREQW lpwhr) cchRawHeaders += sizeof(szCrLf)/sizeof(szCrLf[0])-1; lpszRawHeaders[cchRawHeaders] = '\0'; - HTTP_ProcessHeader(lpwhr, szStatus, status_code, - HTTP_ADDHDR_FLAG_REPLACE); - - HeapFree(GetProcessHeap(),0,lpwhr->lpszVersion); - HeapFree(GetProcessHeap(),0,lpwhr->lpszStatusText); - - lpwhr->lpszVersion= WININET_strdupW(buffer); - lpwhr->lpszStatusText = WININET_strdupW(status_text); - /* Parse each response line */ do {