← Commit list

b98981e16b

Daniel Stenberg
Daniel Stenberg
2026-03-17
SUCCESS Duration: 312s

Subject

url: don't assume all transfers have hostnames

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/url.c+3 -2
@@ -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;
tests/data/Makefile.am+1 -2
@@ -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 \
\
tests/data/test1659+27 -0
@@ -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>