The Request Method, as supplied in the REQUEST_METHOD meta-variable,
identifies the processing method to be applied by the script in
producing a response. The script author can choose to implement the
methods most appropriate for the particular application. If the
script receives a request with a method it does not support it SHOULD
reject it with an error (see section 6.3.3).
4.3.1. GET
The GET method indicates that the script should produce a document
based on the meta-variable values. By convention, the GET method is
'safe' and 'idempotent' and SHOULD NOT have the significance of
taking an action other than producing a document.
The meaning of the GET method may be modified and refined by
protocol-specific meta-variables.
RFC 3875 CGI Version 1.1 October 2004
4.3.2. POST
The POST method is used to request the script perform processing and
produce a document based on the data in the request message-body, in
addition to meta-variable values. A common use is form submission in
HTML [18], intended to initiate processing by the script that has a
permanent affect, such a change in a database.
The script MUST check the value of the CONTENT_LENGTH variable before
reading the attached message-body, and SHOULD check the CONTENT_TYPE
value before processing it.
4.3.3. HEAD
The HEAD method requests the script to do sufficient processing to
return the response header fields, without providing a response
message-body. The script MUST NOT provide a response message-body
for a HEAD request. If it does, then the server MUST discard the
message-body when reading the response from the script.
4.3.4. Protocol-Specific Methods
The script MAY implement any protocol-specific method, such as
HTTP/1.1 PUT and DELETE; it SHOULD check the value of SERVER_PROTOCOL
when doing so.
The server MAY decide that some methods are not appropriate or
permitted for a script, and may handle the methods itself or return
an error to the client.
4.4. The Script Command Line
Some systems support a method for supplying an array of strings to
the CGI script. This is only used in the case of an 'indexed' HTTP
query, which is identified by a 'GET' or 'HEAD' request with a URI
query string that does not contain any unencoded "=" characters. For
such a request, the server SHOULD treat the query-string as a
search-string and parse it into words, using the rules
search-string = search-word *( "+" search-word )
search-word = 1*schar
schar = unreserved | escaped | xreserved
xreserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "," |
"$"
After parsing, each search-word is URL-decoded, optionally encoded in
a system-defined manner and then added to the command line argument
list.
RFC 3875 CGI Version 1.1 October 2004
If the server cannot create any part of the argument list, then the
server MUST NOT generate any command line information. For example,
the number of arguments may be greater than operating system or
server limits, or one of the words may not be representable as an
argument.
The script SHOULD check to see if the QUERY_STRING value contains an
unencoded "=" character, and SHOULD NOT use the command line
arguments if it does.
5. NPH Scripts
5.1. Identification
The server MAY support NPH (Non-Parsed Header) scripts; these are
scripts to which the server passes all responsibility for response
processing.
=12= |