cURL / Mailing Lists / curl-users / Single Mail

curl-users

No Errorcode in commandline will be returned even http errors occ ured

From: TP <thomas.prager_at_kirchnersoft.com>
Date: Wed, 25 Oct 2006 16:19:58 +0200

Hello,

I´m using curl für commandline (Version 7.15.4). When I try to upload to a
http - webspace i see the error "HTTP/1.1 401 Unauthorized" but the
returncode is 0, although the comandlineparameter -f is set.

D:\tmp>curl -f -s -S -v --upload-file sepp.plc http://192.168.1.100
* About to connect() to 192.168.1.100 port 80
* Trying 192.168.1.100... connected
* Connected to 192.168.1.100 (192.168.1.100) port 80
> PUT /sepp%2Eplc HTTP/1.1
> User-Agent: curl/7.15.4 (i586-pc-mingw32msvc) libcurl/7.15.4 zlib/1.2.2
> Host: 192.168.1.100
> Accept: */*
> Content-Length: 1011
> Expect: 100-continue
>
< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: BASIC Realm=Authenticated RTS webSERVER Site
< Content-Type: text/html
* Connection #0 to host 192.168.1.100 left intact
* Closing connection #0

D:\tmp>echo %errorlevel%
0

I know that in this case the http - Server threws 2 responses

first response
>>HTTP/1.1 100 CONTINUE
Connection: close
Server: RTS-HTTPD $Revision: 1.5 $
Content-Type: text/html

<html><head>The operation succeeded with success code
100</head><body><h1>The op
eration succeeded with success code 100</h1></body></html><<

2nd response
>>HTTP/1.1 403 FORBIDDEN
Connection: close
Server: RTS-HTTPD $Revision: 1.5 $
Content-Type: text/html

I will get a returncode not equal to zero if the webserver threw only one
response with the error.

How can I detect this error from the commandline?
Please help

Kind regards
thomas
Received on 2006-10-25