mirror of
https://github.com/curl/curl.git
synced 2026-08-05 22:26:14 +03:00
url: don't assume all transfers have hostnames
Follow-up from 412cd2577a
Add test 1659 to verify --connect-to when doing file:// transfers.
Reported-by: James Fuller
Closes #20948
This commit is contained in:
parent
1e3c2bec7e
commit
b98981e16b
3 changed files with 31 additions and 4 deletions
|
|
@ -2749,8 +2749,9 @@ static CURLcode parse_connect_to_string(struct Curl_easy *data,
|
|||
/* check whether the URL's hostname matches. Use the URL hostname
|
||||
* when it was an IPv6 address. Otherwise use the connection's hostname
|
||||
* that has IDN conversion. */
|
||||
char *hostname_to_match = (data->state.up.hostname[0] == '[') ?
|
||||
data->state.up.hostname : conn->host.name;
|
||||
char *hostname_to_match =
|
||||
(data->state.up.hostname && data->state.up.hostname[0] == '[') ?
|
||||
data->state.up.hostname : conn->host.name;
|
||||
size_t hlen = strlen(hostname_to_match);
|
||||
host_match = curl_strnequal(ptr, hostname_to_match, hlen);
|
||||
ptr += hlen;
|
||||
|
|
|
|||
|
|
@ -221,8 +221,7 @@ test1630 test1631 test1632 test1633 test1634 test1635 test1636 test1637 \
|
|||
test1640 test1641 test1642 test1643 \
|
||||
\
|
||||
test1650 test1651 test1652 test1653 test1654 test1655 test1656 test1657 \
|
||||
test1658 \
|
||||
test1660 test1661 test1662 test1663 test1664 test1665 \
|
||||
test1658 test1659 test1660 test1661 test1662 test1663 test1664 test1665 \
|
||||
\
|
||||
test1670 test1671 \
|
||||
\
|
||||
|
|
|
|||
27
tests/data/test1659
Normal file
27
tests/data/test1659
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="US-ASCII"?>
|
||||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
--connect-to
|
||||
FILE
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
<client>
|
||||
<features>
|
||||
file
|
||||
</features>
|
||||
<name>
|
||||
--connect-to when using file:// URL
|
||||
</name>
|
||||
<command>
|
||||
file://localhost%FILE_PWD/%LOGDIR/test%TESTNUMBER.txt --connect-to localhost:8080:localhost:8080
|
||||
</command>
|
||||
<file name="%LOGDIR/test%TESTNUMBER.txt">
|
||||
1234567890
|
||||
</file>
|
||||
</client>
|
||||
|
||||
<verify>
|
||||
</verify>
|
||||
</testcase>
|
||||
Loading…
Add table
Add a link
Reference in a new issue