Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
easy: Fix the broken CURLOPT_MAXCONNECTS option
Copy the CURLOPT_MAXCONNECTS option to CURLMOPT_MAXCONNECTS in curl_easy_perform(). Bug: http://curl.haxx.se/bug/view.cgi?id=1212 Reported-by: Steven Gu
- Loading branch information
1 parent
984e20d
commit e87e76e
Showing
5 changed files
with
195 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<testcase> | ||
<info> | ||
<keywords> | ||
HTTP | ||
</keywords> | ||
</info> | ||
|
||
# Server-side | ||
<reply> | ||
<data1> | ||
HTTP/1.1 200 OK | ||
Date: Thu, 09 Nov 2010 14:49:00 GMT | ||
Server: test-server/fake | ||
Content-Length: 47 | ||
|
||
file contents should appear once for each file | ||
</data1> | ||
<data2> | ||
HTTP/1.1 200 OK | ||
Date: Thu, 09 Nov 2010 14:49:00 GMT | ||
Server: test-server/fake | ||
Content-Length: 47 | ||
|
||
file contents should appear once for each file | ||
</data2> | ||
<data3> | ||
HTTP/1.1 200 OK | ||
Date: Thu, 09 Nov 2010 14:49:00 GMT | ||
Server: test-server/fake | ||
Content-Length: 47 | ||
|
||
file contents should appear once for each file | ||
</data3> | ||
<data4> | ||
HTTP/1.1 200 OK | ||
Date: Thu, 09 Nov 2010 14:49:00 GMT | ||
Server: test-server/fake | ||
Content-Length: 47 | ||
|
||
file contents should appear once for each file | ||
</data4> | ||
</reply> | ||
|
||
# Client-side | ||
<client> | ||
<server> | ||
http | ||
</server> | ||
<tool> | ||
lib1510 | ||
</tool> | ||
<name> | ||
HTTP GET connection cache limit (CURLOPT_MAXCONNECTS) | ||
</name> | ||
<command> | ||
http://%HOSTIP:%HTTPPORT/path/1510 %HOSTIP %HTTPPORT | ||
</command> | ||
</client> | ||
|
||
# Verify data after the test has been "shot" | ||
<verify> | ||
<protocol> | ||
GET /path/15100001 HTTP/1.1 | ||
Host: %HOSTIP:%HTTPPORT | ||
Accept: */* | ||
|
||
GET /path/15100002 HTTP/1.1 | ||
Host: %HOSTIP:%HTTPPORT | ||
Accept: */* | ||
|
||
GET /path/15100003 HTTP/1.1 | ||
Host: %HOSTIP:%HTTPPORT | ||
Accept: */* | ||
|
||
GET /path/15100004 HTTP/1.1 | ||
Host: %HOSTIP:%HTTPPORT | ||
Accept: */* | ||
|
||
</protocol> | ||
<strip> | ||
^Host:.* | ||
</strip> | ||
<file name="log/stderr1510" mode="text"> | ||
* Connection #0 to host server1.example.com left intact | ||
* Connection #1 to host server2.example.com left intact | ||
* Connection #2 to host server3.example.com left intact | ||
* Closing connection 0 | ||
* Connection #3 to host server4.example.com left intact | ||
</file> | ||
<stripfile> | ||
$_ = '' if (($_ !~ /left intact/) && ($_ !~ /Closing connection/)) | ||
</stripfile> | ||
</verify> | ||
</testcase> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/*************************************************************************** | ||
* _ _ ____ _ | ||
* Project ___| | | | _ \| | | ||
* / __| | | | |_) | | | ||
* | (__| |_| | _ <| |___ | ||
* \___|\___/|_| \_\_____| | ||
* | ||
* Copyright (C) 2013, Linus Nielsen Feltzing <linus@haxx.se> | ||
* | ||
* This software is licensed as described in the file COPYING, which | ||
* you should have received as part of this distribution. The terms | ||
* are also available at http://curl.haxx.se/docs/copyright.html. | ||
* | ||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell | ||
* copies of the Software, and permit persons to whom the Software is | ||
* furnished to do so, under the terms of the COPYING file. | ||
* | ||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
* KIND, either express or implied. | ||
* | ||
***************************************************************************/ | ||
#include "test.h" | ||
|
||
#include "testutil.h" | ||
#include "warnless.h" | ||
#include "memdebug.h" | ||
|
||
#define TEST_HANG_TIMEOUT 60 * 1000 | ||
|
||
#define NUM_URLS 4 | ||
|
||
int test(char *URL) | ||
{ | ||
int res = 0; | ||
CURL *curl = NULL; | ||
int i; | ||
char target_url[256]; | ||
char dnsentry[256]; | ||
struct curl_slist *slist = NULL; | ||
char *port = libtest_arg3; | ||
char *address = libtest_arg2; | ||
|
||
(void)URL; | ||
|
||
/* Create fake DNS entries for serverX.example.com for all handles */ | ||
for(i=0; i < NUM_URLS; i++) { | ||
sprintf(dnsentry, "server%d.example.com:%s:%s", i + 1, port, address); | ||
printf("%s\n", dnsentry); | ||
slist = curl_slist_append(slist, dnsentry); | ||
} | ||
|
||
start_test_timing(); | ||
|
||
global_init(CURL_GLOBAL_ALL); | ||
|
||
/* get an easy handle */ | ||
easy_init(curl); | ||
|
||
/* go verbose */ | ||
easy_setopt(curl, CURLOPT_VERBOSE, 1L); | ||
/* include headers */ | ||
easy_setopt(curl, CURLOPT_HEADER, 1L); | ||
|
||
easy_setopt(curl, CURLOPT_RESOLVE, slist); | ||
|
||
easy_setopt(curl, CURLOPT_MAXCONNECTS, 3); | ||
|
||
/* get NUM_HANDLES easy handles */ | ||
for(i=0; i < NUM_URLS; i++) { | ||
/* specify target */ | ||
sprintf(target_url, "http://server%d.example.com:%s/path/1510%04i", | ||
i + 1, port, i + 1); | ||
target_url[sizeof(target_url) - 1] = '\0'; | ||
easy_setopt(curl, CURLOPT_URL, target_url); | ||
|
||
res = curl_easy_perform(curl); | ||
|
||
abort_on_test_timeout(); | ||
} | ||
|
||
test_cleanup: | ||
|
||
/* proper cleanup sequence - type PB */ | ||
|
||
curl_easy_cleanup(curl); | ||
|
||
curl_slist_free_all(slist); | ||
|
||
curl_global_cleanup(); | ||
|
||
return res; | ||
} |