cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: No callbacks during POST

From: Raf Nulens <raf.nulens_at_androme.com>
Date: Mon, 9 Jul 2007 10:39:58 +0200

Our purpose is to rely on socket- and timeout-callbacks in order to call
curl_multi_socket or curl_multi_socket_all. We don't want to have a
while(true) loop calling curl_multi_socket_all until all requests have
finished. In this particular case we don't get a callback after a part of
the buffer has been sent, so in our implementation curl_multi_socket or
curl_multi_socket_all is never called and therefore the upload stops.

Is it possible to use libcurl only by relying on socket- and
timeout-callbacks?

Or should there be a socket-callback triggered at the end of function
CURLcode Curl_readwrite(struct connectdata *conn, bool *done)?

Tnx for your help

Kind regards,

Raf Nulens

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: Friday, July 06, 2007 11:34 PM
To: libcurl development
Subject: Re: No callbacks during POST

On Wed, 4 Jul 2007, Raf Nulens wrote:

> using libcurl version 7.16.0 (win32) we are experiencing following
problem:
> when uploading binary data using POST the upload stops after having sent a

> few bytes (without having received a read- or socket-callback). So we
> repeaditly have to call curl_multi_socket_all to send the next part of the

> buffer.

So if you can get it to continue sending, what exactly does it mean when you

say "the upload stops" ?

> We have investigated this problem and it seems there is something wrong in

> transfer.c function CURLcode Curl_readwrite(struct connectdata *conn, bool

> *done) on line 1358 -> bool writedone=TRUE; It seems that writedone is
> initialized on true, and the only value writedone gets assigned is true...

> So the while loop (line 1369 to 1513 -> while(!writedone); ) can only be
> executed once.

That is, in fact, on purpose.

> Purpose of the while loop is to keep sending data until the buffer is
empty
> or an EWOULDBLOCK is returned from the socket. In our case in the first
> (and only) iteration there is some data sent from the buffer to the
socket,
> but not enough to get an EWOULDBLOCK back.

The (original) purpose of the loop was that, yes. But having it present
introduced problems, especially if you'd upload to somewhere that was fast
enough so that this loop more or less never blocked...

So I made it never loop and only execute once, and we've been happy with
that
since ages ago. The question is rather why you feel a need to change this
now
all of a sudden!?

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-07-09