www.digitalmars.com         C & C++   DMDScript  

D - post method wtih cgi

reply manfred toppoint.de writes:
Hello,

i try to read out the value from the post method, but i get
always an "Internal Server Error" -:(



import c.stdlib;
import c.stdio;
import stream;

int main(char[][] args) {
char[] string;
char *cl;
uint size;
printf("Content-type: text/html\n\n");
printf("<html><body>Hallo Manfred !!! </body></html>\r\n");
printf("<br>");
//query = getenv("QUERY_STRING");
cl = getenv("CONTENT_LENGTH");
printf("cl = %s <br>",cl);
if (cl != null) {
size = atoll(cl);
printf("<br> size %li",size);
}
string = stream.stdin.readString(size);  // <-- here is the problem
return 0;
}


<html>
<head>
<title>Eine einfache Auswertung</title>
</head>
<body>
<h1><center>
<b><u>POST-Formular</u></b></center></h1><br><br>
<form action=http://localhost/cgi-bin/post_methode.cgi method=post>
<center><b>Bitte geben Sie ihren Namen ein :</b><br>
<input name="Textfeld" siue="20"> </input>
<input type=submit value="abschicken"></center>
</form>
</body>
</html>

Manfred 
Sep 17 2003
next sibling parent reply "Julio César Carrascal Urquijo" <adnoctum phreaker.net> writes:
This line:

 printf("Content-type: text/html\n\n");
Should be: printf("Content-type: text/html\r\n\r\n");
Sep 17 2003
parent Manfred Hansen <manfred toppoint.de> writes:
Hello,

i have change this, but i get still the error message -:(

On Wed, 17 Sep 2003 12:10:07 -0500, Julio César Carrascal Urquijo wrote:

 This line:
 
 printf("Content-type: text/html\n\n");
Should be: printf("Content-type: text/html\r\n\r\n");
Sep 18 2003
prev sibling next sibling parent "Mårten Ask" <majbritt37 hotmail.com> writes:
stdin.toString() returns all the POST-data. No need to use CONTENT_LENGTH.



<manfred toppoint.de> skrev i meddelandet
news:bk9mqj$239g$1 digitaldaemon.com...
 Hello,

 i try to read out the value from the post method, but i get
 always an "Internal Server Error" -:(



 import c.stdlib;
 import c.stdio;
 import stream;

 int main(char[][] args) {
 char[] string;
 char *cl;
 uint size;
 printf("Content-type: text/html\n\n");
 printf("<html><body>Hallo Manfred !!! </body></html>\r\n");
 printf("<br>");
 //query = getenv("QUERY_STRING");
 cl = getenv("CONTENT_LENGTH");
 printf("cl = %s <br>",cl);
 if (cl != null) {
 size = atoll(cl);
 printf("<br> size %li",size);
 }
 string = stream.stdin.readString(size);  // <-- here is the problem
 return 0;
 }


 <html>
 <head>
 <title>Eine einfache Auswertung</title>
 </head>
 <body>
 <h1><center>
 <b><u>POST-Formular</u></b></center></h1><br><br>
 <form action=http://localhost/cgi-bin/post_methode.cgi method=post>
 <center><b>Bitte geben Sie ihren Namen ein :</b><br>
 <input name="Textfeld" siue="20"> </input>
 <input type=submit value="abschicken"></center>
 </form>
 </body>
 </html>

 Manfred
Sep 18 2003
prev sibling parent reply "Charles Sanders" <sanders-consulting comcast.net> writes:
Someone wrote a cgi module, anyone rememeber where it is ?

Benji hurry up with that site its desperatly needed! :)

Charles


<manfred toppoint.de> wrote in message
news:bk9mqj$239g$1 digitaldaemon.com...
 Hello,

 i try to read out the value from the post method, but i get
 always an "Internal Server Error" -:(



 import c.stdlib;
 import c.stdio;
 import stream;

 int main(char[][] args) {
 char[] string;
 char *cl;
 uint size;
 printf("Content-type: text/html\n\n");
 printf("<html><body>Hallo Manfred !!! </body></html>\r\n");
 printf("<br>");
 //query = getenv("QUERY_STRING");
 cl = getenv("CONTENT_LENGTH");
 printf("cl = %s <br>",cl);
 if (cl != null) {
 size = atoll(cl);
 printf("<br> size %li",size);
 }
 string = stream.stdin.readString(size);  // <-- here is the problem
 return 0;
 }


 <html>
 <head>
 <title>Eine einfache Auswertung</title>
 </head>
 <body>
 <h1><center>
 <b><u>POST-Formular</u></b></center></h1><br><br>
 <form action=http://localhost/cgi-bin/post_methode.cgi method=post>
 <center><b>Bitte geben Sie ihren Namen ein :</b><br>
 <input name="Textfeld" siue="20"> </input>
 <input type=submit value="abschicken"></center>
 </form>
 </body>
 </html>

 Manfred
Sep 18 2003
parent Brad Anderson <brad sankaty.com> writes:
Charles Sanders wrote:
 Someone wrote a cgi module, anyone rememeber where it is ?
 
Mårten Ask - posted on 7/27/03 - cgi.d was attached.
Sep 18 2003