![]() |
![]()
| ![]() |
![]()
NAME
LIBRARYPDEL Library (libpdel, -lpdel) SYNOPSIS
struct http_servlet *
void
DESCRIPTION
info is a pointer to a
typedef int http_servlet_file_hide_t( const struct http_servlet_file_info *info, struct http_request *req, struct http_response *resp, const char *path); struct http_servlet_file_info { const char *docroot; /* document root, or NULL for cwd */ u_char allow_escape; /* allow url to escape docroot */ const char *filename; /* filename, or NULL to use url */ const char *prefix; /* url prefix to strip, or NULL */ const char *mime_type; /* mime type, or NULL to guess */ const char *mime_encoding; /* mime encoding (or NULL) */ http_logger_t *logger; /* http error logger */ http_servlet_file_hide_t *hide; /* optional file hider */ struct http_servlet_tmpl_tinfo tinfo; /* for *.tmpl files */ }; When a request is received, the above info is used together with the requested URL to identify a file in the filesystem from which to generate the response. docroot specifies the root directory
starting from which relative pathnames are resolved. If
docroot is allow_escape is a boolean value that
determines whether the file ultimately served may lie outside of the
directory hierarchy rooted at docroot (or the current
directory if docroot is equal to
If not Otherwise, if filename is
In all cases, the strings “.”, “..”, and the empty string are disallowed as pathname components in the requested URL path and will generate a “404 Not Found” response. mime_type may be used to specify the MIME
type for the served file, and mime_encoding the
content encoding. Either or both may be The logger is a logging function whose type is defined in http_server(3). The hide function pointer, if not
Template supportThis servlet is capable of serving
tmpl
template files by automatically creating
http_servlet_tmpl(3)
servlets on a demand basis. To enable this feature, the
tinfo structure should be filled in with a non-
See
http_servlet_tmpl(3)
for a description of the tinfo structure. Although the
same tinfo structure is used to create multiple
template servlets, the
The
Directory supportIf the file being served is a directory, the file servlet will
respond with a corresponding HTTP redirect if any of the following files
exist in that directory:
RETURN VALUESOn failure, SEE ALSOhttp_request(3), http_response(3), http_server(3), http_servlet(3), http_servlet_tmpl(3), libpdel(3), realpath(3) HISTORYThe PDEL library was developed at Packet Design, LLC.
AUTHORSArchie Cobbs ⟨archie@freebsd.org⟩
|