📄 rfc3050.txt
字号:
These metavariables are specific to the protocol via which the method is sent. Interpretation of these variables depends on the value of the SERVER_PROTOCOL metavariable (see section 5.5.1.20). Metavariables with names beginning with "SIP_" contain values from the message header, if the protocol used was SIP. Each SIP header field name is converted to upper case, has all occurrences of "-" replaced with "_", and has "SIP_" prepended to form the metavariable name. Similar transformations are applied for other protocols. The header data MAY be presented as sent by the client, or MAY be rewritten in ways which do not change its semantics. If multiple header fields with the same field-name are received then the server MUST rewrite them as though they had been received as a single header field having the same semantics before being represented in a metavariable. Similarly, a header field that is received on more than one line MUST be merged into a single line. The server MUST, if necessary, change the representation of the data (for example, the character set) to be appropriate for a CGI metavariable. Note: these metavariables' names were changed from HTTP_* to SIP_* since the first draft of this specification. The intention had been to make it easier to use existing CGI libraries unmodified, but this convenience was felt to be outweighed by the confusion this introduced. Servers are not required to create metavariables for all the message header fields they receive. However, because of the relatively high importance of headers in SIP for messages' semantic content, the server SHOULD provide all headers which do not contain potentially sensitive authorization information, such as Authorization. Servers SHOULD provide protocol-specific metavariables even for information which is available through other SIP CGI metavariables, such as CONTENT_LENGTH and CONTENT_TYPE. This allows a SIP CGI script to determine, if necessary, whether the information in the other metavariables was in the original message, or was synthesized by the server.5.5.1.6 REGISTRATIONS This metavariable contains a list the current locations the server has registered for the user in the Request-URI of the initial request of a transaction. It is syntactically identical to the protocolLennox, et al. Informational [Page 18]RFC 3050 CGI for SIP January 2001 metavariable SIP_CONTACT, and thus is defined by section 5.5.1.5 of this document and by section 6.13 of the SIP/2.0 specification [2]. It contains all the uris, uri parameters, display names, and contact parameters for the addresses registered with the server. The syntax of REGISTRATIONS is identical to how SIP_CONTACT would appear in a 302 response from a redirection server. This allows parsing code to be re-used. If a user's registrations change in the course of a transaction, the server SHOULD update this metavariable accordingly for subsequent script invocations for the transaction.5.5.1.7 REMOTE_ADDR The IP address of the client that sent the message to the server. This is not necessarily that of the originating user agent client or server. REMOTE_ADDR = hostnumber hostnumber = IPv4address | IPv6address The definitions of IPv4address and Ipv6address are provided in Appendix B of RFC 2373 [7]. For locally-generated responses (see section 5.8), this SHOULD be the loopback address (i.e., 127.0.0.1 for IPv4 or ::1 for IPv6). Servers MUST supply this value to scripts.5.5.1.8 REMOTE_HOST This is the fully qualified domain name of the host sending the message to this server, if available, otherwise not defined. (See section 5.5.1.7). Domain names are not case sensitive. REMOTE_HOST = hostname Servers SHOULD provide this information to scripts.5.5.1.9 REMOTE_IDENT The identity information supported about the connection by a RFC 1413 [8] request, if available. REMOTE_IDENT = *CHARLennox, et al. Informational [Page 19]RFC 3050 CGI for SIP January 2001 The server MAY choose not to support this feature, and it is anticipated that not many implementations will, as the information is not particularly useful in the presence of complex proxy paths.5.5.1.10 REMOTE_USER If the message requested authentication (i.e., the AUTH_TYPE metavariable is set), then the value of the REMOTE_USER metavariable is set to the user-ID supplied for the authentication. For Basic authentication this is the content of the (decoded) "userid" grammar element; for Digest it is content of "username-value." For PGP authentication, it is the URI specified in the "signed-by" parameter of the Authorization header, if present, otherwise the URI part of the From header. If some other authentication scheme was requested, this metavariable SHOULD be set to an appropriate component of the authorization information identifying the user or entity associated with the credentials. If authentication was not requested, this metavariable is not defined. REMOTE_USER = *OCTET Servers SHOULD provide this metavariable to scripts.5.5.1.11 REQUEST_METHOD If the message triggering the script was a request, the REQUEST_METHOD metavariable is set to the method with which the request was made, as described in section 4.2 of the SIP/2.0 specification [2]; otherwise not defined. REQUEST_METHOD = sip-method sip-method = "INVITE" | "BYE" | "OPTIONS" | "CANCEL" | "REGISTER" | "ACK" | extension-method extension-method = token Note that ACK is usually not appropriate for the SIP CGI 1.1 environment; however, see section 5.11. The implications of REGISTER in the CGI context are discussed in section 5.9, and CANCEL is discussed in section 5.10. A SIP CGI 1.1 server MAY choose to process some methods directly rather than passing them to scripts. Servers MUST provide this metavariable to scripts if the triggering message was a request.Lennox, et al. Informational [Page 20]RFC 3050 CGI for SIP January 20015.5.1.12 REQUEST_TOKEN REQUEST_TOKEN = token If the script specified a request token in a proxied request, this token is returned to the server in responses to that request. Note that this token is chosen by the script, not by the server. Each response to a proxied request contains the same value for this token.5.5.1.13 REQUEST_URI This metavariable is specific to requests made with SIP. REQUEST_URI = absoluteURI ; defined in RFC 2396 [9] If the message triggering the script was a request, this variable indicates the URI specified with the request method. This metavariable is only defined if REQUEST_METHOD is defined; in that case, servers MUST provide it to scripts. This metavariable fills the roles of HTTP CGI's SCRIPT_NAME, PATH_INFO, and QUERY_STRING.5.5.1.14 RESPONSE_STATUS RESPONSE_STATUS = Status-Code If the message triggering the script was a response, this variable indicates the numeric code specified in the response; otherwise it is not defined. In the former case, servers MUST provide this metavariable to scripts.5.5.1.15 RESPONSE_REASON RESPONSE_REASON = Reason-Phrase If the message triggering the script was a response, this variable indicates the textual string specified in the response.5.5.1.16 RESPONSE_TOKEN RESPONSE_TOKEN = token If the message triggering the script was a response, the server MUST specify a token which subsequent invocations of the CGI script can use to identify this response. This string is chosen by the server and is opaque to the CGI script. See the discussion of CGI-FORWARD- RESPONSE in section 5.6.1 below.Lennox, et al. Informational [Page 21]RFC 3050 CGI for SIP January 20015.5.1.17 SCRIPT_COOKIE SCRIPT_COOKIE = token This is the value an earlier invocation of this script for this transaction passed to the server in CGI action line CGI-SET-COOKIE. See the description of that action in section 5.6.1.4 below.5.5.1.18 SERVER_NAME The SERVER_NAME metavariable is set to the name of the server. SERVER_NAME = hostname | hostnumber Servers MUST provide this metavariable to scripts.5.5.1.19 SERVER_PORT The SERVER_PORT metavariable is set to the port on which the message was received. SERVER_PORT = 1*digit Servers MUST provide this metavariable to scripts.5.5.1.20 SERVER_PROTOCOL The SERVER_PROTOCOL metavariable is set to the name and revision of the protocol with which the message arrived. This will usually be "SIP/2.0". This is not necessarily the same as the protocol version used by the server in its response to the client. SERVER_PROTOCOL = SIP-Version | extension-version | extension-token extension-version = protocol "/" 1*digit "." 1*digit protocol = 1*( alphanum | "+" | "-" | "." ) extension-token = token Servers MUST provide this metavariable to scripts.Lennox, et al. Informational [Page 22]RFC 3050 CGI for SIP January 20015.5.1.21 SERVER_SOFTWARE The SERVER_SOFTWARE metavariable is set to the name and version of the information server software handling the message (and running the gateway). SERVER_SOFTWARE = 1*product product = token [ "/" product-version ] product-version = token Servers MUST provide this metavariable to scripts.5.5.2 Message Bodies As there may be a data entity attached to the message, there MUST be a system-defined method for the script to read these data. Unless defined otherwise, this will be via the `standard input' file descriptor. If the metavariable CONTENT_LENGTH (see section 5.5.1.2) is defined, the server MUST supply at least that many bytes to scripts on the standard input stream. Scripts are not obliged to read the data. Servers MAY signal an EOF condition after CONTENT_LENGTH bytes have been read, but are not obligated to do so. Therefore, scripts MUST NOT attempt to read more than CONTENT_LENGTH bytes, even if more data are available.5.6 Data Output from the SIP CGI Script There MUST be a system-defined method for the script to send data back to the server or client. Unless defined otherwise, this will be via the `standard output' file descriptor. Servers MAY implement a timeout period within which data must be received from scripts, a maximum number of requests or responses that a particular CGI script can initiate, a maximum total number of requests or responses that can be sent by scripts over the lifetime of a transaction, or any other resource limitations it desires. If a script exceeds one of these limitations, the server MAY terminate the script process and SHOULD abort the transaction with either a `504 Gateway Timed Out' or a `500 Internal Server Error' response.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -