You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by johnd <jo...@roiad.com> on 2001/12/06 21:52:20 UTC

cgi stdin

In the apache docs I read:

The ``special format'' is very simple. A field name and its value are joined together with an equals (=) sign, and pairs of values are joined together with an ampersand (&). Inconvenient characters like spaces, ampersands, and equals signs, are converted into their hex equivalent so that they don't gum up the works. The whole data string might look something like:

     name=Rich%20Bowen&city=Lexington&state=KY&sidekick=Squirrel%20Monkey



I made this little cgi:

------------------------

#!/usr/bin/python

import sys

print "Content-type: text/html\n\n"
inp=sys.stdin
#inp=open('inp', 'r+')
inp.readline();
print "about to show vars"
while 1:
	line=inp.readline()
	if line=="":
		break
	print line

-------------------

When I post a from of data to it...it doesnt sshow the query string data..

According the the docs, I thought the data was supposed to come in on stdin
 

 ps...I know I can get it from the env var QUERY_STRING

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


RE: cgi stdin

Posted by Joshua Slive <jo...@slive.ca>.

> -----Original Message-----
> From: johnd [mailto:john@roiad.com]

> When I post a from of data to it...it doesnt sshow the query string data..
>
> According the the docs, I thought the data was supposed to come
> in on stdin
>
>
>  ps...I know I can get it from the env var QUERY_STRING

The "official" word in this regard comes from the CGI spec:
http://httpd.apache.org/docs/misc/FAQ.html#cgi-spec

There you will find that CGI data can come from two places.  If you really
POST, then it comes in stdin.  If you GET the cgi script, then it comes in
the QUERY_STRING.  My suspicion is that your are using method="get" in your
form.  Try changing it to method="post".

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org