cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Close callback [Discussion]

From: Ingo Krabbe <ikrabbe.ask_at_web.de>
Date: Sat, 8 Mar 2008 11:56:44 +0100

So lets discuss on the base of this example now:

To finish the Program you simple need to close stdin, for example by pressing
^D or by piping some input.

echo "" | ./test-it

I send head 25 HEAD requests to your curl.haxx.se Server:

http://curl.haxx.se/download/curl-7."%d".0.tar.bz2

where "%d" is counted from 0 to 24 to see which packages are in your download
area.

Lets assume I modify this command to feed a database table (quite senseless of
course but near to real examples) to cache each day what 7.X Versions of your
library can be found on your server.

create table CurlVersions (
        URL char(1024) primary key,
        http_code int,
        index(http_code)
);

Now I want to read the HTTP Head you send me, and evaluate the return code and
to feed my database table:

replace into CurlVersions values ( URL, http_code );

Now I could find out all existing URLS by

select URL from CurlVersions where http_code = 200;

======================================================

So far, so good. The example could be extended by such database interaction
by writing a database command for each returned HTTP code in
the "incoming_list" function (section 10). I could call here a database
function when I write the log line and this example would work.

But if we extent this example not only to HEAD requests but to real GET/POST
requests with some content, I would like to wait for the content to complete
and process it then, to execute some processed command (like the sql commands
above).

Now my question is: Where Do I find the readiness of the URL request here ?

Again: I know I can find out this by simulation of signals, but I really ask,
why I don't get signalled by libcURL. This signal could be done by calling
the socket_cb with CURL_POLL_REMOVE when nothing more is scheduled for the
opened socket.

What you currently do is to call socket_cb with REMOVE also when the
processing changes from OUT to IN.

bye ingo
Received on 2008-03-08