Commit 7707a765 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- Fully delete custom headers on connection opening.

- Free unneeded memory on clearing of standard headers. - Fix index sanity test in delete function.
parent 401d4cf4
...@@ -1977,6 +1977,8 @@ static void HTTP_clear_response_headers( LPWININETHTTPREQW lpwhr ) ...@@ -1977,6 +1977,8 @@ static void HTTP_clear_response_headers( LPWININETHTTPREQW lpwhr )
if ( lpwhr->StdHeaders[i].wFlags & HDR_ISREQUEST ) if ( lpwhr->StdHeaders[i].wFlags & HDR_ISREQUEST )
continue; continue;
HTTP_ReplaceHeaderValue( &lpwhr->StdHeaders[i], NULL ); HTTP_ReplaceHeaderValue( &lpwhr->StdHeaders[i], NULL );
HeapFree( GetProcessHeap(), 0, lpwhr->StdHeaders[i].lpszField );
lpwhr->StdHeaders[i].lpszField = NULL;
} }
for( i=0; i<lpwhr->nCustHeaders; i++) for( i=0; i<lpwhr->nCustHeaders; i++)
{ {
...@@ -1986,7 +1988,8 @@ static void HTTP_clear_response_headers( LPWININETHTTPREQW lpwhr ) ...@@ -1986,7 +1988,8 @@ static void HTTP_clear_response_headers( LPWININETHTTPREQW lpwhr )
continue; continue;
if ( lpwhr->pCustHeaders[i].wFlags & HDR_ISREQUEST ) if ( lpwhr->pCustHeaders[i].wFlags & HDR_ISREQUEST )
continue; continue;
HTTP_ReplaceHeaderValue( &lpwhr->pCustHeaders[i], NULL ); HTTP_DeleteCustomHeader( lpwhr, i );
i--;
} }
} }
...@@ -2163,6 +2166,8 @@ LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer) ...@@ -2163,6 +2166,8 @@ LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer)
if (!pszColon) if (!pszColon)
{ {
HTTP_FreeTokens(pTokenPair); HTTP_FreeTokens(pTokenPair);
if (buffer[0])
TRACE("No ':' in line: %s\n", debugstr_w(buffer));
return NULL; return NULL;
} }
...@@ -2615,7 +2620,7 @@ BOOL HTTP_DeleteCustomHeader(LPWININETHTTPREQW lpwhr, DWORD index) ...@@ -2615,7 +2620,7 @@ BOOL HTTP_DeleteCustomHeader(LPWININETHTTPREQW lpwhr, DWORD index)
{ {
if( lpwhr->nCustHeaders <= 0 ) if( lpwhr->nCustHeaders <= 0 )
return FALSE; return FALSE;
if( lpwhr->nCustHeaders >= index ) if( index >= lpwhr->nCustHeaders )
return FALSE; return FALSE;
lpwhr->nCustHeaders--; lpwhr->nCustHeaders--;
......
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