Changelog
Daniel (19 October 2004)
+- Guillaume Arluison added CURLINFO_NUM_CONNECTS to allow an app to figure
+ out how many new connects a previous transfer required.
+
+ I added %{num_connects} to the curl tool and added test case 192 and 193
+ to verify the new code.
+
- Test case 165 modified to use a charset define older iconv versions
understand. ISO-8859-1 instead of ISO8859-1. Bug report #1049275 (anonymous)
This release includes the following changes:
- o
+ o added CURLINFO_NUM_CONNECTS
This release includes the following bugfixes:
- o
+ o test 165 works with older iconv versions as well
+ o use setlocale() for better IDN functionality by default
Other curl-related news since the previous public release:
- o
+ o pycurl 7.12.2: http://pycurl.sf.net/
+ o TclCurl 0.12.2: http://personal1.iddeo.es/andresgarci/tclcurl/english/
This release would not have looked like this without help, code, reports and
advice from friends like these:
+ Peter Wullinger, Guillaume Arluison
Thanks! (and sorry if I forgot to mention someone)
Issues not sorted in any particular order.
-To get fixed in 7.12.2 (planned release: mid October 2004)
-======================
-
To get fixed in 7.12.3 (planned release: December 2004)
======================
47 - Peter Sylvester's patch for SRP on the TLS layer
48 - MSVC Makefile improvements by Samuel Díaz García
+
.IP CURLINFO_OS_ERRNO
Pass a pointer to a long to receive the errno variable from a connect failure.
(Added in 7.12.2)
+.IP CURLINFO_NUM_CONNECTS
+Pass a pointer to a long to receive how many new connections libcurl had to
+create to achieve the previous transfer (only the successful connects are
+counted). Combined with \fICURLINFO_REDIRECT_COUNT\fP you are able to know
+how many times libcurl successfully reused existing connection(s) or not. See
+the Connection Options of \fIcurl_easy_setopt(3)\fP to see how libcurl tries
+to make persistent connections to save time. (Added in 7.12.3)
.SH RETURN VALUE
If the operation was successful, CURLE_OK is returned. Otherwise an
appropriate error code will be returned.
CURLINFO_HTTPAUTH_AVAIL = CURLINFO_LONG + 23,
CURLINFO_PROXYAUTH_AVAIL = CURLINFO_LONG + 24,
CURLINFO_OS_ERRNO = CURLINFO_LONG + 25,
+ CURLINFO_NUM_CONNECTS = CURLINFO_LONG + 26,
/* Fill in new entries below here! */
- CURLINFO_LASTONE = 26
+ CURLINFO_LASTONE = 27
} CURLINFO;
/* CURLINFO_RESPONSE_CODE is the new name for the option previously known as
if(sockconn)
*sockconn = sockfd; /* the socket descriptor we've connected */
+ data->info.numconnects++; /* to track the number of connections made */
+
return CURLE_OK;
}
#include "memdebug.h"
/*
- * This is supposed to be called in the beginning of a permform() session
+ * This is supposed to be called in the beginning of a perform() session
* and should reset all session-info variables
*/
CURLcode Curl_initinfo(struct SessionHandle *data)
info->header_size = 0;
info->request_size = 0;
+ info->numconnects = 0;
return CURLE_OK;
}
case CURLINFO_OS_ERRNO:
*param_longp = data->state.os_errno;
break;
+ case CURLINFO_NUM_CONNECTS:
+ *param_longp = data->info.numconnects;
+ break;
default:
return CURLE_BAD_FUNCTION_ARGUMENT;
}
long proxyauthavail;
long httpauthavail;
+ long numconnects; /* how many new connection did libcurl created */
+
char *contenttype; /* the content type of the object */
};
VAR_REQUEST_SIZE,
VAR_EFFECTIVE_URL,
VAR_CONTENT_TYPE,
+ VAR_NUM_CONNECTS,
VAR_NUM_OF_VARS /* must be the last */
} replaceid;
{"speed_download", VAR_SPEED_DOWNLOAD},
{"speed_upload", VAR_SPEED_UPLOAD},
{"content_type", VAR_CONTENT_TYPE},
+ {"num_connects", VAR_NUM_CONNECTS},
{NULL, VAR_NONE}
};
curl_easy_getinfo(curl, CURLINFO_REQUEST_SIZE, &longinfo))
fprintf(stream, "%ld", longinfo);
break;
+ case VAR_NUM_CONNECTS:
+ if(CURLE_OK ==
+ curl_easy_getinfo(curl, CURLINFO_NUM_CONNECTS, &longinfo))
+ fprintf(stream, "%ld", longinfo);
+ break;
case VAR_TOTAL_TIME:
if(CURLE_OK ==
curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &doubleinfo))
test512 test165 test166 test167 test168 test169 test170 test171 \
test172 test204 test205 test173 test174 test175 test176 test177 \
test513 test514 test178 test179 test180 test181 test182 test183 \
- test184 test185 test186 test187 test188 test189 test191
+ test184 test185 test186 test187 test188 test189 test191 test192 \
+ test193
# The following tests have been removed from the dist since they no longer
# work. We need to fix the test suite's FTPS server first, then bring them
--- /dev/null
+#
+# Server-side
+<reply>
+<data nocheck=1>
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Content-Length: 8
+Connection: close
+
+monster
+</data>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+ <name>
+HTTP GET -w num_connects with one simple connect
+ </name>
+ <command>
+http://%HOSTIP:%HTTPPORT/192 -w '%{num_connects}\n'
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<protocol>
+GET /192 HTTP/1.1\r
+Host: 127.0.0.1:%HTTPPORT\r
+Pragma: no-cache\r
+Accept: */*\r
+\r
+</protocol>
+
+<stdout>
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Content-Length: 8
+Connection: close
+
+monster
+1
+</stdout>
+</verify>
--- /dev/null
+#
+# Server-side
+<reply>
+<data nocheck=1>
+HTTP/1.1 302 OK swsbounce swsclose
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Content-Length: 8
+Connection: close
+Location: ./193
+
+monster
+</data>
+<data1 nocheck=1>
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Content-Length: 8
+Connection: close
+
+monster
+</data1>
+
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+ <name>
+HTTP GET -w num_connects with redirected fetch (2 connects)
+ </name>
+ <command>
+http://%HOSTIP:%HTTPPORT/193 -w '%{num_connects}\n' -L
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<protocol>
+GET /193 HTTP/1.1\r
+Host: 127.0.0.1:%HTTPPORT\r
+Pragma: no-cache\r
+Accept: */*\r
+\r
+GET /193 HTTP/1.1\r
+Host: 127.0.0.1:%HTTPPORT\r
+Pragma: no-cache\r
+Accept: */*\r
+\r
+</protocol>
+
+<stdout>
+HTTP/1.1 302 OK swsbounce swsclose
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Content-Length: 8
+Connection: close
+Location: ./193
+
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Content-Length: 8
+Connection: close
+
+monster
+2
+</stdout>
+
+</verify>