On 2012-04-18 06:04, Johnny Billquist wrote:
On 2012-04-15 04:49, Oleg Safiullin wrote:
Hmm, putting it all in some file, that can be read?
You can create a virtual terminal for CGI task and pass data through
terminal I/O :)
Oh well, another wasted night and I now have a rough CGI interface to my
web server...
Anyone curious should just ask me how to do things for now. It's not at
all difficult, but it's also not properly finished yet. But there is a
page linked from the home page on madame which have dynamic content.
And after a bunch of additional wasted hours, I now have working CGI using both GET and
POST for RSX.
It's pretty simply, really. The best example is in MIM::US:[BQT]PUBLIC.HTM. Notice
lines that have targets starting with CGI:
Those give programs that will be run. The program will be run logged in to a virtual
terminal, and logical names will be set up for various pieces of information.
The program is expected to output lines that are to be in the header of the response
first, followed by an empty line, and after that it's all HTML.
With a GET, the arguments will be in an logical name.
With a POST, the values will be fed to the input of the CGI program. One line at a time,
where each line is defined as the splitting point by the '&' character. When
all input data have been processed, you get an EOF, and then you start outputting data as
above.
Two short examples:
http://madame.update.uu.se/~bqt/test1 (uses GET)
http://madame.update.uu.se/~bqt/test2 (uses POST)
The actual programs run are MIM::US:[BQT]TESTF1.CMD and TESTF2.CMD, which are both just
IND programs. Really simple. You can, of course, write your programs in any language you
like.
Also, at this writing, the following logical names are defined:
HTTP_CONTENT
HTTP_HOST
HTTP_METHOD
HTTP_REFERER
HTTP_UAG
HTTP_URI
REMOTE_ADDR
REMOTE_PORT
Try the test programs, look at the sources, and play around. Bug reports are as always
welcome.
Johnny
--
Johnny Billquist || "I'm on a bus
|| on a psychedelic
trip
email: bqt at softjar.se || Reading murder books
pdp is alive! || tryin' to stay hip" -
B. Idol