curl-users
Curl returns exit code 18 for remote file
Date: Tue, 2 Aug 2011 11:00:01 -0400 (EDT)
curl 7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b
zlib/1.2.3 libidn/0.6.5
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
I am using ftp through Curl on a CentOS-5.6 based client to check
for the existence of a particular file on a remote host immediately
following an attempted transfer of that file via Curl within the
same script. The remote host is not a *nix box and its ftp server
is both idiosyncratic and quite old.
This is what I am seeing.
curl --disable-epsv \
--ignore-content-length \
--silent \
--use-ascii \
ftp://user.account@host.harte-lyne.ca/CCBROKMT
* About to connect() to host.harte-lyne.ca port 21
* Trying 168.192.1.102... connected
* Connected to host.harte-lyne.ca (168.192.1.102) port 21
< 220 HP ARPA FTP Server [A0012H15] (C) Hewlett-Packard Co. 2000
[PASV SUPPORT]
> USER ccbrokmd.hartlyne
< 331 Password required for CCBROKMD.HARTLYNE. Syntax:
userpass,acctpass
> PASS xxx,yyy
< 230 User logged on
> PWD
< 257 "/HARTLYNE/CADEXJOB" is the current directory.
* Entry path is '/HARTLYNE/CADEXJOB'
> PASV
* Connect data stream passively
< 227 Entering Passive Mode (168,192,1,102,228,30)
* Trying 168.192.1.102... connected
* Connecting to 168.192.1.102 (168.192.1.102) port 58398
> TYPE A
< 200 Type set to A.
> SIZE CCBROKMT
< 213 "CCBROKMT": 80 bytes
> RETR CCBROKMT
< 150 File: CCBROKMT opened; data connection will be opened
* Getting file with size: 0
% Total % Received % Xferd Average Speed Time Time
Time Current
Dload Upload Total Spent
Left Speed
0 82 0 82 0 0 74 0 --:--:-- 0:00:01
--:--:-- 74*
transfer closed with -82 bytes remaining to read
* Received only partial file: 82 bytes
0 82 0 82 0 0 74 0 --:--:-- 0:00:01
--:--:-- 0*
Closing connection #0
curl: (18) transfer closed with -82 bytes remaining to read
However, the file in fact does exist and does contain the data
previously sent. This is a unit record host and so the file has the
characteristics of comprising one 80 byte ASCII encoded record.
My question then is: Why am I receiving a return code of 18 and a
partial file error/warning instead of a simple 0 return code? Is
this an artifact of the --ignore-content-length option. Is that
option even material given an ftp transfer?
The problem that I want solved is simply to confirm via ftp that the
file name exists on the target host. So, if this is accomplished in
some other way with curl I would appreciate being informed as to how
that is done.
-- *** E-Mail is NOT a SECURE channel *** James B. Byrne mailto:ByrneJB_at_Harte-Lyne.ca Harte & Lyne Limited http://www.harte-lyne.ca 9 Brockley Drive vox: +1 905 561 1241 Hamilton, Ontario fax: +1 905 561 0757 Canada L8E 3C3 ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-users FAQ: http://curl.haxx.se/docs/faq.html Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2011-08-02