Branch: Tag:

2019-09-20

2019-09-20 12:13:15 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Protocols.HTTP: Fix race-condition in https_proxy_connect_ok().

The write callback might get called for the raw socket before
the TLS wrapper is in place.

473:    // Install the timeout handler for the interval until    // the TLS connection is up.    con->init_async_timeout(); +  +  con->headers["connection"] = "keep-alive"; +  con->headers["content-length"] = "0"; +  con->host = url->host; +  con->port = url->port; +  con->https = 1; +  con->start_tls(0); +     con->con->set_nonblocking(0,    lambda() {    // Remove the timeout handler; it will be
481:    do_async_method(method, url, query_variables,    request_headers, con, data);    }, con->async_failed); -  -  con->headers["connection"] = "keep-alive"; -  con->headers["content-length"] = "0"; -  con->host = url->host; -  con->port = url->port; -  con->https = 1; -  con->start_tls(0); +    }      //! Low level asynchronous proxied HTTP call method.