#include "nsd.h"Data Structures | |
| struct | Stream |
Defines | |
| #define | BUFSIZE 2048 |
Functions | |
| int | Ns_FetchPage (Ns_DString *dsPtr, char *url, char *server) |
| int | Ns_FetchURL (Ns_DString *dsPtr, char *url, Ns_Set *headers) |
| int | NsTclGetUrlObjCmd (ClientData arg, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) |
| #define BUFSIZE 2048 |
| int Ns_FetchPage | ( | Ns_DString * | dsPtr, | |
| char * | url, | |||
| char * | server | |||
| ) |
----------------------------------------------------------------------
Ns_FetchPage --
Fetch a page off of this very server. Url must reference a file in the filesystem.
Results: NS_OK or NS_ERROR.
Side effects: The file contents will be put into the passed-in dstring.
----------------------------------------------------------------------
| int Ns_FetchURL | ( | Ns_DString * | dsPtr, | |
| char * | url, | |||
| Ns_Set * | headers | |||
| ) |
----------------------------------------------------------------------
Ns_FetchURL --
Open up an HTTP connection to an arbitrary URL.
Results: NS_OK or NS_ERROR.
Side effects: Page contents will be appended to the passed-in dstring. Headers returned to us will be put into the passed-in Ns_Set. The set name will be changed to a copy of the HTTP status line.
----------------------------------------------------------------------
Parse the URL and open a connection.
Send a simple HTTP GET request.
Buffer the socket and read the response line and then consume the headers, parsing them into any given header set.
Without any check on limit or total size, foolishly read the remaining content into the dstring.
| int NsTclGetUrlObjCmd | ( | ClientData | arg, | |
| Tcl_Interp * | interp, | |||
| int | objc, | |||
| Tcl_Obj *CONST | objv[] | |||
| ) |
----------------------------------------------------------------------
NsTclGetUrlObjCmd --
Implements ns_geturl.
Results: Tcl result.
Side effects: See docs.
----------------------------------------------------------------------
1.5.1