[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HTCondor-users] Curl return codes



On Thu, Jan 31, 2013 at 08:16:07PM -0600, Nathan Panike wrote:
> Any curl experts in htcondor-users?
> 
> I have the following:
> 
> + curl -o reference.maps http://proxy.chtc.wisc.edu/SQUID/LMCG/nwp/reference185.maps
> 
> ^^^ This returns success, and yet:
> 
> + /usr/bin/head reference.maps
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd";>
> <html><head>
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
> <title>ERROR: The requested URL could not be retrieved</title>
> <style type="text/css"><!--
>  /*
>  Stylesheet for Squid Error pages
>  Adapted from design by Free CSS Templates
>  http://www.freecsstemplates.org
>  Released for free under a Creative Commons Attribution 2.5 License

>From man curl:

       -f/--fail
              (HTTP) Fail silently (no output at all) on server  errors.  This
              is  mostly done to better enable scripts etc to better deal with
              failed attempts. In normal cases when a  HTTP  server  fails  to
              deliver  a  document,  it  returns  an  HTML document stating so
              (which often also describes why and more). This flag  will  pre-
              vent curl from outputting that and return error 22.

This appears to work:

$ curl -o test.xxx http://www.google.com/nonexistent; echo $?
0
$ curl -f -o test.yyy http://www.google.com/nonexistent; echo $?
22

(and in the latter case, test.yyy is not created)