Denis Vlasenko | 136f42f | 2007-02-11 14:52:07 +0000 | [diff] [blame^] | 1 | <html><head><title>CGI Script input</title></head><body><h1><img alt="" src="in_files/CGIlogo.gif"> CGI Script Input</h1> |
| 2 | <hr> |
| 3 | |
| 4 | <h2>Specification</h2> |
| 5 | |
| 6 | For requests which have information attached after the header, such as |
| 7 | HTTP POST or PUT, the information will be sent to the script on stdin. |
| 8 | <p> |
| 9 | |
| 10 | The server will send <a href="http://hoohoo.ncsa.uiuc.edu/cgi/env.html#cl">CONTENT_LENGTH</a> bytes on |
| 11 | this file descriptor. Remember that it will give the <a href="http://hoohoo.ncsa.uiuc.edu/cgi/env.html#ct">CONTENT_TYPE</a> of the data as well. The server is |
| 12 | in no way obligated to send end-of-file after the script reads |
| 13 | <code>CONTENT_LENGTH</code> bytes. </p><p> |
| 14 | </p><hr> |
| 15 | <h2>Example</h2> |
| 16 | |
| 17 | Let's take a form with METHOD="POST" as an example. Let's say the form |
| 18 | results are 7 bytes encoded, and look like <code>a=b&b=c</code>. |
| 19 | <p> |
| 20 | |
| 21 | In this case, the server will set CONTENT_LENGTH to 7 and CONTENT_TYPE |
| 22 | to application/x-www-form-urlencoded. The first byte on the script's |
| 23 | standard input will be "a", followed by the rest of the encoded string.</p><p> |
| 24 | |
| 25 | </p><hr> |
| 26 | |
| 27 | <a href="http://hoohoo.ncsa.uiuc.edu/cgi/interface.html"><img alt="[Back]" src="in_files/back.gif">Return to the |
| 28 | interface specification</a> <p> |
| 29 | |
| 30 | CGI - Common Gateway Interface |
| 31 | </p><address><a href="http://hoohoo.ncsa.uiuc.edu/cgi/mailtocgi.html">cgi@ncsa.uiuc.edu</a></address> |
| 32 | |
| 33 | </body></html> |