REBOL 3.0

CGI moon bounce

Carl Sassenrath, CTO
REBOL Technologies
27-Oct-2009 0:27 GMT

Article #0283
Main page || Index || Prior Article [0282] || Next Article [0284] || 5 Comments || Send feedback

In ham radio a fun thing to do is bounce your signal off the moon. Well, in R3 A93, you can now have just about as much fun.

Type this:

url: http://www.rebol.net/cgi-bin/r3-echo.r
write url "test"
"test^/"

You've just sent an HTTP message to an R3 CGI script that echoed it back. I must admit, I really like simple examples.

And, it works reasonably fast (as least today):

dt [write url "test"]
0:00:00.328

Other lines to try, just for fun:

print write url mold system/options

print write url mold :import

print write url read %file.txt

print write url read http://www.rebol.com

The R3 CGI script is only 270 bytes:

#!./r3 -q
REBOL [Title: "R3 CGI Post Test"]

print "Content-type: text/plain^/"

limit: 100000
data: make binary! 10000

while [not empty? d: read system/ports/input][
    append data d
    if limit <= length? data [print "too big" quit]
]

print to-string data

Notice the limit if you try to send large data.

Once system/ports/output is fixed, I'll add a variation that removes the to-string line from the data. Then any binary data of any encoding can be "bounced off the moon".

See also R3 CGI test for another early R3 CGI example.

PS: now we need an embedded CGI module with the most common utility functions provided.

5 Comments

REBOL 3.0
Updated 22-Jun-2017 - Edit - Copyright REBOL Technologies - REBOL.net