cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Automated telnet problems

From: Pierre Brico <pierre.brico_at_tsdsoftware.eu>
Date: Wed, 11 Mar 2009 23:03:47 +0100

Hello guys,

Here is a patch for the second issue (libcurl didn't report error when
write_callback returns unexpected value):

$ diff /h/curl-7.19.5-20090311/lib/telnet.c telnet.c
111c111
< void telrcv(struct connectdata *,

---
> CURLcode telrcv(struct connectdata *,
955c955
< void telrcv(struct connectdata *conn,
---
> CURLcode telrcv(struct connectdata *conn,
963a964
>   CURLcode result;
966,967c967,971
<     if(startwrite >= 0) \
<        Curl_client_write(conn, CLIENTWRITE_BODY, (char
*)&inbuf[startwrite], in-startwrite); \
---
>     if(startwrite >= 0) { \
>        result = Curl_client_write(conn, CLIENTWRITE_BODY, (char
*)&inbuf[startwrite], in-startwrite); \
>        if (result != CURLE_OK) \
>           return result; \
>     } \
1121a1126,1127
>
>   return CURLE_OK;
1376c1382,1386
<         telrcv(conn, (unsigned char *)buf, nread);
---
>         code = telrcv(conn, (unsigned char *)buf, nread);
>         if(code) {
>           keepon = FALSE;
>           break;
>         }
1454c1464,1468
<         telrcv(conn, (unsigned char *)buf, nread);
---
>         code = telrcv(conn, (unsigned char *)buf, nread);
>         if(code) {
>           keepon = FALSE;
>           break;
>         }
Regards,
Pierre
On Wed, Mar 11, 2009 at 9:42 PM, Pierre Brico
<pierre.brico_at_tsdsoftware.eu>wrote:
> Hello,
>
> Thanks to Yang who has fixed my first issue (I tested it under Windows and
> it works). However, the behavior is different of what I was waiting for.
> Indeed, I though the timeout was computed between two calls of the
> write_callback function and not computed by subtracting current time from
> connected time.
> Is it possible to have a timeout only if the time between two consecutive
> calls to write_callback function is more than X seconds (I won't have a
> timeout if there's still activity) ?
>
> For my second issue, I will try to solve it by myself.
>
> Thanks for your help,
> Pierre
>
>
> On Wed, Mar 11, 2009 at 9:23 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
>
>> On Wed, 11 Mar 2009, Daniel Stenberg wrote:
>>
>>  Why is it a difference between Windows and Unix behaviour ? It shouldn't
>>>> be difficult to place a timeout of 1s for the WaitForMultipleObjects
>>>> function and to add a code similar to (the Unix code)
>>>>
>>>
>>> Any chance you can provide a full patch for this fix?
>>>
>>
>> Oops, I should learn to read all mails before I start replying - I noticed
>> that Yang already fixed this part...
>>
>> --
>>
>>  / daniel.haxx.se
>>
>
>
Received on 2009-03-11