D - CGI module
- "Mårten Ask" <majbritt37 hotmail.com> Jul 27 2003
- "Carlos Santander B." <carlos8294 msn.com> Jul 27 2003
- "Charles Sanders" <sanders-consulting comcast.net> Jul 28 2003
- "Mårten Ask" <majbritt37 hotmail.com> Jul 28 2003
- "Carlos Santander B." <carlos8294 msn.com> Jul 30 2003
Hello,
I've written a very basic cgi module. It parses headers, querystrings and
forms as well as getting and settings cookies. It needs lots of more work,
but is quite useful already. Anyway, I've tested it a little and was hoping
that others might test it aswell so I can add useful stuff. I've only used
PHP before and all this strong typing really hurts my brain! :-) So I could
use some help..
Anyway, I'll send the module along and here's a small test program I wrote:
import cgi;
void main()
{
Request req = new Request();
Response res = new Response();
if(req.serverVariable("REQUEST_METHOD") == "POST")
{
char[] name = req.formString("name"); // returns formfield value as string
char[] comment = req.formString("comment");
res.cookie("name", name, "", "", "", 0);
res.write("<html>\n<head>\n<title>CGI-test</title>\n</head>\n");
res.write("<body>\n");
res.write("Hello <b>"~name~"</b><p>\n");
res.write("You wrote:\n");
res.write("<blockquote><b>\""~comment~"\"</b></blockquote>\n");
res.write("<a href='cgitest.exe'>Back to form</a>");
res.write("</body></html>");
res.flush();
}
else
{
char[] cookie;
try
{
cookie = req.cookie("name");
}
catch(CGIError) // cookie wasn't set!
{
cookie = "";
}
printf(res.getHeaders()~"\n\n");
printf("<html>\n<head>\n<title>CGI-test</title>\n</head>\n");
printf("<body>\n");
printf("<form method='post' action='cgitest.exe'>\n");
printf("Name: <input type='text' name='name' value='%.*s'><br>\n",
cookie);
printf("Comment: <input type='text' name='comment'><br>\n");
printf("<input type='submit' value='Send!'>\n");
printf("</form></body></html");
}
}
Jul 27 2003
"Mårten Ask" <majbritt37 hotmail.com> wrote in message news:bg0tqe$2mhm$1 digitaldaemon.com... | Hello, | | I've written a very basic cgi module. It parses headers, querystrings and | forms as well as getting and settings cookies. It needs lots of more work, | but is quite useful already. Anyway, I've tested it a little and was hoping | that others might test it aswell so I can add useful stuff. I've only used | PHP before and all this strong typing really hurts my brain! :-) So I could | use some help.. | | Anyway, I'll send the module along and here's a small test program I wrote: | ... what do I have to do to use cgi? ————————————————————————— Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.504 / Virus Database: 302 - Release Date: 2003-07-24
Jul 27 2003
Yes I'd like to know also, is their instructions to setup apache with it somewhere? Charles "Carlos Santander B." <carlos8294 msn.com> wrote in message news:bg2477$tb5$1 digitaldaemon.com..."Mårten Ask" <majbritt37 hotmail.com> wrote in message news:bg0tqe$2mhm$1 digitaldaemon.com... | Hello, | | I've written a very basic cgi module. It parses headers, querystrings
| forms as well as getting and settings cookies. It needs lots of more
| but is quite useful already. Anyway, I've tested it a little and was hoping | that others might test it aswell so I can add useful stuff. I've only
| PHP before and all this strong typing really hurts my brain! :-) So I could | use some help.. | | Anyway, I'll send the module along and here's a small test program I wrote: | ... what do I have to do to use cgi? ------------------------- Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.504 / Virus Database: 302 - Release Date: 2003-07-24
Jul 28 2003
With apache you just put the .exe in the cgi-bin directory. Then reach it at http://localhost/cgi-bin/filename.exe "Charles Sanders" <sanders-consulting comcast.net> skrev i meddelandet news:bg3dmn$28uh$1 digitaldaemon.com...Yes I'd like to know also, is their instructions to setup apache with it somewhere? Charles "Carlos Santander B." <carlos8294 msn.com> wrote in message news:bg2477$tb5$1 digitaldaemon.com..."Mårten Ask" <majbritt37 hotmail.com> wrote in message news:bg0tqe$2mhm$1 digitaldaemon.com... | Hello, | | I've written a very basic cgi module. It parses headers, querystrings
| forms as well as getting and settings cookies. It needs lots of more
| but is quite useful already. Anyway, I've tested it a little and was hoping | that others might test it aswell so I can add useful stuff. I've only
| PHP before and all this strong typing really hurts my brain! :-) So I could | use some help.. | | Anyway, I'll send the module along and here's a small test program I wrote: | ... what do I have to do to use cgi? ------------------------- Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.504 / Virus Database: 302 - Release Date: 2003-07-24
Jul 28 2003
"Mårten Ask" <majbritt37 hotmail.com> wrote in message news:bg3n4v$2ik1$1 digitaldaemon.com... | With apache you just put the .exe in the cgi-bin directory. Then reach it at | http://localhost/cgi-bin/filename.exe | And if I'm trying to access it from a html page? I mean, how do I put it in a <a href=...>? ————————————————————————— Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.504 / Virus Database: 302 - Release Date: 2003-07-24
Jul 30 2003








"Carlos Santander B." <carlos8294 msn.com>