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

Windows: no_proxy environment variable ignored when longer than (258) chars #4174

Closed
myfonj opened this issue Jul 30, 2019 · 1 comment

Comments

@myfonj
Copy link

@myfonj myfonj commented Jul 30, 2019

I did this

no_proxy (user) environment variable on my machine is 966 characters long [1] and http_proxy and https_proxy variables set. I've observed that as long as I keep no_proxy length above 258 characters, cURL requests are always passed to proxy on my system.

cURL calls with 258 and 259 characters long `no_proxy` environment variable in my CMD:
C:\apps\cmd>set no_proxy=localhost,127.0.0.*,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

C:\apps\cmd>curl --location --head http://localhost/
HTTP/1.1 200 OK
Date: Tue, 30 Jul 2019 15:46:25 GMT
Server: Apache/2.4.37 (Win64) PHP/7.3.3
Last-Modified: Thu, 18 Jul 2019 15:02:45 GMT
ETag: "2000-58df5e7002ac0"
X-Clacks-Overhead: GNU Terry Pratchett
Content-Type: text/html;charset=UTF-8

C:\apps\cmd>set no_proxy=localhost,127.0.0.*,aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

C:\apps\cmd>curl --location --head http://localhost/
HTTP/1.1 503 Service Unavailable
Server: squid/(...)
(...)

I expected

Both cURL calls had the same outcome.

curl -V

7.65.3
curl 7.65.3 (x86_64-pc-win32) libcurl/7.65.3 OpenSSL/1.1.1c (Schannel) zlib/1.2.11 brotli/1.0.7 WinIDN libssh2/1.9.0 nghttp2/1.39.1
Release-Date: 2019-07-19
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile MultiSSL NTLM SPNEGO SSL SSPI TLS-SRP brotli libz

Operating system

Windows 10, 10.0.16299, build 1709

Notes

System settings GUI for (user) environment variable allows 2047 characters on my system.


[1] don't ask why; just copied what was in the Network settings GUI (inetcpl.cpl) in Exceptions field, replaced semicolons and added it to my CMDer user_profile.cmd script an/or User Environment Variables settings panel as no_proxy entry.

@bagder

This comment has been minimized.

Copy link
Member

@bagder bagder commented Jul 30, 2019

Oh... and here's the explanation:

char env[MAX_PATH]; /* MAX_PATH is from windef.h */

We should expand that array quite a bit...

bagder added a commit that referenced this issue Jul 30, 2019
Reported-by: Michal Čaplygin
Fixes #4174
@bagder bagder closed this in b7d1264 Jul 31, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.