curl-users
return code of curl -O BLAH
Date: Sat, 5 Jun 2004 13:15:00 -0700
if BLAH does not exist... why does curl return a successful operation?
I saw the post (appended below) which addresses a similar issue.
Maybe I am not seeing the light on the policy decision involved.
In a script, should one verify the existence of a particular URL,
in effect testing if it exists, before invoking curl?
Thx!
##
> From: Daniel Stenberg (Daniel.Stenberg_at_haxx.se)
> Date: 1999-12-28 14:38:45 MET
>
> On Mon, 27 Dec 1999, Rainer Sigl wrote:
>
>> I am running curl 5.8 (i686-pc-linux-gnu) libcurl 5.8 (SSL disabled)
>
> Ok, this is not a version dependent thing. This is general curl
> philosophy.
>
>> Siju@Sputnic:~ > curl -O http://www.mircosoft.com/linux.tgz
>> 162 bytes received in 0.646 seconds (251 bytes/sec)
>> Siju_at_Sputnic:~ > echo $?
>> 0
>>
>> That url dosen't exist. But the return code is 0. The retrun from the
>> http-server will not been seen.
>
> This sure is a question of what is right and what is wrong. The return
> codes
> from curl indicate curl problems. When curl gets a page like the
> above, curl
> doesn't really care what kind of page it gets back, as long as the
> operation
> in itself works. In this case, it works.
>
> To find the return code from the server, check out the first line of
> the
> server's response (the first header line).
>
>> The same problem I have when the server broke down his connection
>> while
>> downloading.
>
> That's a whole different story. A broken download is a problem with
> the curl
> operation and should return an error. In some cases, where the server
> doesn't
> use the Content-Length: header, curl can't tell the size on
> before-hand and
> therefore it has no means to tell if the download was prematurely
> aborted or
> not.
>
> Get a much newer version and retry this
> not-telling-when-the-download-is-
> aborted bug. If you can repeat it with 6.3.1 I'd be very interesting in
> getting verbose details.
>
> --
> Daniel Stenberg - http://www.contactor.se/~dast
> ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol
>
Received on 2004-06-05