wininet: Pass host name as substring to get_server.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bd1f39ea27
commit
3413d01764
|
@ -265,7 +265,7 @@ static BOOL process_host_port(server_t *server)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
server_t *get_server(const WCHAR *name, INTERNET_PORT port, BOOL is_https, BOOL do_create)
|
server_t *get_server(substr_t name, INTERNET_PORT port, BOOL is_https, BOOL do_create)
|
||||||
{
|
{
|
||||||
server_t *iter, *server = NULL;
|
server_t *iter, *server = NULL;
|
||||||
|
|
||||||
|
@ -275,7 +275,8 @@ server_t *get_server(const WCHAR *name, INTERNET_PORT port, BOOL is_https, BOOL
|
||||||
EnterCriticalSection(&connection_pool_cs);
|
EnterCriticalSection(&connection_pool_cs);
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(iter, &connection_pool, server_t, entry) {
|
LIST_FOR_EACH_ENTRY(iter, &connection_pool, server_t, entry) {
|
||||||
if(iter->port == port && !strcmpW(iter->name, name) && iter->is_https == is_https) {
|
if(iter->port == port && name.len == strlenW(iter->name) && !strncmpW(iter->name, name.str, name.len)
|
||||||
|
&& iter->is_https == is_https) {
|
||||||
server = iter;
|
server = iter;
|
||||||
server_addref(server);
|
server_addref(server);
|
||||||
break;
|
break;
|
||||||
|
@ -289,7 +290,7 @@ server_t *get_server(const WCHAR *name, INTERNET_PORT port, BOOL is_https, BOOL
|
||||||
server->port = port;
|
server->port = port;
|
||||||
server->is_https = is_https;
|
server->is_https = is_https;
|
||||||
list_init(&server->conn_pool);
|
list_init(&server->conn_pool);
|
||||||
server->name = heap_strdupW(name);
|
server->name = heap_strndupW(name.str, name.len);
|
||||||
if(server->name && process_host_port(server)) {
|
if(server->name && process_host_port(server)) {
|
||||||
list_add_head(&connection_pool, &server->entry);
|
list_add_head(&connection_pool, &server->entry);
|
||||||
}else {
|
}else {
|
||||||
|
@ -1788,7 +1789,6 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
|
||||||
static const WCHAR protoHttp[] = { 'h','t','t','p',0 };
|
static const WCHAR protoHttp[] = { 'h','t','t','p',0 };
|
||||||
static const WCHAR szHttp[] = { 'h','t','t','p',':','/','/',0 };
|
static const WCHAR szHttp[] = { 'h','t','t','p',':','/','/',0 };
|
||||||
static const WCHAR szFormat[] = { 'h','t','t','p',':','/','/','%','s',0 };
|
static const WCHAR szFormat[] = { 'h','t','t','p',':','/','/','%','s',0 };
|
||||||
WCHAR buf[INTERNET_MAX_HOST_NAME_LENGTH];
|
|
||||||
WCHAR protoProxy[INTERNET_MAX_URL_LENGTH];
|
WCHAR protoProxy[INTERNET_MAX_URL_LENGTH];
|
||||||
DWORD protoProxyLen = INTERNET_MAX_URL_LENGTH;
|
DWORD protoProxyLen = INTERNET_MAX_URL_LENGTH;
|
||||||
WCHAR proxy[INTERNET_MAX_URL_LENGTH];
|
WCHAR proxy[INTERNET_MAX_URL_LENGTH];
|
||||||
|
@ -1799,8 +1799,7 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
|
||||||
|
|
||||||
memset( &UrlComponents, 0, sizeof UrlComponents );
|
memset( &UrlComponents, 0, sizeof UrlComponents );
|
||||||
UrlComponents.dwStructSize = sizeof UrlComponents;
|
UrlComponents.dwStructSize = sizeof UrlComponents;
|
||||||
UrlComponents.lpszHostName = buf;
|
UrlComponents.dwHostNameLength = 1;
|
||||||
UrlComponents.dwHostNameLength = INTERNET_MAX_HOST_NAME_LENGTH;
|
|
||||||
|
|
||||||
if (!INTERNET_FindProxyForProtocol(hIC->proxy, protoHttp, protoProxy, &protoProxyLen))
|
if (!INTERNET_FindProxyForProtocol(hIC->proxy, protoHttp, protoProxy, &protoProxyLen))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1821,7 +1820,8 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
|
||||||
if (is_https && UrlComponents.nPort == INTERNET_INVALID_PORT_NUMBER)
|
if (is_https && UrlComponents.nPort == INTERNET_INVALID_PORT_NUMBER)
|
||||||
UrlComponents.nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
UrlComponents.nPort = INTERNET_DEFAULT_HTTPS_PORT;
|
||||||
|
|
||||||
new_server = get_server(UrlComponents.lpszHostName, UrlComponents.nPort, is_https, TRUE);
|
new_server = get_server(substr(UrlComponents.lpszHostName, UrlComponents.dwHostNameLength),
|
||||||
|
UrlComponents.nPort, is_https, TRUE);
|
||||||
if(!new_server)
|
if(!new_server)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -3391,7 +3391,7 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
|
||||||
request->session = session;
|
request->session = session;
|
||||||
list_add_head( &session->hdr.children, &request->hdr.entry );
|
list_add_head( &session->hdr.children, &request->hdr.entry );
|
||||||
|
|
||||||
request->server = get_server(session->hostName, session->hostPort, (dwFlags & INTERNET_FLAG_SECURE) != 0, TRUE);
|
request->server = get_server(substrz(session->hostName), session->hostPort, (dwFlags & INTERNET_FLAG_SECURE) != 0, TRUE);
|
||||||
if(!request->server) {
|
if(!request->server) {
|
||||||
WININET_Release(&request->hdr);
|
WININET_Release(&request->hdr);
|
||||||
return ERROR_OUTOFMEMORY;
|
return ERROR_OUTOFMEMORY;
|
||||||
|
@ -4204,7 +4204,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
|
||||||
if(strcmpiW(request->server->name, hostName) || request->server->port != urlComponents.nPort) {
|
if(strcmpiW(request->server->name, hostName) || request->server->port != urlComponents.nPort) {
|
||||||
server_t *new_server;
|
server_t *new_server;
|
||||||
|
|
||||||
new_server = get_server(hostName, urlComponents.nPort, urlComponents.nScheme == INTERNET_SCHEME_HTTPS, TRUE);
|
new_server = get_server(substrz(hostName), urlComponents.nPort, urlComponents.nScheme == INTERNET_SCHEME_HTTPS, TRUE);
|
||||||
server_release(request->server);
|
server_release(request->server);
|
||||||
request->server = new_server;
|
request->server = new_server;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4496,7 +4496,6 @@ BOOL WINAPI InternetGetSecurityInfoByURLW(LPCWSTR lpszURL, PCCERT_CHAIN_CONTEXT
|
||||||
{
|
{
|
||||||
URL_COMPONENTSW url = {sizeof(url)};
|
URL_COMPONENTSW url = {sizeof(url)};
|
||||||
server_t *server;
|
server_t *server;
|
||||||
WCHAR *hostname;
|
|
||||||
BOOL res;
|
BOOL res;
|
||||||
|
|
||||||
TRACE("(%s %p %p)\n", debugstr_w(lpszURL), ppCertChain, pdwSecureFlags);
|
TRACE("(%s %p %p)\n", debugstr_w(lpszURL), ppCertChain, pdwSecureFlags);
|
||||||
|
@ -4508,14 +4507,7 @@ BOOL WINAPI InternetGetSecurityInfoByURLW(LPCWSTR lpszURL, PCCERT_CHAIN_CONTEXT
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
hostname = heap_strndupW(url.lpszHostName, url.dwHostNameLength);
|
server = get_server(substr(url.lpszHostName, url.dwHostNameLength), url.nPort, TRUE, FALSE);
|
||||||
if(!hostname) {
|
|
||||||
SetLastError(ERROR_OUTOFMEMORY);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
server = get_server(hostname, url.nPort, TRUE, FALSE);
|
|
||||||
heap_free(hostname);
|
|
||||||
if(!server) {
|
if(!server) {
|
||||||
SetLastError(ERROR_INTERNET_ITEM_NOT_FOUND);
|
SetLastError(ERROR_INTERNET_ITEM_NOT_FOUND);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -467,7 +467,7 @@ DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC
|
||||||
int sock_send(int fd, const void *msg, size_t len, int flags) DECLSPEC_HIDDEN;
|
int sock_send(int fd, const void *msg, size_t len, int flags) DECLSPEC_HIDDEN;
|
||||||
int sock_recv(int fd, void *msg, size_t len, int flags) DECLSPEC_HIDDEN;
|
int sock_recv(int fd, void *msg, size_t len, int flags) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
server_t *get_server(const WCHAR*,INTERNET_PORT,BOOL,BOOL) DECLSPEC_HIDDEN;
|
server_t *get_server(substr_t,INTERNET_PORT,BOOL,BOOL) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
DWORD create_req_file(const WCHAR*,req_file_t**) DECLSPEC_HIDDEN;
|
DWORD create_req_file(const WCHAR*,req_file_t**) DECLSPEC_HIDDEN;
|
||||||
void req_file_release(req_file_t*) DECLSPEC_HIDDEN;
|
void req_file_release(req_file_t*) DECLSPEC_HIDDEN;
|
||||||
|
|
Loading…
Reference in New Issue