[REBOL] Re: HTTP response status
From: hallvard:ystad:babelserver at: 8-Oct-2010 0:12
Here's something I used once. Don't know where I got it from, it might very well be this
list. Works with R2, not tested otherwise:
insert-this: {GET / HTTP/1.0
Host: www.rebol.com
connection: close
user-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
}
port: open/lines [
scheme: 'tcp
host: "www.rebol.com"
port-id: 80
]
insert port insert-this
header: make block! 100
while [
reply: first port not empty? reply ] [
parse reply [
[copy name [thru #":"] (name: load name) | copy name [to end] (append header reduce [name
""])]
[copy value to newline | copy value to end] (if value [append header reduce [name value]])
]
]
either [ not empty? content: first port ] [content: copy port] [print "EMPTY!"]
close port
probe header
;print reduce [content]
halt
Dixit Thorsten Moeller (17:03 07.10.2010):