curl-users
Re: Fwd: Question on CURLE_RECV_ERROR (56)
Date: Mon, 15 Jan 2018 13:12:02 +0530
@Daniel
>> You get a HTTP response 407 back and libcurl returns CURLE_OK.
*libcurl does not return CURLE_OK, instead it returns CURLE_RECV_ERROR.
Below is the verbose extract for my application using libcurl.*
* STATE: INIT => CONNECT handle 0x742680a620; line 1423 (connection #-5000)
* Added connection 0. The cache now contains 1 members
* Trying 127.0.0.1...
* TCP_NODELAY set
* STATE: CONNECT => WAITCONNECT handle 0x742680a620; line 1475 (connection
#0)
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0* Connected to 127.0.0.1 (127.0.0.1) port 8888 (#0)
* STATE: WAITCONNECT => WAITPROXYCONNECT handle 0x742680a620; line 1592
(connection #0)
* Marked for [keep alive]: HTTP default
* allocate connect buffer!
* Establish HTTP proxy tunnel to yahoo.com:443
> CONNECT yahoo.com:443 HTTP/1.1
Host: yahoo.com:443
Proxy-Connection: Keep-Alive
< HTTP/1.1 407 Proxy Auth Required
< Connection: close
< Proxy-Authenticate: Basic realm="FiddlerProxy (user: 1, pass: 1)"
< Content-Type: text/html
<
* Connect me again please
* CONNECT phase completed!
* multi_done
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0
* Connection #0 to host 127.0.0.1 left intact
* STATE: WAITPROXYCONNECT => CONNECT handle 0x742680a620; line 1563
(connection #-5000)
* Found bundle for host yahoo.com: 0x742681e330 [serially]
* Connection #0 isn't open enough, can't reuse
* Added connection 1. The cache now contains 2 members
* Hostname 127.0.0.1 was found in DNS cache
* Trying 127.0.0.1...
* TCP_NODELAY set
* STATE: CONNECT => WAITCONNECT handle 0x742680a620; line 1475 (connection
#1)
* Connected to 127.0.0.1 (127.0.0.1) port 8888 (#1)
* STATE: WAITCONNECT => WAITPROXYCONNECT handle 0x742680a620; line 1592
(connection #1)
* Marked for [keep alive]: HTTP default
* allocate connect buffer!
* Establish HTTP proxy tunnel to yahoo.com:443
* Proxy auth using Basic with user '11'
> CONNECT yahoo.com:443 HTTP/1.1
Host: yahoo.com:443
Proxy-Authorization: Basic MTE6MTE=
Proxy-Connection: Keep-Alive
< HTTP/1.1 407 Proxy Auth Required
< Connection: close
< Proxy-Authenticate: Basic realm="FiddlerProxy (user: 1, pass: 1)"
* Authentication problem. Ignoring this.
< Content-Type: text/html
<
* Marked for [closure]: proxy CONNECT failure
* Received HTTP code 407 from proxy after CONNECT
* CONNECT phase completed!
* Expire cleared
* multi_done
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0
* Closing connection 1
* The cache now contains 1 members
On Mon, Jan 15, 2018 at 3:13 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Sun, 14 Jan 2018, ghanashyam satpathy via curl-users wrote:
>
> Here is the verbose output using fiddler proxy(basic-auth) with invalid
>> credentials.
>>
>> curl -v -x http://127.0.0.1:8888 --proxy-user foo:bar --proxy-basic
>>> http://
>>>
>> google.com"
>>
>
> Ah right! Yes, now I get it.
>
> libcurl atually doesn't return any error at all for this. You get a HTTP
> response 407 back and libcurl returns CURLE_OK. That curl command line thus
> returns a zero return code.
>
> You can make the command return a failure by adding --fail. It will then
> return 22 (CURLE_HTTP_RETURNED_ERROR) for this case
>
> I don't understand why you'd get a CURLE_RECV_ERROR. Your curl command
> line didn't say it exited with error 56, did it?
>
> --
>
> / daniel.haxx.se
>
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-01-15