Read
[1/4] from: gchiu::compkarori::co::nz at: 19-Nov-2000 17:23
On Sat, 18 Nov 2000 14:46:04 +0100
Doc Kimbel <[dockimbel--free--fr]> wrote:
> Just try :
> http-port: open tcp://www.mtnsms.com:80
<<quoted lines omitted: 6>>
> which virtual host
> you're asking for. Rebol 'read function always send one.
Thanks very much DK. My development code actually has the
Host header present, but this clue led me to find the
problem that has been bugging me for the last few days!
--
Graham Chiu
[2/4] from: gchiu:compkarori at: 18-Nov-2000 12:33
In the old days, Rebol's read used to return the http
headers, but now it is smart and strips them out. Wouldn't
it be nice if there were a refinement to elect not to strip
them out? Or better still, factor 'read' out rather than
have it defined as a primitive so we could do this
ourselves?
And now my question. I can use read to read in some web
pages, and it does it correctly. But if I open the port
directly to read the page, it doesn't always work. Does
'read' have extra smarts in it?
--
Graham Chiu
[3/4] from: gchiu:compkarori at: 18-Nov-2000 17:48
This is an example of the problems I'm having
read http://www.mtnsms.com
vs:
http-port: open tcp://www.mtnsms.com:80 insert http-port
GET / HTTP/1.0^/^/
while [data: copy http-port] [ prin
data ]
which produces quite different output
--
Graham Chiu
[4/4] from: dockimbel:free at: 18-Nov-2000 14:46
Just try :
http-port: open tcp://www.mtnsms.com:80
insert http-port rejoin [
"GET / HTTP/1.0" newline
"Host: www.mtnsms.com" newline newline
]
while [data: copy http-port][prin data]
By adding a Host header, the web server can determine which virtual host
you're asking for. Rebol 'read function always send one.
DK.
>> trace/net on
>> read http://www.mtnsms.com
URL Parse: none none www.mtnsms.com none none none
Net-log: ["Opening tcp for" HTTP]
connecting to: www.mtnsms.com
Net-log: {GET / HTTP/1.0
Accept: */*
Connection: close
User-Agent: REBOL 0.10.38.3.1
Host: www.mtnsms.com
}
Net-log: "HTTP/1.1 200 OK"
Net-log: ["low level read of " 7997 "bytes"]
Net-log: ["low level read of " 934 "bytes"]
== {
<html>
<head>
<title>mtnsms.com</title>
<meta name="description" content="Send short text messages to mobile
Graham Chiu wrote :
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted