Menu

#1388 Another problem with proxy CONNECT and Connection: Keep-Alive

closed-accepted
None
5
2014-07-04
2014-06-30
Marcel Raad
No

This issue occurs in the same setup as [#1381], but with the correct proxy credentials preset with CURLOPT_PROXYUSERNAME and CURLOPT_PROXYPASSWORD.

I'm using libcurl 7.37.0 (built with SSPI on Windows) and I'm trying to establish a proxy tunnel through a squid 3.2.11 proxy. Both CURLOPT_HTTPPROXYTUNNEL and CURLOPT_CONNECT_ONLY are set to 1. The problem occurs only if the proxy does not send "(Proxy-)Connection: Close" together with "407 Proxy Authentication Required". It also does not occurs if I set exactly the authentication method required by the proxy (Basic) with CURLOPT_PROXYAUTH.

The problem is that after the proxy tunnel is established successfully, nothing ever happens (none of my callbacks are ever called) until the timeout occurs (no matter how high the values of CURLOPT_TIMEOUT and CURLOPT_CONNECTTIMEOUT are, I have tested with values between 3 and 60 seconds). Then my timeout triggers and curl_multi_info_read returns with CURLE_OPERATION_TIMEDOUT.

The big difference to a working proxy that sends "Proxy-Connection: Close" together with "407 Proxy Authentication Required" is that the working proxy ends up in the "if(data->easy_conn->bits.proxy_connect_closed)" case after the call to Curl_http_connect in the CURLM_STATE_WAITPROXYCONNECT case of multi_runsingle, while the failing proxy ends up in "else if((CURLE_OK == data->result) && (data->easy_conn->tunnel_state[FIRSTSOCKET] == TUNNEL_COMPLETE))".

The attached patch (against current git revision 1b6bc02fb926403f04061721f9159e9887202a96) fixes the problem for me, but I have no idea if it is correct or breaks other use cases.

1 Attachments

Related

Bugs: #1381

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2014-07-03

    Thanks for your report.

    With CONNECT_ONLY enabled, exactly which callbacks are you expecting?

     
  • Daniel Stenberg

    Daniel Stenberg - 2014-07-03
    • assigned_to: Daniel Stenberg
     
  • Marcel Raad

    Marcel Raad - 2014-07-03

    Sorry, this was actually an error in my code :-( I always passed CURL_SOCKET_BAD to curl_multi_socket_action when I called it with CURL_CSELECT_IN. I have changed that to the correct socket descriptor and it's working now. It only worked by chance with the other proxies.

     
  • Daniel Stenberg

    Daniel Stenberg - 2014-07-04
    • status: open --> closed-accepted
     
MongoDB Logo MongoDB