curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Detection of failed connection

From: Ray Satiro via curl-library <curl-library_at_lists.haxx.se>
Date: Wed, 3 Jan 2024 14:39:19 -0500

On 1/3/2024 5:34 AM, Ali Nasir via curl-library wrote:
> * Connected to host.docker.internal (192.168.65.2) port 80 (#0)
> > POST /upload HTTP/1.1
> Host: host.docker.internal
> Accept: */*
> Shoesize: 10
> Content-Length: 321
> Content-Type: multipart/form-data;
> boundary=------------------------b2b856525299ec0a
>
> * We are completely uploaded and fine
>
> Multi Perform exit with code 0, still running 1
>
> Multi poll : 0
>  Queued 0
>
> Multi Perform exit with code 0, still running 1
>
> Multi poll : 0
>  Queued 0
>
> Multi Perform exit with code 0, still running 1
>
> Multi poll : 0
>  Queued 0
>
> Multi Perform exit with code 0, still running 1
>
> Multi poll : 0
>  Queued 0
> * Mark bundle as not supporting multiuse
> * HTTP 1.0, assume close after body
> < HTTP/1.0 403 connecting to host.docker.internal:80: connecting to
> 127.0.0.1:80 <http://127.0.0.1:80>: dial tcp 127.0.0.1:80
> <http://127.0.0.1:80>: connectex: No c
> onnection could be made because the target machine actively refused it.
> < Connection: close
> <
> connecting to host.docker.internal:80: connecting to 127.0.0.1:80
> <http://127.0.0.1:80>: dial tcp 127.0.0.1:80 <http://127.0.0.1:80>:
> connectex: No connection could be made because t
> he target machine actively refused it.
> Multi Perform exit with code 0, still running 1
> Multi poll : 0
>  Queued 0
> * Closing connection 0
> Multi Perform exit with code 0, still running 0
> Multi poll : 0
>  Queued 0
> Curl code 0
> Transfer completed
>  Queued 0
> ERRNO 0
>
> If we see the output, all the methods are returning 0, although there
> is a message (due to verbose enabled) that the machine refused the
> connection.


Please don't top-post, it makes the conversation hard to follow [1].
That error message is from the server and not curl. As far as curl is
concerned the transfer completed successfully. The server is returning a
HTTP/1.0 403 response error however curl does not return error for HTTP
non-200 responses unless you ask for it [2]. You can tell curl to error
on HTTP response errors by using --fail [3] for the curl tool and
CURLOPT_FAILONERROR [4] for libcurl.


[1]: https://curl.se/mail/etiquette.html#Do_Not_Top_Post
[2]: https://curl.se/docs/faq.html#curl_does_not_return_error_for_H
[3]: https://curl.se/docs/manpage.html#-f
[4]: https://curl.se/libcurl/c/CURLOPT_FAILONERROR.html


-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2024-01-03