Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Reading HTTP headers

 [1/8] from: harold::1st-spot::net at: 11-Jan-2002 17:12


Using the View/Pro package for Linux: I want to use REBOL for submitting some pages of my website to search engines. Supposedly I submit the query string using a "read" of the appropriate search engine submission page. But how can I read just the header code (such as "200 OK") of the page that is returned? I don't want the content of the page that is returned, just its headers. harold

 [2/8] from: hallvard:ystad:helpinhand at: 12-Jan-2002 12:11


I've been wondering about that too. Even when you do NOT do a web-page: read http://some.url/ but simply a port: open http://some/url/ the whole web page is read and stored in the port object. Try probe port or probe port/state. To send custom HTTP requests, I use read/custom, so I think the answer to your problem (and mine, although I work on other things right now), must be open/custom. But I've never used it, so I cannot tell you how to do it. And the function is native, so we canot probe it... ~H Dixit Harold (02.12 12.01.2002):

 [3/8] from: carl:cybercraft at: 13-Jan-2002 1:28


On 12-Jan-02, Harold wrote:
> Using the View/Pro package for Linux: > I want to use REBOL for submitting some pages of my website to
<<quoted lines omitted: 3>>
> page that is returned? I don't want the content of the page that is > returned, just its headers.
You can get it using a TCP port and HEAD instead of GET. Here's a modified version of the example in the Core User Guide... http-port: open tcp://www.rebol.com:80 insert http-port "HEAD / HTTP/1.0^/^/" while [data: copy http-port][prin data] close http-port Along with looking through the protocol section of the User Guide, you might find these two URLs might come in handy as well, they having the specs of HTML 1.0 and 1.1... http://www.ics.uci.edu/pub/ietf/http/rfc1945.txt http://www.ietf.org/rfc/rfc2068.txt -- Carl Read

 [4/8] from: tomc:darkwing:uoregon at: 12-Jan-2002 19:34


slightly suprized that
>> read/custom http://www.rebol.com ["HEAD"]
did not work ... but you can always roll yer own
>> port: open [scheme: 'tcp host: "www.rebol.com" port-id: 80] >> insert port "HEAD http://www.rebol.orgHTTP/1.0^/^/" >> wait port >> print copy port
HTTP/1.1 200 OK Date: Sun, 13 Jan 2002 03:28:08 GMT Server: Apache/1.3.20 (Unix) FrontPage/4.0.4.3 Last-Modified: Wed, 09 Jan 2002 02:48:33 GMT ETag: "595d6e-32c8-3c3baf81" Accept-Ranges: bytes Content-Length: 13000 Connection: close Content-Type: text/html
>>
hmmm anyone know what an "Etag:" is? On Fri, 11 Jan 2002, Harold wrote:

 [5/8] from: sterling:rebol at: 12-Jan-2002 19:19


If you do a normal OPEN, it will read the whole page right then. If you demand that no part of the web page be read at all, then the directions below are the way to go. However, if you don't mind if just a bit is read (one packet worth), then you can do the following: a: open/direct http://www.rebol.com probe a/locals close a Probing the port after the OPEN will show data in the inBuffer field of the sub-port but it's not thw whole page unless the page is very small. Probing the locals will get everything but the "HTTP/1.1 200 OK" line in an object. Fields that are NONE, were not specified. Hope that helps. Sterling

 [6/8] from: jason:cunliffe:verizon at: 12-Jan-2002 23:44


> hmmm anyone know what an "Etag:" is?
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19 http://mail.anywhereyougo.com/pipermail/wap-dev/2001-January/016615.html <quote> ETag is used for checking if the resource is modified. When you modify a resource, server generates new ETag for it. ETag may be e.g. simple hash, or time when the resource was changed, or any other implementation-specific value. RFC 2616 (HTTP/1.1) says: The ETag response-header field value, an entity tag, provides for an "opaque" cache validator. This might allow more reliable validation in situations where it is inconvenient to store modification dates, where the one-second resolution of HTTP date values is not sufficient, or where the origin server wishes to avoid certain paradoxes that might arise from the use of modification dates. </quote>

 [7/8] from: sterling:rebol at: 14-Jan-2002 10:04


Hmmm. That might be worth adding in there in some form or another. Sterling

 [8/8] from: tomc:darkwing:uoregon at: 14-Jan-2002 23:01


and options! and put! and ... :) On Mon, 14 Jan 2002 [sterling--rebol--com] wrote:

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted