From b8b56248bddc646bf8d262dc9c5b45ce68a1ef08 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 10 Sep 2004 20:58:51 +0000 Subject: - Bug report #1025986. When following a Location: with a custom Host: header replacement, curl only replaced the Host: header on the initial request and didn't replace it on the following ones. This resulted in requests with two Host: headers. Now, curl checks if the location is on the same host as the initial request and then continues to replace the Host: header. And when it moves to another host, it doesn't replace the Host: header but it also doesn't make the second Host: header get used in the request. This change is verified by the two new test cases 184 and 185. --- tests/data/test184 | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 tests/data/test184 (limited to 'tests/data/test184') diff --git a/tests/data/test184 b/tests/data/test184 new file mode 100644 index 000000000..547993f6a --- /dev/null +++ b/tests/data/test184 @@ -0,0 +1,67 @@ +# Server-side + + +HTTP/1.1 301 OK swsbounce +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 4 +Location: http://yet.another.host/184 + +moo + + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 4 + +moo + + +HTTP/1.1 301 OK swsbounce +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 4 +Location: http://yet.another.host/184 + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 4 + +moo + + + +# Client-side + + +http + + +SSL + + +HTTP replace Host: when following Location: to new host + + +http://deathstar.another.galaxy/184 -L -H "Host: another.visitor.stay.a.while.stay.foreeeeeever" --proxy http://%HOSTIP:%HTTPPORT + + + +# Verify data after the test has been "shot" + + +^User-Agent: curl/.* + + +GET http://deathstar.another.galaxy/184 HTTP/1.1 +User-Agent: curl/7.12.2-CVS (i686-pc-linux-gnu) libcurl/7.12.2-CVS OpenSSL/0.9.6b zlib/1.1.4 libidn/0.4.6 +Pragma: no-cache +Accept: */* +Host: another.visitor.stay.a.while.stay.foreeeeeever + +GET http://yet.another.host/184 HTTP/1.1 +Host: yet.another.host +Pragma: no-cache +Accept: */* + + + + -- cgit v1.2.3