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

CONNECT over proxy to non-existing host fails #217

Closed
peterlaser opened this issue Apr 14, 2015 · 8 comments
Closed

CONNECT over proxy to non-existing host fails #217

peterlaser opened this issue Apr 14, 2015 · 8 comments
Assignees
Labels

Comments

@peterlaser
Copy link

There a regression after Bug fix: http://curl.haxx.se/mail/lib-2015-01/0170.html
The issue reproduce steps is below:
1.enable local proxy
2 input an unresolvable server address in Client to connect
Result:
The process will be hanging until an error message is prompted

The code used some happy eyeballs logic even after CONNECT has been
sent to a proxy, while the happy eyeball phase is already (should be)
over by then.

This is solved by splitting the multi state into two separate states
introducing the new SENDPROTOCONNECT state.

We reported that timeout issue to you, and the issue disappeared after our own fix was used instead of yours. Looks it was hung in the select poll of curl, see the below stack with your patch:

WARNING: Stack unwind information not available. Following frames may be wrong.
001bdc4c 756d6a28 000006d5 001bdf48 00000000 ntdll32!NtDeviceIoControlFile+0x15
001bdccc 522b218e 000006d5 001bdf48 00000000 WS2_32!select+0x9f
001be064 522986a2 000006d4 ffffffff ffffffff libcurl!Curl_socket_check+0x47e [d:\build\win32\curl-7.41.0\curl-7.41.0\lib\select.c @ 327]
001be134 5229816f 06bec540 00000000 06becc50 libcurl!Curl_proxyCONNECT+0x492 [d:\build\win32\curl-7.41.0\curl-7.41.0\lib\http_proxy.c @ 233]
001be1c4 522929c1 06bec540 cccccccc 001be2e0 libcurl!Curl_proxy_connect+0x8f [d:\build\win32\curl-7.41.0\curl-7.41.0\lib\http_proxy.c @ 74]
001be1d4 522a2d5c 06bec540 001be2bc 001be324 libcurl!Curl_http_connect+0x21 [d:\build\win32\curl-7.41.0\curl-7.41.0\lib\http.c @ 1391]
001be2e0 522a4bd8 06bef708 000ae2a9 000182b8 libcurl!multi_runsingle+0x5ec [d:\build\win32\curl-7.41.0\curl-7.41.0\lib\multi.c @ 1181]
001be324 522a4d62 06bef708 00000000 000006d4 libcurl!multi_socket+0x198 [d:\build\win32\curl-7.41.0\curl-7.41.0\lib\multi.c @ 2270]
001be344 004d2518 06bef708 000006d4 00000000 libcurl!curl_multi_socket_action+0x22 [d:\build\win32\curl-7.41.0\curl-7.41.0\lib\multi.c @ 2416]

@peterlaser
Copy link
Author

The original fixed bug http://sourceforge.net/p/curl/bugs/1479/

@bagder
Copy link
Member

bagder commented Apr 14, 2015

Can you please help us and describe the issue more? That stack trace isn't helping us a whole lot without more info. The best case would be if you can provide source code and a scenario on how to repeat it!

@bagder bagder self-assigned this Apr 14, 2015
@peterlaser
Copy link
Author

Hi Daniel,
The reproduce steps is below:
1.Enable proxy in client host
2 Input an invalid server address in our client to connect

Result:
The process will be hanging until an error message is prompted
Thanks!

 On Tuesday, April 14, 2015 4:16 PM, Daniel Stenberg <notifications@github.com> wrote:

Can you please help us and describe the issue more? That stack trace isn't helping us a whole lot without more info. The best case would be if you can provide source code and a scenario on how to repeat it!—
Reply to this email directly or view it on GitHub.

@bagder bagder added HTTP and removed needs-info labels Apr 14, 2015
@bagder
Copy link
Member

bagder commented Apr 17, 2015

Something like this?

 curl -p -x localhost:80 non-existing.haxx.se -v

In your case, what does the proxy respond? I could not repeat the problem, I need more details.

@peterlaser
Copy link
Author

Hi Daniel,
Do you have applied the patch for http://sourceforge.net/p/curl/bugs/1479/ in your curl executable file? It should be only repro after the patch checked in.
I have not the curl executable file in hand, Could you please provide the build to me so that I can try it in my host? Thanks.

@bagder
Copy link
Member

bagder commented Apr 20, 2015

I use the current git master. You can build your own from git or from a daily snapshot: http://curl.haxx.se/snapshots/ - I don't have any suitable executable to share.

@bagder bagder changed the title Subject: [PATCH] multi: fix *getsock() with CONNECT CONNECT over proxy to non-existing host fails Apr 20, 2015
@peterlaser
Copy link
Author

Hi Daniel,
I tried curl 7.42 executable from http://www.paehl.com/open_source/downloads/curl_X64_ssl.7z
The main thread will be hang for a while after Proxy-Connection: Keep-Alive below, please let me know if there is a way to collect the curl executable logs or need additional information, thanks.

C:\curl_X64_ssl\openssl>curl -x proxy.xx.xx:3128 -v https://

  • Rebuilt URL to: https://10.117.46.1/
  • Trying x.x.x.x...
  • Connected to x.x.x.x port 3128 (#0)
  • Establish HTTP proxy tunnel to 10.117.46.1:443

    CONNECT 10.117.46.1:443 HTTP/1.1
    Host: 10.117.46.1:443
    User-Agent: curl/7.42.0
    Proxy-Connection: Keep-Alive

The main thread will be hang for a while in here

< HTTP/1.0 503 Service Unavailable
< Server: squid/2.6.STABLE21
< Date: Thu, 23 Apr 2015 06:03:52 GMT
< Content-Type: text/html
< Content-Length: 1074
< Expires: Thu, 23 Apr 2015 06:03:52 GMT
< X-Squid-Error: ERR_CONNECT_FAIL 110
<

  • Received HTTP code 503 from proxy after CONNECT
  • Closing connection 0
    curl: (56) Received HTTP code 503 from proxy after CONNECT

@dfandrich
Copy link
Contributor

On Wed, Apr 22, 2015 at 11:12:31PM -0700, peterlaser wrote:

Hi Daniel,
I tried curl 7.42 executable from http://www.paehl.com/open_source/downloads/
curl_X64_ssl.7z
The main thread will be hang for a while after Proxy-Connection: Keep-Alive
below, please let me know if there is a way to collect the curl executable logs
or need additional information, thanks.

C:\curl_X64_ssl\openssl>curl -x proxy.xx.xx:3128 -v https://

• Rebuilt URL to: https://10.117.46.1/
• Trying x.x.x.x...
• Connected to x.x.x.x port 3128 (#0)
• Establish HTTP proxy tunnel to 10.117.46.1:443 > CONNECT 10.117.46.1:443
HTTP/1.1 > Host: 10.117.46.1:443 > User-Agent: curl/7.42.0 >
Proxy-Connection: Keep-Alive >

The main thread will be hang for a while in here

< HTTP/1.0 503 Service Unavailable
< Server: squid/2.6.STABLE21
< Date: Thu, 23 Apr 2015 06:03:52 GMT
< Content-Type: text/html
< Content-Length: 1074
< Expires: Thu, 23 Apr 2015 06:03:52 GMT
< X-Squid-Error: ERR_CONNECT_FAIL 110
<

  □ Received HTTP code 503 from proxy after CONNECT
  □ Closing connection 0 curl: (56) Received HTTP code 503 from proxy after
    CONNECT

This sounds like perfectly normal behaviour if the proxy is unable to reach the
server. Once the proxy times out trying, it will return the error code that
curl reports.

Dan

@bagder bagder closed this as completed May 10, 2015
@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

3 participants