← Back to team overview

sslug-teknik team mailing list archive

Re: Hvordan kan man "smage" på en URL (hente første 256 bytes)

 

Thorbjoern Ravn Andersen wrote:
Ask Holme <ask@xxxxxxxxxxxxxxxxx> writes:

Jamen vil det der ikke resulterer i at 1. wget henter _hele_ filen og
piper den over til head. 2. head skærer filen ned til de første 256
bytes. 3. file kikker i den. Det Hans Christian gerne vil have er at han
kun skal hente 256 fra webserveren - jeg gætter på at han skal hente
mange sider og ikke har lyst til at belaste sin linje med X antal pdf
filer :)

curl har et -r argument:

       -r/--range <range>
              (HTTP/FTP)  Retrieve  a  byte  range (i.e a partial
              document) from a HTTP/1.1 or FTP server. Ranges can
              be specified in a number of ways.

              0-499     specifies the first 500 bytes

              500-999   specifies the second 500 bytes

              -500      specifies the last 500 bytes

              9500      specifies  the bytes from offset 9500 and
                        forward

Sorry, men det ser ikke ud til at virke 8(

(/user/w3c/http) #curl -v -r 0-256 -o curl-1.out 'www.helsinge-kommune.dk/nethotel-include/WoBilag.dll?InfoId=1271474&amp;BilagId=116022'
* Connected to 193.88.113.181 (193.88.113.181) port 80
> GET /nethotel-include/WoBilag.dll?InfoId=1271474&amp;BilagId=116022 HTTP/1.1
Range: bytes=0-256
User-Agent: curl/7.9.5 (i386-redhat-linux-gnu) libcurl 7.9.5 (OpenSSL 0.9.6b) (ipv6 enabled)
Host: www.helsinge-kommune.dk
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

% Total % Received % Xferd Average Speed Time Curr. Dload Upload Total Current Left Speed 100 8256 0 8256 0 0 760 0 --:--:-- 0:00:10 --:--:-- 1786

--- og sådan fortsætter den med at modtage op til 1,6 MB
--
Hans Christian Studt  mailto:hc@xxxxxxxx  http://hc.studt.dk
Free Software is the carrot. Microsoft is the stick.
Linux information
http://linux.studt.dk
.dk og W3C : http://home13.inet.tele.dk/hcstudt/w3c/index.html



Follow ups

References