mirror of
https://github.com/curl/curl.git
synced 2026-08-08 08:52:56 +03:00
transfer: fix CURLOPT_CURLU override logic
- Change setopt and pretransfer to always reset URL related variables for a CURLU handle set CURLOPT_CURLU. This change is to ensure we are in compliance with the doc which says CURLU handles must be able to override a URL set via CURLOPT_URL and that if the contents of the CURLU handle changes between transfers then the updated contents must be used. Prior to this change, although subsequent transfers appear to be performed correctly in those cases, the work URL `data->state.url` was not updated. CURLINFO_EFFECTIVE_URL returns data->state.url to the user so it would return the URL from the initial transfer which was the wrong URL. It's likely there are other cases as well. Ref: https://curl.se/libcurl/c/CURLOPT_CURLU.html Reported-by: Nicolás San Martín Fixes https://github.com/curl/curl/issues/15984 Closes https://github.com/curl/curl/pull/15985
This commit is contained in:
parent
8ab468c8aa
commit
5ffc73c78e
6 changed files with 182 additions and 13 deletions
|
|
@ -237,7 +237,7 @@ test1916 test1917 test1918 test1919 \
|
|||
test1933 test1934 test1935 test1936 test1937 test1938 test1939 test1940 \
|
||||
test1941 test1942 test1943 test1944 test1945 test1946 test1947 test1948 \
|
||||
test1955 test1956 test1957 test1958 test1959 test1960 test1964 \
|
||||
test1970 test1971 test1972 test1973 test1974 test1975 test1976 \
|
||||
test1970 test1971 test1972 test1973 test1974 test1975 test1976 test1977 \
|
||||
\
|
||||
test2000 test2001 test2002 test2003 test2004 test2005 \
|
||||
\
|
||||
|
|
|
|||
62
tests/data/test1977
Normal file
62
tests/data/test1977
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
CURLOPT_CURLU
|
||||
CURLINFO_EFFECTIVE_URL
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<data nocheck="yes">
|
||||
HTTP/1.1 200 OK
|
||||
Date: Tue, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes swsclose
|
||||
|
||||
</data>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
CURLOPT_CURLU and CURLINFO_EFFECTIVE_URL
|
||||
</name>
|
||||
<tool>
|
||||
lib%TESTNUMBER
|
||||
</tool>
|
||||
|
||||
# The test does three transfers to check how CURLINFO_EFFECTIVE_URL is reported
|
||||
# when CURLOPT_CURLU changes between transfers. (Bug #15984)
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
</command>
|
||||
</client>
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<stdout>
|
||||
effective URL: http://%HOSTIP:%HTTPPORT/%TESTNUMBER
|
||||
effective URL: http://%HOSTIP:%HTTPPORT/%TESTNUMBER?foo
|
||||
effective URL: http://%HOSTIP:%HTTPPORT/%TESTNUMBER?foo&bar
|
||||
</stdout>
|
||||
<protocol>
|
||||
GET /%TESTNUMBER HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
|
||||
GET /%TESTNUMBER?foo HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
|
||||
GET /%TESTNUMBER?foo&bar HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
Loading…
Add table
Add a link
Reference in a new issue