read/custom and HTTP HEAD behaviour
[1/4] from: jmalv:hotm:ail at: 15-Feb-2002 9:42
I am trying to query a URL with HTTP HEAD but I get the full HTTP GET
instead
print read/custom http://www.yahoo.com reduce ['HEAD ]
or
response: copy ""
port: open tcp://www.yahoo.com:80
insert port rejoin [ "GET" newline "host:www.yahoo.com" newline "connection:
close" newline newline ]
while [ res: copy port ] [][ append response res ]
close port
How can I just get the HTTP HEAD without the full page ?
Thanks
[2/4] from: hallvard::ystad::helpinhand::com at: 15-Feb-2002 12:03
Here's the solution:
http://www.escribe.com/internet/rebol/index.html?by=OneThread&t=%5BREBOL%5D Reading HTTP headers
~H
Dixit j m (09.42 15.02.2002):
[3/4] from: carl:cybercraft at: 16-Feb-2002 0:54
On 15-Feb-02, j m wrote:
> I am trying to query a URL with HTTP HEAD but I get the full HTTP
> GET instead
<<quoted lines omitted: 5>>
> while [ res: copy port ] [][ append response res ] close port
> How can I just get the HTTP HEAD without the full page ?
Use "HEAD" instead of "GET" when opening the port. ie...
---8<---
>> port: open tcp://www.rebol.com:80
>> insert port "HEAD / HTTP/1.0 ^/^/"
>> while [data: copy port][prin data]
HTTP/1.1 200 OK
Date: Fri, 15 Feb 2002 11:43:28 GMT
Server: Apache/1.3.20 (Unix) FrontPage/4.0.4.3
Last-Modified: Wed, 13 Feb 2002 19:01:52 GMT
ETag: "595d6e-351e-3c6ab820"
Accept-Ranges: bytes
Content-Length: 13598
Connection: close
Content-Type: text/html
>> close port
---8<---
That works with rebol.com, anyway, though not with Yahoo. You may
need to supply more info in Yahoo's case, or it maybe it's just
because Yahoo refuses to supply just the header. But with a bit of
luck, it won't be Yahoo's header you're after. (:
--
Carl Read
[4/4] from: jmalv::hotmail at: 15-Feb-2002 16:37
Thanks Hallvard & Carl.
{ I missed the thread in January }
>From: Hallvard Ystad <[hallvard--ystad--helpinhand--com]>
>Reply-To: [rebol-list--rebol--com]
<<quoted lines omitted: 37>>
>[rebol-request--rebol--com] with "unsubscribe" in the
>subject, without the quotes.
_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail.
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted