cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: "pull" aspect of multi interface not quite working properly

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 22 Jun 2007 23:24:24 +0200 (CEST)

On Fri, 22 Jun 2007, Allen Pulsifer wrote:

>> I also think both these changes are slightly too naive and simple-minded in
>> the way they just return instead of keeping some kind of state to be able
>> to get back to where they were in the next invoke
>
> I looked at that and it appeared to me that the state was already saved, and
> that the next time curl_multi_perform() was called, it would (eventually)
> return to the right place.

I don't think so. The case where we'd return instead of looping for
OpenSSL/libssh2 clearly needs treatment, as we would not get back to the
"proper" place again even if CURLM_CALL_MULTI_PERFORM is returned. The reason
is that we poll() (in transfer.c:Curl_readwrite()) the socket to know how or
if libcurl should act on it.

>>> while (easy->easy_handle->change.url_changed);
>
>> This was added to make libcurl properly deal with the (very rare) situation
>> when you get the new URL during the SSL handshake
>
> I note that the only time this change could possibly present an issue is if,
> when the program reaches the bottom of the loop, both change.url_changed and
> CURLM_STATE_COMPLETED==easy->state (which is the next and only thing tested
> after the loop) are both true. Is it possible for change.url_changed to be
> true when easy->state==CURLM_STATE_COMPLETED?

I don't think it can, no.

> curl_multi_perform() should also restart the loop without waiting on the
> socket. That is why the data_pending(conn) was placed at the top of the
> loop, to ensure this will happen.

Aha, I didn't see this move of the calling of data_pending. Please send a diff
-u for your suggestion and I'll look over it again.

> One troubling thing in the code is that there are a few functions like sftp
> that call Curl_read but only transfer.c appears to check data_pending(conn).

They don't do that anymore, but yes it was indeed reason for weirdness.

> How do those functions deal with data in the SSL buffer?

Just FYI: sftp is a SSH-based protocol and thus built upon libssh2 (no SSL
there!)

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