#include "nsd.h"Functions | |
| Ns_Set * | Ns_ConnHeaders (Ns_Conn *conn) |
| Ns_Set * | Ns_ConnOutputHeaders (Ns_Conn *conn) |
| char * | Ns_ConnAuthUser (Ns_Conn *conn) |
| char * | Ns_ConnAuthPasswd (Ns_Conn *conn) |
| int | Ns_ConnContentLength (Ns_Conn *conn) |
| char * | Ns_ConnContent (Ns_Conn *conn) |
| int | Ns_ConnContentOnDisk (Ns_Conn *conn) |
| int | Ns_ConnContentFd (Ns_Conn *conn) |
| char * | Ns_ConnServer (Ns_Conn *conn) |
| int | Ns_ConnResponseStatus (Ns_Conn *conn) |
| int | Ns_ConnGetStatus (Ns_Conn *conn) |
| void | Ns_ConnSetStatus (Ns_Conn *conn, int status) |
| int | Ns_ConnContentSent (Ns_Conn *conn) |
| int | Ns_ConnResponseLength (Ns_Conn *conn) |
| char * | Ns_ConnPeer (Ns_Conn *conn) |
| int | Ns_ConnPeerPort (Ns_Conn *conn) |
| void | Ns_SetConnLocationProc (Ns_LocationProc *procPtr) |
| void | Ns_SetLocationProc (char *server, Ns_LocationProc *procPtr) |
| char * | Ns_ConnLocation (Ns_Conn *conn) |
| char * | Ns_ConnHost (Ns_Conn *conn) |
| int | Ns_ConnPort (Ns_Conn *conn) |
| int | Ns_ConnSock (Ns_Conn *conn) |
| char * | Ns_ConnDriverName (Ns_Conn *conn) |
| void * | Ns_ConnDriverContext (Ns_Conn *conn) |
| Ns_Time * | Ns_ConnStartTime (Ns_Conn *conn) |
| int | Ns_ConnId (Ns_Conn *conn) |
| int | Ns_ConnModifiedSince (Ns_Conn *conn, time_t since) |
| char * | Ns_ConnGetType (Ns_Conn *conn) |
| void | Ns_ConnSetType (Ns_Conn *conn, char *type) |
| Tcl_Encoding | Ns_ConnGetEncoding (Ns_Conn *conn) |
| void | Ns_ConnSetEncoding (Ns_Conn *conn, Tcl_Encoding encoding) |
| Tcl_Encoding | Ns_ConnGetUrlEncoding (Ns_Conn *conn) |
| void | Ns_ConnSetUrlEncoding (Ns_Conn *conn, Tcl_Encoding encoding) |
| int | NsTclCheckConnId (Tcl_Interp *interp, Tcl_Obj *objPtr) |
| int | Ns_ConnGetWriteEncodedFlag (Ns_Conn *conn) |
| int | Ns_ConnGetKeepAliveFlag (Ns_Conn *conn) |
| int | Ns_ConnGetGzipFlag (Ns_Conn *conn) |
| void | Ns_ConnSetWriteEncodedFlag (Ns_Conn *conn, int flag) |
| void | Ns_ConnSetKeepAliveFlag (Ns_Conn *conn, int flag) |
| void | Ns_ConnSetGzipFlag (Ns_Conn *conn, int flag) |
| int | NsTclConnObjCmd (ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj **objv) |
| int | NsTclWriteContentObjCmd (ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj **objv) |
| int | NsTclStartContentObjCmd (ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj **objv) |
| char* Ns_ConnAuthPasswd | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnAuthPasswd --
Get the authenticated user's password
Results: A pointer to a string with the user's plaintext password
Side effects: None.
----------------------------------------------------------------------
| char* Ns_ConnAuthUser | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnAuthUser --
Get the authenticated user
Results: A pointer to a string with the username
Side effects: None
----------------------------------------------------------------------
| char* Ns_ConnContent | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnContent --
Return pointer to start of content of length conn->contetLength. Note the content is likely, but not guaranteed to be, null terminated. Specifically, in the case of file mapped content which ends on a page boundry, a terminating null may not be present. The content is safe to modify in place.
Results: Start of content or NULL on mapping failure.
Side effects: Content file will be mapped if currently only in an open file.
----------------------------------------------------------------------
| int Ns_ConnContentFd | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnContentFd --
Return open fd with request content. The fd is owned by the connection and should not be closed by the caller.
Results: Open temp file or -1 on new temp file failure.
Side effects: Content will be copied to a temp file if it is currently only in memory.
----------------------------------------------------------------------
| int Ns_ConnContentLength | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnContentLength --
Get the content length from the client
Results: An integer content length, or 0 if none sent
Side effects: None.
----------------------------------------------------------------------
| int Ns_ConnContentOnDisk | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnContentOnDisk --
Return 1 if the content has been copied to a temp file, either because it was greater than maxinput, or because Ns_ConnContentFd has been called. Returns 0, otherwise. This is useful in the case the application wants to be as efficient as possible, and not cause excess file creation or mmap()ing.
Results: 0 if content only in RAM, 1 if in /tmp file.
Side effects: None.
----------------------------------------------------------------------
| int Ns_ConnContentSent | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnContentSent --
Return the number of bytes sent to the browser after headers.
Results: Bytes sent.
Side effects: None.
----------------------------------------------------------------------
| void* Ns_ConnDriverContext | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnDriverContext --
Get the conn-wide context for this driver
Results: The driver-supplied context
Side effects: None.
----------------------------------------------------------------------
| char* Ns_ConnDriverName | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnDriverName --
Return the name of this driver
Results: A driver name
Side effects: None.
----------------------------------------------------------------------
| Tcl_Encoding Ns_ConnGetEncoding | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnGetEncoding, Ns_ConnSetEncoding --
Get (set) the Tcl_Encoding for the connection which is used to convert from UTF to specified output character set.
Results: Pointer to Tcl_Encoding (get) or NULL (set).
Side effects: See Ns_ConnGetQuery().
----------------------------------------------------------------------
| int Ns_ConnGetGzipFlag | ( | Ns_Conn * | conn | ) |
| int Ns_ConnGetKeepAliveFlag | ( | Ns_Conn * | conn | ) |
| int Ns_ConnGetStatus | ( | Ns_Conn * | conn | ) |
| char* Ns_ConnGetType | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnGetType, Ns_ConnSetType --
Get (set) the response mime type.
Results: Pointer to current type.
Side effects: May update connection enconding.
----------------------------------------------------------------------
| Tcl_Encoding Ns_ConnGetUrlEncoding | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnGetUrlEncoding, Ns_ConnSetUrlEncoding --
Get (set) the Tcl_Encoding for the connection which is used to convert input forms to proper UTF.
Results: Pointer to Tcl_Encoding (get) or NULL (set).
Side effects: See Ns_ConnGetQuery().
----------------------------------------------------------------------
| int Ns_ConnGetWriteEncodedFlag | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnGetWriteEncodedFlag -- Ns_ConnGetKeepAliveFlag -- Ns_ConnGetGzipFlag --
Get the current write encoding, keepalive, or gzip flag.
Results: Boolean.
Side effects: None.
----------------------------------------------------------------------
| Ns_Set* Ns_ConnHeaders | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnHeaders --
Get the headers
Results: An Ns_Set containing HTTP headers from the client
Side effects: None
----------------------------------------------------------------------
| char* Ns_ConnHost | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnHost --
Get the address of the current connection
Results: A string address
Side effects: None.
----------------------------------------------------------------------
| int Ns_ConnId | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnId --
Return the connection id.
Results: Integer id.
Side effects: None.
----------------------------------------------------------------------
| char* Ns_ConnLocation | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnLocation --
Get the location of this connection. It is of the form METHOD://HOSTNAME:PORT
Results: a string URL, not including path
Side effects: None.
----------------------------------------------------------------------
| int Ns_ConnModifiedSince | ( | Ns_Conn * | conn, | |
| time_t | since | |||
| ) |
----------------------------------------------------------------------
Ns_ConnModifiedSince --
Has the data the url points to changed since a given time?
Results: NS_TRUE if data modified, NS_FALSE otherwise.
Side effects: None
NOTE: This doesn't do a strict time check. If the server flags aren't set to check modification, or if there wasn't an 'If-Modified-Since' header in the request, then this'll always return true
----------------------------------------------------------------------
| Ns_Set* Ns_ConnOutputHeaders | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnOutputHeaders --
Get the output headers
Results: A writeable Ns_Set containing headers to send back to the client
Side effects: None
----------------------------------------------------------------------
| char* Ns_ConnPeer | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnPeer --
Get the peer's internet address
Results: A string IP address
Side effects: None
----------------------------------------------------------------------
| int Ns_ConnPeerPort | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnPeerPort --
Get the port from which the peer is coming
Results: An integer port #
Side effects: None
----------------------------------------------------------------------
| int Ns_ConnPort | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnPort --
What server port is this connection on?
Results: Integer port number
Side effects: None.
----------------------------------------------------------------------
| int Ns_ConnResponseLength | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnResponseLength --
Get the response length
Results: integer, number of bytes to send
Side effects: None.
----------------------------------------------------------------------
| int Ns_ConnResponseStatus | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnResponseStatus --
Get the HTTP reponse code that will be sent
Results: An integer response code (e.g., 200 for OK)
Side effects: None.
----------------------------------------------------------------------
| char* Ns_ConnServer | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnServer --
Get the server name
Results: A string ptr to the server name
Side effects: None.
----------------------------------------------------------------------
| void Ns_ConnSetEncoding | ( | Ns_Conn * | conn, | |
| Tcl_Encoding | encoding | |||
| ) |
| void Ns_ConnSetGzipFlag | ( | Ns_Conn * | conn, | |
| int | flag | |||
| ) |
| void Ns_ConnSetKeepAliveFlag | ( | Ns_Conn * | conn, | |
| int | flag | |||
| ) |
| void Ns_ConnSetStatus | ( | Ns_Conn * | conn, | |
| int | status | |||
| ) |
| void Ns_ConnSetType | ( | Ns_Conn * | conn, | |
| char * | type | |||
| ) |
| void Ns_ConnSetUrlEncoding | ( | Ns_Conn * | conn, | |
| Tcl_Encoding | encoding | |||
| ) |
| void Ns_ConnSetWriteEncodedFlag | ( | Ns_Conn * | conn, | |
| int | flag | |||
| ) |
----------------------------------------------------------------------
Ns_ConnSetWriteEncodedFlag -- Ns_ConnSetKeepAliveFlag -- Ns_ConnSetGzipFlag --
Set the current write encoding, keepalive, or gzip flag.
Results: void.
Side effects: None.
----------------------------------------------------------------------
| int Ns_ConnSock | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnSock --
Return the underlying socket for a connection.
Results: A driver name
Side effects: None.
----------------------------------------------------------------------
| Ns_Time* Ns_ConnStartTime | ( | Ns_Conn * | conn | ) |
----------------------------------------------------------------------
Ns_ConnStartTime --
Return the Start Time
Results: Ns_Time value
Side effects: None.
----------------------------------------------------------------------
| void Ns_SetConnLocationProc | ( | Ns_LocationProc * | procPtr | ) |
---------------------------------------------------------------------- Ns_SetConnLocationProc --
Set pointer to custom routine that acts like Ns_ConnLocation();
Results: None.
Side effects: None.
----------------------------------------------------------------------
| void Ns_SetLocationProc | ( | char * | server, | |
| Ns_LocationProc * | procPtr | |||
| ) |
---------------------------------------------------------------------- Ns_SetLocationProc --
Set pointer to custom routine that acts like Ns_ConnLocation();
Results: None.
Side effects: None.
----------------------------------------------------------------------
| int NsTclCheckConnId | ( | Tcl_Interp * | interp, | |
| Tcl_Obj * | objPtr | |||
| ) |
----------------------------------------------------------------------
NsTclCheckConnId --
Given an conn ID, could this be a conn ID?
Results: Boolean.
Side effects: If interp is non-null, an error message will be left if necessary.
----------------------------------------------------------------------
| int NsTclConnObjCmd | ( | ClientData | arg, | |
| Tcl_Interp * | interp, | |||
| int | objc, | |||
| Tcl_Obj ** | objv | |||
| ) |
----------------------------------------------------------------------
NsTclConnObjCmd --
Implements ns_conn as an obj command.
Results: Standard Tcl result.
Side effects: See docs.
----------------------------------------------------------------------
Only the "isconnected" option operates without a conn.
NB: Not reached - silence compiler warning.
NB: Dup the fd so the channel can be safely closed later.
NB: Ignore any cached form if query is no longer valid.
| int NsTclStartContentObjCmd | ( | ClientData | arg, | |
| Tcl_Interp * | interp, | |||
| int | objc, | |||
| Tcl_Obj ** | objv | |||
| ) |
----------------------------------------------------------------------
NsTclStartContentObjCmd --
Set connPtr->sendState to "Content" and set the charset/encoding to use for further data.
Results: NS_OK/NS_ERROR
Side effects: connPtr->sendState and connPtr->encoding may be set.
----------------------------------------------------------------------
| int NsTclWriteContentObjCmd | ( | ClientData | arg, | |
| Tcl_Interp * | interp, | |||
| int | objc, | |||
| Tcl_Obj ** | objv | |||
| ) |
----------------------------------------------------------------------
NsTclWriteContentObjCmd --
Implements ns_writecontent as obj command.
Results: Tcl result.
Side effects: See docs.
----------------------------------------------------------------------
1.5.1