cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: wget works, cURL doesn't: what is this newbie doing wrong?

From: Khoa Nguyen <khoa.coffee_at_gmail.com>
Date: Tue, 8 Apr 2014 13:56:25 -0400

Perhaps add -L to your curl command line so that it will follow the
"location" header?

On Tue, Apr 8, 2014 at 10:06 AM, Thompson, Matt (GSFC-610.1)[SCIENCE
SYSTEMS AND APPLICATIONS INC] <matthew.thompson_at_nasa.gov> wrote:

> All,
>
> I have what is probably a dumb newbie question, but I have to start
> somewhere.
>
> Namely, I'm just trying to use cURL to download a file. From olden days I
> tend to use wget, but cURL has more features, so I'm trying to learn it.
>
> Now, with wget I can do this:
>
> (173) $ wget http://pypi.python.org/packages/source/v/virtualenv/
>> virtualenv-1.9.1.tar.gz
>> --2014-04-08 10:00:09-- http://pypi.python.org/
>> packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz
>> Resolving pypi.python.org... 199.27.78.175
>> Connecting to pypi.python.org|199.27.78.175|:80... connected.
>> HTTP request sent, awaiting response... 301 Moved Permanently
>> Location: https://pypi.python.org/packages/source/v/virtualenv/
>> virtualenv-1.9.1.tar.gz [following]
>> --2014-04-08 10:00:09-- https://pypi.python.org/
>> packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz
>> Connecting to pypi.python.org|199.27.78.175|:443... connected.
>> HTTP request sent, awaiting response... 200 OK
>> Length: 2004589 (1.9M) [application/octet-stream]
>> Saving to: “virtualenv-1.9.1.tar.gz”
>>
>> 100%[================================================================>]
>> 2,004,589 7.93M/s in 0.2s
>>
>> 2014-04-08 10:00:10 (7.93 MB/s) - “virtualenv-1.9.1.tar.gz” saved
>> [2004589/2004589]
>>
>
> And it works. Now, my usual routine then is instead of "wget" use "curl
> -O" (here with -v since it doesn't work):
>
> (177) $ curl -v -O http://pypi.python.org/packages/source/v/virtualenv/
>> virtualenv-1.9.1.tar.gz
>> * Hostname was NOT found in DNS cache
>> * Trying 199.27.76.175...
>> % Total % Received % Xferd Average Speed Time Time Time
>> Current
>> Dload Upload Total Spent Left
>> Speed
>> 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:--
>> 0* Connected to pypi.python.org (199.27.76.175) port 80 (#0)
>>
>>> GET /packages/source/v/virtualenv/virtualenv-1.9.1.tar.gz HTTP/1.1
>>> User-Agent: curl/7.36.0
>>> Host: pypi.python.org
>>> Accept: */*
>>>
>>> < HTTP/1.1 301 Moved Permanently
>> < Retry-After: 0
>> < Location: https://pypi.python.org/packages/source/v/virtualenv/
>> virtualenv-1.9.1.tar.gz
>> < Content-Length: 0
>> < Accept-Ranges: bytes
>> < Date: Tue, 08 Apr 2014 14:01:05 GMT
>> < Connection: close
>> <
>> 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:--
>> 0
>> * Closing connection 0
>>
>
> So...yeah. For reference, I did build this cURL myself (as part of a set
> of base libraries for a project) and it reports these protocols:
>
> (180) $ curl -V
>> curl 7.36.0 (x86_64-unknown-linux-gnu) libcurl/7.36.0 OpenSSL/1.0.1e
>> zlib/1.2.3
>> Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s
>> rtsp smtp smtps tftp
>> Features: IPv6 Largefile NTLM NTLM_WB SSL libz
>>
>
> from this configure:
>
> @echo "Configuring curl"
>> @(cd curl; \
>> export PATH="$(prefix)/bin:$(PATH)" ;\
>> export CPPFLAGS="$(INC_SUPP)";\
>> export LIBS="-lm";\
>> ./configure --prefix=$(prefix) \
>> --includedir=$(prefix)/include/ \
>> --libdir=$(prefix)/lib \
>> --disable-ldap \
>> --disable-telnet \
>> --disable-manual \
>> --disable-shared \
>> --enable-static \
>> --with-ssl \
>> --without-libidn \
>> CCFLAGS="$(CFLAGS)" CC=$(CC) CXX=$(CXX) FC=$(FC) )
>> @touch $@
>>
>
> So the answer might be that I just did not configure the build correctly.
>
> Either way, does anyone know what I might add to get this to work? Either
> on the command-line or to my configure?
>
> Thanks,
> Matt
> --
> Matt Thompson SSAI, Sr Software Test Engr
> NASA GSFC, Global Modeling and Assimilation Office
> Code 610.1, 8800 Greenbelt Rd, Greenbelt, MD 20771
> Phone: 301-614-6712 Fax: 301-614-6246
> -------------------------------------------------------------------
> 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.html
>

-------------------------------------------------------------------
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.html
Received on 2014-04-08