1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 15:48:49 -05:00

openssl: improve data-pending check for https proxy

- Allow proxy_ssl to be checked for pending data even when connssl does
  not yet have an SSL handle.

This change is for posterity. Currently there doesn't seem to be a code
path that will cause a pending data check when proxyssl could have
pending data and the connssl handle doesn't yet exist [1].

[1]: Recall that an https proxy connection starts out in connssl but if
the destination is also https then the proxy SSL backend data is moved
from connssl to proxyssl, which means connssl handle is temporarily
empty until an SSL handle for the destination can be created.

Ref: https://github.com/curl/curl/commit/f4a6238#commitcomment-24396542

Closes https://github.com/curl/curl/pull/1916
This commit is contained in:
Jay Satiro 2017-09-24 01:42:37 -04:00
parent 9ffad8eb13
commit 9dfb194833

View File

@ -3383,12 +3383,13 @@ static bool Curl_ossl_data_pending(const struct connectdata *conn,
{ {
const struct ssl_connect_data *connssl = &conn->ssl[connindex]; const struct ssl_connect_data *connssl = &conn->ssl[connindex];
const struct ssl_connect_data *proxyssl = &conn->proxy_ssl[connindex]; const struct ssl_connect_data *proxyssl = &conn->proxy_ssl[connindex];
if(BACKEND->handle)
/* SSL is in use */ if(connssl->backend->handle && SSL_pending(connssl->backend->handle))
return (0 != SSL_pending(BACKEND->handle) || return TRUE;
(proxyssl->backend->handle &&
0 != SSL_pending(proxyssl->backend->handle))) ? if(proxyssl->backend->handle && SSL_pending(proxyssl->backend->handle))
TRUE : FALSE; return TRUE;
return FALSE; return FALSE;
} }