curl/tests/data/test3225
Memduh Çelik ddc76c24c5
tests: pin connection reuse rules for partial, host, and credentials
Add classic tests 3223-3226 and extend tests/http/test_12_reuse.py so that
connection reuse decisions are explicit:

- partial/aborted HTTP/1.1 responses must not reuse the connection
  (premature multi_done closes non-multiplexed conns)
- different target hostnames must not share a connection even when they
  resolve to the same address (url_match_destination)
- HTTP Basic credentials are per-request (PROTOPT_CREDSPERREQUEST), so
  different -u values still reuse; assert that with num_connects
- same host positive control reuses (num_connects 1 then 0)

Closes #22224
2026-06-30 09:57:00 +02:00

69 lines
1.6 KiB
XML

<?xml version="1.0" encoding="US-ASCII"?>
<testcase>
# url_match_destination() / Curl_peer_same_destination() require matching
# origin hostname and port. Different Host names that resolve to the same
# address must not share a connection. Both connections may stay in the
# pool until process exit, so the server may see two DISCONNECT events only
# at the end; num_connects proves a new connection was opened.
<info>
<keywords>
HTTP
HTTP GET
--resolve
connection reuse
--next
</keywords>
</info>
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Content-Length: 3
Content-Type: text/plain
H1
</data>
<data1 nocheck="yes">
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Content-Length: 3
Content-Type: text/plain
H2
</data1>
<servercmd>
connection-monitor
</servercmd>
</reply>
<client>
<server>
http
</server>
<name>
HTTP connection not reused when target host changes
</name>
<command>
http://host-a.example.test:%HTTPPORT/%TESTNUMBER --resolve host-a.example.test:%HTTPPORT:%HOSTIP -o %LOGDIR/3225-1 -w "connects=%{num_connects}/" --next http://host-b.example.test:%HTTPPORT/%TESTNUMBER0001 --resolve host-b.example.test:%HTTPPORT:%HOSTIP -o %LOGDIR/3225-2 -w "connects=%{num_connects}/"
</command>
</client>
<verify>
<protocol crlf="headers">
GET /%TESTNUMBER HTTP/1.1
Host: host-a.example.test:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
GET /%TESTNUMBER0001 HTTP/1.1
Host: host-b.example.test:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
[DISCONNECT]
[DISCONNECT]
</protocol>
# Same IP via --resolve, different Host names => new connection each time.
<stdout nonewline="yes">
connects=1/connects=1/
</stdout>
</verify>
</testcase>