Commit fa4c25dd authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wininet: Correct handling of redirected HEAD requests.

parent 336ee286
......@@ -79,6 +79,7 @@ static const WCHAR szProxy_Authorization[] = { 'P','r','o','x','y','-','A','u','
static const WCHAR szStatus[] = { 'S','t','a','t','u','s',0 };
static const WCHAR szKeepAlive[] = {'K','e','e','p','-','A','l','i','v','e',0};
static const WCHAR szGET[] = { 'G','E','T', 0 };
static const WCHAR szHEAD[] = { 'H','E','A','D', 0 };
static const WCHAR szCrLf[] = {'\r','\n', 0};
static const WCHAR szAccept[] = { 'A','c','c','e','p','t',0 };
......@@ -909,9 +910,11 @@ static BOOL HTTP_HttpEndRequestW(http_request_t *lpwhr, DWORD dwFlags, DWORD_PTR
dwBufferSize=sizeof(szNewLocation);
if (HTTP_HttpQueryInfoW(lpwhr, HTTP_QUERY_LOCATION, szNewLocation, &dwBufferSize, NULL))
{
/* redirects are always GETs */
HeapFree(GetProcessHeap(), 0, lpwhr->lpszVerb);
lpwhr->lpszVerb = heap_strdupW(szGET);
if (strcmpW(lpwhr->lpszVerb, szGET) && strcmpW(lpwhr->lpszVerb, szHEAD))
{
HeapFree(GetProcessHeap(), 0, lpwhr->lpszVerb);
lpwhr->lpszVerb = heap_strdupW(szGET);
}
HTTP_DrainContent(lpwhr);
if ((new_url = HTTP_GetRedirectURL( lpwhr, szNewLocation )))
{
......@@ -2526,6 +2529,7 @@ static void HTTP_DrainContent(http_request_t *req)
NETCON_close(&req->netConnection);
return;
}
if (!strcmpW(req->lpszVerb, szHEAD)) return;
do
{
......@@ -3790,10 +3794,11 @@ BOOL WINAPI HTTP_HttpSendRequestW(http_request_t *lpwhr, LPCWSTR lpszHeaders,
if ((dwStatusCode==HTTP_STATUS_REDIRECT || dwStatusCode==HTTP_STATUS_MOVED) &&
HTTP_HttpQueryInfoW(lpwhr,HTTP_QUERY_LOCATION,szNewLocation,&dwBufferSize,NULL))
{
/* redirects are always GETs */
HeapFree(GetProcessHeap(), 0, lpwhr->lpszVerb);
lpwhr->lpszVerb = heap_strdupW(szGET);
if (strcmpW(lpwhr->lpszVerb, szGET) && strcmpW(lpwhr->lpszVerb, szHEAD))
{
HeapFree(GetProcessHeap(), 0, lpwhr->lpszVerb);
lpwhr->lpszVerb = heap_strdupW(szGET);
}
HTTP_DrainContent(lpwhr);
if ((new_url = HTTP_GetRedirectURL( lpwhr, szNewLocation )))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment