mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 22:34:28 +00:00
wininet: Use standard HTTP_ADD Flags.
This commit is contained in:
parent
4bdf92cb7f
commit
b114b2c9eb
|
@ -58,11 +58,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
||||
|
||||
#define HTTP_ADDHDR_FLAG_ADD 0x20000000
|
||||
#define HTTP_ADDHDR_FLAG_ADD_IF_NEW 0x10000000
|
||||
#define HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA 0x40000000
|
||||
#define HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON 0x01000000
|
||||
#define HTTP_ADDHDR_FLAG_REPLACE 0x80000000
|
||||
#define HTTP_ADDHDR_FLAG_REQ 0x02000000
|
||||
|
||||
#define COLLECT_TIME 60000
|
||||
|
@ -1591,7 +1586,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn
|
|||
TRACE("Inserting authorization: %s\n", debugstr_w(authorization));
|
||||
|
||||
HTTP_ProcessHeader(request, header, authorization,
|
||||
HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);
|
||||
HTTP_ADDHDR_FLAG_REQ | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);
|
||||
heap_free(authorization);
|
||||
}
|
||||
else
|
||||
|
@ -1620,7 +1615,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthIn
|
|||
TRACE("Inserting authorization: %s\n", debugstr_w(authorization));
|
||||
|
||||
HTTP_ProcessHeader(request, header, authorization,
|
||||
HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDHDR_FLAG_ADD);
|
||||
HTTP_ADDHDR_FLAG_REQ | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);
|
||||
heap_free(data);
|
||||
heap_free(authorization);
|
||||
}
|
||||
|
@ -3422,9 +3417,9 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
|
|||
{
|
||||
if (!*lpszAcceptTypes[i]) continue;
|
||||
HTTP_ProcessHeader(request, L"Accept", lpszAcceptTypes[i],
|
||||
HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA |
|
||||
HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA |
|
||||
HTTP_ADDHDR_FLAG_REQ |
|
||||
(i == 0 ? (HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDHDR_FLAG_ADD) : 0));
|
||||
(i == 0 ? (HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD) : 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4945,7 +4940,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
|
|||
|
||||
/* add the headers the caller supplied */
|
||||
if( lpszHeaders && dwHeaderLength )
|
||||
HTTP_HttpAddRequestHeadersW(request, lpszHeaders, dwHeaderLength, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REPLACE);
|
||||
HTTP_HttpAddRequestHeadersW(request, lpszHeaders, dwHeaderLength, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -4974,7 +4969,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
|
|||
if (request->hdr.dwFlags & INTERNET_FLAG_KEEP_CONNECTION)
|
||||
{
|
||||
HTTP_ProcessHeader(request, L"Connection", L"Keep-Alive",
|
||||
HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDHDR_FLAG_ADD);
|
||||
HTTP_ADDHDR_FLAG_REQ | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);
|
||||
}
|
||||
HTTP_InsertAuthorization(request, request->authInfo, L"Authorization");
|
||||
HTTP_InsertAuthorization(request, request->proxyAuthInfo, L"Proxy-Authorization");
|
||||
|
@ -5060,7 +5055,7 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders,
|
|||
|
||||
INTERNET_SendCallback(&request->hdr, request->hdr.dwContext,
|
||||
INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0);
|
||||
|
||||
|
||||
if (HTTP_GetResponseHeaders(request, &responseLen))
|
||||
{
|
||||
http_release_netconn(request, FALSE);
|
||||
|
@ -5991,7 +5986,7 @@ static DWORD HTTP_GetResponseHeaders(http_request_t *request, INT *len)
|
|||
|
||||
/* Add status code */
|
||||
HTTP_ProcessHeader(request, L"Status", status_code,
|
||||
HTTP_ADDHDR_FLAG_REPLACE | HTTP_ADDHDR_FLAG_ADD);
|
||||
HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDREQ_FLAG_ADD);
|
||||
|
||||
heap_free(request->version);
|
||||
heap_free(request->statusText);
|
||||
|
@ -6104,7 +6099,7 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer)
|
|||
*
|
||||
*/
|
||||
|
||||
#define COALESCEFLAGS (HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA|HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON)
|
||||
#define COALESCEFLAGS (HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA|HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON)
|
||||
|
||||
static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR value, DWORD dwModifier)
|
||||
{
|
||||
|
@ -6118,17 +6113,17 @@ static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR
|
|||
EnterCriticalSection( &request->headers_section );
|
||||
|
||||
/* REPLACE wins out over ADD */
|
||||
if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE)
|
||||
dwModifier &= ~HTTP_ADDHDR_FLAG_ADD;
|
||||
|
||||
if (dwModifier & HTTP_ADDHDR_FLAG_ADD)
|
||||
if (dwModifier & HTTP_ADDREQ_FLAG_REPLACE)
|
||||
dwModifier &= ~HTTP_ADDREQ_FLAG_ADD;
|
||||
|
||||
if (dwModifier & HTTP_ADDREQ_FLAG_ADD)
|
||||
index = -1;
|
||||
else
|
||||
index = HTTP_GetCustomHeaderIndex(request, field, 0, request_only);
|
||||
|
||||
if (index >= 0)
|
||||
{
|
||||
if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW)
|
||||
if (dwModifier & HTTP_ADDREQ_FLAG_ADD_IF_NEW)
|
||||
{
|
||||
LeaveCriticalSection( &request->headers_section );
|
||||
return ERROR_HTTP_INVALID_HEADER;
|
||||
|
@ -6162,7 +6157,7 @@ static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR
|
|||
else
|
||||
lphttpHdr->wFlags &= ~HDR_ISREQUEST;
|
||||
|
||||
if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE)
|
||||
if (dwModifier & HTTP_ADDREQ_FLAG_REPLACE)
|
||||
{
|
||||
HTTP_DeleteCustomHeader( request, index );
|
||||
|
||||
|
@ -6193,12 +6188,12 @@ static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR
|
|||
INT origlen = lstrlenW(lphttpHdr->lpszValue);
|
||||
INT valuelen = lstrlenW(value);
|
||||
|
||||
if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA)
|
||||
if (dwModifier & HTTP_ADDREQ_FLAG_COALESCE_WITH_COMMA)
|
||||
{
|
||||
ch = ',';
|
||||
lphttpHdr->wFlags |= HDR_COMMADELIMITED;
|
||||
}
|
||||
else if (dwModifier & HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON)
|
||||
else if (dwModifier & HTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON)
|
||||
{
|
||||
ch = ';';
|
||||
lphttpHdr->wFlags |= HDR_COMMADELIMITED;
|
||||
|
|
Loading…
Reference in a new issue