cURL / Mailing Lists / curl-users / Single Mail

curl-users

The --range option doesn't take effect for my case.

From: Hongyi Zhao <hongyi.zhao_at_gmail.com>
Date: Mon, 30 Mar 2015 22:59:28 +0800

Hi developer,

I compiled the latest git version of curl 7.42.0-DEV on Debian Wheezy,
and also learned the following options from its built-in manual page:

-------------------------
       -r, --range <range>
              (HTTP/FTP/SFTP/FILE) Retrieve a byte range (i.e a partial
docu‐
              ment) from a HTTP/1.1, FTP or SFTP server or a local
FILE.
              Ranges can be specified in a number of ways.

              0-499 specifies the first 500 bytes
[snipped]
------------------------------

So I try to test this option with the following comands:

1- Firstly, I obtain the length and content type of the target webpage as
follows:

werner@debian:~$ curl -I http://130.158.6.87/api/iphone/
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 1128131
Content-Type: text/plain; charset=utf-8
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
Set-Cookie: sid=56F3865922CC; expires=Fri, 30-Mar-2018 14:46:59 GMT; path=/
X-Powered-By: ASP.NET
Date: Mon, 30 Mar 2015 14:46:56 GMT

2- Then, I try to obtain the the first 500 bytes for the above webpage:

----------------------------
werner@debian:~$ curl --range 0-499 http://130.158.6.87/api/iphone/
*vpn_servers
#HostName,IP,Score,Ping,Speed,CountryLong,CountryShort,NumVpnSessions,Uptime,TotalUsers,TotalTraffic,LogType,Operator,Message,OpenVPN_ConfigData_Base64
vpn277114450,126.28.186.172,630670,3,76498757,Japan,JP,65,31526254,52524,5876446960061,2weeks,ran-PC's
owner,,IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIw0KIyBPcGVuVlBOIDIuMCBTYW1wbGUgQ
[snipped]
------------------------------------

As you can see, though I use the ` --range 0-499' option, curl still will
download all of the contents of that webpage.

Why does this happen? Any hints?

Regards

-- 
Hongyi Zhao <hongyi.zhao_at_gmail.com>
Xinjiang Technical Institute of Physics and Chemistry
Chinese Academy of Sciences
GnuPG DSA: 0xD108493

-------------------------------------------------------------------
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 2015-03-30