Collaboration diagram for HTTP:
A read-only file system is sufficient to run an HTTP server.
Data Structures | |
struct | _REQUEST |
HTTP request information structure. More... | |
struct | _AUTHINFO |
HTTP authorization information structure. More... | |
struct | _CGIFUNCTION |
Registered CGI function. More... | |
struct | _REQUEST |
HTTP request information structure. More... | |
struct | _AUTHINFO |
HTTP authorization information structure. More... | |
struct | _CGIFUNCTION |
Registered CGI function. More... | |
Defines | |
#define | METHOD_GET 1 |
#define | METHOD_POST 2 |
#define | METHOD_HEAD 3 |
#define | MAX_BUFFER_SIZE 256 |
#define | MAX_ASP_FUNC_SIZE 64 |
#define | BUFSIZE 512 |
#define | MIN(a, b) (a<b?a:b) |
#define | SSI_TYPE_FILE 0x01 |
#define | SSI_TYPE_VIRTUAL 0x02 |
#define | SSI_TYPE_EXEC 0x03 |
Typedefs | |
typedef _REQUEST | REQUEST |
Enumerations | |
enum | { ASP_STATE_IDLE = 0, ASP_STATE_START, ASP_STATE_COPY_FUNC } |
Functions | |
void | NutHttpProcessRequest (FILE *stream) |
Process the next HTTP request. | |
void | NutHttpProcessQueryString (REQUEST *req) |
Parses the QueryString. | |
void | NutHttpSendHeaderTop (FILE *stream, REQUEST *req, int status, char *title) |
Send top lines of a standard HTML header. | |
void | NutHttpSendHeaderBot (FILE *stream, char *mime_type, long bytes) |
Send bottom lines of a standard HTML header. | |
void | NutHttpSendError (FILE *stream, REQUEST *req, int status) |
Send a HTTP error response. | |
char * | NutGetMimeType (char *name) |
Return the mime type description of a specified file name. | |
void * | NutGetMimeHandler (char *name) |
Return the mime type handler of a specified file name. | |
u_char | NutSetMimeHandler (char *extension, void(*handler)(FILE *stream, int fd, int file_len, char *http_root, REQUEST *req)) |
Set the mime type handler for a specified file extension. | |
int | NutHttpAuthValidate (REQUEST *req) |
Validate an authorization request. | |
int | NutRegisterAuth (CONST char *dirname, CONST char *login) |
Register an authorization entry. | |
void | NutClearAuth (void) |
Clear all authorization entries. | |
void | NutRegisterSsi (void) |
Register SSI handler for shtml files. | |
void | NutHttpProcessAsp (FILE *stream, int fd, int file_len, char *http_root, REQUEST *req) |
int | NutRegisterAspCallback (int(*func)(char *, FILE *)) |
void | NutRegisterAsp (void) |
Register ASP handler for asp files. | |
int | NutRegisterCgi (char *name, int(*func)(FILE *, REQUEST *)) |
Register a CGI function. | |
void | NutCgiProcessRequest (FILE *stream, REQUEST *req) |
Process an incoming CGI request. | |
char * | NutHttpURLEncode (char *str) |
void | NutHttpURLDecode (char *str) |
URLDecodes a string. | |
void | NutHttpProcessPostQuery (FILE *stream, REQUEST *req) |
Parses the QueryString. | |
char * | NutHttpGetParameter (REQUEST *req, char *name) |
Gets a request parameter value by name. | |
int | NutHttpGetParameterCount (REQUEST *req) |
Gets the number of request parameters. | |
char * | NutHttpGetParameterName (REQUEST *req, int index) |
Gets the name of a request parameter. | |
char * | NutHttpGetParameterValue (REQUEST *req, int index) |
Get the value of a request paramter. | |
int | NutRegisterHttpRoot (char *path) |
Register the HTTP server's root directory. | |
Variables | |
typedef__END_DECLS struct _AUTHINFO | AUTHINFO |
typedef__END_DECLS struct _CGIFUNCTION | CGIFUNCTION |
CONFNET | confnet |
Global network configuration structure. | |
AUTHINFO * | authList = 0 |
CGIFUNCTION *volatile | cgiFunctionList = 0 |
|
Process the next HTTP request. Waits for the next HTTP request on an established connection and processes it.
|
|
Parses the QueryString. Reads the QueryString from a request, and parses it into name/value table. To save RAM, this method overwrites the contents of req_query, and creates a table of pointers into the req_query buffer.
|
|
Send top lines of a standard HTML header. Sends HTTP and Server version lines.
|
|
Send bottom lines of a standard HTML header. Sends Content-Type, Content-Lenght and Connection lines.
|
|
Send a HTTP error response. A canned error file is used.
|
|
Return the mime type description of a specified file name. The mime type returned is based on the file extension.
|
|
Return the mime type handler of a specified file name. This is the function that handles / sends a specific file type to the client. Escpecialy used for server side includes (shtml files)
|
|
Set the mime type handler for a specified file extension. This is the function that handles / sends a specific file type to the client. Escpecialy used for server side includes (shtml files)
|
|
Validate an authorization request.
|
|
Register an authorization entry. Protect a specified directory from unauthorized access.
|
|
Clear all authorization entries. Clears all authorization entries and frees the used ressouces. |
|
Register SSI handler for shtml files. shtml files may use the following ssi commands:
|
|
Register ASP handler for asp files. asp files may use the following syntax: <my_function%> |
|
Register a CGI function.
|
|
Process an incoming CGI request. Applications do not need to call this function. It is automatically called by NutHttpProcessRequest().
|
|
URLDecodes a string. Takes a url-encoded string and decodes it.
|
|
Parses the QueryString. Reads the query from input stream and parses it into name/value table. To save RAM, this method allocated ram and uses req_query to store the input data. Then it creates a table of pointers into the req_query buffer.
|
|
Gets a request parameter value by name.
|
|
Gets the number of request parameters.
|
|
Gets the name of a request parameter.
|
|
Get the value of a request paramter.
|
|
Register the HTTP server's root directory. Only one root directory is supported. Subsequent calls will override previous settings.
|
|
Global network configuration structure. Contains the current network configuration. Nut/Net will load this structure from non-volatile memory during initialization. |