|
NAMEhttp_servlet —
HTTP response generation API
LIBRARYPDEL Library (libpdel, -lpdel)SYNOPSIS#include <sys/types.h>
#include <stdio.h>
#include <netinet/in.h>
#include <openssl/ssl.h>
#include <pdel/http/http_defs.h>
#include
<pdel/http/http_server.h>
#include
<pdel/http/http_servlet.h>
DESCRIPTIONThehttp_servlet API provides an interface for user code
to generate HTTP responses for the
http_server(3)
HTTP server.
The PDEL library comes with these predefined servlets:
Servlets are registered by first constructing the servlet object
and then invoking typedef int http_servlet_run_t(struct http_servlet *servlet, struct http_request *req, struct http_response *resp); typedef void http_servlet_destroy_t(struct http_servlet *servlet); struct http_servlet { void *arg; /* servlet cookie */ struct http_servlet_hook *hook; /* server info */ http_servlet_run_t *run; /* execute method */ http_servlet_destroy_t *destroy; /* destructor */ }; The arg fields is private to the servlet itself and is ignored by the server. The hook is an
http_server(3)
private pointer that should be initialized to
RETURN VALUESIf successful,run () should return 1 to indicate that
the response is complete, or 0 to indicate that the servlet did not generate a
response and execution should continue with the next-best matching servlet.
Zero return values are used by servlets that only generate a response
conditionally, e.g., authorization servlets.
On failure SEE ALSOhttp_client(3), http_request(3), http_response(3), http_server(3), http_servlet_basicauth(3), http_servlet_cookieauth(3), http_servlet_file(3), http_servlet_redirect(3), http_servlet_tmpl(3), http_servlet_xml(3), http_servlet_xmlrpc(3), libpdel(3)R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L. Masinter, P. Leach, and T. Berners-Lee, Hypertext Transfer Protocol -- HTTP/1.1, RFC 2616. HISTORYThe PDEL library was developed at Packet Design, LLC.http://www.packetdesign.com/
AUTHORSArchie Cobbs ⟨archie@freebsd.org⟩
Visit the GSP FreeBSD Man Page Interface. |