Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy information reported as (nil) in verbose logs #9937

Closed
astamp opened this issue Nov 17, 2022 · 1 comment
Closed

Proxy information reported as (nil) in verbose logs #9937

astamp opened this issue Nov 17, 2022 · 1 comment
Assignees

Comments

@astamp
Copy link

astamp commented Nov 17, 2022

Hello,

We recently upgraded to curl 7.86.0 from 7.84.0 and noticed that the proxy information is not being reported correctly in the log messages.

swgroup@fwdev2-astamp:~/ES2$ http_proxy=http://192.168.2.1:8080 ./curl-7.86.0/src/curl -sv google.com -o /dev/null
* Uses proxy env variable http_proxy == 'http://192.168.2.1:8080'
*   Trying 192.168.2.1:8080...
* Connected to (nil) (192.168.2.1) port 8080 (#0)
> GET http://google.com/ HTTP/1.1

where 7.84.0 shows the proxy info correctly.

swgroup@fwdev2-astamp:~/ES2$ http_proxy=http://192.168.2.1:8080 ./curl-7.84.0/src/curl -sv google.com -o /dev/null
* Uses proxy env variable http_proxy == 'http://192.168.2.1:8080'
*   Trying 192.168.2.1:8080...
* Connected to 192.168.2.1 (192.168.2.1) port 8080 (#0)
> GET http://google.com/ HTTP/1.1
swgroup@fwdev2-astamp:~/ES2$ http_proxy=http://192.168.2.1:8080 ./curl-7.86.0/src/curl -sv google.com -o /dev/null
* Uses proxy env variable http_proxy == 'http://192.168.2.1:8080'
*   Trying 192.168.2.1:8080...
* Connected to (nil) (192.168.2.1) port 8080 (#0)
> GET http://google.com/ HTTP/1.1

Notice Connected to (nil) (192.168.2.1) port 8080 (#0) in 7.86 vs. Connected to 192.168.2.1 (192.168.2.1) port 8080 (#0) in 7.84.

Both versions of curl were configured with:

./configure --prefix=/home/swgroup --with-openssl --enable-verbose

It appears to be related to this commit: 53bcf55

In lib/url.c the calls to Curl_idnconvert_hostname were moved to parseurlandfillconn() which is called before create_conn_helper_init_proxy in create_conn.
While we are not using libidn2, Curl_idnconvert_hostname is where the dispname member of struct hostname is populated.
Since the calls are gated by conn->bits.httpproxy/conn->bits.socksproxy, the names are not converted since the bits are only set in create_conn_helper_init_proxy.

I'm not sure how to resolve this and still maintain the changes for HSTS needed for that commit, otherwise I'd propose a patch.

Thanks,
--Andy

I did this

With a proxy running at the specified info:

$ http_proxy=http://192.168.2.1:8080 ./curl-7.86.0/src/curl -sv google.com -o /dev/null

I expected the following

I expected to see Connected to 192.168.2.1 (192.168.2.1) port 8080 (#0) as is observed in curl 7.84.0.
but instead received: Connected to (nil) (192.168.2.1) port 8080 (#0)

curl/libcurl version

$ ./curl-7.86.0/src/curl -V
curl 7.86.0 (x86_64-pc-linux-gnu) libcurl/7.86.0 OpenSSL/1.0.2g zlib/1.2.8
Release-Date: 2022-10-26
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS HSTS HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL threadsafe TLS-SRP UnixSockets

operating system

Linux, but also observed in QNX.

$ uname -a
Linux fwdev2-astamp 4.4.0-112-generic #135-Ubuntu SMP Fri Jan 19 11:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
@bagder bagder self-assigned this Nov 17, 2022
@bagder
Copy link
Member

bagder commented Nov 17, 2022

I can reproduce

bagder added a commit that referenced this issue Nov 17, 2022
Regression: in commit 53bcf55 we moved the IDN conversion calls to
happen before the HSTS checks. But the HSTS checks are only done on the
server host name, not the proxy names. By moving the proxy name IDN
conversions, we accidentally broke the verbose output showing the proxy
name.

This change moves back the IDN conversions for the proxy names to the
place in the code path they were before 53bcf55.

Reported-by: Andy Stamp
Fixes #9937
@bagder bagder closed this as completed in 37ca6f0 Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants