r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3 Schemes] Implementors guide

BrianH
5-Jan-2010
[120x2]
All the stuff is defined in the http module - it's the only part 
if the internals that has been put in a module, so far.
Clarification: The http server mode is meant to be good enough for 
Doc to build an R3 Cheyenne on. If he feels the need to bypass it 
and go down to the tcp level, that would be a failure.
Graham
5-Jan-2010
[122]
so would I access make-http-request ?
BrianH
5-Jan-2010
[123]
I can't say right now - ask me again tomorrow.
Graham
5-Jan-2010
[124]
what I need is a function that traverses all the objects to find 
a function ....
BrianH
5-Jan-2010
[125]
Going out :)
Graham
5-Jan-2010
[126]
running away from me??  Happens a lot :(
BrianH
5-Jan-2010
[127]
It's just a fling - I'll be back :)
Graham
6-Jan-2010
[128x8]
my candle will still be burning ...
For instance, in writing the AWS stuff, Maarten basically had to 
write his own http scheme ... because it wasn't easy to reuse the 
existing stuff.
I hope we can avoid that need for r3
if you look at the port object! after eg. opening rebol.com, there 
is a port/scheme/actor object, and then the actor object seems to 
be duplicated in port/actor ...
Is there actually any documentation on using the http apart from 
read ?
http://www.rebol.net/docs/HTTPScheme state diagram.png
Just a question about eg.

open http://www.rebol.com


Does 'open take the url, turn it into a port object, and then invokes 
the http scheme'' open on the port object?
scheme's 'open on the port object?
Steeve
6-Jan-2010
[136x2]
actually what is the question ? :-)
it's doing what you noted, so what ?
Graham
6-Jan-2010
[138]
just a stream of consciousness like Marcel Proust
Steeve
6-Jan-2010
[139]
:-)
Graham
6-Jan-2010
[140x2]
So, if you write your own schemes ... open must invoke the correct 
'open some how
looks like 'open is a native ... no source given
Steeve
6-Jan-2010
[142]
you're seeking the proto-open ?
Graham
6-Jan-2010
[143x2]
still streaming ..
AFAIK there's virtually no R3 documentation
Steeve
6-Jan-2010
[145]
i think you know this source system/intrinsic/make-port
Graham
6-Jan-2010
[146x7]
ahh.. that helps
there's no trace/net ?
I guess it's download wireshark time :(
HEAD / HTTP/1.0
Accept: */*
Accept-Charset: utf-8
Host: www.rebol.com
User-Agent: REBOL

HTTP/1.1 200 OK
Date: Wed, 06 Jan 2010 07:28:08 GMT

Server: Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 
mod_bwlimited/1.4 PHP/4.4.7 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 
OpenSSL/0.9.7a
Last-Modified: Fri, 01 Jan 2010 21:19:01 GMT
ETag: "3f44376-2667-4b3e66c5"
Accept-Ranges: bytes
Content-Type: text/html
Via: 1.1 bc1
Content-Length: 9831
Connection: close
this was from ...


r: read open [ scheme: 'http host: "www.rebol.com" method: 'head 
port-id: 80 ]

but probe r
[x/ 9831 none ]
well I guess it tells me something is there .. as I don't get an 
error.  But 9831 is not very useful content.
r: read open [ scheme: 'http host: "www.rebol.com" method: 'head 
port-id: 80 headers: [ User-Agent: "Graham" Content-length: 0 ]]
works to override the headers
sqlab
6-Jan-2010
[153]
read p: open [scheme: 'http host: "www.rebol.com" method: 'head port-id: 
80 ]
probe p/state/info/headers
gives more information without wireshark
Graham
6-Jan-2010
[154]
That's useful ... I thought I molded the whole p and didn't see anything 
...
Steeve
6-Jan-2010
[155]
must initiate the path var to get a response from the server:
read [ scheme: 'http path: host: "www.rebol.com" method: 'head]

** Access error: protocol error: "Server error: HTTP/1.1 400 Bad 
Request"
Graham
6-Jan-2010
[156x2]
ok, to send stuff ... need to set a content: in the port spec.

[ content: "ehlo" scheme: 'http ..etc ]
You're sending 

HEAD www.rebol.com HTTP/1.0
Accept: */*
Accept-Charset: utf-8
Host: www.rebol.com
User-Agent: REBOL

which is invalid
Steeve
6-Jan-2010
[158]
ah ok
Graham
6-Jan-2010
[159x9]
Ok, we seem to have some basic information now on how to use the 
http protocol :)
This is a little inconsistent .. if I read www.rebol.com I get a 
binary returned

If I read http://www.compkarori.co.nz:8090 I get a string returned 
instead
in the latter case, there's no port/state/info ...
Infact port/state is none
looks like the port structure is being clobbered
anyway the state object is set to none in the latter case ...
I wonder why that should be ...
Gabriele: why is port/state set to none in the latter http read?
Trying to create some noob documentation on http http://rebol.wik.is/Rebol3/Schemes/Http
Gabriele
6-Jan-2010
[168x2]
Graham: i write top-down or bottom-up depending on the case. if i 
know *very well* were i am going, i usually work bottom-up. otherwise 
top-down generally gives much better results. the R3 http scheme 
was more bottom-up than top-down. however, i always tend to present 
the code top-down, for a number of reasons. first, most people are 
only interested in the interface (how to use the scheme) - they find 
that first. after that, people maybe just want to figure out why 
something is not working or how something works, so they just need 
to go a little bit deeper, and that means just reading a bit further. 
only someone who needs to figure out the whole thing needs to read 
the whole file.
Brian: you guys love to hurt yourselves, if you modified the .r directly.