1. EuCGI test

Hi all. I've installed a Web server on my PC and coded a simple CGI with
Euphoria. If you're a bit bored surfing the web you can point to:


http://www.dabersoft.xitami.net/eutest.html

or


http://dabersoft.xitami.net/eutest.html

If I'm connected (I've got a dial-up connection) you'll log into my PC.
Please tell me (if you are succesful) wich URL worked and how fast/slow it
was. I'm usually connected between 23:00 to 04:00 (GMT -4:00), but often
connect at random times during the day.

If anyone is interesed there is a great free HTTP/FTP server at
http://www.xitami.net.


Regards,
         Daniel  Berstein
         [daber at pair.com]

new topic     » topic index » view message » categorize

2. Re: EuCGI test

Both URL's worked fine for me, and both were fast.  Mind you, it's 1:30
in the morning, and everything on the internet is fast at this time of
night =)

The script worked great.  I'm curious, how exactly did you implement CGI
with Euphoria?  I made an (admittedly cursory) attempt at it, just out
of curiosity, with little success.

Anyways, thanks,
Greg

--
Greg Phillips
i.shoot at rednecks.com
http://euphoria.server101.com
--

Useless fact of the day:

The term 'The Real McCoy' was coined in the 1880's

new topic     » goto parent     » topic index » view message » categorize

3. Re: EuCGI test

At 05:27 AM 27-02-1999 , you wrote:
>Both URL's worked fine for me, and both were fast.  Mind you, it's 1:30
>in the morning, and everything on the internet is fast at this time of
>night =)
>
>The script worked great.  I'm curious, how exactly did you implement CGI
>with Euphoria?  I made an (admittedly cursory) attempt at it, just out
>of curiosity, with little success.
>
>Anyways, thanks,
>Greg

Thanks you for wasting your time on my experiment ;)

It's weird. www.dabersoft.xitami.net doesn't work for me!

Here's the actual code of the CGI I made. I bouded the program, but surely
there must be a way to make the server execute exw.exe + cgi.exw. It's
messy, but what did you expected for 15 min. of experimentation? Don't jump
on me Jiri about my "planification" :)

--*CODE START*--

object infile, outfile, username
sequence server_url, remote_addr, today
integer in, out, logfile

infile = getenv("CGI_STDIN")
if atom(infile) then
    abort(-1)
end if
infile = "..\\" &infile

outfile = getenv("CGI_STDOUT")
if atom(outfile) then
    abort(-1)
end if
outfile = "..\\" &outfile

in = open(infile,"r")
out = open(outfile, "a")

puts(out, "Content-type: text/html\n\n")
puts(out, "<html><head><title>EuCGI test result</title>\n")
puts(out, "<body bgcolor=\"Teal\">")
puts(out, "<font face=\"Verdana\" color=\"Navy\"><div align=\"center\"><hr>")

username = getenv("FORM_USERNAME")
if atom(username) then
    puts(out, "Error retriving username<br><br>")
    username = ""
else
    puts(out, "Thanks <font color=\"Black\">" & username & "</font> for
using this EuCGI!<br><br>")
end if

server_url = getenv("SERVER_URL")
remote_addr = getenv("REMOTE_ADDR")

puts(out, "Connected to " & server_url & " from " & remote_addr & "<br><br>")
puts(out, "<hr>STDIN contents:<br><br>")

infile = gets(in)
while sequence(infile) do
    puts(out, infile&"<br>")
    infile = gets(in)
end while

puts(out, "<br><br>Daniel Berstein<br><a


-- Update logfile
logfile = open("eucgi.txt", "a")
today = date()
printf(logfile,"%d-%d %d:%d:%d %s as %s\n",{today[2], today[3], today[4],
today[5], today[6], remote_addr, username})
close(logfile)

close(in)
close(out)

--*CODE END*--

Some of the enviormental variables may be specific to the Xitami webserver
I'm using... maybe not.
CGI_STDIN is the filename where the query strings are stored, but I got
them (username) using getenv() instead. CGI_STDOUT is the filename where
output should be send. It's important you open it for "a"ppend... I tried
with "w"rite and got an ugly error. I used those "..\" because the
webserver wasn't giving be an appropiate relative path to CGI_STDIN/OUT
files. FORM_USERNAME if the name of the input field where you input your
name. Xitami let's me get query strings from enviormental variables and/or
from the CGI_STDIN file. I was too lazy to parse CGI_STDIN so just used
getenv().

BTW you can get you own domain name at http://www.tzo.com . ie:
http://greg.tzo.com. It's free for 30 days, to keep the service you must
pay $25 per year.

Side note: David, did the code I posted helped with your text metrics problem?


Regards,
         Daniel  Berstein
         [daber at pair.com]

new topic     » goto parent     » topic index » view message » categorize

4. Re: EuCGI test

Thank yuo...I can never say how happy i am at this...I have not messed
with it yet but is there a way to make it run any E code? I do not know
cgi(does anyone know of a good book or web site to start at?)

Grape Vine

>Subject:      EuCGI test

>
>Hi all. I've installed a Web server on my PC and coded a simple CGI
with
>Euphoria. If you're a bit bored surfing the web you can point to:
>
>
>http://www.dabersoft.xitami.net/eutest.html
>
>or
>
>
>http://dabersoft.xitami.net/eutest.html
>
>If I'm connected (I've got a dial-up connection) you'll log into my PC.
>Please tell me (if you are succesful) wich URL worked and how fast/slow
it
>was. I'm usually connected between 23:00 to 04:00 (GMT -4:00), but
often
>connect at random times during the day.
>
>If anyone is interesed there is a great free HTTP/FTP server at
>http://www.xitami.net.
>
>
>Regards,
>         Daniel  Berstein
>         [daber at pair.com]


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

5. Re: EuCGI test

At 04:00 PM 28-02-1999 , you wrote:
>Thank yuo...I can never say how happy i am at this...I have not messed
>with it yet but is there a way to make it run any E code? I do not know
>cgi(does anyone know of a good book or web site to start at?)
>
>Grape Vine

I noticed you visited me on 2-28 16:49:48 4.20.104.15 as Grape Vine ;)

On an earlier post is the full source code of the cgi you used.

CGI programming is easy! A CGI is a program that takes an input, process it
and then send it back to the webserver. The procesing of the data is done
as usual, you can use anything you want, including calling other
applications, connecting to databases, creating files, etc. The only
special mention is about getting the input and sending output.

There a mainly two way your CGI can get it's input:

a) Reading the standard input (like when using the '<' in DOS). Here you
must parse each query string that is in the form KEY1=VALUE?KEY2=VALUE2..
etc. Spaces are changed by the '+' sign. This way is the standard CGI (Unix)

b) Some server support another way, called WinCGI. WinCGI was developed by
O'Reilly for their WebSite webserver. Today several wintel webserver
support WinCGI. WinCGI is mich simpler than std. CGI. The webserver creates
an enviormental variable where a .INI file is specified. Your app then
reads the KY=VALUE pairs from that standard Windows ini file. The task is
simplifies because there are WinAPI functions that easily read a given key
value.

Each server may have it's own "other" way to pass parameters. In the case
of Xitami the KEY/VALUE pairs are set as enviormental variables and
alternativly as an input file (referenced by the CGI_STDIN enviomental
variable).

A CGI should output to the standard output. Because several languages can't
do this under Windows (mainly VB), many wintel webserver pass the app. a
filename it should use for it's output. Xitami defines this filename in the
CGI_STDOUT enviormental variable.

When sending your output to stdout the firs line must be exactly:

        Content-type: text/html

followed by at least one blank line. After that you can send your html code.

I can't suggest any CGI book because I don't have any (well I have an
online version of "CGI programming on the WWW"), and haven't buy any
because they are usually based on Perl, something that I just don't want to
learn.

Some useful (related) links:

CGI official specification

http://hoohoo.ncsa.uiuc.edu/cgi/interface.html

CGI resources

http://www.cgi-resources.com/

Yahoo's CGI directory

ommon_Gateway_Interface/

Xitami

http://www.xitami.net

Internet Servers

http://serverwatch.internet.com/


Regards,
         Daniel  Berstein
         [daber at pair.com]

new topic     » goto parent     » topic index » view message » categorize

6. Re: EuCGI test

Thank you thank you than you........


Grape

>Subject:      Re: EuCGI test
>To:           EUPHORIA at LISTSERV.MUOHIO.EDU
>
>At 04:00 PM 28-02-1999 , you wrote:
>>Thank yuo...I can never say how happy i am at this...I have not messed
>>with it yet but is there a way to make it run any E code? I do not
know
>>cgi(does anyone know of a good book or web site to start at?)
>>
>>Grape Vine
>
>I noticed you visited me on 2-28 16:49:48 4.20.104.15 as Grape Vine ;)
>
>On an earlier post is the full source code of the cgi you used.
>
>CGI programming is easy! A CGI is a program that takes an input,
process it
>and then send it back to the webserver. The procesing of the data is
done
>as usual, you can use anything you want, including calling other
>applications, connecting to databases, creating files, etc. The only
>special mention is about getting the input and sending output.
>
>There a mainly two way your CGI can get it's input:
>
>a) Reading the standard input (like when using the '<' in DOS). Here
you
>must parse each query string that is in the form
KEY1=VALUE?KEY2=VALUE2..
>etc. Spaces are changed by the '+' sign. This way is the standard CGI
(Unix)
>
>b) Some server support another way, called WinCGI. WinCGI was developed
by
>O'Reilly for their WebSite webserver. Today several wintel webserver
>support WinCGI. WinCGI is mich simpler than std. CGI. The webserver
creates
>an enviormental variable where a .INI file is specified. Your app then
>reads the KY=VALUE pairs from that standard Windows ini file. The task
is
>simplifies because there are WinAPI functions that easily read a given
key
>value.
>
>Each server may have it's own "other" way to pass parameters. In the
case
>of Xitami the KEY/VALUE pairs are set as enviormental variables and
>alternativly as an input file (referenced by the CGI_STDIN enviomental
>variable).
>
>A CGI should output to the standard output. Because several languages
can't
>do this under Windows (mainly VB), many wintel webserver pass the app.
a
>filename it should use for it's output. Xitami defines this filename in
the
>CGI_STDOUT enviormental variable.
>
>When sending your output to stdout the firs line must be exactly:
>
>        Content-type: text/html
>
>followed by at least one blank line. After that you can send your html
code.
>
>I can't suggest any CGI book because I don't have any (well I have an
>online version of "CGI programming on the WWW"), and haven't buy any
>because they are usually based on Perl, something that I just don't
want to
>learn.
>
>Some useful (related) links:
>
>CGI official specification
>
>http://hoohoo.ncsa.uiuc.edu/cgi/interface.html
>
>CGI resources
>
>http://www.cgi-resources.com/
>
>Yahoo's CGI directory
>
>ommon_Gateway_Interface/
>
>Xitami
>
>http://www.xitami.net
>
>Internet Servers
>
>http://serverwatch.internet.com/
>
>
>Regards,
>         Daniel  Berstein
>         [daber at pair.com]


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu