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

probably OT: Apache and Rebol

 [1/13] from: eric::ehrichweiss::com at: 27-May-2005 18:14


This is probably more of an Apache question that will be handled easiest by using mod_rewrite but here goes... I need to have Apache execute a Rebol script that will preprocess an HTML file but I'd like to make it so that instead of the url being www.mysite.com/cgi-bin/handler.r?filename=index.html it could be www.mysite.com/index.html If I hadn't had such horrible results with webserv.r and POST binary data(images), I would be using that by now and wouldn't have this problem in the least but at this point, I might be willing to recode just so I can do all of this from one single program which I can hack the code to do what I need. That was my original intent. Any pointers?

 [2/13] from: ammon::johnson::gmail::com at: 27-May-2005 15:37


Webserv.r You're talking about Cal Dixon's webserver? POST images, you mean uploading to the webserver, right? Enjoy!! ~~Ammon ;~> On 5/27/05, Eric Haddix <[eric--ehrichweiss--com]> wrote:

 [3/13] from: SunandaDH::aol::com at: 28-May-2005 3:34


Eric:
> This is probably more of an Apache question that will be handled easiest > by using mod_rewrite but here goes...
If you have a recent version of Apache that generates the REDIRECT headers as defined here: http://httpd.apache.org/docs/custom-error.html Then: -- make sure that (say) http://mysite.com/myprog.html does *not* exist -- in the .htaccess: errordocument 404 http://www.mysite.com/cgi-bin/handle-requests.r -- in the handle-requests.r script, check the REDIRECT headers to see what the original URL was, and pass to the appropriate handler Sunanda.

 [4/13] from: andreas:bolka:gmx at: 28-May-2005 14:18


Saturday, May 28, 2005, 12:14:58 AM, Eric wrote:
> This is probably more of an Apache question that will be handled > easiest by using mod_rewrite but here goes...
<<quoted lines omitted: 3>>
> it could be > www.mysite.com/index.html
using mod_rewrite: RewriteEngine on RewriteRule ^/(.*)$ /cgi-bin/handler.r?filename=$1 [PT] -- Best regards, Andreas

 [5/13] from: hallvard:ystad:oops-as:no at: 28-May-2005 15:21


I use something like this, in httpd.conf: ScriptAlias /index.html "/path/on/server/to/executable" HY Dixit Eric Haddix (00.14 28.05.2005):

 [6/13] from: gabriele:colellachiara at: 28-May-2005 15:52


Hi Eric, On Saturday, May 28, 2005, 12:14:58 AM, you wrote: EH> I need to have Apache execute a Rebol script that will preprocess an EH> HTML file but I'd like to make it so that instead of the url being EH> www.mysite.com/cgi-bin/handler.r?filename=index.html EH> it could be EH> www.mysite.com/index.html Another way to do it, is to use AddHandler. You can tell Apache to let your CGI script handle all HTML files (or, define a new file type and extension). Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/

 [7/13] from: eric:ehrichweiss at: 28-May-2005 10:57


Yes. I had a horrible time getting it to work with my image uploads. Ammon Johnson wrote:

 [8/13] from: eric:ehrichweiss at: 28-May-2005 11:00


Gabriele Santilli wrote:
> Another way to do it, is to use AddHandler. You can tell Apache to > let your CGI script handle all HTML files (or, define a new file > type and extension).
Now that is a suggestion that I haven't gotten yet. I'm going to check that out.

 [9/13] from: SunandaDH::aol::com at: 28-May-2005 11:06


Eric:
> Yes. I had a horrible time getting it to work with my image uploads.
Binary file uploads can be messy -- at the CGI end, you need to pick apart the multi-part mime wrappers to recover the original binary data. There is no native REBOL support for that. Fortunately Andreas published some code that handles the case: http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-message.r?m=rmlKVSQ Commentary here: http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlZYMQ Sunanda

 [10/13] from: eric::ehrichweiss::com at: 28-May-2005 12:15


Is that written specifically for webserv.r? I had no problem handling binary data(multi-part or not) with Apache, etc. but I discovered that webserv.r handles the CGI data differently. Here's what Cal Dixon had to say webserv.r sets system/ports/input to the actual TCP connection with the browser, so it is slightly different from what you get running rebol CGI scripts with Apache, being a TCP port rather than a file port, but it generally works the same. And as much as I tried, I could use GET but not POST with my scripts due to that, I think. At this point, I'm more than willing to try again cause it'd surely make my work a lot easier to have complete editing abilites on the source code without having to read a gazillion lines of half-way understandable C code. Eric [SunandaDH--aol--com] wrote:

 [11/13] from: gabriele:colellachiara at: 28-May-2005 18:56


Hi Eric, On Saturday, May 28, 2005, 6:15:21 PM, you wrote: EH> "webserv.r sets system/ports/input to the actual TCP connection with the EH> browser, so it is slightly different from what you get running rebol CGI EH> scripts with Apache, being a TCP port rather than a file port, but it EH> generally works the same." Did you try: set-modes system/ports/input [binary: true] ? Also, if it is not already set to no-wait, you'll probably want to enable that. You may also need to check the Content-Length and only COPY/PART that much data. Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/

 [12/13] from: ammon::johnson::gmail::com at: 28-May-2005 13:02


I'll relay this to the author. I happen to know he has a new version on his hard drive that he just hasn't been able to find the time upload perhaps your issue will be resolved with webserv.r... Enjoy!! ~~Ammon ;~> On 5/28/05, Eric Haddix <[eric--ehrichweiss--com]> wrote:

 [13/13] from: eric::ehrichweiss::com at: 29-May-2005 16:47


Thanx Ammon, I've been losing my mind trying to figure out what causes webserv to respond the way it does. I can't seem to get it to pass any POST data to cgi, even if the cgi program consists of little more content than: print "content-type: text/html^/"(missing the typical headers, etc. of course) because it immediately returns that the document contains no data which I presume to mean webserv isn't handling it correctly at all and the cgi script is crashing. Anyway, I await a new version to be certain. Eric Ammon Johnson wrote:

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted