cURL / Mailing Lists / curl-users / Single Mail

curl-users

RE: HTTPS GET/POST through a proxy with authentication fails. BUG#25related?

From: Lau, Hang Kin <hklau_at_avistar.com>
Date: Mon, 12 Mar 2007 11:38:21 -0700

Since I don't have the proxy setup anymore, I will try to recapture what
happened when the 10053 was returned.

The following is where it happened, inside http.c, Curl_proxyCONNECT():
        /* This is version 7.16.0 */

      /* timeout each second and check the timeout */
      switch (Curl_select(tunnelsocket, CURL_SOCKET_BAD, 1000)) {
      case -1: /* select() error, stop reading */
        error = SELECT_ERROR;
        failf(data, "Proxy CONNECT aborted due to select() error");
        break;
      case 0: /* timeout */
        break;
      default:
        res = Curl_read(conn, tunnelsocket, ptr, BUFSIZE-nread,
&gotbytes);
        if(res< 0)
          /* EWOULDBLOCK */
          continue; /* go loop yourself */
        else if(res)
          keepon = FALSE;
        else if(gotbytes <= 0) {
          keepon = FALSE;
          error = SELECT_ERROR;
          failf(data, "Proxy CONNECT aborted");
        }
        else {...}
        break;
      } /* switch */
    } /* while there's buffer left and loop is requested */

    if(error)
      return CURLE_RECV_ERROR;

After receiving a 407, Curl_select() returned indicating something was
ready and then Curl_read() tried to read the socket. However, nothing
was read from the socket because that was in fact an 10053 error from
Windows (Connection closed caused by the proxy sending a RST to us).
Thus, Curl_read returns 0 with gotbytes == 0. This in turn sets the
"error" to SELECT_ERROR and "Proxy CONNECT aborted" was displayed.
Eventually, Curl_proxyCONNECT returns with CURLE_RECV_ERROR.

The connection process ended here, without sending further
authentication credentials to the proxy server.

Note that if the same handle is used to connect again, appropriate
credentials did get send out and everything works fine afterwards. It's
just the first connection attempt didn't complete successfully.

This is as far as I can recall, I hope this helps in clarifying the
problem.
Received on 2007-03-12