Re: How to dry-run a http request
Jeroen Ooms via curl-library <[email protected]>
| Newsgroups | gmane.comp.web.curl.library |
|---|---|
| Message-ID | <CABFfbXvXC64ZcWKp+Vy+UgU78nX02DESVUeKXeMToL_QN2o6=w@mail.gmail.com> |
On Sat, Feb 15, 2025 at 8:59 PM Dan Fandrich via curl-library <[email protected]> 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