Data Structures | |
struct | _HTTP_LOCATION |
HTTP redirection information structure. More... | |
Typedefs | |
typedef struct _HTTP_LOCATION | HTTP_LOCATION |
HTTP redirection entry type. | |
Functions | |
int | HttpRegisterRedir (const char *url, const char *redir, int response) |
Register an HTTP redirection. | |
int | HttpLocationRedir (HTTPD_SESSION *hs) |
Default HTTP redirection handler. | |
HTTP_LOCATION * | HttpLocationLookup (const char *uri) |
Retrieve redirection entry for a given resource. |
$Id$
typedef struct _HTTP_LOCATION HTTP_LOCATION |
HTTP redirection entry type.
int HttpRegisterRedir | ( | const char * | url, |
const char * | redir, | ||
int | response | ||
) |
Register an HTTP redirection.
The following sample permanently redirects an empty resource to the index page index.html.
#include <pro/uhttp/modules/mod_redir.h> HttpRegisterRedir("", "/index.html", 301);
This function will automatically set the default redirection handler HttpLocationRedir().
url | The resource that will be redirected. |
redir | The redirection target. |
response | The HTTP response code that will be send with the redirection. |
References calloc, free(), httpd_loc_redirector, HttpLocationRedir(), ISC_LIST_APPEND, ISC_LIST_HEAD, ISC_LIST_INSERTBEFORE, ISC_LIST_NEXT, _HTTP_LOCATION::loc_redir, _HTTP_LOCATION::loc_response, _HTTP_LOCATION::loc_uri, rc, strcasecmp, and strdup().
int HttpLocationRedir | ( | HTTPD_SESSION * | hs | ) |
Default HTTP redirection handler.
This function is automatically called by the default client handler function HttpdClientHandler() after at least one redirection entry had been registered.
hs | Pointer to the session info structure. |
References HTTP_ASSERT, HttpLocationLookup(), HttpSendRedirection(), _HTTP_LOCATION::loc_redir, _HTTP_LOCATION::loc_response, NULL, _HTTP_REQUEST::req_url, and _HTTPD_SESSION::s_req.
Referenced by HttpRegisterRedir().
HTTP_LOCATION* HttpLocationLookup | ( | const char * | uri | ) |
Retrieve redirection entry for a given resource.
This routine may be used by custom redirection handlers.
Referenced by HttpLocationRedir().