Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] How? Read HTTP message body

From: dave:jtgoodstuff at: 10-Aug-2001 19:23

I'm totally new to Rebol. I'm modifying the webserver.r script from the Rebol script library. I've stripped it down. The technique that was used seems to make available the Request Line and Message Headers.Which are line oriented. It seems to stop after it hits the blank line and the actual Message Body is missing. Here's the main code. Any hints on how to get to the message body? Oh yes, what's the [err] for on send-cmd? I can't get rid of it but it doesn't appear to do anything. Thanks. cntr: 1 buffer: make string! 1024 ; will auto-expand if needed listen-port: open/lines tcp://:9090 ; port used for web connections send-cmd: function [buffer thecntr] [err] [ insert http-port join "HTTP/1.0 200 OK^/" [ "Content-type: text/html^/^/" "<br><pre>" buffer "</pre><br>" length? buffer "<br><br>" now/time " " thecntr ] ] forever [ http-port: first wait listen-port clear buffer while [not empty? request: first http-port] [ repend buffer [request newline] ] set 'cntr cntr + 1 send-cmd buffer cntr close http-port ]