1. Help... Im lost(again) (was Re: More about Euphoria CGIs (a
- Posted by Grape Vine <chat_town at HOTMAIL.COM> Mar 16, 1999
- 455 views
Hiya all, I must be as think as a brick... I have been messing with this since this first was posted and had this lower example work... Then i started messing with code and messed up.. So i restored the code to what it had been... Then it starts to give theerr hex number not formed correctly .. and now i cant get it to work... and i realy need it to... Im tryign to put it on a web site for my clan(age of empires: rise to rome) to report the statis of our games.... TIA Grape Vine >From: Daniel Berstein <daber at PAIR.COM> >Reply-To: Euphoria Programming for MS-DOS <EUPHORIA at LISTSERV.MUOHIO.EDU> >To: EUPHORIA at LISTSERV.MUOHIO.EDU >Subject: More about Euphoria CGIs (a succesful story!) >Date: Wed, 3 Mar 1999 01:19:01 -0400 > >I tried to execute the EuCGI without binding it. I was unsuccesful :( > >Here's the problem: > >Xitami recognize as a CGI a file that is located in a valid cgi directory >(it must be configured on the server for security reasons) *and* must >follow one of these criterias: > >a) Be a valid exe file (starts with MZ). >b) Start with #! a space and followed by the full path of the interpreter >(used by Perl and Awk scripts). >c) Start with /*! a space and followed by the full path of the >interpreter, and the last text in the line is */ (used by Rexx scripts). > >I made a silly test and put on the first line of my code: #! >c:\euphoria\bin\exw.exe > >Half Eureka. The server recognized it as a CGI and spawned exw.exe... with >the obvious error raised by Euphoria: > >C:\Xitami\cgi-bin\cgitest.exw:1 >hex number not formed correctly >#! c:\euphoria\bin\exw.exe > >So here is a new entry to 2.1 beta wish-list: > >Rob, please be so kind to just raise a Warning if the very first line of >the code is either a Perl/Awk or Rexx style comment (I asume several other >servers work a similar). > >Creating bounded EuCGI is functional, but storage of all those .exe files >may not be desireable. Unregistered (yet) users may start playing with >Euphoria for creating their own CGI's... you know, anything WWWebable is a >commercial success ;) (at least for book publishers). > > >*Attention* >While writing this email an idea jumped of my mind: > >If Xitami reads the first line of a Perl/Awk script to get the interpreter >path, then maybe I oculd fool it. So I created a blank new text document >(with Notepad) and wrote: > >#! c:\euphoria\bin\exw.exe c:\xitami\cgi-bin\cgitest.exw > >Followed by a blank line. > >It worked! Xitami just called exw.exe with the first parameter as my EuCGI >and as second (passed to my script's command line) the location of the >"wrapper" text cgi. From now on I'll use this method for my EuCGI's. In >fact I just moved eucgi.exw from the cgi-bin directory to >c:\eucgi\eucgi.exw and instead put a wrapper file called eucgi (no >extension) that says: > >#! c:\euphoria\bin\exw.exe c:\eucgi\eucgi > >The only withdraw of this method is that the current working directory is >set where the wrapper is. if you need to get the path of the actual >Euphoria code you could SET a variable on autoxec.bat (EUCGI_DIR?). Rob, >why can't command_line give the path of unbounded files? > >Maybe my wish-list contribution should be ommited, but not the idea of >making Euphoria more WWWebable. > >I apologize for this long and evolving post, it's one of those emails you >write while coding and testing. Anyways I thought it may be useful to >follow the nature of this "hack". > > >Regards, > Daniel Berstein > [daber at pair.com] > Get Your Private, Free Email at http://www.hotmail.com
2. Re: Help... Im lost(again) (was Re: More about Euphoria CGIs (a
- Posted by Daniel Berstein <daber at PAIR.COM> Mar 16, 1999
- 433 views
At 01:02 PM 16-03-1999 , you wrote: >Hiya all, > >I must be as think as a brick... I have been messing with this since >this first was posted and had this lower example work... Then i started >messing with code and messed up.. So i restored the code to what it had >been... Then it starts to give theerr hex number not formed correctly >.. and now i cant get it to work... and i realy need it to... Im tryign >to put it on a web site for my clan(age of empires: rise to rome) to >report the statis of our games.... TIA > >Grape Vine Hi Grape. Your are inserting the #! thingy on your exw file! That's wrong. Here are step-by-step instructions to make it work on Xitami: Create on the Xitami cgi-bin directory a text file (use notepad or ed or whatever you like best) that says: #! c:\euporia\bin\exw.exe c:\eucgi\mycgi Remember that the above text must be on the very first line of the document, and must be followed by at least one blank line. c:\euphoria\... is the complete path to exw.exe. c:\eucgi\mycgi is the parameter passed to exw.exe (Euphoria will execute the file c:\eucgi\mycgi.exw). On your EuCGI app (mycgi.exw in this example), read the enviormental variable CGI_STDOUT. It holds the name of the file to where you should output the HTML code. If you examine these name you'll notice that it doesn't have a well formed path, so just prepend 'c:\\xitami\\temp\\' or '..\\temp\\' to it. Open that file for 'a'ppend, open(out_file, "a"). Before sending HTML text, first you must output: Content-type: text/html Followed by at least one blank line, puts(fout, "Content-type: text/html\n\n"). That's all! Regards, Daniel Berstein [ daber at pair.com ]
3. Re: Help... Im lost(again) (was Re: More about Euphoria CGIs (a
- Posted by Daniel Berstein <daber at PAIR.COM> Mar 16, 1999
- 463 views
I forgot to mention that the URL of your CGI is: http://your.server/cgi-bin/cgifile Where "cgifile" is the filename of that plain text file we created on the cgi-bin directory. Remeber that the "cgifile" is simple way to fool Xitami so it executes exw.exe, without needing to bound each EuCGI with it's own exw copy. Regards, Daniel Berstein [ daber at pair.com ]