wininet: Store an info if connection is HTTPS in server_t.

This commit is contained in:
Jacek Caban 2012-11-19 11:46:50 +01:00 committed by Alexandre Julliard
parent d1607dbb30
commit cdf25ee469
3 changed files with 9 additions and 7 deletions

View File

@ -251,14 +251,14 @@ void server_release(server_t *server)
heap_free(server);
}
server_t *get_server(const WCHAR *name, INTERNET_PORT port, BOOL do_create)
server_t *get_server(const WCHAR *name, INTERNET_PORT port, BOOL is_https, BOOL do_create)
{
server_t *iter, *server = NULL;
EnterCriticalSection(&connection_pool_cs);
LIST_FOR_EACH_ENTRY(iter, &connection_pool, server_t, entry) {
if(iter->port == port && !strcmpW(iter->name, name)) {
if(iter->port == port && !strcmpW(iter->name, name) && iter->is_https == is_https) {
server = iter;
server_addref(server);
break;
@ -270,6 +270,7 @@ server_t *get_server(const WCHAR *name, INTERNET_PORT port, BOOL do_create)
if(server) {
server->ref = 2; /* list reference and return */
server->port = port;
server->is_https = is_https;
list_init(&server->conn_pool);
server->name = heap_strdupW(name);
if(server->name) {
@ -1725,7 +1726,7 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_req
if(UrlComponents.nPort == INTERNET_INVALID_PORT_NUMBER)
UrlComponents.nPort = INTERNET_DEFAULT_HTTP_PORT;
new_server = get_server(UrlComponents.lpszHostName, UrlComponents.nPort, TRUE);
new_server = get_server(UrlComponents.lpszHostName, UrlComponents.nPort, UrlComponents.nScheme == INTERNET_SCHEME_HTTPS, TRUE);
if(!new_server)
return FALSE;
@ -3194,7 +3195,7 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *session,
if(port == INTERNET_INVALID_PORT_NUMBER)
port = dwFlags & INTERNET_FLAG_SECURE ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT;
request->server = get_server(session->hostName, port, TRUE);
request->server = get_server(session->hostName, port, (dwFlags & INTERNET_FLAG_SECURE) != 0, TRUE);
if(!request->server) {
WININET_Release(&request->hdr);
return ERROR_OUTOFMEMORY;
@ -4022,7 +4023,7 @@ static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl)
if(strcmpiW(request->server->name, hostName) || request->server->port != urlComponents.nPort) {
server_t *new_server;
new_server = get_server(hostName, urlComponents.nPort, TRUE);
new_server = get_server(hostName, urlComponents.nPort, urlComponents.nScheme == INTERNET_SCHEME_HTTPS, TRUE);
server_release(request->server);
request->server = new_server;
}

View File

@ -4431,7 +4431,7 @@ BOOL WINAPI InternetGetSecurityInfoByURLW(LPCWSTR lpszURL, PCCERT_CHAIN_CONTEXT
if(url.nPort == INTERNET_INVALID_PORT_NUMBER)
url.nPort = INTERNET_DEFAULT_HTTPS_PORT;
server = get_server(hostname, url.nPort, FALSE);
server = get_server(hostname, url.nPort, TRUE, FALSE);
if(!server) {
SetLastError(ERROR_INTERNET_ITEM_NOT_FOUND);
return FALSE;

View File

@ -58,6 +58,7 @@ extern HMODULE WININET_hModule DECLSPEC_HIDDEN;
typedef struct {
WCHAR *name;
INTERNET_PORT port;
BOOL is_https;
struct sockaddr_storage addr;
socklen_t addr_len;
char addr_str[INET6_ADDRSTRLEN];
@ -550,7 +551,7 @@ int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN;
DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, DWORD value) DECLSPEC_HIDDEN;
int sock_get_error(int) DECLSPEC_HIDDEN;
server_t *get_server(const WCHAR*,INTERNET_PORT,BOOL);
server_t *get_server(const WCHAR*,INTERNET_PORT,BOOL,BOOL);
BOOL init_urlcache(void) DECLSPEC_HIDDEN;
void free_urlcache(void) DECLSPEC_HIDDEN;