|
@ -247,23 +247,12 @@ |
|
|
return WAITRESS_RET_OK; |
|
|
return WAITRESS_RET_OK; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -807,11 +878,6 @@ static WaitressReturn_t WaitressConnect
|
|
|
|
|
|
/* we need shorter timeouts for connect() */ |
|
|
|
|
|
fcntl (sock, F_SETFL, O_NONBLOCK); |
|
|
|
|
|
|
|
|
|
|
|
- /* increase socket receive buffer */
|
|
|
|
|
|
- const int sockopt = 256*1024;
|
|
|
|
|
|
- setsockopt (sock, SOL_SOCKET, SO_RCVBUF, &sockopt,
|
|
|
|
|
|
- sizeof (sockopt));
|
|
|
|
|
|
-
|
|
|
|
|
|
/* non-blocking connect will return immediately */ |
|
|
|
|
|
if (connect (sock, gacurr->ai_addr, gacurr->ai_addrlen) == -1) { |
|
|
|
|
|
// Error if not in-progress or immediate success |
|
|
|
|
|
@@ -880,6 +946,11 @@ static WaitressReturn_t WaitressConnect
|
|
|
|
|
|
|
|
|
@@ -876,6 +947,12 @@ static WaitressReturn_t WaitressConnect
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
+#if defined(USE_POLARSSL)
|
|
|
+#if defined(USE_POLARSSL)
|
|
|
|
|
|
+ ssl_set_hostname (&waith->request.sslCtx->ssl, waith->url.host);
|
|
|
+ if (ssl_handshake (&waith->request.sslCtx->ssl) != 0) {
|
|
|
+ if (ssl_handshake (&waith->request.sslCtx->ssl) != 0) {
|
|
|
+ return WAITRESS_RET_TLS_HANDSHAKE_ERR;
|
|
|
+ return WAITRESS_RET_TLS_HANDSHAKE_ERR;
|
|
|
+ }
|
|
|
+ }
|
|
@ -271,7 +260,7 @@ |
|
|
/* Ignore return code as connection will likely still succeed */ |
|
|
/* Ignore return code as connection will likely still succeed */ |
|
|
gnutls_server_name_set (waith->request.tlsSession, GNUTLS_NAME_DNS, |
|
|
gnutls_server_name_set (waith->request.tlsSession, GNUTLS_NAME_DNS, |
|
|
waith->url.host, strlen (waith->url.host)); |
|
|
waith->url.host, strlen (waith->url.host)); |
|
|
@@ -887,14 +958,15 @@ static WaitressReturn_t WaitressConnect
|
|
|
|
|
|
|
|
|
@@ -883,14 +960,15 @@ static WaitressReturn_t WaitressConnect
|
|
|
if (gnutls_handshake (waith->request.tlsSession) != GNUTLS_E_SUCCESS) { |
|
|
if (gnutls_handshake (waith->request.tlsSession) != GNUTLS_E_SUCCESS) { |
|
|
return WAITRESS_RET_TLS_HANDSHAKE_ERR; |
|
|
return WAITRESS_RET_TLS_HANDSHAKE_ERR; |
|
|
} |
|
|
} |
|
@ -289,7 +278,7 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return WAITRESS_RET_OK; |
|
|
return WAITRESS_RET_OK; |
|
|
@@ -1120,6 +1192,21 @@ WaitressReturn_t WaitressFetchCall (Wait
|
|
|
|
|
|
|
|
|
@@ -1116,6 +1194,21 @@ WaitressReturn_t WaitressFetchCall (Wait
|
|
|
waith->request.contentLengthKnown = false; |
|
|
waith->request.contentLengthKnown = false; |
|
|
|
|
|
|
|
|
if (waith->url.tls) { |
|
|
if (waith->url.tls) { |
|
@ -311,7 +300,7 @@ |
|
|
gnutls_init (&waith->request.tlsSession, GNUTLS_CLIENT); |
|
|
gnutls_init (&waith->request.tlsSession, GNUTLS_CLIENT); |
|
|
gnutls_set_default_priority (waith->request.tlsSession); |
|
|
gnutls_set_default_priority (waith->request.tlsSession); |
|
|
|
|
|
|
|
|
@@ -1137,6 +1224,7 @@ WaitressReturn_t WaitressFetchCall (Wait
|
|
|
|
|
|
|
|
|
@@ -1133,6 +1226,7 @@ WaitressReturn_t WaitressFetchCall (Wait
|
|
|
WaitressPollRead); |
|
|
WaitressPollRead); |
|
|
gnutls_transport_set_push_function (waith->request.tlsSession, |
|
|
gnutls_transport_set_push_function (waith->request.tlsSession, |
|
|
WaitressPollWrite); |
|
|
WaitressPollWrite); |
|
@ -319,7 +308,7 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* buffer is required for connect already */ |
|
|
/* buffer is required for connect already */ |
|
|
@@ -1148,15 +1236,22 @@ WaitressReturn_t WaitressFetchCall (Wait
|
|
|
|
|
|
|
|
|
@@ -1144,15 +1238,22 @@ WaitressReturn_t WaitressFetchCall (Wait
|
|
|
if ((wRet = WaitressSendRequest (waith)) == WAITRESS_RET_OK) { |
|
|
if ((wRet = WaitressSendRequest (waith)) == WAITRESS_RET_OK) { |
|
|
wRet = WaitressReceiveResponse (waith); |
|
|
wRet = WaitressReceiveResponse (waith); |
|
|
} |
|
|
} |
|
|