winhttp: Build with msvcrt.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5a212dff7d
commit
e3057aea62
|
@ -3,6 +3,8 @@ IMPORTLIB = winhttp
|
|||
IMPORTS = uuid jsproxy user32 advapi32 ws2_32
|
||||
DELAYIMPORTS = oleaut32 ole32 crypt32 secur32 iphlpapi dhcpcsvc
|
||||
|
||||
EXTRADLLFLAGS = -mno-cygwin
|
||||
|
||||
C_SRCS = \
|
||||
cookie.c \
|
||||
handle.c \
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "ws2tcpip.h"
|
||||
#include <stdarg.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "ws2tcpip.h"
|
||||
#include "winhttp.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
@ -69,7 +69,7 @@ static struct cookie *find_cookie( struct domain *domain, const WCHAR *path, con
|
|||
LIST_FOR_EACH( item, &domain->cookies )
|
||||
{
|
||||
cookie = LIST_ENTRY( item, struct cookie, entry );
|
||||
if (!strcmpW( cookie->path, path ) && !strcmpW( cookie->name, name ))
|
||||
if (!wcscmp( cookie->path, path ) && !wcscmp( cookie->name, name ))
|
||||
{
|
||||
TRACE("found %s=%s\n", debugstr_w(cookie->name), debugstr_w(cookie->value));
|
||||
return cookie;
|
||||
|
@ -82,8 +82,8 @@ static BOOL domain_match( const WCHAR *name, struct domain *domain, BOOL partial
|
|||
{
|
||||
TRACE("comparing %s with %s\n", debugstr_w(name), debugstr_w(domain->name));
|
||||
|
||||
if (partial && !strstrW( name, domain->name )) return FALSE;
|
||||
else if (!partial && strcmpW( name, domain->name )) return FALSE;
|
||||
if (partial && !wcsstr( name, domain->name )) return FALSE;
|
||||
else if (!partial && wcscmp( name, domain->name )) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ static struct cookie *parse_cookie( const WCHAR *string )
|
|||
const WCHAR *p;
|
||||
int len;
|
||||
|
||||
if (!(p = strchrW( string, '=' ))) p = string + strlenW( string );
|
||||
if (!(p = wcschr( string, '=' ))) p = string + lstrlenW( string );
|
||||
len = p - string;
|
||||
while (len && string[len - 1] == ' ') len--;
|
||||
if (!len) return NULL;
|
||||
|
@ -184,7 +184,7 @@ static struct cookie *parse_cookie( const WCHAR *string )
|
|||
if (*p++ == '=')
|
||||
{
|
||||
while (*p == ' ') p++;
|
||||
len = strlenW( p );
|
||||
len = lstrlenW( p );
|
||||
while (len && p[len - 1] == ' ') len--;
|
||||
|
||||
if (!(cookie->value = heap_alloc( (len + 1) * sizeof(WCHAR) )))
|
||||
|
@ -272,9 +272,9 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies )
|
|||
struct cookie *cookie;
|
||||
int len, used;
|
||||
|
||||
len = strlenW( cookies );
|
||||
len = lstrlenW( cookies );
|
||||
if (!(buffer = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return FALSE;
|
||||
strcpyW( buffer, cookies );
|
||||
lstrcpyW( buffer, cookies );
|
||||
|
||||
p = buffer;
|
||||
while (*p && *p != ';') p++;
|
||||
|
@ -284,15 +284,15 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies )
|
|||
heap_free( buffer );
|
||||
return FALSE;
|
||||
}
|
||||
len = strlenW( p );
|
||||
len = lstrlenW( p );
|
||||
while (len && (attr = parse_attr( p, &used )))
|
||||
{
|
||||
if (!strcmpiW( attr->name, domainW ))
|
||||
if (!wcsicmp( attr->name, domainW ))
|
||||
{
|
||||
domain = attr;
|
||||
cookie_domain = attr->value;
|
||||
}
|
||||
else if (!strcmpiW( attr->name, pathW ))
|
||||
else if (!wcsicmp( attr->name, pathW ))
|
||||
{
|
||||
path = attr;
|
||||
cookie_path = attr->value;
|
||||
|
@ -308,7 +308,7 @@ BOOL set_cookies( struct request *request, const WCHAR *cookies )
|
|||
if (!cookie_domain && !(cookie_domain = strdupW( request->connect->servername ))) goto end;
|
||||
if (!cookie_path && !(cookie_path = strdupW( request->path ))) goto end;
|
||||
|
||||
if ((p = strrchrW( cookie_path, '/' )) && p != cookie_path) *p = 0;
|
||||
if ((p = wcsrchr( cookie_path, '/' )) && p != cookie_path) *p = 0;
|
||||
ret = add_cookie( session, cookie, cookie_domain, cookie_path );
|
||||
|
||||
end:
|
||||
|
@ -342,14 +342,14 @@ BOOL add_cookie_headers( struct request *request )
|
|||
|
||||
TRACE("comparing path %s with %s\n", debugstr_w(request->path), debugstr_w(cookie->path));
|
||||
|
||||
if (strstrW( request->path, cookie->path ) == request->path)
|
||||
if (wcsstr( request->path, cookie->path ) == request->path)
|
||||
{
|
||||
static const WCHAR cookieW[] = {'C','o','o','k','i','e',':',' '};
|
||||
int len, len_cookie = ARRAY_SIZE( cookieW ), len_name = strlenW( cookie->name );
|
||||
int len, len_cookie = ARRAY_SIZE( cookieW ), len_name = lstrlenW( cookie->name );
|
||||
WCHAR *header;
|
||||
|
||||
len = len_cookie + len_name;
|
||||
if (cookie->value) len += strlenW( cookie->value ) + 1;
|
||||
if (cookie->value) len += lstrlenW( cookie->value ) + 1;
|
||||
if (!(header = heap_alloc( (len + 1) * sizeof(WCHAR) )))
|
||||
{
|
||||
LeaveCriticalSection( &session->cs );
|
||||
|
@ -357,11 +357,11 @@ BOOL add_cookie_headers( struct request *request )
|
|||
}
|
||||
|
||||
memcpy( header, cookieW, len_cookie * sizeof(WCHAR) );
|
||||
strcpyW( header + len_cookie, cookie->name );
|
||||
lstrcpyW( header + len_cookie, cookie->name );
|
||||
if (cookie->value)
|
||||
{
|
||||
header[len_cookie + len_name] = '=';
|
||||
strcpyW( header + len_cookie + len_name + 1, cookie->value );
|
||||
lstrcpyW( header + len_cookie + len_name + 1, cookie->value );
|
||||
}
|
||||
|
||||
TRACE("%s\n", debugstr_w(header));
|
||||
|
|
|
@ -18,12 +18,11 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "ws2tcpip.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "ws2tcpip.h"
|
||||
#include "winhttp.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
|
|
@ -16,13 +16,12 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
#include "config.h"
|
||||
#include "ws2tcpip.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#define COBJMACROS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "ws2tcpip.h"
|
||||
#include "objbase.h"
|
||||
#include "rpcproxy.h"
|
||||
#include "httprequest.h"
|
||||
|
|
|
@ -17,20 +17,17 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#define NONAMELESSUNION
|
||||
#include "ws2tcpip.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "ws2tcpip.h"
|
||||
#include "winhttp.h"
|
||||
#include "schannel.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/library.h"
|
||||
#include "winhttp_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(winhttp);
|
||||
|
@ -207,7 +204,9 @@ struct netconn *netconn_create( struct hostdata *host, const struct sockaddr_sto
|
|||
addr_len = sizeof(struct sockaddr_in6);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
ERR( "unhandled family %u\n", conn->sockaddr.ss_family );
|
||||
heap_free( conn );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (timeout > 0) set_blocking( conn, FALSE );
|
||||
|
@ -374,7 +373,7 @@ BOOL netconn_secure_connect( struct netconn *conn, WCHAR *hostname, DWORD securi
|
|||
heap_free(read_buf);
|
||||
|
||||
if(status != SEC_E_OK || res != ERROR_SUCCESS) {
|
||||
WARN("Failed to initialize security context failed: %08x\n", status);
|
||||
WARN("Failed to initialize security context: %08x\n", status);
|
||||
heap_free(conn->ssl_buf);
|
||||
conn->ssl_buf = NULL;
|
||||
DeleteSecurityContext(&ctx);
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#define COBJMACROS
|
||||
#include "config.h"
|
||||
#include "ws2tcpip.h"
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#define COBJMACROS
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "ws2tcpip.h"
|
||||
#include "ole2.h"
|
||||
#include "initguid.h"
|
||||
#include "httprequest.h"
|
||||
|
@ -300,7 +300,7 @@ static struct header *parse_header( const WCHAR *string )
|
|||
int len;
|
||||
|
||||
p = string;
|
||||
if (!(q = strchrW( p, ':' )))
|
||||
if (!(q = wcschr( p, ':' )))
|
||||
{
|
||||
WARN("no ':' in line %s\n", debugstr_w(string));
|
||||
return NULL;
|
||||
|
@ -331,7 +331,7 @@ static struct header *parse_header( const WCHAR *string )
|
|||
|
||||
q++; /* skip past colon */
|
||||
while (*q == ' ') q++;
|
||||
len = strlenW( q );
|
||||
len = lstrlenW( q );
|
||||
|
||||
if (!(header->value = heap_alloc( (len + 1) * sizeof(WCHAR) )))
|
||||
{
|
||||
|
@ -352,7 +352,7 @@ static int get_header_index( struct request *request, const WCHAR *field, int re
|
|||
|
||||
for (index = 0; index < request->num_headers; index++)
|
||||
{
|
||||
if (strcmpiW( request->headers[index].field, field )) continue;
|
||||
if (wcsicmp( request->headers[index].field, field )) continue;
|
||||
if (request_only && !request->headers[index].is_request) continue;
|
||||
if (!request_only && request->headers[index].is_request) continue;
|
||||
|
||||
|
@ -438,8 +438,8 @@ BOOL process_header( struct request *request, const WCHAR *field, const WCHAR *v
|
|||
int len, len_orig, len_value;
|
||||
struct header *header = &request->headers[index];
|
||||
|
||||
len_orig = strlenW( header->value );
|
||||
len_value = strlenW( value );
|
||||
len_orig = lstrlenW( header->value );
|
||||
len_value = lstrlenW( value );
|
||||
|
||||
len = len_orig + len_value + 2;
|
||||
if (!(tmp = heap_realloc( header->value, (len + 1) * sizeof(WCHAR) ))) return FALSE;
|
||||
|
@ -469,7 +469,7 @@ BOOL add_request_headers( struct request *request, const WCHAR *headers, DWORD l
|
|||
WCHAR *buffer, *p, *q;
|
||||
struct header *header;
|
||||
|
||||
if (len == ~0u) len = strlenW( headers );
|
||||
if (len == ~0u) len = lstrlenW( headers );
|
||||
if (!len) return TRUE;
|
||||
if (!(buffer = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return FALSE;
|
||||
memcpy( buffer, headers, len * sizeof(WCHAR) );
|
||||
|
@ -548,24 +548,24 @@ static WCHAR *build_absolute_request_path( struct request *request, const WCHAR
|
|||
static const WCHAR fmt[] = {'%','s',':','/','/','%','s',0};
|
||||
const WCHAR *scheme;
|
||||
WCHAR *ret;
|
||||
int len;
|
||||
int len, offset;
|
||||
|
||||
scheme = (request->netconn ? request->netconn->secure : (request->hdr.flags & WINHTTP_FLAG_SECURE)) ? https : http;
|
||||
|
||||
len = strlenW( scheme ) + strlenW( request->connect->hostname ) + 4; /* '://' + nul */
|
||||
len = lstrlenW( scheme ) + lstrlenW( request->connect->hostname ) + 4; /* '://' + nul */
|
||||
if (request->connect->hostport) len += 6; /* ':' between host and port, up to 5 for port */
|
||||
|
||||
len += strlenW( request->path );
|
||||
len += lstrlenW( request->path );
|
||||
if ((ret = heap_alloc( len * sizeof(WCHAR) )))
|
||||
{
|
||||
len = sprintfW( ret, fmt, scheme, request->connect->hostname );
|
||||
offset = swprintf( ret, len, fmt, scheme, request->connect->hostname );
|
||||
if (request->connect->hostport)
|
||||
{
|
||||
static const WCHAR port_fmt[] = {':','%','u',0};
|
||||
len += sprintfW( ret + len, port_fmt, request->connect->hostport );
|
||||
offset += swprintf( ret + offset, len - offset, port_fmt, request->connect->hostport );
|
||||
}
|
||||
strcpyW( ret + len, request->path );
|
||||
if (path) *path = ret + len;
|
||||
lstrcpyW( ret + offset, request->path );
|
||||
if (path) *path = ret + offset;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -578,39 +578,39 @@ static WCHAR *build_request_string( struct request *request )
|
|||
WCHAR *path, *ret;
|
||||
unsigned int i, len;
|
||||
|
||||
if (!strcmpiW( request->connect->hostname, request->connect->servername )) path = request->path;
|
||||
if (!wcsicmp( request->connect->hostname, request->connect->servername )) path = request->path;
|
||||
else if (!(path = build_absolute_request_path( request, NULL ))) return NULL;
|
||||
|
||||
len = strlenW( request->verb ) + 1 /* ' ' */;
|
||||
len += strlenW( path ) + 1 /* ' ' */;
|
||||
len += strlenW( request->version );
|
||||
len = lstrlenW( request->verb ) + 1 /* ' ' */;
|
||||
len += lstrlenW( path ) + 1 /* ' ' */;
|
||||
len += lstrlenW( request->version );
|
||||
|
||||
for (i = 0; i < request->num_headers; i++)
|
||||
{
|
||||
if (request->headers[i].is_request)
|
||||
len += strlenW( request->headers[i].field ) + strlenW( request->headers[i].value ) + 4; /* '\r\n: ' */
|
||||
len += lstrlenW( request->headers[i].field ) + lstrlenW( request->headers[i].value ) + 4; /* '\r\n: ' */
|
||||
}
|
||||
len += 4; /* '\r\n\r\n' */
|
||||
|
||||
if ((ret = heap_alloc( (len + 1) * sizeof(WCHAR) )))
|
||||
{
|
||||
strcpyW( ret, request->verb );
|
||||
strcatW( ret, spaceW );
|
||||
strcatW( ret, path );
|
||||
strcatW( ret, spaceW );
|
||||
strcatW( ret, request->version );
|
||||
lstrcpyW( ret, request->verb );
|
||||
lstrcatW( ret, spaceW );
|
||||
lstrcatW( ret, path );
|
||||
lstrcatW( ret, spaceW );
|
||||
lstrcatW( ret, request->version );
|
||||
|
||||
for (i = 0; i < request->num_headers; i++)
|
||||
{
|
||||
if (request->headers[i].is_request)
|
||||
{
|
||||
strcatW( ret, crlfW );
|
||||
strcatW( ret, request->headers[i].field );
|
||||
strcatW( ret, colonW );
|
||||
strcatW( ret, request->headers[i].value );
|
||||
lstrcatW( ret, crlfW );
|
||||
lstrcatW( ret, request->headers[i].field );
|
||||
lstrcatW( ret, colonW );
|
||||
lstrcatW( ret, request->headers[i].value );
|
||||
}
|
||||
}
|
||||
strcatW( ret, twocrlfW );
|
||||
lstrcatW( ret, twocrlfW );
|
||||
}
|
||||
|
||||
if (path != request->path) heap_free( path );
|
||||
|
@ -681,7 +681,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na
|
|||
headers = request->raw_headers;
|
||||
|
||||
if (!headers) return FALSE;
|
||||
len = strlenW( headers ) * sizeof(WCHAR);
|
||||
len = lstrlenW( headers ) * sizeof(WCHAR);
|
||||
if (!buffer || len + sizeof(WCHAR) > *buflen)
|
||||
{
|
||||
len += sizeof(WCHAR);
|
||||
|
@ -698,7 +698,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na
|
|||
return ret;
|
||||
}
|
||||
case WINHTTP_QUERY_VERSION:
|
||||
len = strlenW( request->version ) * sizeof(WCHAR);
|
||||
len = lstrlenW( request->version ) * sizeof(WCHAR);
|
||||
if (!buffer || len + sizeof(WCHAR) > *buflen)
|
||||
{
|
||||
len += sizeof(WCHAR);
|
||||
|
@ -706,7 +706,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na
|
|||
}
|
||||
else
|
||||
{
|
||||
strcpyW( buffer, request->version );
|
||||
lstrcpyW( buffer, request->version );
|
||||
TRACE("returning string: %s\n", debugstr_w(buffer));
|
||||
ret = TRUE;
|
||||
}
|
||||
|
@ -714,7 +714,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na
|
|||
return ret;
|
||||
|
||||
case WINHTTP_QUERY_STATUS_TEXT:
|
||||
len = strlenW( request->status_text ) * sizeof(WCHAR);
|
||||
len = lstrlenW( request->status_text ) * sizeof(WCHAR);
|
||||
if (!buffer || len + sizeof(WCHAR) > *buflen)
|
||||
{
|
||||
len += sizeof(WCHAR);
|
||||
|
@ -722,7 +722,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na
|
|||
}
|
||||
else
|
||||
{
|
||||
strcpyW( buffer, request->status_text );
|
||||
lstrcpyW( buffer, request->status_text );
|
||||
TRACE("returning string: %s\n", debugstr_w(buffer));
|
||||
ret = TRUE;
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na
|
|||
return ret;
|
||||
|
||||
case WINHTTP_QUERY_REQUEST_METHOD:
|
||||
len = strlenW( request->verb ) * sizeof(WCHAR);
|
||||
len = lstrlenW( request->verb ) * sizeof(WCHAR);
|
||||
if (!buffer || len + sizeof(WCHAR) > *buflen)
|
||||
{
|
||||
len += sizeof(WCHAR);
|
||||
|
@ -738,7 +738,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na
|
|||
}
|
||||
else
|
||||
{
|
||||
strcpyW( buffer, request->verb );
|
||||
lstrcpyW( buffer, request->verb );
|
||||
TRACE("returning string: %s\n", debugstr_w(buffer));
|
||||
ret = TRUE;
|
||||
}
|
||||
|
@ -780,7 +780,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na
|
|||
else
|
||||
{
|
||||
int *number = buffer;
|
||||
*number = atoiW( header->value );
|
||||
*number = wcstol( header->value, NULL, 10 );
|
||||
TRACE("returning number: %d\n", *number);
|
||||
ret = TRUE;
|
||||
}
|
||||
|
@ -803,7 +803,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na
|
|||
}
|
||||
else if (header->value)
|
||||
{
|
||||
len = strlenW( header->value ) * sizeof(WCHAR);
|
||||
len = lstrlenW( header->value ) * sizeof(WCHAR);
|
||||
if (!buffer || len + sizeof(WCHAR) > *buflen)
|
||||
{
|
||||
len += sizeof(WCHAR);
|
||||
|
@ -811,7 +811,7 @@ static BOOL query_headers( struct request *request, DWORD level, const WCHAR *na
|
|||
}
|
||||
else
|
||||
{
|
||||
strcpyW( buffer, header->value );
|
||||
lstrcpyW( buffer, header->value );
|
||||
TRACE("returning string: %s\n", debugstr_w(buffer));
|
||||
ret = TRUE;
|
||||
}
|
||||
|
@ -885,7 +885,7 @@ static DWORD auth_scheme_from_header( const WCHAR *header )
|
|||
|
||||
for (i = 0; i < ARRAY_SIZE( auth_schemes ); i++)
|
||||
{
|
||||
if (!strncmpiW( header, auth_schemes[i].str, auth_schemes[i].len ) &&
|
||||
if (!wcsnicmp( header, auth_schemes[i].str, auth_schemes[i].len ) &&
|
||||
(header[auth_schemes[i].len] == ' ' || !header[auth_schemes[i].len])) return auth_schemes[i].scheme;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1194,8 +1194,8 @@ static BOOL do_authorization( struct request *request, DWORD target, DWORD schem
|
|||
if (!username || !password) return FALSE;
|
||||
if ((!authinfo && !(authinfo = alloc_authinfo())) || authinfo->finished) return FALSE;
|
||||
|
||||
userlen = WideCharToMultiByte( CP_UTF8, 0, username, strlenW( username ), NULL, 0, NULL, NULL );
|
||||
passlen = WideCharToMultiByte( CP_UTF8, 0, password, strlenW( password ), NULL, 0, NULL, NULL );
|
||||
userlen = WideCharToMultiByte( CP_UTF8, 0, username, lstrlenW( username ), NULL, 0, NULL, NULL );
|
||||
passlen = WideCharToMultiByte( CP_UTF8, 0, password, lstrlenW( password ), NULL, 0, NULL, NULL );
|
||||
|
||||
authinfo->data_len = userlen + 1 + passlen;
|
||||
if (!(authinfo->data = heap_alloc( authinfo->data_len ))) return FALSE;
|
||||
|
@ -1228,7 +1228,7 @@ static BOOL do_authorization( struct request *request, DWORD target, DWORD schem
|
|||
|
||||
first = TRUE;
|
||||
domain = (WCHAR *)username;
|
||||
user = strchrW( username, '\\' );
|
||||
user = wcschr( username, '\\' );
|
||||
|
||||
if (user) user++;
|
||||
else
|
||||
|
@ -1238,11 +1238,11 @@ static BOOL do_authorization( struct request *request, DWORD target, DWORD schem
|
|||
}
|
||||
id.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
|
||||
id.User = user;
|
||||
id.UserLength = strlenW( user );
|
||||
id.UserLength = lstrlenW( user );
|
||||
id.Domain = domain;
|
||||
id.DomainLength = domain ? user - domain - 1 : 0;
|
||||
id.Password = (WCHAR *)password;
|
||||
id.PasswordLength = strlenW( password );
|
||||
id.PasswordLength = lstrlenW( password );
|
||||
|
||||
status = AcquireCredentialsHandleW( NULL, (SEC_WCHAR *)auth_schemes[scheme].str,
|
||||
SECPKG_CRED_OUTBOUND, NULL, &id, NULL, NULL,
|
||||
|
@ -1268,8 +1268,8 @@ static BOOL do_authorization( struct request *request, DWORD target, DWORD schem
|
|||
}
|
||||
else if (authinfo->finished) return FALSE;
|
||||
|
||||
if ((strlenW( auth_value ) < auth_schemes[authinfo->scheme].len ||
|
||||
strncmpiW( auth_value, auth_schemes[authinfo->scheme].str, auth_schemes[authinfo->scheme].len )))
|
||||
if ((lstrlenW( auth_value ) < auth_schemes[authinfo->scheme].len ||
|
||||
wcsnicmp( auth_value, auth_schemes[authinfo->scheme].str, auth_schemes[authinfo->scheme].len )))
|
||||
{
|
||||
ERR("authentication scheme changed from %s to %s\n",
|
||||
debugstr_w(auth_schemes[authinfo->scheme].str), debugstr_w(auth_value));
|
||||
|
@ -1288,7 +1288,7 @@ static BOOL do_authorization( struct request *request, DWORD target, DWORD schem
|
|||
p = auth_value + auth_schemes[scheme].len;
|
||||
if (*p == ' ')
|
||||
{
|
||||
int len = strlenW( ++p );
|
||||
int len = lstrlenW( ++p );
|
||||
in.cbBuffer = decode_base64( p, len, NULL );
|
||||
if (!(in.pvBuffer = heap_alloc( in.cbBuffer ))) {
|
||||
destroy_authinfo( authinfo );
|
||||
|
@ -1368,10 +1368,10 @@ static WCHAR *build_proxy_connect_string( struct request *request )
|
|||
static const WCHAR twocrlfW[] = {'\r','\n','\r','\n',0};
|
||||
WCHAR *ret, *host;
|
||||
unsigned int i;
|
||||
int len;
|
||||
int len = lstrlenW( request->connect->hostname ) + 7;
|
||||
|
||||
if (!(host = heap_alloc( (strlenW( request->connect->hostname ) + 7) * sizeof(WCHAR) ))) return NULL;
|
||||
len = sprintfW( host, fmtW, request->connect->hostname, request->connect->hostport );
|
||||
if (!(host = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
|
||||
len = swprintf( host, len, fmtW, request->connect->hostname, request->connect->hostport );
|
||||
|
||||
len += ARRAY_SIZE(connectW);
|
||||
len += ARRAY_SIZE(http1_1);
|
||||
|
@ -1379,29 +1379,29 @@ static WCHAR *build_proxy_connect_string( struct request *request )
|
|||
for (i = 0; i < request->num_headers; i++)
|
||||
{
|
||||
if (request->headers[i].is_request)
|
||||
len += strlenW( request->headers[i].field ) + strlenW( request->headers[i].value ) + 4; /* '\r\n: ' */
|
||||
len += lstrlenW( request->headers[i].field ) + lstrlenW( request->headers[i].value ) + 4; /* '\r\n: ' */
|
||||
}
|
||||
len += 4; /* '\r\n\r\n' */
|
||||
|
||||
if ((ret = heap_alloc( (len + 1) * sizeof(WCHAR) )))
|
||||
{
|
||||
strcpyW( ret, connectW );
|
||||
strcatW( ret, spaceW );
|
||||
strcatW( ret, host );
|
||||
strcatW( ret, spaceW );
|
||||
strcatW( ret, http1_1 );
|
||||
lstrcpyW( ret, connectW );
|
||||
lstrcatW( ret, spaceW );
|
||||
lstrcatW( ret, host );
|
||||
lstrcatW( ret, spaceW );
|
||||
lstrcatW( ret, http1_1 );
|
||||
|
||||
for (i = 0; i < request->num_headers; i++)
|
||||
{
|
||||
if (request->headers[i].is_request)
|
||||
{
|
||||
strcatW( ret, crlfW );
|
||||
strcatW( ret, request->headers[i].field );
|
||||
strcatW( ret, colonW );
|
||||
strcatW( ret, request->headers[i].value );
|
||||
lstrcatW( ret, crlfW );
|
||||
lstrcatW( ret, request->headers[i].field );
|
||||
lstrcatW( ret, colonW );
|
||||
lstrcatW( ret, request->headers[i].value );
|
||||
}
|
||||
}
|
||||
strcatW( ret, twocrlfW );
|
||||
lstrcatW( ret, twocrlfW );
|
||||
}
|
||||
|
||||
heap_free( host );
|
||||
|
@ -1599,7 +1599,7 @@ static BOOL open_connection( struct request *request )
|
|||
|
||||
LIST_FOR_EACH_ENTRY( iter, &connection_pool, struct hostdata, entry )
|
||||
{
|
||||
if (iter->port == port && !strcmpW( connect->servername, iter->hostname ) && !is_secure == !iter->secure)
|
||||
if (iter->port == port && !wcscmp( connect->servername, iter->hostname ) && !is_secure == !iter->secure)
|
||||
{
|
||||
host = iter;
|
||||
host->ref++;
|
||||
|
@ -1656,7 +1656,7 @@ static BOOL open_connection( struct request *request )
|
|||
|
||||
if (!connect->resolved)
|
||||
{
|
||||
len = strlenW( host->hostname ) + 1;
|
||||
len = lstrlenW( host->hostname ) + 1;
|
||||
send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_RESOLVING_NAME, host->hostname, len );
|
||||
|
||||
if (!netconn_resolve( host->hostname, port, &connect->sockaddr, request->resolve_timeout ))
|
||||
|
@ -1671,7 +1671,7 @@ static BOOL open_connection( struct request *request )
|
|||
release_host( host );
|
||||
return FALSE;
|
||||
}
|
||||
len = strlenW( addressW ) + 1;
|
||||
len = lstrlenW( addressW ) + 1;
|
||||
send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_NAME_RESOLVED, addressW, len );
|
||||
}
|
||||
|
||||
|
@ -1701,7 +1701,7 @@ static BOOL open_connection( struct request *request )
|
|||
if (is_secure)
|
||||
{
|
||||
if (connect->session->proxy_server &&
|
||||
strcmpiW( connect->hostname, connect->servername ))
|
||||
wcsicmp( connect->hostname, connect->servername ))
|
||||
{
|
||||
if (!secure_proxy_connect( request ))
|
||||
{
|
||||
|
@ -1726,7 +1726,7 @@ static BOOL open_connection( struct request *request )
|
|||
}
|
||||
}
|
||||
|
||||
send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, addressW, strlenW(addressW) + 1 );
|
||||
send_callback( &request->hdr, WINHTTP_CALLBACK_STATUS_CONNECTED_TO_SERVER, addressW, lstrlenW(addressW) + 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1778,9 +1778,9 @@ static BOOL add_host_header( struct request *request, DWORD modifier )
|
|||
{
|
||||
return process_header( request, attr_host, connect->hostname, modifier, TRUE );
|
||||
}
|
||||
len = strlenW( connect->hostname ) + 7; /* sizeof(":65335") */
|
||||
len = lstrlenW( connect->hostname ) + 7; /* sizeof(":65335") */
|
||||
if (!(host = heap_alloc( len * sizeof(WCHAR) ))) return FALSE;
|
||||
sprintfW( host, fmt, connect->hostname, port );
|
||||
swprintf( host, len, fmt, connect->hostname, port );
|
||||
ret = process_header( request, attr_host, host, modifier, TRUE );
|
||||
heap_free( host );
|
||||
return ret;
|
||||
|
@ -1933,9 +1933,9 @@ static void finished_reading( struct request *request )
|
|||
else if (query_headers( request, WINHTTP_QUERY_CONNECTION, NULL, connection, &size, NULL ) ||
|
||||
query_headers( request, WINHTTP_QUERY_PROXY_CONNECTION, NULL, connection, &size, NULL ))
|
||||
{
|
||||
if (!strcmpiW( connection, closeW )) close = TRUE;
|
||||
if (!wcsicmp( connection, closeW )) close = TRUE;
|
||||
}
|
||||
else if (!strcmpW( request->version, http1_0 )) close = TRUE;
|
||||
else if (!wcscmp( request->version, http1_0 )) close = TRUE;
|
||||
if (close)
|
||||
{
|
||||
close_connection( request );
|
||||
|
@ -2092,7 +2092,7 @@ static DWORD str_to_wire( const WCHAR *src, int src_len, char *dst, enum escape_
|
|||
DWORD len;
|
||||
char *utf8;
|
||||
|
||||
if (src_len < 0) src_len = strlenW( src );
|
||||
if (src_len < 0) src_len = lstrlenW( src );
|
||||
len = WideCharToMultiByte( CP_UTF8, 0, src, src_len, NULL, 0, NULL, NULL );
|
||||
if (!(utf8 = heap_alloc( len ))) return 0;
|
||||
|
||||
|
@ -2111,16 +2111,16 @@ static char *build_wire_path( struct request *request, DWORD *ret_len )
|
|||
enum escape_flags path_flags, query_flags;
|
||||
char *ret;
|
||||
|
||||
if (!strcmpiW( request->connect->hostname, request->connect->servername )) start = full_path = request->path;
|
||||
if (!wcsicmp( request->connect->hostname, request->connect->servername )) start = full_path = request->path;
|
||||
else if (!(full_path = build_absolute_request_path( request, &start ))) return NULL;
|
||||
|
||||
len = strlenW( full_path );
|
||||
if ((path = strchrW( start, '/' )))
|
||||
len = lstrlenW( full_path );
|
||||
if ((path = wcschr( start, '/' )))
|
||||
{
|
||||
len_path = strlenW( path );
|
||||
if ((query = strchrW( path, '?' )))
|
||||
len_path = lstrlenW( path );
|
||||
if ((query = wcschr( path, '?' )))
|
||||
{
|
||||
len_query = strlenW( query );
|
||||
len_query = lstrlenW( query );
|
||||
len_path -= len_query;
|
||||
}
|
||||
}
|
||||
|
@ -2222,10 +2222,10 @@ static BOOL send_request( struct request *request, const WCHAR *headers, DWORD h
|
|||
if (request->creds[TARGET_SERVER][SCHEME_BASIC].username)
|
||||
do_authorization( request, WINHTTP_AUTH_TARGET_SERVER, WINHTTP_AUTH_SCHEME_BASIC );
|
||||
|
||||
if (total_len || (request->verb && !strcmpW( request->verb, postW )))
|
||||
if (total_len || (request->verb && !wcscmp( request->verb, postW )))
|
||||
{
|
||||
WCHAR length[21]; /* decimal long int + null */
|
||||
sprintfW( length, length_fmt, total_len );
|
||||
swprintf( length, ARRAY_SIZE(length), length_fmt, total_len );
|
||||
process_header( request, attr_content_length, length, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW, TRUE );
|
||||
}
|
||||
if (!(request->hdr.disable_flags & WINHTTP_DISABLE_KEEP_ALIVE))
|
||||
|
@ -2315,7 +2315,7 @@ BOOL WINAPI WinHttpSendRequest( HINTERNET hrequest, LPCWSTR headers, DWORD heade
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (headers && !headers_len) headers_len = strlenW( headers );
|
||||
if (headers && !headers_len) headers_len = lstrlenW( headers );
|
||||
|
||||
if (request->connect->hdr.flags & WINHTTP_FLAG_ASYNC)
|
||||
{
|
||||
|
@ -2452,7 +2452,7 @@ static DWORD set_content_length( struct request *request, DWORD status )
|
|||
WCHAR encoding[20];
|
||||
DWORD buflen = sizeof(request->content_length);
|
||||
|
||||
if (status == HTTP_STATUS_NO_CONTENT || status == HTTP_STATUS_NOT_MODIFIED || !strcmpW( request->verb, headW ))
|
||||
if (status == HTTP_STATUS_NO_CONTENT || status == HTTP_STATUS_NOT_MODIFIED || !wcscmp( request->verb, headW ))
|
||||
request->content_length = 0;
|
||||
else
|
||||
{
|
||||
|
@ -2462,7 +2462,7 @@ static DWORD set_content_length( struct request *request, DWORD status )
|
|||
|
||||
buflen = sizeof(encoding);
|
||||
if (query_headers( request, WINHTTP_QUERY_TRANSFER_ENCODING, NULL, encoding, &buflen, NULL ) &&
|
||||
!strcmpiW( encoding, chunkedW ))
|
||||
!wcsicmp( encoding, chunkedW ))
|
||||
{
|
||||
request->content_length = ~0u;
|
||||
request->read_chunked = TRUE;
|
||||
|
@ -2520,7 +2520,7 @@ static BOOL read_reply( struct request *request )
|
|||
static const WCHAR crlf[] = {'\r','\n',0};
|
||||
|
||||
char buffer[MAX_REPLY_LEN];
|
||||
DWORD buflen, len, offset, crlf_len = 2; /* strlenW(crlf) */
|
||||
DWORD buflen, len, offset, crlf_len = 2; /* lstrlenW(crlf) */
|
||||
char *status_code, *status_text;
|
||||
WCHAR *versionW, *status_textW, *raw_headers;
|
||||
WCHAR status_codeW[4]; /* sizeof("nnn") */
|
||||
|
@ -2621,7 +2621,7 @@ static void record_cookies( struct request *request )
|
|||
for (i = 0; i < request->num_headers; i++)
|
||||
{
|
||||
struct header *set_cookie = &request->headers[i];
|
||||
if (!strcmpiW( set_cookie->field, attr_set_cookie ) && !set_cookie->is_request)
|
||||
if (!wcsicmp( set_cookie->field, attr_set_cookie ) && !set_cookie->is_request)
|
||||
{
|
||||
set_cookies( request, set_cookie->value );
|
||||
}
|
||||
|
@ -2670,12 +2670,12 @@ static BOOL handle_redirect( struct request *request, DWORD status )
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((p = strrchrW( request->path, '/' ))) *p = 0;
|
||||
len = strlenW( request->path ) + 1 + len_loc;
|
||||
if ((p = wcsrchr( request->path, '/' ))) *p = 0;
|
||||
len = lstrlenW( request->path ) + 1 + len_loc;
|
||||
if (!(path = heap_alloc( (len + 1) * sizeof(WCHAR) ))) goto end;
|
||||
strcpyW( path, request->path );
|
||||
strcatW( path, slashW );
|
||||
memcpy( path + strlenW(path), location, len_loc * sizeof(WCHAR) );
|
||||
lstrcpyW( path, request->path );
|
||||
lstrcatW( path, slashW );
|
||||
memcpy( path + lstrlenW(path), location, len_loc * sizeof(WCHAR) );
|
||||
path[len_loc] = 0;
|
||||
}
|
||||
heap_free( request->path );
|
||||
|
@ -2705,7 +2705,7 @@ static BOOL handle_redirect( struct request *request, DWORD status )
|
|||
hostname[len] = 0;
|
||||
|
||||
port = uc.nPort ? uc.nPort : (uc.nScheme == INTERNET_SCHEME_HTTPS ? 443 : 80);
|
||||
if (strcmpiW( connect->hostname, hostname ) || connect->serverport != port)
|
||||
if (wcsicmp( connect->hostname, hostname ) || connect->serverport != port)
|
||||
{
|
||||
heap_free( connect->hostname );
|
||||
connect->hostname = hostname;
|
||||
|
@ -2739,7 +2739,7 @@ static BOOL handle_redirect( struct request *request, DWORD status )
|
|||
if ((index = get_header_index( request, attr_content_type, 0, TRUE )) >= 0) delete_header( request, index );
|
||||
if ((index = get_header_index( request, attr_content_length, 0, TRUE )) >= 0 ) delete_header( request, index );
|
||||
|
||||
if (status != HTTP_STATUS_REDIRECT_KEEP_VERB && !strcmpW( request->verb, postW ))
|
||||
if (status != HTTP_STATUS_REDIRECT_KEEP_VERB && !wcscmp( request->verb, postW ))
|
||||
{
|
||||
heap_free( request->verb );
|
||||
request->verb = strdupW( getW );
|
||||
|
@ -2762,7 +2762,7 @@ static BOOL is_passport_request( struct request *request )
|
|||
if (!(request->connect->session->passport_flags & WINHTTP_ENABLE_PASSPORT_AUTH) ||
|
||||
!query_headers( request, WINHTTP_QUERY_WWW_AUTHENTICATE, NULL, buf, &len, NULL )) return FALSE;
|
||||
|
||||
if (!strncmpiW( buf, passportW, ARRAY_SIZE(passportW) ) &&
|
||||
if (!wcsnicmp( buf, passportW, ARRAY_SIZE(passportW) ) &&
|
||||
(buf[ARRAY_SIZE(passportW)] == ' ' || !buf[ARRAY_SIZE(passportW)])) return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
@ -2772,7 +2772,7 @@ static BOOL handle_passport_redirect( struct request *request )
|
|||
{
|
||||
static const WCHAR status401W[] = {'4','0','1',0};
|
||||
DWORD flags = WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE;
|
||||
int i, len = strlenW( request->raw_headers );
|
||||
int i, len = lstrlenW( request->raw_headers );
|
||||
WCHAR *p = request->raw_headers;
|
||||
|
||||
if (!process_header( request, attr_status, status401W, flags, FALSE )) return FALSE;
|
||||
|
@ -3677,14 +3677,14 @@ static HRESULT WINAPI winhttp_request_SetRequestHeader(
|
|||
err = ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND;
|
||||
goto done;
|
||||
}
|
||||
len = strlenW( header ) + 4;
|
||||
if (value) len += strlenW( value );
|
||||
len = lstrlenW( header ) + 4;
|
||||
if (value) len += lstrlenW( value );
|
||||
if (!(str = heap_alloc( (len + 1) * sizeof(WCHAR) )))
|
||||
{
|
||||
err = ERROR_OUTOFMEMORY;
|
||||
goto done;
|
||||
}
|
||||
sprintfW( str, fmtW, header, value ? value : emptyW );
|
||||
swprintf( str, len + 1, fmtW, header, value ? value : emptyW );
|
||||
if (!WinHttpAddRequestHeaders( request->hrequest, str, len,
|
||||
WINHTTP_ADDREQ_FLAG_ADD | WINHTTP_ADDREQ_FLAG_REPLACE ))
|
||||
{
|
||||
|
@ -3843,7 +3843,7 @@ static HRESULT request_receive( struct winhttp_request *request )
|
|||
return HRESULT_FROM_WIN32( GetLastError() );
|
||||
}
|
||||
if ((err = wait_for_completion( request ))) return HRESULT_FROM_WIN32( err );
|
||||
if (!strcmpW( request->verb, headW ))
|
||||
if (!wcscmp( request->verb, headW ))
|
||||
{
|
||||
request->state = REQUEST_STATE_RESPONSE_RECEIVED;
|
||||
return S_OK;
|
||||
|
@ -3920,9 +3920,9 @@ static void request_set_utf8_content_type( struct winhttp_request *request )
|
|||
WCHAR headerW[64];
|
||||
int len;
|
||||
|
||||
len = sprintfW( headerW, fmtW, attr_content_type, text_plainW );
|
||||
len = swprintf( headerW, ARRAY_SIZE(headerW), fmtW, attr_content_type, text_plainW );
|
||||
WinHttpAddRequestHeaders( request->hrequest, headerW, len, WINHTTP_ADDREQ_FLAG_ADD_IF_NEW );
|
||||
len = sprintfW( headerW, fmtW, attr_content_type, charset_utf8W );
|
||||
len = swprintf( headerW, ARRAY_SIZE(headerW), fmtW, attr_content_type, charset_utf8W );
|
||||
WinHttpAddRequestHeaders( request->hrequest, headerW, len, WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON );
|
||||
}
|
||||
|
||||
|
@ -3936,14 +3936,14 @@ static HRESULT request_send( struct winhttp_request *request )
|
|||
DWORD err;
|
||||
|
||||
if ((err = request_set_parameters( request ))) return HRESULT_FROM_WIN32( err );
|
||||
if (strcmpW( request->verb, getW ))
|
||||
if (wcscmp( request->verb, getW ))
|
||||
{
|
||||
VariantInit( &data );
|
||||
if (V_VT( &request->data ) == VT_BSTR)
|
||||
{
|
||||
UINT cp = CP_ACP;
|
||||
const WCHAR *str = V_BSTR( &request->data );
|
||||
int i, len = strlenW( str );
|
||||
int i, len = lstrlenW( str );
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
|
@ -4153,14 +4153,14 @@ static DWORD request_get_codepage( struct winhttp_request *request, UINT *codepa
|
|||
{
|
||||
return GetLastError();
|
||||
}
|
||||
if ((p = strstrW( buffer, charsetW )))
|
||||
if ((p = wcsstr( buffer, charsetW )))
|
||||
{
|
||||
p += strlenW( charsetW );
|
||||
p += lstrlenW( charsetW );
|
||||
while (*p == ' ') p++;
|
||||
if (*p++ == '=')
|
||||
{
|
||||
while (*p == ' ') p++;
|
||||
if (!strcmpiW( p, utf8W )) *codepage = CP_UTF8;
|
||||
if (!wcsicmp( p, utf8W )) *codepage = CP_UTF8;
|
||||
}
|
||||
}
|
||||
heap_free( buffer );
|
||||
|
@ -4506,7 +4506,7 @@ static HRESULT WINAPI winhttp_request_put_Option(
|
|||
request->url_codepage = V_UI4( &cp );
|
||||
TRACE("URL codepage: %u\n", request->url_codepage);
|
||||
}
|
||||
else if (V_VT( &value ) == VT_BSTR && !strcmpiW( V_BSTR( &value ), utf8W ))
|
||||
else if (V_VT( &value ) == VT_BSTR && !wcsicmp( V_BSTR( &value ), utf8W ))
|
||||
{
|
||||
TRACE("URL codepage: UTF-8\n");
|
||||
request->url_codepage = CP_UTF8;
|
||||
|
|
|
@ -16,9 +16,7 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
@ -379,7 +377,7 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
|
|||
static const WCHAR localW[] = { '<','l','o','c','a','l','>',0 };
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if (!strcmpiW( domain, localW ) && !strchrW( server, '.' ))
|
||||
if (!wcsicmp( domain, localW ) && !wcschr( server, '.' ))
|
||||
ret = TRUE;
|
||||
else if (*domain == '*')
|
||||
{
|
||||
|
@ -391,12 +389,12 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
|
|||
* the wildcard exactly. E.g. if the wildcard is *.a.b, and the
|
||||
* hostname is www.foo.a.b, it matches, but a.b does not.
|
||||
*/
|
||||
dot = strchrW( server, '.' );
|
||||
dot = wcschr( server, '.' );
|
||||
if (dot)
|
||||
{
|
||||
int len = strlenW( dot + 1 );
|
||||
int len = lstrlenW( dot + 1 );
|
||||
|
||||
if (len > strlenW( domain + 2 ))
|
||||
if (len > lstrlenW( domain + 2 ))
|
||||
{
|
||||
LPCWSTR ptr;
|
||||
|
||||
|
@ -404,8 +402,8 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
|
|||
* could be a subdomain. Compare the last portion of the
|
||||
* server's domain.
|
||||
*/
|
||||
ptr = dot + len + 1 - strlenW( domain + 2 );
|
||||
if (!strcmpiW( ptr, domain + 2 ))
|
||||
ptr = dot + len + 1 - lstrlenW( domain + 2 );
|
||||
if (!wcsicmp( ptr, domain + 2 ))
|
||||
{
|
||||
/* This is only a match if the preceding character is
|
||||
* a '.', i.e. that it is a matching domain. E.g.
|
||||
|
@ -416,12 +414,12 @@ static BOOL domain_matches(LPCWSTR server, LPCWSTR domain)
|
|||
}
|
||||
}
|
||||
else
|
||||
ret = !strcmpiW( dot + 1, domain + 2 );
|
||||
ret = !wcsicmp( dot + 1, domain + 2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
ret = !strcmpiW( server, domain );
|
||||
ret = !wcsicmp( server, domain );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -438,9 +436,9 @@ static BOOL should_bypass_proxy(struct session *session, LPCWSTR server)
|
|||
do {
|
||||
LPCWSTR tmp = ptr;
|
||||
|
||||
ptr = strchrW( ptr, ';' );
|
||||
ptr = wcschr( ptr, ';' );
|
||||
if (!ptr)
|
||||
ptr = strchrW( tmp, ' ' );
|
||||
ptr = wcschr( tmp, ' ' );
|
||||
if (ptr)
|
||||
{
|
||||
if (ptr - tmp < MAX_HOST_NAME_LENGTH)
|
||||
|
@ -468,9 +466,9 @@ BOOL set_server_for_hostname( struct connect *connect, const WCHAR *server, INTE
|
|||
{
|
||||
LPCWSTR colon;
|
||||
|
||||
if ((colon = strchrW( session->proxy_server, ':' )))
|
||||
if ((colon = wcschr( session->proxy_server, ':' )))
|
||||
{
|
||||
if (!connect->servername || strncmpiW( connect->servername,
|
||||
if (!connect->servername || wcsnicmp( connect->servername,
|
||||
session->proxy_server, colon - session->proxy_server - 1 ))
|
||||
{
|
||||
heap_free( connect->servername );
|
||||
|
@ -485,14 +483,14 @@ BOOL set_server_for_hostname( struct connect *connect, const WCHAR *server, INTE
|
|||
(colon - session->proxy_server) * sizeof(WCHAR) );
|
||||
connect->servername[colon - session->proxy_server] = 0;
|
||||
if (*(colon + 1))
|
||||
connect->serverport = atoiW( colon + 1 );
|
||||
connect->serverport = wcstol( colon + 1, NULL, 10 );
|
||||
else
|
||||
connect->serverport = INTERNET_DEFAULT_PORT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!connect->servername || strcmpiW( connect->servername,
|
||||
if (!connect->servername || wcsicmp( connect->servername,
|
||||
session->proxy_server ))
|
||||
{
|
||||
heap_free( connect->servername );
|
||||
|
@ -635,7 +633,7 @@ static void request_destroy( struct object_header *hdr )
|
|||
static void str_to_buffer( WCHAR *buffer, const WCHAR *str, LPDWORD buflen )
|
||||
{
|
||||
int len = 0;
|
||||
if (str) len = strlenW( str );
|
||||
if (str) len = lstrlenW( str );
|
||||
if (buffer && *buflen > len)
|
||||
{
|
||||
if (str) memcpy( buffer, str, len * sizeof(WCHAR) );
|
||||
|
@ -1075,13 +1073,13 @@ static BOOL add_accept_types_header( struct request *request, const WCHAR **type
|
|||
|
||||
static WCHAR *get_request_path( const WCHAR *object )
|
||||
{
|
||||
int len = object ? strlenW(object) : 0;
|
||||
int len = object ? lstrlenW(object) : 0;
|
||||
WCHAR *p, *ret;
|
||||
|
||||
if (!object || object[0] != '/') len++;
|
||||
if (!(p = ret = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return NULL;
|
||||
if (!object || object[0] != '/') *p++ = '/';
|
||||
if (object) strcpyW( p, object );
|
||||
if (object) lstrcpyW( p, object );
|
||||
ret[len] = 0;
|
||||
return ret;
|
||||
}
|
||||
|
@ -1421,12 +1419,12 @@ static WCHAR *build_wpad_url( const char *hostname, const struct addrinfo *ai )
|
|||
|
||||
if (!reverse_lookup( ai, name, sizeof(name) )) hostname = name;
|
||||
|
||||
len = strlenW( httpW ) + strlen( hostname ) + strlenW( wpadW );
|
||||
len = lstrlenW( httpW ) + strlen( hostname ) + lstrlenW( wpadW );
|
||||
if (!(ret = p = GlobalAlloc( 0, (len + 1) * sizeof(WCHAR) ))) return NULL;
|
||||
strcpyW( p, httpW );
|
||||
p += strlenW( httpW );
|
||||
lstrcpyW( p, httpW );
|
||||
p += lstrlenW( httpW );
|
||||
while (*hostname) { *p++ = *hostname++; }
|
||||
strcpyW( p, wpadW );
|
||||
lstrcpyW( p, wpadW );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2007,9 +2005,9 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
|
|||
|
||||
if (info->dwAccessType == WINHTTP_ACCESS_TYPE_NAMED_PROXY)
|
||||
{
|
||||
size += strlenW( info->lpszProxy );
|
||||
size += lstrlenW( info->lpszProxy );
|
||||
if (info->lpszProxyBypass)
|
||||
size += strlenW( info->lpszProxyBypass );
|
||||
size += lstrlenW( info->lpszProxyBypass );
|
||||
}
|
||||
buf = heap_alloc( size );
|
||||
if (buf)
|
||||
|
@ -2025,14 +2023,14 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
|
|||
BYTE *dst;
|
||||
|
||||
hdr->flags = PROXY_TYPE_PROXY;
|
||||
*len++ = strlenW( info->lpszProxy );
|
||||
*len++ = lstrlenW( info->lpszProxy );
|
||||
for (dst = (BYTE *)len, src = info->lpszProxy; *src;
|
||||
src++, dst++)
|
||||
*dst = *src;
|
||||
len = (DWORD *)dst;
|
||||
if (info->lpszProxyBypass)
|
||||
{
|
||||
*len++ = strlenW( info->lpszProxyBypass );
|
||||
*len++ = lstrlenW( info->lpszProxyBypass );
|
||||
for (dst = (BYTE *)len, src = info->lpszProxyBypass; *src;
|
||||
src++, dst++)
|
||||
*dst = *src;
|
||||
|
@ -2176,7 +2174,7 @@ BOOL WINAPI WinHttpTimeFromSystemTime( const SYSTEMTIME *time, LPWSTR string )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
sprintfW( string, format,
|
||||
swprintf( string, WINHTTP_TIME_FORMAT_BUFSIZE / sizeof(WCHAR), format,
|
||||
wkday[time->wDayOfWeek],
|
||||
time->wDay,
|
||||
month[time->wMonth - 1],
|
||||
|
@ -2215,15 +2213,15 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
|
|||
|
||||
SetLastError( ERROR_SUCCESS );
|
||||
|
||||
while (*s && !isalphaW( *s )) s++;
|
||||
while (*s && !iswalpha( *s )) s++;
|
||||
if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE;
|
||||
time->wDayOfWeek = 7;
|
||||
|
||||
for (i = 0; i < 7; i++)
|
||||
{
|
||||
if (toupperW( wkday[i][0] ) == toupperW( s[0] ) &&
|
||||
toupperW( wkday[i][1] ) == toupperW( s[1] ) &&
|
||||
toupperW( wkday[i][2] ) == toupperW( s[2] ) )
|
||||
if (towupper( wkday[i][0] ) == towupper( s[0] ) &&
|
||||
towupper( wkday[i][1] ) == towupper( s[1] ) &&
|
||||
towupper( wkday[i][2] ) == towupper( s[2] ) )
|
||||
{
|
||||
time->wDayOfWeek = i;
|
||||
break;
|
||||
|
@ -2231,19 +2229,19 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
|
|||
}
|
||||
|
||||
if (time->wDayOfWeek > 6) return TRUE;
|
||||
while (*s && !isdigitW( *s )) s++;
|
||||
time->wDay = strtolW( s, &end, 10 );
|
||||
while (*s && !iswdigit( *s )) s++;
|
||||
time->wDay = wcstol( s, &end, 10 );
|
||||
s = end;
|
||||
|
||||
while (*s && !isalphaW( *s )) s++;
|
||||
while (*s && !iswalpha( *s )) s++;
|
||||
if (s[0] == '\0' || s[1] == '\0' || s[2] == '\0') return TRUE;
|
||||
time->wMonth = 0;
|
||||
|
||||
for (i = 0; i < 12; i++)
|
||||
{
|
||||
if (toupperW( month[i][0]) == toupperW( s[0] ) &&
|
||||
toupperW( month[i][1]) == toupperW( s[1] ) &&
|
||||
toupperW( month[i][2]) == toupperW( s[2] ) )
|
||||
if (towupper( month[i][0]) == towupper( s[0] ) &&
|
||||
towupper( month[i][1]) == towupper( s[1] ) &&
|
||||
towupper( month[i][2]) == towupper( s[2] ) )
|
||||
{
|
||||
time->wMonth = i + 1;
|
||||
break;
|
||||
|
@ -2251,24 +2249,24 @@ BOOL WINAPI WinHttpTimeToSystemTime( LPCWSTR string, SYSTEMTIME *time )
|
|||
}
|
||||
if (time->wMonth == 0) return TRUE;
|
||||
|
||||
while (*s && !isdigitW( *s )) s++;
|
||||
while (*s && !iswdigit( *s )) s++;
|
||||
if (*s == '\0') return TRUE;
|
||||
time->wYear = strtolW( s, &end, 10 );
|
||||
time->wYear = wcstol( s, &end, 10 );
|
||||
s = end;
|
||||
|
||||
while (*s && !isdigitW( *s )) s++;
|
||||
while (*s && !iswdigit( *s )) s++;
|
||||
if (*s == '\0') return TRUE;
|
||||
time->wHour = strtolW( s, &end, 10 );
|
||||
time->wHour = wcstol( s, &end, 10 );
|
||||
s = end;
|
||||
|
||||
while (*s && !isdigitW( *s )) s++;
|
||||
while (*s && !iswdigit( *s )) s++;
|
||||
if (*s == '\0') return TRUE;
|
||||
time->wMinute = strtolW( s, &end, 10 );
|
||||
time->wMinute = wcstol( s, &end, 10 );
|
||||
s = end;
|
||||
|
||||
while (*s && !isdigitW( *s )) s++;
|
||||
while (*s && !iswdigit( *s )) s++;
|
||||
if (*s == '\0') return TRUE;
|
||||
time->wSecond = strtolW( s, &end, 10 );
|
||||
time->wSecond = wcstol( s, &end, 10 );
|
||||
|
||||
time->wMilliseconds = 0;
|
||||
return TRUE;
|
||||
|
|
|
@ -16,12 +16,10 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "ws2tcpip.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <wchar.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "ws2tcpip.h"
|
||||
#include "winreg.h"
|
||||
#include "winhttp.h"
|
||||
#include "shlwapi.h"
|
||||
|
@ -74,12 +72,12 @@ static WCHAR *decode_url( LPCWSTR url, DWORD *len )
|
|||
q = ret;
|
||||
while (*len > 0)
|
||||
{
|
||||
if (p[0] == '%' && isxdigitW( p[1] ) && isxdigitW( p[2] ))
|
||||
if (p[0] == '%' && iswxdigit( p[1] ) && iswxdigit( p[2] ))
|
||||
{
|
||||
hex[0] = p[1];
|
||||
hex[1] = p[2];
|
||||
hex[2] = 0;
|
||||
*q++ = strtolW( hex, NULL, 16 );
|
||||
*q++ = wcstol( hex, NULL, 16 );
|
||||
p += 3;
|
||||
*len -= 3;
|
||||
}
|
||||
|
@ -139,7 +137,7 @@ static DWORD escape_url( const WCHAR *url, DWORD *len, WCHAR **ret )
|
|||
const WCHAR *p;
|
||||
DWORD len_base, len_path;
|
||||
|
||||
if ((p = strrchrW( url, '/' )))
|
||||
if ((p = wcsrchr( url, '/' )))
|
||||
{
|
||||
len_base = p - url;
|
||||
if (!escape_string( p, *len - len_base, NULL, &len_path )) return ERROR_INVALID_PARAMETER;
|
||||
|
@ -164,7 +162,7 @@ static DWORD parse_port( const WCHAR *str, DWORD len, INTERNET_PORT *ret )
|
|||
{
|
||||
const WCHAR *p = str;
|
||||
DWORD port = 0;
|
||||
while (len && isdigitW( *p ))
|
||||
while (len && iswdigit( *p ))
|
||||
{
|
||||
if ((port = port * 10 + *p - '0') > 65535) return ERROR_WINHTTP_INVALID_URL;
|
||||
p++; len--;
|
||||
|
@ -191,7 +189,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
|
|||
SetLastError( ERROR_INVALID_PARAMETER );
|
||||
return FALSE;
|
||||
}
|
||||
if (!len) len = strlenW( url );
|
||||
if (!len) len = lstrlenW( url );
|
||||
|
||||
if (flags & ICU_ESCAPE)
|
||||
{
|
||||
|
@ -211,13 +209,13 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
|
|||
}
|
||||
url = url_decoded;
|
||||
}
|
||||
if (!(p = strchrW( url, ':' )))
|
||||
if (!(p = wcschr( url, ':' )))
|
||||
{
|
||||
SetLastError( ERROR_WINHTTP_UNRECOGNIZED_SCHEME );
|
||||
return FALSE;
|
||||
}
|
||||
if (p - url == 4 && !strncmpiW( url, scheme_http, 4 )) scheme_number = INTERNET_SCHEME_HTTP;
|
||||
else if (p - url == 5 && !strncmpiW( url, scheme_https, 5 )) scheme_number = INTERNET_SCHEME_HTTPS;
|
||||
if (p - url == 4 && !wcsnicmp( url, scheme_http, 4 )) scheme_number = INTERNET_SCHEME_HTTP;
|
||||
else if (p - url == 5 && !wcsnicmp( url, scheme_https, 5 )) scheme_number = INTERNET_SCHEME_HTTPS;
|
||||
else
|
||||
{
|
||||
err = ERROR_WINHTTP_UNRECOGNIZED_SCHEME;
|
||||
|
@ -248,10 +246,10 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
|
|||
password.str = &uc->lpszPassword;
|
||||
password.len = &uc->dwPasswordLength;
|
||||
|
||||
if ((q = memchrW( p, '@', len - (p - url) )) && !(memchrW( p, '/', q - p )))
|
||||
if ((q = wmemchr( p, '@', len - (p - url) )) && !(wmemchr( p, '/', q - p )))
|
||||
{
|
||||
|
||||
if ((r = memchrW( p, ':', q - p )))
|
||||
if ((r = wmemchr( p, ':', q - p )))
|
||||
{
|
||||
if ((err = set_component( &username, p, r - p, flags, &overflow ))) goto exit;
|
||||
r++;
|
||||
|
@ -279,9 +277,9 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
|
|||
extra.str = &uc->lpszExtraInfo;
|
||||
extra.len = &uc->dwExtraInfoLength;
|
||||
|
||||
if ((q = memchrW( p, '/', len - (p - url) )))
|
||||
if ((q = wmemchr( p, '/', len - (p - url) )))
|
||||
{
|
||||
if ((r = memchrW( p, ':', q - p )))
|
||||
if ((r = wmemchr( p, ':', q - p )))
|
||||
{
|
||||
if ((err = set_component( &hostname, p, r - p, flags, &overflow ))) goto exit;
|
||||
r++;
|
||||
|
@ -294,7 +292,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
|
|||
if (scheme_number == INTERNET_SCHEME_HTTPS) uc->nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
||||
}
|
||||
|
||||
if ((r = memchrW( q, '?', len - (q - url) )))
|
||||
if ((r = wmemchr( q, '?', len - (q - url) )))
|
||||
{
|
||||
if (*extra.len)
|
||||
{
|
||||
|
@ -311,7 +309,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((r = memchrW( p, ':', len - (p - url) )))
|
||||
if ((r = wmemchr( p, ':', len - (p - url) )))
|
||||
{
|
||||
if ((err = set_component( &hostname, p, r - p, flags, &overflow ))) goto exit;
|
||||
r++;
|
||||
|
@ -345,8 +343,8 @@ exit:
|
|||
|
||||
static INTERNET_SCHEME get_scheme( const WCHAR *scheme, DWORD len )
|
||||
{
|
||||
if (!strncmpW( scheme, scheme_http, len )) return INTERNET_SCHEME_HTTP;
|
||||
if (!strncmpW( scheme, scheme_https, len )) return INTERNET_SCHEME_HTTPS;
|
||||
if (!wcsncmp( scheme, scheme_http, len )) return INTERNET_SCHEME_HTTP;
|
||||
if (!wcsncmp( scheme, scheme_https, len )) return INTERNET_SCHEME_HTTPS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -369,7 +367,7 @@ static DWORD get_comp_length( DWORD len, DWORD flags, WCHAR *comp )
|
|||
DWORD ret;
|
||||
unsigned int i;
|
||||
|
||||
ret = len ? len : strlenW( comp );
|
||||
ret = len ? len : lstrlenW( comp );
|
||||
if (!(flags & ICU_ESCAPE)) return ret;
|
||||
for (i = 0; i < len; i++) if (need_escape( comp[i] )) ret += 2;
|
||||
return ret;
|
||||
|
@ -391,7 +389,7 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len )
|
|||
{
|
||||
scheme = uc->nScheme;
|
||||
if (!scheme) scheme = INTERNET_SCHEME_HTTP;
|
||||
*len += strlenW( get_scheme_string( scheme ) );
|
||||
*len += lstrlenW( get_scheme_string( scheme ) );
|
||||
}
|
||||
*len += 3; /* "://" */
|
||||
|
||||
|
@ -421,7 +419,7 @@ static BOOL get_url_length( URL_COMPONENTS *uc, DWORD flags, DWORD *len )
|
|||
{
|
||||
WCHAR port[sizeof("65535")];
|
||||
|
||||
*len += sprintfW( port, formatW, uc->nPort );
|
||||
*len += swprintf( port, ARRAY_SIZE(port), formatW, uc->nPort );
|
||||
*len += 1; /* ":" */
|
||||
}
|
||||
if (uc->lpszUrlPath && *uc->lpszUrlPath != '/') *len += 1; /* '/' */
|
||||
|
@ -480,7 +478,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
|
|||
if (!scheme) scheme = INTERNET_SCHEME_HTTP;
|
||||
|
||||
schemeW = get_scheme_string( scheme );
|
||||
len = strlenW( schemeW );
|
||||
len = lstrlenW( schemeW );
|
||||
memcpy( url, schemeW, len * sizeof(WCHAR) );
|
||||
url += len;
|
||||
}
|
||||
|
@ -513,7 +511,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
|
|||
if (!uses_default_port( scheme, uc->nPort ))
|
||||
{
|
||||
*url++ = ':';
|
||||
url += sprintfW( url, formatW, uc->nPort );
|
||||
url += swprintf( url, sizeof("65535"), formatW, uc->nPort );
|
||||
}
|
||||
|
||||
/* add slash between hostname and path if necessary */
|
||||
|
|
|
@ -19,13 +19,8 @@
|
|||
#ifndef _WINE_WINHTTP_PRIVATE_H_
|
||||
#define _WINE_WINHTTP_PRIVATE_H_
|
||||
|
||||
#ifndef __WINE_CONFIG_H
|
||||
# error You must include config.h to use this header
|
||||
#endif
|
||||
|
||||
#include "wine/heap.h"
|
||||
#include "wine/list.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
#include "ole2.h"
|
||||
#include "sspi.h"
|
||||
|
@ -304,8 +299,8 @@ static inline WCHAR *strdupW( const WCHAR *src )
|
|||
WCHAR *dst;
|
||||
|
||||
if (!src) return NULL;
|
||||
dst = heap_alloc( (strlenW( src ) + 1) * sizeof(WCHAR) );
|
||||
if (dst) strcpyW( dst, src );
|
||||
dst = heap_alloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) );
|
||||
if (dst) lstrcpyW( dst, src );
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue