boinc/curl/patches/7.15.3.Socks/url_c.patch

47 lines
1.5 KiB
Diff

--- G:\curl\curl-7.15.3\lib\url.c Wed Mar 08 00:11:42 2006
+++ G:\curl\curl-7.15.3mod1\lib\url.c Wed Apr 19 17:54:39 2006
@@ -2030,10 +2030,43 @@
ssize_t actualread;
ssize_t written;
int result;
CURLcode code;
curl_socket_t sock = conn->sock[FIRSTSOCKET];
+ long timeout = DEFAULT_CONNECT_TIMEOUT;
+
+ /* make sure connect is complete when doing multi */
+ if(conn->data->state.used_interface == Curl_if_multi) {
+ /* get timeout */
+ if(conn->data->set.timeout && conn->data->set.connecttimeout) {
+ if (conn->data->set.timeout < conn->data->set.connecttimeout)
+ timeout = conn->data->set.timeout*1000;
+ else
+ timeout = conn->data->set.connecttimeout*1000;
+ }
+ else if(conn->data->set.timeout) {
+ timeout = conn->data->set.timeout*1000;
+ }
+ else if(conn->data->set.connecttimeout) {
+ timeout = conn->data->set.connecttimeout*1000;
+ }
+
+ /* verify scoket is connected */
+ result = Curl_select(CURL_SOCKET_BAD, sock, timeout);
+ if(-1 == result)
+ /* select error, no connect here, try next */
+ return -1;
+ else if(0 == result)
+ /* timeout, no connect today */
+ return 1;
+
+ if(result & CSELECT_ERR)
+ /* error condition caught */
+ return 2;
+
+ /* we have a connect! */
+ } /* used_interface == Curl_if_multi */
Curl_nonblock(sock, FALSE);
socksreq[0] = 5; /* version */
socksreq[1] = (char)(proxy_name ? 2 : 1); /* number of methods (below) */