From 0f147887b0d592d5fa72215282e84103eb165ad7 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Fri, 15 Feb 2013 11:50:45 +0100 Subject: Multiple pipelines and limiting the number of connections. Introducing a number of options to the multi interface that allows for multiple pipelines to the same host, in order to optimize the balance between the penalty for opening new connections and the potential pipelining latency. Two new options for limiting the number of connections: CURLMOPT_MAX_HOST_CONNECTIONS - Limits the number of running connections to the same host. When adding a handle that exceeds this limit, that handle will be put in a pending state until another handle is finished, so we can reuse the connection. CURLMOPT_MAX_TOTAL_CONNECTIONS - Limits the number of connections in total. When adding a handle that exceeds this limit, that handle will be put in a pending state until another handle is finished. The free connection will then be reused, if possible, or closed if the pending handle can't reuse it. Several new options for pipelining: CURLMOPT_MAX_PIPELINE_LENGTH - Limits the pipeling length. If a pipeline is "full" when a connection is to be reused, a new connection will be opened if the CURLMOPT_MAX_xxx_CONNECTIONS limits allow it. If not, the handle will be put in a pending state until a connection is ready (either free or a pipe got shorter). CURLMOPT_CONTENT_LENGTH_PENALTY_SIZE - A pipelined connection will not be reused if it is currently processing a transfer with a content length that is larger than this. CURLMOPT_CHUNK_LENGTH_PENALTY_SIZE - A pipelined connection will not be reused if it is currently processing a chunk larger than this. CURLMOPT_PIPELINING_SITE_BL - A blacklist of hosts that don't allow pipelining. CURLMOPT_PIPELINING_SERVER_BL - A blacklist of server types that don't allow pipelining. See the curl_multi_setopt() man page for details. --- tests/data/Makefile.am | 3 +- tests/data/test1900 | 57 ++++++++++++++++++++ tests/data/test1901 | 58 ++++++++++++++++++++ tests/data/test1902 | 57 ++++++++++++++++++++ tests/data/test1903 | 57 ++++++++++++++++++++ tests/data/test2033 | 144 +++++++++++++++++++++++++++++++++++++++++++++++++ tests/data/test530 | 2 +- tests/data/test536 | 8 +++ tests/data/test584 | 2 +- 9 files changed, 385 insertions(+), 3 deletions(-) create mode 100644 tests/data/test1900 create mode 100644 tests/data/test1901 create mode 100644 tests/data/test1902 create mode 100644 tests/data/test1903 create mode 100644 tests/data/test2033 (limited to 'tests/data') diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index f65fe0688..7c2e648f5 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -95,13 +95,14 @@ test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \ test1408 test1409 test1410 test1411 test1412 test1413 \ test1500 test1501 test1502 test1503 test1504 test1505 test1506 test1507 \ test1508 \ +test1900 test1901 test1902 test1903 \ test2000 test2001 test2002 test2003 test2004 test2005 test2006 test2007 \ test2008 test2009 test2010 test2011 test2012 test2013 test2014 test2015 \ test2016 test2017 test2018 test2019 test2020 test2021 test2022 \ test2023 test2024 test2025 \ test2026 test2027 test2028 \ test2029 test2030 test2031 \ -test2032 +test2032 test2033 EXTRA_DIST = $(TESTCASES) DISABLED diff --git a/tests/data/test1900 b/tests/data/test1900 new file mode 100644 index 000000000..857c6096b --- /dev/null +++ b/tests/data/test1900 @@ -0,0 +1,57 @@ + + + +HTTP +pipelining +multi + + + +# Server-side + + +Adding handle 0 +Handle 0 Completed with status 0 +Adding handle 1 +Adding handle 2 +Adding handle 3 +Adding handle 4 +Adding handle 5 +Adding handle 6 +Handle 4 Completed with status 0 +Handle 5 Completed with status 0 +Handle 6 Completed with status 0 +Handle 1 Completed with status 0 +Handle 2 Completed with status 0 +Handle 3 Completed with status 0 + + + +# Client-side + + +http-pipe + + +lib1900 + + +HTTP GET using pipelining + + +http://%HOSTIP:%HTTPPIPEPORT/ + + +0 1k.txt +1000 100k.txt +0 1k.txt +0 1k.txt +0 1k.txt +0 1k.txt +0 1k.txt + + +# Verify data after the test has been "shot" + + + diff --git a/tests/data/test1901 b/tests/data/test1901 new file mode 100644 index 000000000..bacf9cb09 --- /dev/null +++ b/tests/data/test1901 @@ -0,0 +1,58 @@ + + + +HTTP +pipelining +multi + + + +# Server-side + + +Adding handle 0 +Handle 0 Completed with status 0 +Adding handle 1 +Adding handle 2 +Adding handle 3 +Adding handle 4 +Adding handle 5 +Adding handle 6 +Handle 2 Completed with status 0 +Handle 3 Completed with status 0 +Handle 4 Completed with status 0 +Handle 1 Completed with status 0 +Handle 5 Completed with status 0 +Handle 6 Completed with status 0 + + + +# Client-side + + +http-pipe + + +lib1900 + + +HTTP GET using pipelining, blacklisted site + + +http://%HOSTIP:%HTTPPIPEPORT/ + + +blacklist_site 127.0.0.1:%HTTPPIPEPORT +0 1k.txt +1000 100k.txt +0 1k.txt +0 1k.txt +0 1k.txt +0 1k.txt +0 1k.txt + + +# Verify data after the test has been "shot" + + + diff --git a/tests/data/test1902 b/tests/data/test1902 new file mode 100644 index 000000000..22f262176 --- /dev/null +++ b/tests/data/test1902 @@ -0,0 +1,57 @@ + + + +HTTP +pipelining +multi + + + +# Server-side + + +Adding handle 0 +Handle 0 Completed with status 0 +Adding handle 1 +Adding handle 2 +Adding handle 3 +Adding handle 4 +Adding handle 5 +Adding handle 6 +Handle 1 Completed with status 0 +Handle 4 Completed with status 0 +Handle 5 Completed with status 0 +Handle 6 Completed with status 0 +Handle 2 Completed with status 0 +Handle 3 Completed with status 0 + + + +# Client-side + + +http-pipe + + +lib1900 + + +HTTP GET using pipelining, broken pipe + + +http://%HOSTIP:%HTTPPIPEPORT/ + + +0 1k.txt +1000 connection_close.txt +0 1k.txt +0 1k.txt +0 1k.txt +0 1k.txt +0 1k.txt + + +# Verify data after the test has been "shot" + + + diff --git a/tests/data/test1903 b/tests/data/test1903 new file mode 100644 index 000000000..01efa67f8 --- /dev/null +++ b/tests/data/test1903 @@ -0,0 +1,57 @@ + + + +HTTP +pipelining +multi + + + +# Server-side + + +Adding handle 0 +Handle 0 Completed with status 0 +Adding handle 1 +Adding handle 2 +Adding handle 3 +Adding handle 4 +Adding handle 5 +Adding handle 6 +Handle 2 Completed with status 0 +Handle 3 Completed with status 0 +Handle 4 Completed with status 0 +Handle 5 Completed with status 0 +Handle 6 Completed with status 0 +Handle 1 Completed with status 0 + + + +# Client-side + + +http-pipe + + +lib1900 + + +HTTP GET using pipelining, penalized on content-length + + +http://%HOSTIP:%HTTPPIPEPORT/ + + +0 1k.txt +1000 100k.txt +550 alphabet.txt +10 alphabet.txt +10 alphabet.txt +10 alphabet.txt +10 alphabet.txt + + +# Verify data after the test has been "shot" + + + diff --git a/tests/data/test2033 b/tests/data/test2033 new file mode 100644 index 000000000..ad926ebce --- /dev/null +++ b/tests/data/test2033 @@ -0,0 +1,144 @@ + + + +HTTP +HTTP GET +HTTP Basic auth +HTTP NTLM auth +pipelining + + +# Server-side + + + + +HTTP/1.1 401 Need Basic or NTLM auth +Server: Microsoft-IIS/5.0 +Content-Type: text/html; charset=iso-8859-1 +Content-Length: 29 +WWW-Authenticate: NTLM +WWW-Authenticate: Basic realm="testrealm" + +This is a bad password page! + + + + +HTTP/1.1 401 Need Basic or NTLM auth (2) +Server: Microsoft-IIS/5.0 +Content-Type: text/html; charset=iso-8859-1 +Content-Length: 27 +WWW-Authenticate: NTLM +WWW-Authenticate: Basic realm="testrealm" + +This is not the real page! + + + +HTTP/1.1 401 NTLM intermediate (2) +Server: Microsoft-IIS/5.0 +Content-Type: text/html; charset=iso-8859-1 +Content-Length: 33 +WWW-Authenticate: NTLM TlRMTVNTUAACAAAACAAIADAAAAAGggEAq6U1NAWaJCIAAAAAAAAAAAAAAAA4AAAATlRMTUF1dGg= + +This is still not the real page! + + + +HTTP/1.1 200 Things are fine in server land +Server: Microsoft-IIS/5.0 +Content-Type: text/html; charset=iso-8859-1 +Content-Length: 32 + +Finally, this is the real page! + + + +HTTP/1.1 401 Need Basic or NTLM auth +Server: Microsoft-IIS/5.0 +Content-Type: text/html; charset=iso-8859-1 +Content-Length: 29 +WWW-Authenticate: NTLM +WWW-Authenticate: Basic realm="testrealm" + +This is a bad password page! +HTTP/1.1 401 Need Basic or NTLM auth +Server: Microsoft-IIS/5.0 +Content-Type: text/html; charset=iso-8859-1 +Content-Length: 29 +WWW-Authenticate: NTLM +WWW-Authenticate: Basic realm="testrealm" + +This is a bad password page! +HTTP/1.1 401 NTLM intermediate (2) +Server: Microsoft-IIS/5.0 +Content-Type: text/html; charset=iso-8859-1 +Content-Length: 33 +WWW-Authenticate: NTLM TlRMTVNTUAACAAAACAAIADAAAAAGggEAq6U1NAWaJCIAAAAAAAAAAAAAAAA4AAAATlRMTUF1dGg= + +HTTP/1.1 200 Things are fine in server land +Server: Microsoft-IIS/5.0 +Content-Type: text/html; charset=iso-8859-1 +Content-Length: 32 + +Finally, this is the real page! + + + + +# Client-side + + +http + + +lib2033 + + + +NTLM connection mapping, pipelining enabled + + +# we force our own host name, in order to make the test machine independent +CURL_GETHOSTNAME=curlhost +# we try to use the LD_PRELOAD hack, if not a debug build +LD_PRELOAD=%PWD/libtest/.libs/libhostname.so + + +http://%HOSTIP:%HTTPPORT/2032 + + +chkhostname curlhost + + + +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +GET /20320100 HTTP/1.1 +Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M= +Host: 127.0.0.1:8990 +Accept: */* + +GET /20320100 HTTP/1.1 +Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M= +Host: 127.0.0.1:8990 +Accept: */* + +GET /20320200 HTTP/1.1 +Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA= +Host: 127.0.0.1:8990 +Accept: */* + +GET /20320200 HTTP/1.1 +Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoIBAI+/Fp9IERAQ74OsdNPbBpg7o8CVwLSO4DtFyIcZHUMKVktWIu92s2892OVpd2JzqnRlc3R1c2VyY3VybGhvc3Q= +Host: 127.0.0.1:8990 +Accept: */* + + + + diff --git a/tests/data/test530 b/tests/data/test530 index 359d04cf1..09e742179 100644 --- a/tests/data/test530 +++ b/tests/data/test530 @@ -2,7 +2,7 @@ HTTP -Pipelining +pipelining multi diff --git a/tests/data/test536 b/tests/data/test536 index 334c07f06..ef8263d98 100644 --- a/tests/data/test536 +++ b/tests/data/test536 @@ -1,4 +1,12 @@ + + +HTTP +pipelining +multi + + + HTTP/1.1 404 Badness diff --git a/tests/data/test584 b/tests/data/test584 index 81d6a083d..8d1ca92f9 100644 --- a/tests/data/test584 +++ b/tests/data/test584 @@ -2,7 +2,7 @@ HTTP -Pipelining +pipelining multi -- cgit v1.2.3