wininet: Renamed useSSL to secure and set it after secure connection is established.
This commit is contained in:
parent
b0fc000ce1
commit
c6ee6d6c9e
@ -1968,7 +1968,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
|
|||||||
info->Flags |= IDSI_FLAG_KEEP_ALIVE;
|
info->Flags |= IDSI_FLAG_KEEP_ALIVE;
|
||||||
if (req->proxy)
|
if (req->proxy)
|
||||||
info->Flags |= IDSI_FLAG_PROXY;
|
info->Flags |= IDSI_FLAG_PROXY;
|
||||||
if (req->netconn->useSSL)
|
if (req->netconn->secure)
|
||||||
info->Flags |= IDSI_FLAG_SECURE;
|
info->Flags |= IDSI_FLAG_SECURE;
|
||||||
|
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
@ -89,7 +89,7 @@ BOOL collect_connections(collect_type_t) DECLSPEC_HIDDEN;
|
|||||||
/* used for netconnection.c stuff */
|
/* used for netconnection.c stuff */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
BOOL useSSL;
|
BOOL secure;
|
||||||
int socketFD;
|
int socketFD;
|
||||||
void *ssl_s;
|
void *ssl_s;
|
||||||
server_t *server;
|
server_t *server;
|
||||||
|
@ -848,6 +848,7 @@ static DWORD netcon_secure_connect_setup(netconn_t *connection, long tls_option)
|
|||||||
}
|
}
|
||||||
|
|
||||||
connection->ssl_s = ssl_s;
|
connection->ssl_s = ssl_s;
|
||||||
|
connection->secure = TRUE;
|
||||||
|
|
||||||
bits = NETCON_GetCipherStrength(connection);
|
bits = NETCON_GetCipherStrength(connection);
|
||||||
if (bits >= 128)
|
if (bits >= 128)
|
||||||
@ -879,21 +880,20 @@ fail:
|
|||||||
DWORD NETCON_secure_connect(netconn_t *connection, server_t *server)
|
DWORD NETCON_secure_connect(netconn_t *connection, server_t *server)
|
||||||
{
|
{
|
||||||
DWORD res = ERROR_NOT_SUPPORTED;
|
DWORD res = ERROR_NOT_SUPPORTED;
|
||||||
#ifdef SONAME_LIBSSL
|
|
||||||
/* can't connect if we are already connected */
|
/* can't connect if we are already connected */
|
||||||
if (connection->ssl_s)
|
if(connection->secure) {
|
||||||
{
|
|
||||||
ERR("already connected\n");
|
ERR("already connected\n");
|
||||||
return ERROR_INTERNET_CANNOT_CONNECT;
|
return ERROR_INTERNET_CANNOT_CONNECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
connection->useSSL = TRUE;
|
|
||||||
if(server != connection->server) {
|
if(server != connection->server) {
|
||||||
server_release(connection->server);
|
server_release(connection->server);
|
||||||
server_addref(server);
|
server_addref(server);
|
||||||
connection->server = server;
|
connection->server = server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SONAME_LIBSSL
|
||||||
/* connect with given TLS options */
|
/* connect with given TLS options */
|
||||||
res = netcon_secure_connect_setup(connection, get_tls_option());
|
res = netcon_secure_connect_setup(connection, get_tls_option());
|
||||||
if (res == ERROR_SUCCESS)
|
if (res == ERROR_SUCCESS)
|
||||||
@ -926,7 +926,7 @@ DWORD NETCON_secure_connect(netconn_t *connection, server_t *server)
|
|||||||
DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags,
|
DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags,
|
||||||
int *sent /* out */)
|
int *sent /* out */)
|
||||||
{
|
{
|
||||||
if (!connection->useSSL)
|
if(!connection->secure)
|
||||||
{
|
{
|
||||||
*sent = send(connection->socketFD, msg, len, flags);
|
*sent = send(connection->socketFD, msg, len, flags);
|
||||||
if (*sent == -1)
|
if (*sent == -1)
|
||||||
@ -958,13 +958,13 @@ DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags,
|
|||||||
* Basically calls 'recv()' unless we should use SSL
|
* Basically calls 'recv()' unless we should use SSL
|
||||||
* number of chars received is put in *recvd
|
* number of chars received is put in *recvd
|
||||||
*/
|
*/
|
||||||
DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, int flags,
|
DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, int flags, int *recvd)
|
||||||
int *recvd /* out */)
|
|
||||||
{
|
{
|
||||||
*recvd = 0;
|
*recvd = 0;
|
||||||
if (!len)
|
if (!len)
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
if (!connection->useSSL)
|
|
||||||
|
if (!connection->secure)
|
||||||
{
|
{
|
||||||
*recvd = recv(connection->socketFD, buf, len, flags);
|
*recvd = recv(connection->socketFD, buf, len, flags);
|
||||||
return *recvd == -1 ? sock_get_error(errno) : ERROR_SUCCESS;
|
return *recvd == -1 ? sock_get_error(errno) : ERROR_SUCCESS;
|
||||||
@ -1000,7 +1000,7 @@ BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available)
|
|||||||
{
|
{
|
||||||
*available = 0;
|
*available = 0;
|
||||||
|
|
||||||
if (!connection->useSSL)
|
if(!connection->secure)
|
||||||
{
|
{
|
||||||
#ifdef FIONREAD
|
#ifdef FIONREAD
|
||||||
int unread;
|
int unread;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user