cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: cURL 7.10.3 HTTP download and --location not working

From: Ralph Mitchell <rmitchell_at_eds.com>
Date: Wed, 26 Nov 2003 05:27:27 -0600

The Location header is a line in the headers returned by the server
telling you that the page moved to a different location. It would look
something like:

    Location: http://some.domain.com/some/path/file.html

--location tells curl to follow such headers until it reaches a web page
that doesn't have one. That page is then downloaded. If the first page
you get to doesn't have a location header, that's the page you get.

If the server sends you a "302 Moved Temporarily" but doesn't send a
Location: header along with it, the server may be broken (or badly
configured, which amounts to the same thing).

The "Content-Length: 964" header suggests that the server is sending a
pile of stuff along with the "302 Moved Temporarily". I suspect curl
sees the 302, doesn't find a new location to go to, and bails out
without reading the body of the page. You might want to turn off
"--location" and see what it says.

Ralph Mitchell

Tony Blakie wrote:

>Daniel,
>
>Thanks for replying....
>
>I'm very much new to using cURL (in fact I'd never heard of it until I began work on this project).
>
>Can you explain a little further what you mean by it found no location header?
>
>I've blindly played about with the location, header and referer switches but had no success. Searching the web hasn't come up with much in the way of specific examples of using this.....and the manual didn't really help either.
>
>
>Thanks in advance.
>Tony
>
>-----Original Message-----
>From: curl-users-admin_at_lists.sourceforge.net
>[mailto:curl-users-admin_at_lists.sourceforge.net]On Behalf Of Daniel
>Stenberg
>Sent: 22 November 2003 21:40
>To: curl-users_at_lists.sourceforge.net
>Subject: Re: cURL 7.10.3 HTTP download and --location not working
>
>
>On Fri, 21 Nov 2003, Tony Blakie wrote:
>
>
>
>>We're using the following cURL command (I've censored sensitive values, i.e.
>>IP addresses, user Ids and passwords):
>>
>>
>
>[snip]
>
>
>
>><= Recv header, 32 bytes (0x20)
>>0000: HTTP/1.1 302 Moved Temporarily
>><= Recv header, 21 bytes (0x15)
>>0000: Content-Length: 964
>>== Info: transfer closed with 964 bytes remaining to read
>>== Info: Closing connection #0
>>
>>
>
>There's no Location: header here!?
>
>
>
>>Does anyone know why the location switch doesn't seem to be routing on the
>>request from the URL to the actual physical location?
>>
>>
>
>Because it found no Location: header?
>
>
>
>>Is it a version issue?
>>
>>
>
>It never worked without a header!
>
>
>

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
Received on 2003-11-26