Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

XgHTTPD


Data Structures

struct  _AUTHINFO
 HTTP authorization information structure. More...

struct  _AUTHINFO
 HTTP authorization information structure. More...

struct  _CGIFUNCTION
 Registered CGI function. More...

struct  _CGIFUNCTION
 Registered CGI function. More...

struct  _REQUEST
 HTTP request information structure. More...

struct  _REQUEST
 HTTP request information structure. More...


Functions

void NutHttpProcessRequest (NUTDEVICE *sostream)
 Process the next HTTP request.

void NutHttpSendHeaderTop (NUTDEVICE *sostream, REQUEST *req, int status, char *title)
 Send top lines of a standard HTML header.

void NutHttpSendHeaderBot (NUTDEVICE *sostream, char *mime_type, int bytes)
 Send bottom lines of a standard HTML header.

void NutHttpSendError (NUTDEVICE *sostream, REQUEST *req, int status)
 Send a HTTP error response.

char * NutGetMimeType (char *name)
 Return the mime type description of a specified file name.

int NutHttpAuthValidate (REQUEST *req)
 Validate an authorization request.

int NutRegisterAuth (CONST char *dirname, CONST char *login)
 Register an authorization entry.

int NutRegisterCgi (char *name, int(*func)(NUTDEVICE *, REQUEST *))
 Register a CGI function.

void NutCgiProcessRequest (NUTDEVICE *sostream, REQUEST *req)
 Process an incoming CGI request.


Function Documentation

void NutCgiProcessRequest NUTDEVICE   sostream,
REQUEST *    req
 

Process an incoming CGI request.

Applications do not need to call this function. It is automatically called by NutHttpProcessRequest().

Parameters:
sostream  Socket stream of the connection, previously created by calling NutSoStreamCreate().
req  Contains the HTTP request.

char* NutGetMimeType char *    name
 

Return the mime type description of a specified file name.

The mime type returned is based on the file extension.

Todo:
Function to register additional mime types. Currently only .txt, .html, .gif and .jpg are supported.
Parameters:
name  Name of the file.
Returns:
A pointer to a static string, containing the associated mime type description. If the extension is not registered, "text/plain; charset=iso-8859-1" is returned. If the filename is empty, then "text/hatml; charset=iso-8859-1" is returned.

int NutHttpAuthValidate REQUEST *    req
 

Validate an authorization request.

Note:
This function is automatically called by the HTTP library on incoming requests. Applications do not need to call this function.
Parameters:
req  Request to be checked.
Returns:
0, if access granted, -1 otherwise.

void NutHttpProcessRequest NUTDEVICE   sostream
 

Process the next HTTP request.

Waits for the next HTTP request on an established connection and processes it.

Parameters:
sostream  Socket stream of the connection, previously created by calling NutSoStreamCreate().

void NutHttpSendError NUTDEVICE   sostream,
REQUEST *    req,
int    status
 

Send a HTTP error response.

A canned error file is used.

Parameters:
sostream  Socket stream of the connection, previously created by calling NutSoStreamCreate().
req  Contains the HTTP request.
status  Error code to be returned.

void NutHttpSendHeaderBot NUTDEVICE   sostream,
char *    mime_type,
int    bytes
 

Send bottom lines of a standard HTML header.

Sends Content-Type, Content-Lenght and Connection lines.

Parameters:
sostream  Socket stream of the connection, previously created by calling NutSoStreamCreate().
mime_type  Points to a string that specifies the content type. Examples are "text/html", "image/png", "image/gif", "video/mpeg" or "text/css". A null pointer is ignored.
bytes  Content length of the data following this header. Ignored, if negative.

void NutHttpSendHeaderTop NUTDEVICE   sostream,
REQUEST *    req,
int    status,
char *    title
 

Send top lines of a standard HTML header.

Sends HTTP and Server version lines.

Parameters:
sostream  Socket stream of the connection, previously created by calling NutSoStreamCreate().
req  The associated client request.
status  Response status, error code or 200, if no error occured.
title  Error text, or OK, if no error occured.

int NutRegisterAuth CONST char *    dirname,
CONST char *    login
 

Register an authorization entry.

Protect a specified directory from unauthorized access.

\warn Directories not registered by this function are accessible by anyone.

Parameters:
dirname  Name of the directory to protect.
login  Required login to access this directory. This string must contain a user name, followed by a colon followed by an uncrypted password.
Returns:
0 on success, -1 otherwise.

int NutRegisterCgi char *    name,
int(*    func)(NUTDEVICE *, REQUEST *)
 

Register a CGI function.

Bug:
Duplicate names not checked.
Parameters:
name  Name of this CGI function.
func  The function to be called, if the client requests the specified name.
Returns:
0 on success, -1 otherwise.


Generated on Thu Jan 30 22:30:58 2003 for EduNet by doxygen1.2.18