curl / Mailing Lists / curl-users / Single Mail

curl-users

curl exit status on curl: (18) server did not report OK, got 426

From: Kevin R. Bulgrien <kevinb_at_systemsdesignusa.com>
Date: Thu, 21 Mar 2019 11:50:59 -0500 (CDT)

It seems I may have found a case where one cannot trust the exit status
to report a failed transfer. In this case, the file was truncated. Am
I missing something essential in my understanding of how to detect file
transfer errors?

Given the following shell script fragment:

  curl -v -k --use-ascii -u "${GET_USER}:${GET_PASS}" -o "${GET_DST}" \
    "ftps://${GET_HOST}${GET_PATH:+/}${GET_PATH}/${GET_SRC}"
  RET="${?}"
  echo
  echo "Result = ${RET}"

Why might I get "Result = 0" when the log reports an error:

* Trying xx.xx.xx.xx...
* TCP_NODELAY set
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to regionftp (xx.xx.xx.xx) port 990 (#0)
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
} [5 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.0 (IN), TLS handshake, Server hello (2):
{ [81 bytes data]
* TLSv1.0 (IN), TLS handshake, Certificate (11):
{ [1717 bytes data]
* TLSv1.0 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.0 (OUT), TLS handshake, Client key exchange (16):
} [262 bytes data]
* TLSv1.0 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.0 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.0 (IN), TLS change cipher, Change cipher spec (1):
{ [1 bytes data]
* TLSv1.0 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.0 / AES256-SHA
* Server certificate:
* subject: OU=Domain Control Validated; CN=*.xx.xx
* start date: Feb 5 15:50:15 2019 GMT
* expire date: Mar 8 20:21:38 2021 GMT
* issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certs.godaddy.com/repository/; CN=Go Daddy Secure Certificate Authority - G2
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
  0 0 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0{ [5 bytes data]
< 220-FileZilla Server version 0.9.41 beta
< 220-written by Tim Kosse (Tim.Kosse_at_gmx.de)
< 220 Please visit http://sourceforge.net/projects/filezilla/
} [5 bytes data]
> USER xxx
{ [5 bytes data]
< 331 Password required for xxx
} [5 bytes data]
> PASS xxx
{ [5 bytes data]
< 230 Logged on
} [5 bytes data]
> PBSZ 0
{ [5 bytes data]
< 200 PBSZ=0
} [5 bytes data]
> PROT P
{ [5 bytes data]
< 200 Protection level set to P
} [5 bytes data]
> PWD
{ [5 bytes data]
< 257 "/" is current directory.
* Entry path is '/'
} [5 bytes data]
> CWD xxxx
* ftp_perform ends with SECONDARY: 0
{ [5 bytes data]
< 250 CWD successful. "/xxxx" is current directory.
} [5 bytes data]
> EPSV
* Connect data stream passively
{ [5 bytes data]
< 229 Entering Extended Passive Mode (|||5004|)
* Trying xx.xx.xx.xx...
* TCP_NODELAY set
* Connecting to xx.xx.xx.xx (xx.xx.xx.xx) port 5004
* Connected to regionftp (xx.xx.xx.xx) port 990 (#0)
} [5 bytes data]
> TYPE A
{ [5 bytes data]
< 200 Type set to A
} [5 bytes data]
> SIZE xxxxx
{ [5 bytes data]
< 213 310225
} [5 bytes data]
> RETR xxxxx
{ [5 bytes data]
< 150 Connection accepted
* Maxdownload = -1
* Getting file with size: -1
* Doing the SSL/TLS handshake on the data stream
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* SSL re-using session ID
} [5 bytes data]
* TLSv1.0 (OUT), TLS handshake, Client hello (1):
} [232 bytes data]
* TLSv1.0 (IN), TLS handshake, Server hello (2):
{ [81 bytes data]
* TLSv1.0 (IN), TLS change cipher, Change cipher spec (1):
{ [1 bytes data]
* TLSv1.0 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* TLSv1.0 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.0 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* SSL connection using TLSv1.0 / AES256-SHA
* Server certificate:
* subject: OU=Domain Control Validated; CN=*.esc5.net
* start date: Feb 5 15:50:15 2019 GMT
* expire date: Mar 8 20:21:38 2021 GMT
* issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certs.godaddy.com/repository/; CN=Go Daddy Secure Certificate Authority - G2
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
  0 302k 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0{ [5 bytes data]
 65 302k 65 198k 0 0 1641 0 0:03:09 0:02:03 0:01:06 0* Remembering we are in dir "xxxx/"
} [5 bytes data]
* TLSv1.0 (OUT), TLS alert, close notify (256):
} [2 bytes data]
< 426 Connection timed out, aborting transfer
* server did not report OK, got 426
 65 302k 65 198k 0 0 1640 0 0:03:09 0:02:03 0:01:06 0
* Connection #0 to host regionftp left intact
curl: (18) server did not report OK, got 426

Result = 0

--
$ curl --version
curl 7.63.0 (i686-pc-sco3.2v5.0.7) libcurl/7.63.0 OpenSSL/1.0.2q zlib/1.2.11 libssh2/1.8.0
Release-Date: 2018-12-12
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy
--
Kevin Bulgrien
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2019-03-21