Commit 2098006d authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

wininet: De-Hungarian HTTP request member names.

parent 8e050391
...@@ -74,7 +74,7 @@ static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz ) ...@@ -74,7 +74,7 @@ static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz )
if (NULL == request) if (NULL == request)
return FALSE; return FALSE;
session = request->lpHttpSession; session = request->session;
if (NULL == session) if (NULL == session)
goto done; goto done;
...@@ -111,7 +111,7 @@ static BOOL WININET_GetServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz ) ...@@ -111,7 +111,7 @@ static BOOL WININET_GetServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz )
if (NULL == request) if (NULL == request)
return FALSE; return FALSE;
session = request->lpHttpSession; session = request->session;
if (NULL == session) if (NULL == session)
goto done; goto done;
...@@ -250,7 +250,7 @@ static BOOL WININET_SetAuthorization( HINTERNET hRequest, LPWSTR username, ...@@ -250,7 +250,7 @@ static BOOL WININET_SetAuthorization( HINTERNET hRequest, LPWSTR username,
if( !request ) if( !request )
return FALSE; return FALSE;
session = request->lpHttpSession; session = request->session;
if (NULL == session || session->hdr.htype != WH_HHTTPSESSION) if (NULL == session || session->hdr.htype != WH_HHTTPSESSION)
{ {
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
......
...@@ -237,7 +237,7 @@ static LPHTTPHEADERW HTTP_GetHeader(http_request_t *req, LPCWSTR head) ...@@ -237,7 +237,7 @@ static LPHTTPHEADERW HTTP_GetHeader(http_request_t *req, LPCWSTR head)
if (HeaderIndex == -1) if (HeaderIndex == -1)
return NULL; return NULL;
else else
return &req->pCustHeaders[HeaderIndex]; return &req->custHeaders[HeaderIndex];
} }
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
...@@ -291,16 +291,16 @@ static DWORD set_content_length( http_request_t *request ) ...@@ -291,16 +291,16 @@ static DWORD set_content_length( http_request_t *request )
WCHAR encoding[20]; WCHAR encoding[20];
DWORD size; DWORD size;
size = sizeof(request->dwContentLength); size = sizeof(request->contentLength);
if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_CONTENT_LENGTH, if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_CONTENT_LENGTH,
&request->dwContentLength, &size, NULL) != ERROR_SUCCESS) &request->contentLength, &size, NULL) != ERROR_SUCCESS)
request->dwContentLength = ~0u; request->contentLength = ~0u;
size = sizeof(encoding); size = sizeof(encoding);
if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_TRANSFER_ENCODING, encoding, &size, NULL) == ERROR_SUCCESS && if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_TRANSFER_ENCODING, encoding, &size, NULL) == ERROR_SUCCESS &&
!strcmpiW(encoding, szChunked)) !strcmpiW(encoding, szChunked))
{ {
request->dwContentLength = ~0u; request->contentLength = ~0u;
request->read_chunked = TRUE; request->read_chunked = TRUE;
} }
...@@ -310,11 +310,11 @@ static DWORD set_content_length( http_request_t *request ) ...@@ -310,11 +310,11 @@ static DWORD set_content_length( http_request_t *request )
static const WCHAR gzipW[] = {'g','z','i','p',0}; static const WCHAR gzipW[] = {'g','z','i','p',0};
encoding_idx = HTTP_GetCustomHeaderIndex(request, szContent_Encoding, 0, FALSE); encoding_idx = HTTP_GetCustomHeaderIndex(request, szContent_Encoding, 0, FALSE);
if(encoding_idx != -1 && !strcmpiW(request->pCustHeaders[encoding_idx].lpszValue, gzipW)) if(encoding_idx != -1 && !strcmpiW(request->custHeaders[encoding_idx].lpszValue, gzipW))
init_gzip_stream(request); init_gzip_stream(request);
} }
return request->dwContentLength; return request->contentLength;
} }
/*********************************************************************** /***********************************************************************
...@@ -388,33 +388,33 @@ static void HTTP_FixURL(http_request_t *request) ...@@ -388,33 +388,33 @@ static void HTTP_FixURL(http_request_t *request)
static const WCHAR szHttp[] = { 'h','t','t','p',':','/','/', 0 }; static const WCHAR szHttp[] = { 'h','t','t','p',':','/','/', 0 };
/* If we don't have a path we set it to root */ /* If we don't have a path we set it to root */
if (NULL == request->lpszPath) if (NULL == request->path)
request->lpszPath = heap_strdupW(szSlash); request->path = heap_strdupW(szSlash);
else /* remove \r and \n*/ else /* remove \r and \n*/
{ {
int nLen = strlenW(request->lpszPath); int nLen = strlenW(request->path);
while ((nLen >0 ) && ((request->lpszPath[nLen-1] == '\r')||(request->lpszPath[nLen-1] == '\n'))) while ((nLen >0 ) && ((request->path[nLen-1] == '\r')||(request->path[nLen-1] == '\n')))
{ {
nLen--; nLen--;
request->lpszPath[nLen]='\0'; request->path[nLen]='\0';
} }
/* Replace '\' with '/' */ /* Replace '\' with '/' */
while (nLen>0) { while (nLen>0) {
nLen--; nLen--;
if (request->lpszPath[nLen] == '\\') request->lpszPath[nLen]='/'; if (request->path[nLen] == '\\') request->path[nLen]='/';
} }
} }
if(CSTR_EQUAL != CompareStringW( LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, if(CSTR_EQUAL != CompareStringW( LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE,
request->lpszPath, strlenW(request->lpszPath), szHttp, strlenW(szHttp) ) request->path, strlenW(request->path), szHttp, strlenW(szHttp) )
&& request->lpszPath[0] != '/') /* not an absolute path ?? --> fix it !! */ && request->path[0] != '/') /* not an absolute path ?? --> fix it !! */
{ {
WCHAR *fixurl = HeapAlloc(GetProcessHeap(), 0, WCHAR *fixurl = HeapAlloc(GetProcessHeap(), 0,
(strlenW(request->lpszPath) + 2)*sizeof(WCHAR)); (strlenW(request->path) + 2)*sizeof(WCHAR));
*fixurl = '/'; *fixurl = '/';
strcpyW(fixurl + 1, request->lpszPath); strcpyW(fixurl + 1, request->path);
HeapFree( GetProcessHeap(), 0, request->lpszPath ); HeapFree( GetProcessHeap(), 0, request->path );
request->lpszPath = fixurl; request->path = fixurl;
} }
} }
...@@ -445,16 +445,16 @@ static LPWSTR HTTP_BuildHeaderRequestString( http_request_t *request, LPCWSTR ve ...@@ -445,16 +445,16 @@ static LPWSTR HTTP_BuildHeaderRequestString( http_request_t *request, LPCWSTR ve
/* Append custom request headers */ /* Append custom request headers */
for (i = 0; i < request->nCustHeaders; i++) for (i = 0; i < request->nCustHeaders; i++)
{ {
if (request->pCustHeaders[i].wFlags & HDR_ISREQUEST) if (request->custHeaders[i].wFlags & HDR_ISREQUEST)
{ {
req[n++] = szCrLf; req[n++] = szCrLf;
req[n++] = request->pCustHeaders[i].lpszField; req[n++] = request->custHeaders[i].lpszField;
req[n++] = szColon; req[n++] = szColon;
req[n++] = request->pCustHeaders[i].lpszValue; req[n++] = request->custHeaders[i].lpszValue;
TRACE("Adding custom header %s (%s)\n", TRACE("Adding custom header %s (%s)\n",
debugstr_w(request->pCustHeaders[i].lpszField), debugstr_w(request->custHeaders[i].lpszField),
debugstr_w(request->pCustHeaders[i].lpszValue)); debugstr_w(request->custHeaders[i].lpszValue));
} }
} }
...@@ -485,7 +485,7 @@ static void HTTP_ProcessCookies( http_request_t *request ) ...@@ -485,7 +485,7 @@ static void HTTP_ProcessCookies( http_request_t *request )
while((HeaderIndex = HTTP_GetCustomHeaderIndex(request, szSet_Cookie, numCookies, FALSE)) != -1) while((HeaderIndex = HTTP_GetCustomHeaderIndex(request, szSet_Cookie, numCookies, FALSE)) != -1)
{ {
setCookieHeader = &request->pCustHeaders[HeaderIndex]; setCookieHeader = &request->custHeaders[HeaderIndex];
if (!(request->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES) && setCookieHeader->lpszValue) if (!(request->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES) && setCookieHeader->lpszValue)
{ {
...@@ -495,9 +495,9 @@ static void HTTP_ProcessCookies( http_request_t *request ) ...@@ -495,9 +495,9 @@ static void HTTP_ProcessCookies( http_request_t *request )
LPHTTPHEADERW Host; LPHTTPHEADERW Host;
Host = HTTP_GetHeader(request, hostW); Host = HTTP_GetHeader(request, hostW);
len = lstrlenW(Host->lpszValue) + 9 + lstrlenW(request->lpszPath); len = lstrlenW(Host->lpszValue) + 9 + lstrlenW(request->path);
buf_url = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); buf_url = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
sprintfW(buf_url, szFmt, Host->lpszValue, request->lpszPath); sprintfW(buf_url, szFmt, Host->lpszValue, request->path);
InternetSetCookieW(buf_url, NULL, setCookieHeader->lpszValue); InternetSetCookieW(buf_url, NULL, setCookieHeader->lpszValue);
HeapFree(GetProcessHeap(), 0, buf_url); HeapFree(GetProcessHeap(), 0, buf_url);
...@@ -939,7 +939,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue, ...@@ -939,7 +939,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue,
sec_status = InitializeSecurityContextW(first ? &pAuthInfo->cred : NULL, sec_status = InitializeSecurityContextW(first ? &pAuthInfo->cred : NULL,
first ? NULL : &pAuthInfo->ctx, first ? NULL : &pAuthInfo->ctx,
first ? request->lpHttpSession->serverName : NULL, first ? request->session->serverName : NULL,
context_req, 0, SECURITY_NETWORK_DREP, context_req, 0, SECURITY_NETWORK_DREP,
in.pvBuffer ? &in_desc : NULL, in.pvBuffer ? &in_desc : NULL,
0, &pAuthInfo->ctx, &out_desc, 0, &pAuthInfo->ctx, &out_desc,
...@@ -1426,10 +1426,10 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req) ...@@ -1426,10 +1426,10 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req)
static const WCHAR slash[] = { '/',0 }; static const WCHAR slash[] = { '/',0 };
static const WCHAR format[] = { 'h','t','t','p',':','/','/','%','s',':','%','d',0 }; static const WCHAR format[] = { 'h','t','t','p',':','/','/','%','s',':','%','d',0 };
static const WCHAR formatSSL[] = { 'h','t','t','p','s',':','/','/','%','s',':','%','d',0 }; static const WCHAR formatSSL[] = { 'h','t','t','p','s',':','/','/','%','s',':','%','d',0 };
http_session_t *session = req->lpHttpSession; http_session_t *session = req->session;
size = 16; /* "https://" + sizeof(port#) + ":/\0" */ size = 16; /* "https://" + sizeof(port#) + ":/\0" */
size += strlenW( session->hostName ) + strlenW( req->lpszPath ); size += strlenW( session->hostName ) + strlenW( req->path );
if (!(url = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) ))) return NULL; if (!(url = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) ))) return NULL;
...@@ -1437,8 +1437,8 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req) ...@@ -1437,8 +1437,8 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req)
sprintfW( url, formatSSL, session->hostName, session->hostPort ); sprintfW( url, formatSSL, session->hostName, session->hostPort );
else else
sprintfW( url, format, session->hostName, session->hostPort ); sprintfW( url, format, session->hostName, session->hostPort );
if (req->lpszPath[0] != '/') strcatW( url, slash ); if (req->path[0] != '/') strcatW( url, slash );
strcatW( url, req->lpszPath ); strcatW( url, req->path );
} }
TRACE("url=%s\n", debugstr_w(url)); TRACE("url=%s\n", debugstr_w(url));
return url; return url;
...@@ -1476,8 +1476,8 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req ...@@ -1476,8 +1476,8 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
if( UrlComponents.dwHostNameLength == 0 ) if( UrlComponents.dwHostNameLength == 0 )
return FALSE; return FALSE;
if( !request->lpszPath ) if( !request->path )
request->lpszPath = szNul; request->path = szNul;
if(UrlComponents.nPort == INTERNET_INVALID_PORT_NUMBER) if(UrlComponents.nPort == INTERNET_INVALID_PORT_NUMBER)
UrlComponents.nPort = INTERNET_DEFAULT_HTTP_PORT; UrlComponents.nPort = INTERNET_DEFAULT_HTTP_PORT;
...@@ -1497,7 +1497,7 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req ...@@ -1497,7 +1497,7 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
static DWORD HTTP_ResolveName(http_request_t *request) static DWORD HTTP_ResolveName(http_request_t *request)
{ {
char szaddr[INET6_ADDRSTRLEN]; char szaddr[INET6_ADDRSTRLEN];
http_session_t *session = request->lpHttpSession; http_session_t *session = request->session;
const void *addr; const void *addr;
INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_SendCallback(&request->hdr, request->hdr.dwContext,
...@@ -1541,7 +1541,7 @@ static BOOL HTTP_GetRequestURL(http_request_t *req, LPWSTR buf) ...@@ -1541,7 +1541,7 @@ static BOOL HTTP_GetRequestURL(http_request_t *req, LPWSTR buf)
if(!host_header) if(!host_header)
return FALSE; return FALSE;
sprintfW(buf, formatW, host_header->lpszValue, req->lpszPath); /* FIXME */ sprintfW(buf, formatW, host_header->lpszValue, req->path); /* FIXME */
return TRUE; return TRUE;
} }
...@@ -1567,29 +1567,29 @@ static void HTTPREQ_Destroy(object_header_t *hdr) ...@@ -1567,29 +1567,29 @@ static void HTTPREQ_Destroy(object_header_t *hdr)
memset(&ft, 0, sizeof(FILETIME)); memset(&ft, 0, sizeof(FILETIME));
if(HTTP_GetRequestURL(request, url)) { if(HTTP_GetRequestURL(request, url)) {
CommitUrlCacheEntryW(url, request->lpszCacheFile, ft, ft, CommitUrlCacheEntryW(url, request->cacheFile, ft, ft,
NORMAL_CACHE_ENTRY, NULL, 0, NULL, 0); NORMAL_CACHE_ENTRY, NULL, 0, NULL, 0);
} }
} }
HeapFree(GetProcessHeap(), 0, request->lpszCacheFile); HeapFree(GetProcessHeap(), 0, request->cacheFile);
DeleteCriticalSection( &request->read_section ); DeleteCriticalSection( &request->read_section );
WININET_Release(&request->lpHttpSession->hdr); WININET_Release(&request->session->hdr);
destroy_authinfo(request->pAuthInfo); destroy_authinfo(request->authInfo);
destroy_authinfo(request->pProxyAuthInfo); destroy_authinfo(request->proxyAuthInfo);
HeapFree(GetProcessHeap(), 0, request->lpszPath); HeapFree(GetProcessHeap(), 0, request->path);
HeapFree(GetProcessHeap(), 0, request->lpszVerb); HeapFree(GetProcessHeap(), 0, request->verb);
HeapFree(GetProcessHeap(), 0, request->lpszRawHeaders); HeapFree(GetProcessHeap(), 0, request->rawHeaders);
HeapFree(GetProcessHeap(), 0, request->lpszVersion); HeapFree(GetProcessHeap(), 0, request->version);
HeapFree(GetProcessHeap(), 0, request->lpszStatusText); HeapFree(GetProcessHeap(), 0, request->statusText);
for (i = 0; i < request->nCustHeaders; i++) for (i = 0; i < request->nCustHeaders; i++)
{ {
HeapFree(GetProcessHeap(), 0, request->pCustHeaders[i].lpszField); HeapFree(GetProcessHeap(), 0, request->custHeaders[i].lpszField);
HeapFree(GetProcessHeap(), 0, request->pCustHeaders[i].lpszValue); HeapFree(GetProcessHeap(), 0, request->custHeaders[i].lpszValue);
} }
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
...@@ -1600,7 +1600,7 @@ static void HTTPREQ_Destroy(object_header_t *hdr) ...@@ -1600,7 +1600,7 @@ static void HTTPREQ_Destroy(object_header_t *hdr)
} }
#endif #endif
HeapFree(GetProcessHeap(), 0, request->pCustHeaders); HeapFree(GetProcessHeap(), 0, request->custHeaders);
} }
static void HTTPREQ_CloseConnection(object_header_t *hdr) static void HTTPREQ_CloseConnection(object_header_t *hdr)
...@@ -1653,7 +1653,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe ...@@ -1653,7 +1653,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
switch(option) { switch(option) {
case INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO: case INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO:
{ {
http_session_t *session = req->lpHttpSession; http_session_t *session = req->session;
INTERNET_DIAGNOSTIC_SOCKET_INFO *info = buffer; INTERNET_DIAGNOSTIC_SOCKET_INFO *info = buffer;
FIXME("INTERNET_DIAGNOSTIC_SOCKET_INFO stub\n"); FIXME("INTERNET_DIAGNOSTIC_SOCKET_INFO stub\n");
...@@ -1728,7 +1728,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe ...@@ -1728,7 +1728,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
strcatW(url, host->lpszValue); strcatW(url, host->lpszValue);
if (NULL != (pch = strchrW(url + strlenW(httpW), ':'))) if (NULL != (pch = strchrW(url + strlenW(httpW), ':')))
*pch = 0; *pch = 0;
strcatW(url, req->lpszPath); strcatW(url, req->path);
TRACE("INTERNET_OPTION_URL: %s\n",debugstr_w(url)); TRACE("INTERNET_OPTION_URL: %s\n",debugstr_w(url));
...@@ -1790,25 +1790,25 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe ...@@ -1790,25 +1790,25 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
TRACE("INTERNET_OPTION_DATAFILE_NAME\n"); TRACE("INTERNET_OPTION_DATAFILE_NAME\n");
if(!req->lpszCacheFile) { if(!req->cacheFile) {
*size = 0; *size = 0;
return ERROR_INTERNET_ITEM_NOT_FOUND; return ERROR_INTERNET_ITEM_NOT_FOUND;
} }
if(unicode) { if(unicode) {
req_size = (lstrlenW(req->lpszCacheFile)+1) * sizeof(WCHAR); req_size = (lstrlenW(req->cacheFile)+1) * sizeof(WCHAR);
if(*size < req_size) if(*size < req_size)
return ERROR_INSUFFICIENT_BUFFER; return ERROR_INSUFFICIENT_BUFFER;
*size = req_size; *size = req_size;
memcpy(buffer, req->lpszCacheFile, *size); memcpy(buffer, req->cacheFile, *size);
return ERROR_SUCCESS; return ERROR_SUCCESS;
}else { }else {
req_size = WideCharToMultiByte(CP_ACP, 0, req->lpszCacheFile, -1, NULL, 0, NULL, NULL); req_size = WideCharToMultiByte(CP_ACP, 0, req->cacheFile, -1, NULL, 0, NULL, NULL);
if (req_size > *size) if (req_size > *size)
return ERROR_INSUFFICIENT_BUFFER; return ERROR_INSUFFICIENT_BUFFER;
*size = WideCharToMultiByte(CP_ACP, 0, req->lpszCacheFile, *size = WideCharToMultiByte(CP_ACP, 0, req->cacheFile,
-1, buffer, *size, NULL, NULL); -1, buffer, *size, NULL, NULL);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -1881,13 +1881,13 @@ static DWORD HTTPREQ_SetOption(object_header_t *hdr, DWORD option, void *buffer, ...@@ -1881,13 +1881,13 @@ static DWORD HTTPREQ_SetOption(object_header_t *hdr, DWORD option, void *buffer,
*(DWORD*)buffer); *(DWORD*)buffer);
case INTERNET_OPTION_USERNAME: case INTERNET_OPTION_USERNAME:
HeapFree(GetProcessHeap(), 0, req->lpHttpSession->userName); HeapFree(GetProcessHeap(), 0, req->session->userName);
if (!(req->lpHttpSession->userName = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; if (!(req->session->userName = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY;
return ERROR_SUCCESS; return ERROR_SUCCESS;
case INTERNET_OPTION_PASSWORD: case INTERNET_OPTION_PASSWORD:
HeapFree(GetProcessHeap(), 0, req->lpHttpSession->password); HeapFree(GetProcessHeap(), 0, req->session->password);
if (!(req->lpHttpSession->password = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; if (!(req->session->password = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY;
return ERROR_SUCCESS; return ERROR_SUCCESS;
case INTERNET_OPTION_HTTP_DECODING: case INTERNET_OPTION_HTTP_DECODING:
if(size != sizeof(BOOL)) if(size != sizeof(BOOL))
...@@ -1998,13 +1998,13 @@ static DWORD start_next_chunk( http_request_t *req ) ...@@ -1998,13 +1998,13 @@ static DWORD start_next_chunk( http_request_t *req )
{ {
DWORD chunk_size = 0, res; DWORD chunk_size = 0, res;
if (!req->dwContentLength) return ERROR_SUCCESS; if (!req->contentLength) return ERROR_SUCCESS;
if (req->dwContentLength == req->dwContentRead) if (req->contentLength == req->contentRead)
{ {
/* read terminator for the previous chunk */ /* read terminator for the previous chunk */
if ((res = discard_eol( req )) != ERROR_SUCCESS) return res; if ((res = discard_eol( req )) != ERROR_SUCCESS) return res;
req->dwContentLength = ~0u; req->contentLength = ~0u;
req->dwContentRead = 0; req->contentRead = 0;
} }
for (;;) for (;;)
{ {
...@@ -2017,8 +2017,8 @@ static DWORD start_next_chunk( http_request_t *req ) ...@@ -2017,8 +2017,8 @@ static DWORD start_next_chunk( http_request_t *req )
else if (ch == ';' || ch == '\r' || ch == '\n') else if (ch == ';' || ch == '\r' || ch == '\n')
{ {
TRACE( "reading %u byte chunk\n", chunk_size ); TRACE( "reading %u byte chunk\n", chunk_size );
req->dwContentLength = chunk_size; req->contentLength = chunk_size;
req->dwContentRead = 0; req->contentRead = 0;
return discard_eol( req ); return discard_eol( req );
} }
remove_data( req, 1 ); remove_data( req, 1 );
...@@ -2026,7 +2026,7 @@ static DWORD start_next_chunk( http_request_t *req ) ...@@ -2026,7 +2026,7 @@ static DWORD start_next_chunk( http_request_t *req )
if ((res = read_more_data( req, -1 )) != ERROR_SUCCESS) return res; if ((res = read_more_data( req, -1 )) != ERROR_SUCCESS) return res;
if (!req->read_size) if (!req->read_size)
{ {
req->dwContentLength = req->dwContentRead = 0; req->contentLength = req->contentRead = 0;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
} }
...@@ -2036,9 +2036,9 @@ static DWORD start_next_chunk( http_request_t *req ) ...@@ -2036,9 +2036,9 @@ static DWORD start_next_chunk( http_request_t *req )
static BOOL end_of_read_data( http_request_t *req ) static BOOL end_of_read_data( http_request_t *req )
{ {
if (req->gzip_stream) return req->gzip_stream->end_of_data && !req->gzip_stream->buf_size; if (req->gzip_stream) return req->gzip_stream->end_of_data && !req->gzip_stream->buf_size;
if (req->read_chunked) return (req->dwContentLength == 0); if (req->read_chunked) return (req->contentLength == 0);
if (req->dwContentLength == ~0u) return FALSE; if (req->contentLength == ~0u) return FALSE;
return (req->dwContentLength == req->dwContentRead); return (req->contentLength == req->contentRead);
} }
/* fetch some more data into the read buffer (the read section must be held) */ /* fetch some more data into the read buffer (the read section must be held) */
...@@ -2047,16 +2047,16 @@ static DWORD refill_buffer( http_request_t *req ) ...@@ -2047,16 +2047,16 @@ static DWORD refill_buffer( http_request_t *req )
int len = sizeof(req->read_buf); int len = sizeof(req->read_buf);
DWORD res; DWORD res;
if (req->read_chunked && (req->dwContentLength == ~0u || req->dwContentLength == req->dwContentRead)) if (req->read_chunked && (req->contentLength == ~0u || req->contentLength == req->contentRead))
{ {
if ((res = start_next_chunk( req )) != ERROR_SUCCESS) return res; if ((res = start_next_chunk( req )) != ERROR_SUCCESS) return res;
} }
if (req->dwContentLength != ~0u) len = min( len, req->dwContentLength - req->dwContentRead ); if (req->contentLength != ~0u) len = min( len, req->contentLength - req->contentRead );
if (len <= req->read_size) return ERROR_SUCCESS; if (len <= req->read_size) return ERROR_SUCCESS;
if ((res = read_more_data( req, len )) != ERROR_SUCCESS) return res; if ((res = read_more_data( req, len )) != ERROR_SUCCESS) return res;
if (!req->read_size) req->dwContentLength = req->dwContentRead = 0; if (!req->read_size) req->contentLength = req->contentRead = 0;
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
...@@ -2076,10 +2076,10 @@ static DWORD read_gzip_data(http_request_t *req, BYTE *buf, int size, BOOL sync, ...@@ -2076,10 +2076,10 @@ static DWORD read_gzip_data(http_request_t *req, BYTE *buf, int size, BOOL sync,
break; break;
} }
if(req->dwContentRead == req->dwContentLength) if(req->contentRead == req->contentLength)
break; break;
buf_avail = req->dwContentLength == ~0 ? req->read_size : min(req->read_size, req->dwContentLength-req->dwContentRead); buf_avail = req->contentLength == ~0 ? req->read_size : min(req->read_size, req->contentLength-req->contentRead);
zstream->next_in = req->read_buf+req->read_pos; zstream->next_in = req->read_buf+req->read_pos;
zstream->avail_in = buf_avail; zstream->avail_in = buf_avail;
...@@ -2087,7 +2087,7 @@ static DWORD read_gzip_data(http_request_t *req, BYTE *buf, int size, BOOL sync, ...@@ -2087,7 +2087,7 @@ static DWORD read_gzip_data(http_request_t *req, BYTE *buf, int size, BOOL sync,
zstream->avail_out = size-read; zstream->avail_out = size-read;
zres = inflate(zstream, Z_FULL_FLUSH); zres = inflate(zstream, Z_FULL_FLUSH);
read = size - zstream->avail_out; read = size - zstream->avail_out;
req->dwContentRead += buf_avail-zstream->avail_in; req->contentRead += buf_avail-zstream->avail_in;
remove_data(req, buf_avail-zstream->avail_in); remove_data(req, buf_avail-zstream->avail_in);
if(zres == Z_STREAM_END) { if(zres == Z_STREAM_END) {
TRACE("end of data\n"); TRACE("end of data\n");
...@@ -2133,9 +2133,9 @@ static DWORD get_avail_data( http_request_t *req ) ...@@ -2133,9 +2133,9 @@ static DWORD get_avail_data( http_request_t *req )
refill_gzip_buffer(req); refill_gzip_buffer(req);
return req->gzip_stream->buf_size; return req->gzip_stream->buf_size;
} }
if (req->read_chunked && (req->dwContentLength == ~0u || req->dwContentLength == req->dwContentRead)) if (req->read_chunked && (req->contentLength == ~0u || req->contentLength == req->contentRead))
return 0; return 0;
return min( req->read_size, req->dwContentLength - req->dwContentRead ); return min( req->read_size, req->contentLength - req->contentRead );
} }
static void HTTP_ReceiveRequestData(http_request_t *req, BOOL first_notif) static void HTTP_ReceiveRequestData(http_request_t *req, BOOL first_notif)
...@@ -2168,7 +2168,7 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD * ...@@ -2168,7 +2168,7 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *
EnterCriticalSection( &req->read_section ); EnterCriticalSection( &req->read_section );
if (req->read_chunked && (req->dwContentLength == ~0u || req->dwContentLength == req->dwContentRead)) if (req->read_chunked && (req->contentLength == ~0u || req->contentLength == req->contentRead))
{ {
if (start_next_chunk( req ) != ERROR_SUCCESS) goto done; if (start_next_chunk( req ) != ERROR_SUCCESS) goto done;
} }
...@@ -2191,7 +2191,7 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD * ...@@ -2191,7 +2191,7 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *
finished_reading = req->gzip_stream->end_of_data && !req->gzip_stream->buf_size; finished_reading = req->gzip_stream->end_of_data && !req->gzip_stream->buf_size;
}else { }else {
if (req->dwContentLength != ~0u) size = min( size, req->dwContentLength - req->dwContentRead ); if (req->contentLength != ~0u) size = min( size, req->contentLength - req->contentRead );
if (req->read_size) { if (req->read_size) {
bytes_read = min( req->read_size, size ); bytes_read = min( req->read_size, size );
...@@ -2206,16 +2206,16 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD * ...@@ -2206,16 +2206,16 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *
/* always return success, even if the network layer returns an error */ /* always return success, even if the network layer returns an error */
} }
finished_reading = !bytes_read && req->dwContentRead == req->dwContentLength; finished_reading = !bytes_read && req->contentRead == req->contentLength;
req->dwContentRead += bytes_read; req->contentRead += bytes_read;
} }
done: done:
*read = bytes_read; *read = bytes_read;
TRACE( "retrieved %u bytes (%u/%u)\n", bytes_read, req->dwContentRead, req->dwContentLength ); TRACE( "retrieved %u bytes (%u/%u)\n", bytes_read, req->contentRead, req->contentLength );
LeaveCriticalSection( &req->read_section ); LeaveCriticalSection( &req->read_section );
if(ret == ERROR_SUCCESS && req->lpszCacheFile) { if(ret == ERROR_SUCCESS && req->cacheFile) {
BOOL res; BOOL res;
DWORD dwBytesWritten; DWORD dwBytesWritten;
...@@ -2325,8 +2325,8 @@ static DWORD HTTPREQ_ReadFileExA(object_header_t *hdr, INTERNET_BUFFERSA *buffer ...@@ -2325,8 +2325,8 @@ static DWORD HTTPREQ_ReadFileExA(object_header_t *hdr, INTERNET_BUFFERSA *buffer
else else
break; break;
if(!req->read_chunked || read==size || req->dwContentLength!=req->dwContentRead if(!req->read_chunked || read==size || req->contentLength!=req->contentRead
|| !req->dwContentLength || (req->gzip_stream && req->gzip_stream->end_of_data)) || !req->contentLength || (req->gzip_stream && req->gzip_stream->end_of_data))
break; break;
LeaveCriticalSection( &req->read_section ); LeaveCriticalSection( &req->read_section );
...@@ -2434,8 +2434,8 @@ static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, INTERNET_BUFFERSW *buffer ...@@ -2434,8 +2434,8 @@ static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, INTERNET_BUFFERSW *buffer
else else
break; break;
if(!req->read_chunked || read==size || req->dwContentLength!=req->dwContentRead if(!req->read_chunked || read==size || req->contentLength!=req->contentRead
|| !req->dwContentLength || (req->gzip_stream && req->gzip_stream->end_of_data)) || !req->contentLength || (req->gzip_stream && req->gzip_stream->end_of_data))
break; break;
LeaveCriticalSection( &req->read_section ); LeaveCriticalSection( &req->read_section );
...@@ -2475,7 +2475,7 @@ static DWORD HTTPREQ_WriteFile(object_header_t *hdr, const void *buffer, DWORD s ...@@ -2475,7 +2475,7 @@ static DWORD HTTPREQ_WriteFile(object_header_t *hdr, const void *buffer, DWORD s
*written = 0; *written = 0;
res = NETCON_send(&request->netConnection, buffer, size, 0, (LPINT)written); res = NETCON_send(&request->netConnection, buffer, size, 0, (LPINT)written);
if (res == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
request->dwBytesWritten += *written; request->bytesWritten += *written;
INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_REQUEST_SENT, written, sizeof(DWORD)); INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_REQUEST_SENT, written, sizeof(DWORD));
return res; return res;
...@@ -2494,7 +2494,7 @@ static DWORD HTTPREQ_QueryDataAvailable(object_header_t *hdr, DWORD *available, ...@@ -2494,7 +2494,7 @@ static DWORD HTTPREQ_QueryDataAvailable(object_header_t *hdr, DWORD *available,
TRACE("(%p %p %x %lx)\n", req, available, flags, ctx); TRACE("(%p %p %x %lx)\n", req, available, flags, ctx);
if (req->lpHttpSession->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (req->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST workRequest; WORKREQUEST workRequest;
...@@ -2527,7 +2527,7 @@ done: ...@@ -2527,7 +2527,7 @@ done:
{ {
DWORD extra; DWORD extra;
if (NETCON_query_data_available(&req->netConnection, &extra)) if (NETCON_query_data_available(&req->netConnection, &extra))
*available = min( *available + extra, req->dwContentLength - req->dwContentRead ); *available = min( *available + extra, req->contentLength - req->contentRead );
} }
LeaveCriticalSection( &req->read_section ); LeaveCriticalSection( &req->read_section );
...@@ -2581,12 +2581,12 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session, ...@@ -2581,12 +2581,12 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
request->hdr.htype = WH_HHTTPREQ; request->hdr.htype = WH_HHTTPREQ;
request->hdr.dwFlags = dwFlags; request->hdr.dwFlags = dwFlags;
request->hdr.dwContext = dwContext; request->hdr.dwContext = dwContext;
request->dwContentLength = ~0u; request->contentLength = ~0u;
InitializeCriticalSection( &request->read_section ); InitializeCriticalSection( &request->read_section );
WININET_AddRef( &session->hdr ); WININET_AddRef( &session->hdr );
request->lpHttpSession = session; request->session = session;
list_add_head( &session->hdr.children, &request->hdr.entry ); list_add_head( &session->hdr.children, &request->hdr.entry );
lpszHostName = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * lpszHostName = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) *
...@@ -2607,18 +2607,18 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session, ...@@ -2607,18 +2607,18 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
rc = UrlEscapeW(lpszObjectName, NULL, &len, URL_ESCAPE_SPACES_ONLY); rc = UrlEscapeW(lpszObjectName, NULL, &len, URL_ESCAPE_SPACES_ONLY);
if (rc != E_POINTER) if (rc != E_POINTER)
len = strlenW(lpszObjectName)+1; len = strlenW(lpszObjectName)+1;
request->lpszPath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); request->path = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
rc = UrlEscapeW(lpszObjectName, request->lpszPath, &len, rc = UrlEscapeW(lpszObjectName, request->path, &len,
URL_ESCAPE_SPACES_ONLY); URL_ESCAPE_SPACES_ONLY);
if (rc != S_OK) if (rc != S_OK)
{ {
ERR("Unable to escape string!(%s) (%d)\n",debugstr_w(lpszObjectName),rc); ERR("Unable to escape string!(%s) (%d)\n",debugstr_w(lpszObjectName),rc);
strcpyW(request->lpszPath,lpszObjectName); strcpyW(request->path,lpszObjectName);
} }
}else { }else {
static const WCHAR slashW[] = {'/',0}; static const WCHAR slashW[] = {'/',0};
request->lpszPath = heap_strdupW(slashW); request->path = heap_strdupW(slashW);
} }
if (lpszReferrer && *lpszReferrer) if (lpszReferrer && *lpszReferrer)
...@@ -2637,8 +2637,8 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session, ...@@ -2637,8 +2637,8 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
} }
} }
request->lpszVerb = heap_strdupW(lpszVerb && *lpszVerb ? lpszVerb : szGET); request->verb = heap_strdupW(lpszVerb && *lpszVerb ? lpszVerb : szGET);
request->lpszVersion = heap_strdupW(lpszVersion ? lpszVersion : g_szHttp1_1); request->version = heap_strdupW(lpszVersion ? lpszVersion : g_szHttp1_1);
if (session->hostPort != INTERNET_INVALID_PORT_NUMBER && if (session->hostPort != INTERNET_INVALID_PORT_NUMBER &&
session->hostPort != INTERNET_DEFAULT_HTTP_PORT && session->hostPort != INTERNET_DEFAULT_HTTP_PORT &&
...@@ -2747,12 +2747,12 @@ static void HTTP_DrainContent(http_request_t *req) ...@@ -2747,12 +2747,12 @@ static void HTTP_DrainContent(http_request_t *req)
if (!NETCON_connected(&req->netConnection)) return; if (!NETCON_connected(&req->netConnection)) return;
if (req->dwContentLength == -1) if (req->contentLength == -1)
{ {
NETCON_close(&req->netConnection); NETCON_close(&req->netConnection);
return; return;
} }
if (!strcmpW(req->lpszVerb, szHEAD)) return; if (!strcmpW(req->verb, szHEAD)) return;
do do
{ {
...@@ -2864,9 +2864,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, ...@@ -2864,9 +2864,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
DWORD res = ERROR_INVALID_PARAMETER; DWORD res = ERROR_INVALID_PARAMETER;
if (request_only) if (request_only)
headers = HTTP_BuildHeaderRequestString(request, request->lpszVerb, request->lpszPath, request->lpszVersion); headers = HTTP_BuildHeaderRequestString(request, request->verb, request->path, request->version);
else else
headers = request->lpszRawHeaders; headers = request->rawHeaders;
if (headers) if (headers)
len = strlenW(headers) * sizeof(WCHAR); len = strlenW(headers) * sizeof(WCHAR);
...@@ -2896,7 +2896,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, ...@@ -2896,7 +2896,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
} }
case HTTP_QUERY_RAW_HEADERS: case HTTP_QUERY_RAW_HEADERS:
{ {
LPWSTR * ppszRawHeaderLines = HTTP_Tokenize(request->lpszRawHeaders, szCrLf); LPWSTR * ppszRawHeaderLines = HTTP_Tokenize(request->rawHeaders, szCrLf);
DWORD i, size = 0; DWORD i, size = 0;
LPWSTR pszString = lpBuffer; LPWSTR pszString = lpBuffer;
...@@ -2926,9 +2926,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, ...@@ -2926,9 +2926,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
case HTTP_QUERY_STATUS_TEXT: case HTTP_QUERY_STATUS_TEXT:
if (request->lpszStatusText) if (request->statusText)
{ {
DWORD len = strlenW(request->lpszStatusText); DWORD len = strlenW(request->statusText);
if (len + 1 > *lpdwBufferLength/sizeof(WCHAR)) if (len + 1 > *lpdwBufferLength/sizeof(WCHAR))
{ {
*lpdwBufferLength = (len + 1) * sizeof(WCHAR); *lpdwBufferLength = (len + 1) * sizeof(WCHAR);
...@@ -2936,7 +2936,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, ...@@ -2936,7 +2936,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
} }
if (lpBuffer) if (lpBuffer)
{ {
memcpy(lpBuffer, request->lpszStatusText, (len + 1) * sizeof(WCHAR)); memcpy(lpBuffer, request->statusText, (len + 1) * sizeof(WCHAR));
TRACE("returning data: %s\n", debugstr_wn(lpBuffer, len)); TRACE("returning data: %s\n", debugstr_wn(lpBuffer, len));
} }
*lpdwBufferLength = len * sizeof(WCHAR); *lpdwBufferLength = len * sizeof(WCHAR);
...@@ -2944,9 +2944,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, ...@@ -2944,9 +2944,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
} }
break; break;
case HTTP_QUERY_VERSION: case HTTP_QUERY_VERSION:
if (request->lpszVersion) if (request->version)
{ {
DWORD len = strlenW(request->lpszVersion); DWORD len = strlenW(request->version);
if (len + 1 > *lpdwBufferLength/sizeof(WCHAR)) if (len + 1 > *lpdwBufferLength/sizeof(WCHAR))
{ {
*lpdwBufferLength = (len + 1) * sizeof(WCHAR); *lpdwBufferLength = (len + 1) * sizeof(WCHAR);
...@@ -2954,7 +2954,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, ...@@ -2954,7 +2954,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
} }
if (lpBuffer) if (lpBuffer)
{ {
memcpy(lpBuffer, request->lpszVersion, (len + 1) * sizeof(WCHAR)); memcpy(lpBuffer, request->version, (len + 1) * sizeof(WCHAR));
TRACE("returning data: %s\n", debugstr_wn(lpBuffer, len)); TRACE("returning data: %s\n", debugstr_wn(lpBuffer, len));
} }
*lpdwBufferLength = len * sizeof(WCHAR); *lpdwBufferLength = len * sizeof(WCHAR);
...@@ -2974,7 +2974,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, ...@@ -2974,7 +2974,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel,
} }
if (index >= 0) if (index >= 0)
lphttpHdr = &request->pCustHeaders[index]; lphttpHdr = &request->custHeaders[index];
/* Ensure header satisfies requested attributes */ /* Ensure header satisfies requested attributes */
if (!lphttpHdr || if (!lphttpHdr ||
...@@ -3256,7 +3256,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl) ...@@ -3256,7 +3256,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
{ {
static WCHAR szHttp[] = {'h','t','t','p',0}; static WCHAR szHttp[] = {'h','t','t','p',0};
static WCHAR szHttps[] = {'h','t','t','p','s',0}; static WCHAR szHttps[] = {'h','t','t','p','s',0};
http_session_t *session = request->lpHttpSession; http_session_t *session = request->session;
URL_COMPONENTSW urlComponents; URL_COMPONENTSW urlComponents;
DWORD url_length = 0; DWORD url_length = 0;
LPWSTR orig_url; LPWSTR orig_url;
...@@ -3272,7 +3272,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl) ...@@ -3272,7 +3272,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
urlComponents.dwUserNameLength = 0; urlComponents.dwUserNameLength = 0;
urlComponents.lpszPassword = NULL; urlComponents.lpszPassword = NULL;
urlComponents.dwPasswordLength = 0; urlComponents.dwPasswordLength = 0;
urlComponents.lpszUrlPath = request->lpszPath; urlComponents.lpszUrlPath = request->path;
urlComponents.dwUrlPathLength = 0; urlComponents.dwUrlPathLength = 0;
urlComponents.lpszExtraInfo = NULL; urlComponents.lpszExtraInfo = NULL;
urlComponents.dwExtraInfoLength = 0; urlComponents.dwExtraInfoLength = 0;
...@@ -3316,7 +3316,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl) ...@@ -3316,7 +3316,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl)
*/ */
static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl) static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
{ {
http_session_t *session = request->lpHttpSession; http_session_t *session = request->session;
appinfo_t *hIC = session->appInfo; appinfo_t *hIC = session->appInfo;
BOOL using_proxy = hIC->proxy && hIC->proxy[0]; BOOL using_proxy = hIC->proxy && hIC->proxy[0];
WCHAR path[INTERNET_MAX_URL_LENGTH]; WCHAR path[INTERNET_MAX_URL_LENGTH];
...@@ -3441,8 +3441,8 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl) ...@@ -3441,8 +3441,8 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
TRACE("Redirect through proxy\n"); TRACE("Redirect through proxy\n");
} }
HeapFree(GetProcessHeap(), 0, request->lpszPath); HeapFree(GetProcessHeap(), 0, request->path);
request->lpszPath=NULL; request->path=NULL;
if (*path) if (*path)
{ {
DWORD needed = 0; DWORD needed = 0;
...@@ -3451,13 +3451,13 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl) ...@@ -3451,13 +3451,13 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
rc = UrlEscapeW(path, NULL, &needed, URL_ESCAPE_SPACES_ONLY); rc = UrlEscapeW(path, NULL, &needed, URL_ESCAPE_SPACES_ONLY);
if (rc != E_POINTER) if (rc != E_POINTER)
needed = strlenW(path)+1; needed = strlenW(path)+1;
request->lpszPath = HeapAlloc(GetProcessHeap(), 0, needed*sizeof(WCHAR)); request->path = HeapAlloc(GetProcessHeap(), 0, needed*sizeof(WCHAR));
rc = UrlEscapeW(path, request->lpszPath, &needed, rc = UrlEscapeW(path, request->path, &needed,
URL_ESCAPE_SPACES_ONLY); URL_ESCAPE_SPACES_ONLY);
if (rc != S_OK) if (rc != S_OK)
{ {
ERR("Unable to escape string!(%s) (%d)\n",debugstr_w(path),rc); ERR("Unable to escape string!(%s) (%d)\n",debugstr_w(path),rc);
strcpyW(request->lpszPath,path); strcpyW(request->path,path);
} }
} }
...@@ -3506,7 +3506,7 @@ static DWORD HTTP_SecureProxyConnect(http_request_t *request) ...@@ -3506,7 +3506,7 @@ static DWORD HTTP_SecureProxyConnect(http_request_t *request)
DWORD res; DWORD res;
static const WCHAR szConnect[] = {'C','O','N','N','E','C','T',0}; static const WCHAR szConnect[] = {'C','O','N','N','E','C','T',0};
static const WCHAR szFormat[] = {'%','s',':','%','d',0}; static const WCHAR szFormat[] = {'%','s',':','%','d',0};
http_session_t *session = request->lpHttpSession; http_session_t *session = request->session;
TRACE("\n"); TRACE("\n");
...@@ -3544,9 +3544,9 @@ static void HTTP_InsertCookies(http_request_t *request) ...@@ -3544,9 +3544,9 @@ static void HTTP_InsertCookies(http_request_t *request)
DWORD nCookieSize, size; DWORD nCookieSize, size;
LPHTTPHEADERW Host = HTTP_GetHeader(request, hostW); LPHTTPHEADERW Host = HTTP_GetHeader(request, hostW);
size = (strlenW(Host->lpszValue) + strlenW(szUrlForm) + strlenW(request->lpszPath)) * sizeof(WCHAR); size = (strlenW(Host->lpszValue) + strlenW(szUrlForm) + strlenW(request->path)) * sizeof(WCHAR);
if (!(lpszUrl = HeapAlloc(GetProcessHeap(), 0, size))) return; if (!(lpszUrl = HeapAlloc(GetProcessHeap(), 0, size))) return;
sprintfW( lpszUrl, szUrlForm, Host->lpszValue, request->lpszPath); sprintfW( lpszUrl, szUrlForm, Host->lpszValue, request->path);
if (InternetGetCookieW(lpszUrl, NULL, NULL, &nCookieSize)) if (InternetGetCookieW(lpszUrl, NULL, NULL, &nCookieSize))
{ {
...@@ -3598,24 +3598,24 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, ...@@ -3598,24 +3598,24 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
assert(request->hdr.htype == WH_HHTTPREQ); assert(request->hdr.htype == WH_HHTTPREQ);
/* if the verb is NULL default to GET */ /* if the verb is NULL default to GET */
if (!request->lpszVerb) if (!request->verb)
request->lpszVerb = heap_strdupW(szGET); request->verb = heap_strdupW(szGET);
if (dwContentLength || strcmpW(request->lpszVerb, szGET)) if (dwContentLength || strcmpW(request->verb, szGET))
{ {
sprintfW(contentLengthStr, szContentLength, dwContentLength); sprintfW(contentLengthStr, szContentLength, dwContentLength);
HTTP_HttpAddRequestHeadersW(request, contentLengthStr, -1L, HTTP_ADDREQ_FLAG_REPLACE); HTTP_HttpAddRequestHeadersW(request, contentLengthStr, -1L, HTTP_ADDREQ_FLAG_REPLACE);
request->dwBytesToWrite = dwContentLength; request->bytesToWrite = dwContentLength;
} }
if (request->lpHttpSession->appInfo->agent) if (request->session->appInfo->agent)
{ {
WCHAR *agent_header; WCHAR *agent_header;
static const WCHAR user_agent[] = {'U','s','e','r','-','A','g','e','n','t',':',' ','%','s','\r','\n',0}; static const WCHAR user_agent[] = {'U','s','e','r','-','A','g','e','n','t',':',' ','%','s','\r','\n',0};
int len; int len;
len = strlenW(request->lpHttpSession->appInfo->agent) + strlenW(user_agent); len = strlenW(request->session->appInfo->agent) + strlenW(user_agent);
agent_header = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); agent_header = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
sprintfW(agent_header, user_agent, request->lpHttpSession->appInfo->agent); sprintfW(agent_header, user_agent, request->session->appInfo->agent);
HTTP_HttpAddRequestHeadersW(request, agent_header, strlenW(agent_header), HTTP_ADDREQ_FLAG_ADD_IF_NEW); HTTP_HttpAddRequestHeadersW(request, agent_header, strlenW(agent_header), HTTP_ADDREQ_FLAG_ADD_IF_NEW);
HeapFree(GetProcessHeap(), 0, agent_header); HeapFree(GetProcessHeap(), 0, agent_header);
...@@ -3625,7 +3625,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, ...@@ -3625,7 +3625,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
static const WCHAR pragma_nocache[] = {'P','r','a','g','m','a',':',' ','n','o','-','c','a','c','h','e','\r','\n',0}; static const WCHAR pragma_nocache[] = {'P','r','a','g','m','a',':',' ','n','o','-','c','a','c','h','e','\r','\n',0};
HTTP_HttpAddRequestHeadersW(request, pragma_nocache, strlenW(pragma_nocache), HTTP_ADDREQ_FLAG_ADD_IF_NEW); HTTP_HttpAddRequestHeadersW(request, pragma_nocache, strlenW(pragma_nocache), HTTP_ADDREQ_FLAG_ADD_IF_NEW);
} }
if ((request->hdr.dwFlags & INTERNET_FLAG_NO_CACHE_WRITE) && !strcmpW(request->lpszVerb, szPost)) if ((request->hdr.dwFlags & INTERNET_FLAG_NO_CACHE_WRITE) && !strcmpW(request->verb, szPost))
{ {
static const WCHAR cache_control[] = {'C','a','c','h','e','-','C','o','n','t','r','o','l',':', static const WCHAR cache_control[] = {'C','a','c','h','e','-','C','o','n','t','r','o','l',':',
' ','n','o','-','c','a','c','h','e','\r','\n',0}; ' ','n','o','-','c','a','c','h','e','\r','\n',0};
...@@ -3643,16 +3643,16 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, ...@@ -3643,16 +3643,16 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
/* like native, just in case the caller forgot to call InternetReadFile /* like native, just in case the caller forgot to call InternetReadFile
* for all the data */ * for all the data */
HTTP_DrainContent(request); HTTP_DrainContent(request);
request->dwContentRead = 0; request->contentRead = 0;
if(redirected) { if(redirected) {
request->dwContentLength = ~0u; request->contentLength = ~0u;
request->dwBytesToWrite = 0; request->bytesToWrite = 0;
} }
if (TRACE_ON(wininet)) if (TRACE_ON(wininet))
{ {
LPHTTPHEADERW Host = HTTP_GetHeader(request, hostW); LPHTTPHEADERW Host = HTTP_GetHeader(request, hostW);
TRACE("Going to url %s %s\n", debugstr_w(Host->lpszValue), debugstr_w(request->lpszPath)); TRACE("Going to url %s %s\n", debugstr_w(Host->lpszValue), debugstr_w(request->path));
} }
HTTP_FixURL(request); HTTP_FixURL(request);
...@@ -3660,8 +3660,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, ...@@ -3660,8 +3660,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
{ {
HTTP_ProcessHeader(request, szConnection, szKeepAlive, HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE); HTTP_ProcessHeader(request, szConnection, szKeepAlive, HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE);
} }
HTTP_InsertAuthorization(request, request->pAuthInfo, szAuthorization); HTTP_InsertAuthorization(request, request->authInfo, szAuthorization);
HTTP_InsertAuthorization(request, request->pProxyAuthInfo, szProxy_Authorization); HTTP_InsertAuthorization(request, request->proxyAuthInfo, szProxy_Authorization);
if (!(request->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES)) if (!(request->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES))
HTTP_InsertCookies(request); HTTP_InsertCookies(request);
...@@ -3673,14 +3673,14 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, ...@@ -3673,14 +3673,14 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REPLACE); HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REPLACE);
} }
if (request->lpHttpSession->appInfo->proxy && request->lpHttpSession->appInfo->proxy[0]) if (request->session->appInfo->proxy && request->session->appInfo->proxy[0])
{ {
WCHAR *url = HTTP_BuildProxyRequestUrl(request); WCHAR *url = HTTP_BuildProxyRequestUrl(request);
requestString = HTTP_BuildHeaderRequestString(request, request->lpszVerb, url, request->lpszVersion); requestString = HTTP_BuildHeaderRequestString(request, request->verb, url, request->version);
HeapFree(GetProcessHeap(), 0, url); HeapFree(GetProcessHeap(), 0, url);
} }
else else
requestString = HTTP_BuildHeaderRequestString(request, request->lpszVerb, request->lpszPath, request->lpszVersion); requestString = HTTP_BuildHeaderRequestString(request, request->verb, request->path, request->version);
TRACE("Request header -> %s\n", debugstr_w(requestString) ); TRACE("Request header -> %s\n", debugstr_w(requestString) );
...@@ -3714,7 +3714,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, ...@@ -3714,7 +3714,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
res = NETCON_send(&request->netConnection, ascii_req, len, 0, &cnt); res = NETCON_send(&request->netConnection, ascii_req, len, 0, &cnt);
HeapFree( GetProcessHeap(), 0, ascii_req ); HeapFree( GetProcessHeap(), 0, ascii_req );
request->dwBytesWritten = dwOptionalLength; request->bytesWritten = dwOptionalLength;
INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_SendCallback(&request->hdr, request->hdr.dwContext,
INTERNET_STATUS_REQUEST_SENT, INTERNET_STATUS_REQUEST_SENT,
...@@ -3762,10 +3762,10 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, ...@@ -3762,10 +3762,10 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
dwStatusCode == HTTP_STATUS_REDIRECT_METHOD) && dwStatusCode == HTTP_STATUS_REDIRECT_METHOD) &&
HTTP_HttpQueryInfoW(request,HTTP_QUERY_LOCATION,szNewLocation,&dwBufferSize,NULL) == ERROR_SUCCESS) HTTP_HttpQueryInfoW(request,HTTP_QUERY_LOCATION,szNewLocation,&dwBufferSize,NULL) == ERROR_SUCCESS)
{ {
if (strcmpW(request->lpszVerb, szGET) && strcmpW(request->lpszVerb, szHEAD)) if (strcmpW(request->verb, szGET) && strcmpW(request->verb, szHEAD))
{ {
HeapFree(GetProcessHeap(), 0, request->lpszVerb); HeapFree(GetProcessHeap(), 0, request->verb);
request->lpszVerb = heap_strdupW(szGET); request->verb = heap_strdupW(szGET);
} }
HTTP_DrainContent(request); HTTP_DrainContent(request);
if ((new_url = HTTP_GetRedirectURL( request, szNewLocation ))) if ((new_url = HTTP_GetRedirectURL( request, szNewLocation )))
...@@ -3794,9 +3794,9 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, ...@@ -3794,9 +3794,9 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
while (HTTP_HttpQueryInfoW(request,HTTP_QUERY_WWW_AUTHENTICATE,szAuthValue,&dwBufferSize,&dwIndex) == ERROR_SUCCESS) while (HTTP_HttpQueryInfoW(request,HTTP_QUERY_WWW_AUTHENTICATE,szAuthValue,&dwBufferSize,&dwIndex) == ERROR_SUCCESS)
{ {
if (HTTP_DoAuthorization(request, szAuthValue, if (HTTP_DoAuthorization(request, szAuthValue,
&request->pAuthInfo, &request->authInfo,
request->lpHttpSession->userName, request->session->userName,
request->lpHttpSession->password, request->session->password,
Host->lpszValue)) Host->lpszValue))
{ {
HeapFree(GetProcessHeap(), 0, requestString); HeapFree(GetProcessHeap(), 0, requestString);
...@@ -3807,8 +3807,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, ...@@ -3807,8 +3807,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
if(!loop_next) { if(!loop_next) {
TRACE("Cleaning wrong authorization data\n"); TRACE("Cleaning wrong authorization data\n");
destroy_authinfo(request->pAuthInfo); destroy_authinfo(request->authInfo);
request->pAuthInfo = NULL; request->authInfo = NULL;
} }
} }
if (dwStatusCode == HTTP_STATUS_PROXY_AUTH_REQ) if (dwStatusCode == HTTP_STATUS_PROXY_AUTH_REQ)
...@@ -3817,9 +3817,9 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, ...@@ -3817,9 +3817,9 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
while (HTTP_HttpQueryInfoW(request,HTTP_QUERY_PROXY_AUTHENTICATE,szAuthValue,&dwBufferSize,&dwIndex) == ERROR_SUCCESS) while (HTTP_HttpQueryInfoW(request,HTTP_QUERY_PROXY_AUTHENTICATE,szAuthValue,&dwBufferSize,&dwIndex) == ERROR_SUCCESS)
{ {
if (HTTP_DoAuthorization(request, szAuthValue, if (HTTP_DoAuthorization(request, szAuthValue,
&request->pProxyAuthInfo, &request->proxyAuthInfo,
request->lpHttpSession->appInfo->proxyUsername, request->session->appInfo->proxyUsername,
request->lpHttpSession->appInfo->proxyPassword, request->session->appInfo->proxyPassword,
NULL)) NULL))
{ {
loop_next = TRUE; loop_next = TRUE;
...@@ -3829,8 +3829,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, ...@@ -3829,8 +3829,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
if(!loop_next) { if(!loop_next) {
TRACE("Cleaning wrong proxy authorization data\n"); TRACE("Cleaning wrong proxy authorization data\n");
destroy_authinfo(request->pProxyAuthInfo); destroy_authinfo(request->proxyAuthInfo);
request->pProxyAuthInfo = NULL; request->proxyAuthInfo = NULL;
} }
} }
} }
...@@ -3851,13 +3851,13 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, ...@@ -3851,13 +3851,13 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
goto lend; goto lend;
} }
b = CreateUrlCacheEntryW(url, request->dwContentLength > 0 ? request->dwContentLength : 0, NULL, cacheFileName, 0); b = CreateUrlCacheEntryW(url, request->contentLength > 0 ? request->contentLength : 0, NULL, cacheFileName, 0);
if(b) { if(b) {
HeapFree(GetProcessHeap(), 0, request->lpszCacheFile); HeapFree(GetProcessHeap(), 0, request->cacheFile);
CloseHandle(request->hCacheFile); CloseHandle(request->hCacheFile);
request->lpszCacheFile = heap_strdupW(cacheFileName); request->cacheFile = heap_strdupW(cacheFileName);
request->hCacheFile = CreateFileW(request->lpszCacheFile, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, request->hCacheFile = CreateFileW(request->cacheFile, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(request->hCacheFile == INVALID_HANDLE_VALUE) { if(request->hCacheFile == INVALID_HANDLE_VALUE) {
WARN("Could not create file: %u\n", GetLastError()); WARN("Could not create file: %u\n", GetLastError());
...@@ -3874,9 +3874,9 @@ lend: ...@@ -3874,9 +3874,9 @@ lend:
/* TODO: send notification for P3P header */ /* TODO: send notification for P3P header */
if (request->lpHttpSession->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (request->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
if (res == ERROR_SUCCESS && request->dwBytesWritten == request->dwBytesToWrite) if (res == ERROR_SUCCESS && request->bytesWritten == request->bytesToWrite)
HTTP_ReceiveRequestData(request, TRUE); HTTP_ReceiveRequestData(request, TRUE);
else else
{ {
...@@ -3945,10 +3945,10 @@ static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_ ...@@ -3945,10 +3945,10 @@ static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_
dwBufferSize=sizeof(szNewLocation); dwBufferSize=sizeof(szNewLocation);
if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_LOCATION, szNewLocation, &dwBufferSize, NULL) == ERROR_SUCCESS) if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_LOCATION, szNewLocation, &dwBufferSize, NULL) == ERROR_SUCCESS)
{ {
if (strcmpW(request->lpszVerb, szGET) && strcmpW(request->lpszVerb, szHEAD)) if (strcmpW(request->verb, szGET) && strcmpW(request->verb, szHEAD))
{ {
HeapFree(GetProcessHeap(), 0, request->lpszVerb); HeapFree(GetProcessHeap(), 0, request->verb);
request->lpszVerb = heap_strdupW(szGET); request->verb = heap_strdupW(szGET);
} }
HTTP_DrainContent(request); HTTP_DrainContent(request);
if ((new_url = HTTP_GetRedirectURL( request, szNewLocation ))) if ((new_url = HTTP_GetRedirectURL( request, szNewLocation )))
...@@ -4042,7 +4042,7 @@ BOOL WINAPI HttpEndRequestW(HINTERNET hRequest, ...@@ -4042,7 +4042,7 @@ BOOL WINAPI HttpEndRequestW(HINTERNET hRequest,
} }
request->hdr.dwFlags |= dwFlags; request->hdr.dwFlags |= dwFlags;
if (request->lpHttpSession->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC) if (request->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC)
{ {
WORKREQUEST work; WORKREQUEST work;
struct WORKREQ_HTTPENDREQUESTW *work_endrequest; struct WORKREQ_HTTPENDREQUESTW *work_endrequest;
...@@ -4154,7 +4154,7 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, ...@@ -4154,7 +4154,7 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
goto lend; goto lend;
} }
session = request->lpHttpSession; session = request->session;
assert(session->hdr.htype == WH_HHTTPSESSION); assert(session->hdr.htype == WH_HHTTPSESSION);
hIC = session->appInfo; hIC = session->appInfo;
assert(hIC->hdr.htype == WH_HINIT); assert(hIC->hdr.htype == WH_HINIT);
...@@ -4252,7 +4252,7 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, ...@@ -4252,7 +4252,7 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders,
goto lend; goto lend;
} }
session = request->lpHttpSession; session = request->session;
if (NULL == session || session->hdr.htype != WH_HHTTPSESSION) if (NULL == session || session->hdr.htype != WH_HHTTPSESSION)
{ {
res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE;
...@@ -4517,7 +4517,7 @@ static DWORD HTTP_OpenConnection(http_request_t *request) ...@@ -4517,7 +4517,7 @@ static DWORD HTTP_OpenConnection(http_request_t *request)
goto lend; goto lend;
if ((res = HTTP_ResolveName(request)) != ERROR_SUCCESS) goto lend; if ((res = HTTP_ResolveName(request)) != ERROR_SUCCESS) goto lend;
session = request->lpHttpSession; session = request->session;
hIC = session->appInfo; hIC = session->appInfo;
switch (session->socketAddress.ss_family) switch (session->socketAddress.ss_family)
...@@ -4608,11 +4608,11 @@ static void HTTP_clear_response_headers( http_request_t *request ) ...@@ -4608,11 +4608,11 @@ static void HTTP_clear_response_headers( http_request_t *request )
for( i=0; i<request->nCustHeaders; i++) for( i=0; i<request->nCustHeaders; i++)
{ {
if( !request->pCustHeaders[i].lpszField ) if( !request->custHeaders[i].lpszField )
continue; continue;
if( !request->pCustHeaders[i].lpszValue ) if( !request->custHeaders[i].lpszValue )
continue; continue;
if ( request->pCustHeaders[i].wFlags & HDR_ISREQUEST ) if ( request->custHeaders[i].wFlags & HDR_ISREQUEST )
continue; continue;
HTTP_DeleteCustomHeader( request, i ); HTTP_DeleteCustomHeader( request, i );
i--; i--;
...@@ -4690,14 +4690,14 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear) ...@@ -4690,14 +4690,14 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
{ {
WARN("No status line at head of response (%s)\n", debugstr_w(buffer)); WARN("No status line at head of response (%s)\n", debugstr_w(buffer));
HeapFree(GetProcessHeap(), 0, request->lpszVersion); HeapFree(GetProcessHeap(), 0, request->version);
HeapFree(GetProcessHeap(), 0, request->lpszStatusText); HeapFree(GetProcessHeap(), 0, request->statusText);
request->lpszVersion = heap_strdupW(g_szHttp1_0); request->version = heap_strdupW(g_szHttp1_0);
request->lpszStatusText = heap_strdupW(szOK); request->statusText = heap_strdupW(szOK);
HeapFree(GetProcessHeap(), 0, request->lpszRawHeaders); HeapFree(GetProcessHeap(), 0, request->rawHeaders);
request->lpszRawHeaders = heap_strdupW(szDefaultHeader); request->rawHeaders = heap_strdupW(szDefaultHeader);
bSuccess = TRUE; bSuccess = TRUE;
goto lend; goto lend;
...@@ -4708,11 +4708,11 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear) ...@@ -4708,11 +4708,11 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
HTTP_ProcessHeader(request, szStatus, status_code, HTTP_ProcessHeader(request, szStatus, status_code,
HTTP_ADDHDR_FLAG_REPLACE); HTTP_ADDHDR_FLAG_REPLACE);
HeapFree(GetProcessHeap(),0,request->lpszVersion); HeapFree(GetProcessHeap(),0,request->version);
HeapFree(GetProcessHeap(),0,request->lpszStatusText); HeapFree(GetProcessHeap(),0,request->statusText);
request->lpszVersion = heap_strdupW(buffer); request->version = heap_strdupW(buffer);
request->lpszStatusText = heap_strdupW(status_text); request->statusText = heap_strdupW(status_text);
/* Restore the spaces */ /* Restore the spaces */
*(status_code-1) = ' '; *(status_code-1) = ' ';
...@@ -4787,8 +4787,8 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear) ...@@ -4787,8 +4787,8 @@ static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear)
memcpy(&lpszRawHeaders[cchRawHeaders], szCrLf, sizeof(szCrLf)); memcpy(&lpszRawHeaders[cchRawHeaders], szCrLf, sizeof(szCrLf));
HeapFree(GetProcessHeap(), 0, request->lpszRawHeaders); HeapFree(GetProcessHeap(), 0, request->rawHeaders);
request->lpszRawHeaders = lpszRawHeaders; request->rawHeaders = lpszRawHeaders;
TRACE("raw headers: %s\n", debugstr_w(lpszRawHeaders)); TRACE("raw headers: %s\n", debugstr_w(lpszRawHeaders));
bSuccess = TRUE; bSuccess = TRUE;
...@@ -4890,7 +4890,7 @@ static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR ...@@ -4890,7 +4890,7 @@ static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR
{ {
if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW) if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW)
return ERROR_HTTP_INVALID_HEADER; return ERROR_HTTP_INVALID_HEADER;
lphttpHdr = &request->pCustHeaders[index]; lphttpHdr = &request->custHeaders[index];
} }
else if (value) else if (value)
{ {
...@@ -5021,13 +5021,13 @@ static INT HTTP_GetCustomHeaderIndex(http_request_t *request, LPCWSTR lpszField, ...@@ -5021,13 +5021,13 @@ static INT HTTP_GetCustomHeaderIndex(http_request_t *request, LPCWSTR lpszField,
for (index = 0; index < request->nCustHeaders; index++) for (index = 0; index < request->nCustHeaders; index++)
{ {
if (strcmpiW(request->pCustHeaders[index].lpszField, lpszField)) if (strcmpiW(request->custHeaders[index].lpszField, lpszField))
continue; continue;
if (request_only && !(request->pCustHeaders[index].wFlags & HDR_ISREQUEST)) if (request_only && !(request->custHeaders[index].wFlags & HDR_ISREQUEST))
continue; continue;
if (!request_only && (request->pCustHeaders[index].wFlags & HDR_ISREQUEST)) if (!request_only && (request->custHeaders[index].wFlags & HDR_ISREQUEST))
continue; continue;
if (requested_index == 0) if (requested_index == 0)
...@@ -5057,18 +5057,18 @@ static DWORD HTTP_InsertCustomHeader(http_request_t *request, LPHTTPHEADERW lpHd ...@@ -5057,18 +5057,18 @@ static DWORD HTTP_InsertCustomHeader(http_request_t *request, LPHTTPHEADERW lpHd
TRACE("--> %s: %s\n", debugstr_w(lpHdr->lpszField), debugstr_w(lpHdr->lpszValue)); TRACE("--> %s: %s\n", debugstr_w(lpHdr->lpszField), debugstr_w(lpHdr->lpszValue));
count = request->nCustHeaders + 1; count = request->nCustHeaders + 1;
if (count > 1) if (count > 1)
lph = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, request->pCustHeaders, sizeof(HTTPHEADERW) * count); lph = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, request->custHeaders, sizeof(HTTPHEADERW) * count);
else else
lph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HTTPHEADERW) * count); lph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HTTPHEADERW) * count);
if (!lph) if (!lph)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
request->pCustHeaders = lph; request->custHeaders = lph;
request->pCustHeaders[count-1].lpszField = heap_strdupW(lpHdr->lpszField); request->custHeaders[count-1].lpszField = heap_strdupW(lpHdr->lpszField);
request->pCustHeaders[count-1].lpszValue = heap_strdupW(lpHdr->lpszValue); request->custHeaders[count-1].lpszValue = heap_strdupW(lpHdr->lpszValue);
request->pCustHeaders[count-1].wFlags = lpHdr->wFlags; request->custHeaders[count-1].wFlags = lpHdr->wFlags;
request->pCustHeaders[count-1].wCount= lpHdr->wCount; request->custHeaders[count-1].wCount= lpHdr->wCount;
request->nCustHeaders++; request->nCustHeaders++;
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -5089,12 +5089,12 @@ static BOOL HTTP_DeleteCustomHeader(http_request_t *request, DWORD index) ...@@ -5089,12 +5089,12 @@ static BOOL HTTP_DeleteCustomHeader(http_request_t *request, DWORD index)
return FALSE; return FALSE;
request->nCustHeaders--; request->nCustHeaders--;
HeapFree(GetProcessHeap(), 0, request->pCustHeaders[index].lpszField); HeapFree(GetProcessHeap(), 0, request->custHeaders[index].lpszField);
HeapFree(GetProcessHeap(), 0, request->pCustHeaders[index].lpszValue); HeapFree(GetProcessHeap(), 0, request->custHeaders[index].lpszValue);
memmove( &request->pCustHeaders[index], &request->pCustHeaders[index+1], memmove( &request->custHeaders[index], &request->custHeaders[index+1],
(request->nCustHeaders - index)* sizeof(HTTPHEADERW) ); (request->nCustHeaders - index)* sizeof(HTTPHEADERW) );
memset( &request->pCustHeaders[request->nCustHeaders], 0, sizeof(HTTPHEADERW) ); memset( &request->custHeaders[request->nCustHeaders], 0, sizeof(HTTPHEADERW) );
return TRUE; return TRUE;
} }
...@@ -5109,7 +5109,7 @@ static BOOL HTTP_DeleteCustomHeader(http_request_t *request, DWORD index) ...@@ -5109,7 +5109,7 @@ static BOOL HTTP_DeleteCustomHeader(http_request_t *request, DWORD index)
static BOOL HTTP_VerifyValidHeader(http_request_t *request, LPCWSTR field) static BOOL HTTP_VerifyValidHeader(http_request_t *request, LPCWSTR field)
{ {
/* Accept-Encoding is stripped from HTTP/1.0 requests. It is invalid */ /* Accept-Encoding is stripped from HTTP/1.0 requests. It is invalid */
if (!strcmpW(request->lpszVersion, g_szHttp1_0) && !strcmpiW(field, szAccept_Encoding)) if (!strcmpW(request->version, g_szHttp1_0) && !strcmpiW(field, szAccept_Encoding))
return ERROR_HTTP_INVALID_HEADER; return ERROR_HTTP_INVALID_HEADER;
return ERROR_SUCCESS; return ERROR_SUCCESS;
......
...@@ -263,25 +263,25 @@ typedef struct gzip_stream_t gzip_stream_t; ...@@ -263,25 +263,25 @@ typedef struct gzip_stream_t gzip_stream_t;
typedef struct typedef struct
{ {
object_header_t hdr; object_header_t hdr;
http_session_t *lpHttpSession; http_session_t *session;
LPWSTR lpszPath; LPWSTR path;
LPWSTR lpszVerb; LPWSTR verb;
LPWSTR lpszRawHeaders; LPWSTR rawHeaders;
WININET_NETCONNECTION netConnection; WININET_NETCONNECTION netConnection;
LPWSTR lpszVersion; LPWSTR version;
LPWSTR lpszStatusText; LPWSTR statusText;
DWORD dwBytesToWrite; DWORD bytesToWrite;
DWORD dwBytesWritten; DWORD bytesWritten;
HTTPHEADERW *pCustHeaders; HTTPHEADERW *custHeaders;
DWORD nCustHeaders; DWORD nCustHeaders;
HANDLE hCacheFile; HANDLE hCacheFile;
LPWSTR lpszCacheFile; LPWSTR cacheFile;
struct HttpAuthInfo *pAuthInfo; struct HttpAuthInfo *authInfo;
struct HttpAuthInfo *pProxyAuthInfo; struct HttpAuthInfo *proxyAuthInfo;
CRITICAL_SECTION read_section; /* section to protect the following fields */ CRITICAL_SECTION read_section; /* section to protect the following fields */
DWORD dwContentLength; /* total number of bytes to be read */ DWORD contentLength; /* total number of bytes to be read */
DWORD dwContentRead; /* bytes of the content read so far */ DWORD contentRead; /* bytes of the content read so far */
BOOL read_chunked; /* are we reading in chunked mode? */ BOOL read_chunked; /* are we reading in chunked mode? */
DWORD read_pos; /* current read position in read_buf */ DWORD read_pos; /* current read position in read_buf */
DWORD read_size; /* valid data size in read_buf */ DWORD read_size; /* valid data size in read_buf */
......
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