curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support. 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 Daniel himself.

Re: How to dry-run a http request

From: Jeroen Ooms via curl-library <curl-library_at_lists.haxx.se>
Date: Mon, 17 Feb 2025 18:53:54 +0100

On Sat, Feb 15, 2025 at 8:59 PM Dan Fandrich via curl-library
<curl-library_at_lists.haxx.se> wrote:
>
> On Sat, Feb 15, 2025 at 08:48:48PM +0100, Jeroen Ooms wrote:
> > The difficult part is that I need a callback function for the moment
> > where libcurl is done uploading (When curlopt_verbose says "Request
>
> There has been a proposal for a callback to provide events on a connection, but
> I don't recall where it currently stands.
>
> > completely sent off") such that I know I have received full request
> > data and can close() the socket at that point.
>
> You can probably get away with just the timeout scheme I suggested. If you set
> high (or infinite) values for all timeouts then the transfer will never
> complete, except that it MUST timeout to complete because there's no server
> there and there will never be a response. So, if you set a minimum timeout for
> CURLOPT_SERVER_RESPONSE_TIMEOUT_MS, the timeout should immediately be hit after
> the request is sent and the request will complete.

This is perhaps a tangent, but I could not get
CURLOPT_SERVER_RESPONSE_TIMEOUT_MS to do anything at all.

For example, I start a netcat server:

    nc -l -k 2233

And then make a request to "http://localhost:2233" with
CURLOPT_SERVER_RESPONSE_TIMEOUT set to 1, we see that the request is
sent to netcat and then it hangs, waiting for the server to respond.
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2025-02-17