Difference between revisions of "Ns conn"
Jump to navigation
Jump to search
(imported from WiKit id 192) |
m (formatting tweaks) |
||
Line 1: | Line 1: | ||
− | + | <manpage>ns_conn</manpage> | |
− | |||
− | |||
'''NAME''' | '''NAME''' | ||
Line 16: | Line 14: | ||
: The legal ''option''s (which may be abbreviated) are: | : The legal ''option''s (which may be abbreviated) are: | ||
+ | |||
* '''ns_conn authpassword''' | * '''ns_conn authpassword''' | ||
: Returns the decoded user password from the authorization data. | : Returns the decoded user password from the authorization data. | ||
+ | |||
* '''ns_conn authuser''' | * '''ns_conn authuser''' | ||
: Returns the decoded user name from the authorization data. | : Returns the decoded user name from the authorization data. | ||
+ | |||
* '''ns_conn close''' | * '''ns_conn close''' | ||
: Closes the connection so the script (or ADP) can do any time-consuming processing without making the client wait. If you use ns_conn close in an ADP, streaming should be turned on before closing the connection (i.e. <SCRIPT RUNAT=SERVER STREAM=ON>) or nothing will get sent out at all. | : Closes the connection so the script (or ADP) can do any time-consuming processing without making the client wait. If you use ns_conn close in an ADP, streaming should be turned on before closing the connection (i.e. <SCRIPT RUNAT=SERVER STREAM=ON>) or nothing will get sent out at all. | ||
+ | |||
* '''ns_conn content''' ''?offset? ?length?'' | * '''ns_conn content''' ''?offset? ?length?'' | ||
: Returns the content of the HTTP request body, optionally a substring of that content starting at ''offset'' and extending ''length'' characters. | : Returns the content of the HTTP request body, optionally a substring of that content starting at ''offset'' and extending ''length'' characters. | ||
+ | |||
* '''ns_conn contentlength''' | * '''ns_conn contentlength''' | ||
: Returns the number of bytes in the content passed in. | : Returns the number of bytes in the content passed in. | ||
+ | |||
* '''ns_conn driver''' | * '''ns_conn driver''' | ||
: Returns the name of the module (nssock or nsssl) that is acting as the communications driver for this connection. | : Returns the name of the module (nssock or nsssl) that is acting as the communications driver for this connection. | ||
+ | |||
* '''ns_conn form''' | * '''ns_conn form''' | ||
: Returns any submitted form data as an ns_set. This form data may have been submitted with a POST or appended to the URL in a GET request. Note: ns_conn form is not suitable for multipart formdata file upload widgets. | : Returns any submitted form data as an ns_set. This form data may have been submitted with a POST or appended to the URL in a GET request. Note: ns_conn form is not suitable for multipart formdata file upload widgets. | ||
+ | |||
* '''ns_conn headers''' | * '''ns_conn headers''' | ||
: Returns all the header data as an ns_set. The keys of the ns_set represent the field names. The case of the returned field names depends on the HeaderCase configuration parameter. By default, HeaderCase is "Preserve", which means case is preserved. | : Returns all the header data as an ns_set. The keys of the ns_set represent the field names. The case of the returned field names depends on the HeaderCase configuration parameter. By default, HeaderCase is "Preserve", which means case is preserved. | ||
+ | |||
* '''ns_conn host''' | * '''ns_conn host''' | ||
: Returns the host part of the URL in the HTTP request. | : Returns the host part of the URL in the HTTP request. | ||
+ | |||
* '''ns_conn isconnected''' | * '''ns_conn isconnected''' | ||
: Returns 1 if you're in a connection thread, and you are therefore allowed to make calls to ns_conn. It returns 0 if you're not in a connection thread (such as when you're in a schedule procedure) and you are not allowed to make calls to ns_conn. | : Returns 1 if you're in a connection thread, and you are therefore allowed to make calls to ns_conn. It returns 0 if you're not in a connection thread (such as when you're in a schedule procedure) and you are not allowed to make calls to ns_conn. | ||
+ | |||
* '''ns_conn location''' | * '''ns_conn location''' | ||
: Returns the location string for this virtual server in the form: protocol://hostname[:port]. | : Returns the location string for this virtual server in the form: protocol://hostname[:port]. | ||
+ | |||
* '''ns_conn method''' | * '''ns_conn method''' | ||
: Returns the HTTP method, e.g. GET. | : Returns the HTTP method, e.g. GET. | ||
+ | |||
* '''ns_conn outputheaders''' | * '''ns_conn outputheaders''' | ||
: Returns an ns_set containing the headers that will be sent out when a result is returned to the client. This ns_set can be manipulated like any other ns_set. You can also use this command to write to the set of output headers. For example: ns_set put [ns_conn outputheaders] key value. | : Returns an ns_set containing the headers that will be sent out when a result is returned to the client. This ns_set can be manipulated like any other ns_set. You can also use this command to write to the set of output headers. For example: ns_set put [ns_conn outputheaders] key value. | ||
+ | |||
* '''ns_conn peeraddr''' | * '''ns_conn peeraddr''' | ||
: Returns the IP address of the client, i.e. the "other side" of the HTTP connection. The IP address is returned in the form of a string separated with periods (e.g., 155.164.59.75). | : Returns the IP address of the client, i.e. the "other side" of the HTTP connection. The IP address is returned in the form of a string separated with periods (e.g., 155.164.59.75). | ||
+ | |||
* '''ns_conn port''' | * '''ns_conn port''' | ||
: Returns the port specified explicitly in the URL of the HTTP request. If the browser does not explicity send the ":port" part of the URL, the port number returned will be 0. | : Returns the port specified explicitly in the URL of the HTTP request. If the browser does not explicity send the ":port" part of the URL, the port number returned will be 0. | ||
+ | |||
* '''ns_conn protocol''' | * '''ns_conn protocol''' | ||
: Returns the protocol of the URL in the HTTP request (usually unspecified). | : Returns the protocol of the URL in the HTTP request (usually unspecified). | ||
+ | |||
* '''ns_conn query''' | * '''ns_conn query''' | ||
: Returns any query data that was part of the HTTP request. | : Returns any query data that was part of the HTTP request. | ||
+ | |||
* '''ns_conn request''' | * '''ns_conn request''' | ||
: Returns the HTTP request line as presented by the client, e.g. GET / HTTP/1.1. | : Returns the HTTP request line as presented by the client, e.g. GET / HTTP/1.1. | ||
+ | |||
* '''ns_conn url''' | * '''ns_conn url''' | ||
: Returns the URL of the HTTP request. This is the portion of the request after the hostname, for example [ns_conn url] on http://aolserver.com/ returns /index.adp. | : Returns the URL of the HTTP request. This is the portion of the request after the hostname, for example [ns_conn url] on http://aolserver.com/ returns /index.adp. | ||
+ | |||
* '''ns_conn urlc''' | * '''ns_conn urlc''' | ||
: Returns the number of elements (delimited by `/') in the URL of the HTTP request. | : Returns the number of elements (delimited by `/') in the URL of the HTTP request. | ||
+ | |||
* '''ns_conn urlv''' | * '''ns_conn urlv''' | ||
: Returns a list containing the pieces of the URL delimited by `/'. | : Returns a list containing the pieces of the URL delimited by `/'. | ||
+ | |||
* '''ns_conn version''' | * '''ns_conn version''' | ||
Line 90: | Line 110: | ||
: [[ns_getform]], [[ns_queryget]] | : [[ns_getform]], [[ns_queryget]] | ||
− | |||
− | [[Category | + | [[Category:Core Tcl API]] |
Revision as of 12:22, 3 November 2005
<manpage>ns_conn</manpage>
NAME
- ns_conn - Find information about the current HTTP connection.
SYNOPSIS
- ns_conn option ?arg arg ...?
DESCRIPTION
- This command is used to retrieve various pieces of information about a connection.
- The legal options (which may be abbreviated) are:
- ns_conn authpassword
- Returns the decoded user password from the authorization data.
- ns_conn authuser
- Returns the decoded user name from the authorization data.
- ns_conn close
- Closes the connection so the script (or ADP) can do any time-consuming processing without making the client wait. If you use ns_conn close in an ADP, streaming should be turned on before closing the connection (i.e. <SCRIPT RUNAT=SERVER STREAM=ON>) or nothing will get sent out at all.
- ns_conn content ?offset? ?length?
- Returns the content of the HTTP request body, optionally a substring of that content starting at offset and extending length characters.
- ns_conn contentlength
- Returns the number of bytes in the content passed in.
- ns_conn driver
- Returns the name of the module (nssock or nsssl) that is acting as the communications driver for this connection.
- ns_conn form
- Returns any submitted form data as an ns_set. This form data may have been submitted with a POST or appended to the URL in a GET request. Note: ns_conn form is not suitable for multipart formdata file upload widgets.
- ns_conn headers
- Returns all the header data as an ns_set. The keys of the ns_set represent the field names. The case of the returned field names depends on the HeaderCase configuration parameter. By default, HeaderCase is "Preserve", which means case is preserved.
- ns_conn host
- Returns the host part of the URL in the HTTP request.
- ns_conn isconnected
- Returns 1 if you're in a connection thread, and you are therefore allowed to make calls to ns_conn. It returns 0 if you're not in a connection thread (such as when you're in a schedule procedure) and you are not allowed to make calls to ns_conn.
- ns_conn location
- Returns the location string for this virtual server in the form: protocol://hostname[:port].
- ns_conn method
- Returns the HTTP method, e.g. GET.
- ns_conn outputheaders
- Returns an ns_set containing the headers that will be sent out when a result is returned to the client. This ns_set can be manipulated like any other ns_set. You can also use this command to write to the set of output headers. For example: ns_set put [ns_conn outputheaders] key value.
- ns_conn peeraddr
- Returns the IP address of the client, i.e. the "other side" of the HTTP connection. The IP address is returned in the form of a string separated with periods (e.g., 155.164.59.75).
- ns_conn port
- Returns the port specified explicitly in the URL of the HTTP request. If the browser does not explicity send the ":port" part of the URL, the port number returned will be 0.
- ns_conn protocol
- Returns the protocol of the URL in the HTTP request (usually unspecified).
- ns_conn query
- Returns any query data that was part of the HTTP request.
- ns_conn request
- Returns the HTTP request line as presented by the client, e.g. GET / HTTP/1.1.
- ns_conn url
- Returns the URL of the HTTP request. This is the portion of the request after the hostname, for example [ns_conn url] on http://aolserver.com/ returns /index.adp.
- ns_conn urlc
- Returns the number of elements (delimited by `/') in the URL of the HTTP request.
- ns_conn urlv
- Returns a list containing the pieces of the URL delimited by `/'.
- ns_conn version
- Returns the version of the HTTP request. This is usually 1.0 or 1.1.
EXAMPLES
SEE ALSO