cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Three state in the same Error code :-X

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 4 Oct 2007 09:47:49 +0200 (CEST)

On Thu, 4 Oct 2007, Sebastien WILLEMIJNS wrote:

>> I don't know windows land very well so I can't really advice on tools to
>> use, but I thought there are such that can tell what system calls that fail
>> or not, and then you can analyze the network traffic to see what goes on
>> there or not.
>
> i can give you a (big) ethereal log if you want ;)

No thanks, but I'd love your analysis of that log.

>> You're oversimplificating this problem. A timeout is something that took
>> longer than it was allowed. There's actually nothing in the exit code or in
>> the description of it that says it strictly only applies to "a user
>> request".
>
> when i use "-m 1" i think it is me i ask to stop curl after 1 second of
> download :)

When you use "-m 1" you lower the default timeout to 1000 milliseconds, yes.
But when you didn't use -m 1, it still could timeout.

And do read my line there again: 'There's actually nothing in the exit code or
in the description of it that says it strictly only applies to "a user
request"'.

You're reading this as if this can only be returned if your latered timeout
has been reached, but that's not the intended functionality and that's why the
description of it doesn't say the timeout needs to be specified by the user.

I've never wanted to make that distinction and I still now don't quite see the
real benefit of offering two different return codes.

> they are in fact 2 bugs because error 28 gives three sentences...

That is not a bug, that's by design.

> In a classical software every error number will receive only 1 sentence (too
> many connexions, disk full, host not found, too small resolution, not sound
> card detected...)

Thanks for lecturing us on how "classical software" works and not. I don't
care. I want curl to work as good as possible and to act sensible.

> here for the same error code number 28 we have 3 sentences for the same
> number !!! two sentences about timeout and one sentence about user request
> (-m switch in commandline)

Yes, and that is in fact a feature and allows for applications to check the
mere return code to decide on actions, but the human readable string provides
additional information that can explain further what and why the error is for,
in this particular case.

> i maintain a software stopping asked by a user request *MUST* not have the
> same error number than an software which has been stopped by any kind of
> timeout not asked by the user !

Then I suggest the following procedure:

#1 - join the curl-library list and advocate for your idea that we should have
      a unique timeout return code if a timeout is reached when modified by the
      application, as opposed to the default values.

#2 - work with us to alter the code to make #1 reality

#3 - update the docs according to all this

#4 - submit the patch to curl-library

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