Http API Native API
Extensions
Http | Http service object. |
HttpAuth | Authorization. |
HttpCache | Cache Control. |
HttpConn | Http Connections. |
HttpDir | Directory object for the DirHandler. |
HttpEndpoint | Listening endpoints. |
HttpHost | Host Object. |
HttpLimits | Http limits. |
HttpMonitor | Monitor control structure. |
HttpPacket | Packet object. |
HttpQueue | Queue object. |
HttpRange | Content range structure. |
HttpRoute | Route Control. |
HttpRx | Http Rx. |
HttpSession | Session state object. |
HttpStage | Pipeline Stages. |
HttpStats | HttpStats. |
HttpTrace | Trace management structure. |
HttpTx | Http Tx. |
HttpUploadFile | Upload File. |
HttpUri | URI management. |
HttpWebSocket | WebSocket Service to implement the WebSockets RFC 6455 specification for client and server communications. |
Functions
HttpConn* | httpAcceptConn(HttpEndpoint *endpoint, MprEvent *event) |
Accept a new connection. | |
int | httpAddBodyParams(HttpConn *conn) |
Add parameters from the request body content. | |
void | httpAddCache(struct HttpRoute *route, cchar *methods, cchar *uris, cchar *extensions, cchar *types, MprTicks clientLifespan, MprTicks serverLifespan, int flags) |
Add caching for response content. | |
HttpParseCallback | httpAddConfig(cchar *key, HttpParseCallback callback) |
Add a configuration file callback for a property key. | |
int | httpAddCounter(cchar *name) |
Add a counter to be monitored. | |
int | httpAddDefense(cchar *name, cchar *remedy, cchar *args) |
Add a defense. | |
int | httpAddDefenseFromJson(cchar *name, cchar *remedy, MprJson *jargs) |
Add a defense using JSON arguments. | |
void | httpAddHeader(HttpConn *conn, cchar *key, cchar *fmt, ...) PRINTF_ATTRIBUTE(3 |
Add a header to the transmission using a format string. | |
void void | httpAddHeaderString(HttpConn *conn, cchar *key, cchar *value) |
Add a header to the transmission. | |
void | httpAddHostToEndpoint(HttpEndpoint *endpoint, struct HttpHost *host) |
Add a host to an endpoint. | |
void | httpAddJsonParams(HttpConn *conn) |
Add parameters from a JSON body. | |
int | httpAddMonitor(cchar *counter, cchar *expr, uint64 limit, MprTicks period, cchar *defenses) |
Add a monitor. | |
void | httpAddOption(MprHash *options, cchar *field, cchar *value) |
Add an option to the options table. | |
void | httpAddPermResource(HttpRoute *parent, cchar *resource) |
Add routes for a permanent resource. | |
void | httpAddQueryParams(HttpConn *conn) |
Add parameters from the request query string. | |
int | httpAddRemedy(cchar *name, HttpRemedyProc remedy) |
Add a remedy. | |
void | httpAddResource(HttpRoute *parent, cchar *resource) |
Add routes for a resource. | |
void | httpAddResourceGroup(HttpRoute *parent, cchar *resource) |
Add routes for a group of resources. | |
HttpRoute* | httpAddRestfulRoute(HttpRoute *parent, cchar *methods, cchar *pattern, cchar *target, cchar *resource) |
Define a RESTful route. | |
HttpRole* | httpAddRole(HttpAuth *auth, cchar *role, cchar *abilities) |
Add a role. | |
int | httpAddRoute(HttpHost *host, HttpRoute *route) |
Add a route to a host. | |
int | httpAddRouteCondition(HttpRoute *route, cchar *name, cchar *details, int flags) |
Add a route condition. | |
void | httpAddRouteErrorDocument(HttpRoute *route, int status, cchar *uri) |
Add an error document. | |
int | httpAddRouteFilter(HttpRoute *route, cchar *name, cchar *extensions, int direction) |
Add a route filter. | |
int | httpAddRouteHandler(HttpRoute *route, cchar *name, cchar *extensions) |
Add a route handler. | |
void | httpAddRouteIndex(HttpRoute *route, cchar *path) |
Set the route index document. | |
int | httpAddRouteLanguageDir(HttpRoute *route, cchar *language, cchar *path) |
Add a route language directory. | |
int | httpAddRouteLanguageSuffix(HttpRoute *route, cchar *language, cchar *suffix, int flags) |
Add a route language suffix. | |
void | httpAddRouteMapping(HttpRoute *route, cchar *extensions, cchar *mappings) |
Add a route mapping. | |
void | httpAddRouteMethods(HttpRoute *route, cchar *methods) |
Add HTTP methods for the route. | |
void | httpAddRouteParam(HttpRoute *route, cchar *field, cchar *value, int flags) |
Add a route param check. | |
void | httpAddRouteRequestHeaderCheck(HttpRoute *route, cchar *header, cchar *value, int flags) |
Add a request header check. | |
void | httpAddRouteResponseHeader(HttpRoute *route, int cmd, cchar *header, cchar *value) |
Add a response header. | |
void | httpAddRouteSet(HttpRoute *route, cchar *set) |
Add a route set. | |
int | httpAddRouteUpdate(HttpRoute *route, cchar *name, cchar *details, int flags) |
Add a route update rule. | |
int | httpAddSecurityToken(HttpConn *conn, bool recreate) |
Add the security token to the response. | |
HttpUser* | httpAddUser(HttpAuth *auth, cchar *user, cchar *password, cchar *abilities) |
Add a user. | |
HttpRoute* | httpAddWebSocketsRoute(HttpRoute *route, cchar *action) |
Add a route using the WebSockets filter. | |
void | httpAdjustPacketEnd(HttpPacket *packet, MprOff size) |
Adjust the packet end position. | |
void | httpAdjustPacketStart(HttpPacket *packet, MprOff size) |
Adjust the packet starting position. | |
void | httpAfterEvent(HttpConn *conn) |
Do setup after an I/O event to receive future events. | |
HttpSession* | httpAllocSession(HttpConn *conn, cchar *id, MprTicks lifespan) |
Allocate a new session state object. | |
void | httpAppendHeader(HttpConn *conn, cchar *key, cchar *fmt, ...) PRINTF_ATTRIBUTE(3 |
Append a transmission header. | |
void void | httpAppendHeaderString(HttpConn *conn, cchar *key, cchar *value) |
Append a transmission header string. | |
int | httpApplyChangedGroup() |
Apply the changed group ID. | |
int | httpApplyChangedUser() |
Apply the changed user ID. | |
int | httpApplyUserGroup() |
Apply the changed user and group ID. | |
bool | httpAuthenticate(HttpConn *conn) |
Authenticate a user based on session data. | |
int | httpBackupTraceLogFile(HttpTrace *trace) |
Backup the request trace log if required. | |
void void | httpBadRequestError(HttpConn *conn, int status, cchar *fmt, ...) PRINTF_ATTRIBUTE(3 |
Emit an error message for a badly formatted request. | |
int | httpBanClient(cchar *ip, MprTicks period, int status, cchar *msg) |
Ban a client IP from service. | |
void | httpBorrowConn(HttpConn *conn) |
Borrow a connection. | |
bool | httpCanUser(HttpConn *conn, cchar *abilities) |
Test if a user has the required abilities. | |
bool | httpCheckSecurityToken(HttpConn *conn) |
Check a security token. | |
void | httpClearRouteStages(HttpRoute *route, int direction) |
Clear the pipeline stages for the route. | |
bool | httpClientConn(HttpConn *conn) |
Test if the connection is a client-side connection. | |
HttpHost* | httpCloneHost(HttpHost *parent) |
Clone a host. | |
HttpPacket* | httpClonePacket(HttpPacket *orig) |
Clone a packet. | |
HttpStage* | httpCloneStage(HttpStage *stage) |
Create a clone of an existing state. | |
HttpUri* | httpCloneUri(HttpUri *base, int flags) |
Clone a URI. | |
void | httpClosePipeline(HttpConn *conn) |
Destroy the request pipeline. | |
void | httpCommonTraceFormatter(HttpTrace *trace, struct HttpConn *conn, cchar *event, cchar *type, cchar *values, cchar *buf, ssize len) |
Common Log trace formatter. | |
HttpUri* | httpCompleteUri(HttpUri *uri, HttpUri *other) |
Complete the given URI. | |
void | httpComputeAllUserAbilities(HttpAuth *auth) |
Compute all the user abilities for a route using the given auth. | |
void | httpComputeUserAbilities(HttpAuth *auth, HttpUser *user) |
Compute the user abilities for a given user in a route using the given auth. | |
bool | httpConfigure(HttpConfigureProc proc, void *arg, MprTicks timeout) |
Alter the configuration by first quiescing all Http activity. | |
int | httpConnect(HttpConn *conn, cchar *method, cchar *uri, struct MprSsl *ssl) |
Connect to a server and issue Http client request. | |
bool | httpContentNotModified(HttpConn *conn) |
Test if the content has not been modified. | |
Http* | httpCreate(int flags) |
Create a Http service object. | |
HttpRoute* | httpCreateActionRoute(HttpRoute *parent, cchar *pattern, HttpAction action) |
Create a route for use with the Action Handler. | |
HttpRoute* | httpCreateAliasRoute(HttpRoute *parent, cchar *pattern, cchar *path, int status) |
Create a route suitable for use as an alias. | |
HttpAuth* | httpCreateAuth() |
Create an authentication object. | |
HttpAuthStore* | httpCreateAuthStore(cchar *name, HttpVerifyUser verifyUser) |
Add an authorization store for password validation. | |
int | httpCreateAuthType(cchar *name, HttpAskLogin askLogin, HttpParseAuth parse, HttpSetAuth setAuth) |
Create an authorization protocol type. | |
void | httpCreateCGIParams(HttpConn *conn) |
Create CGI parameters. | |
HttpEndpoint* | httpCreateConfiguredEndpoint(struct HttpHost *host, cchar *home, cchar *documents, cchar *ip, int port) |
Create and configure a new endpoint. | |
HttpRoute* | httpCreateConfiguredRoute(struct HttpHost *host, int serverSide) |
Create a configured route. | |
HttpConn* | httpCreateConn(struct HttpEndpoint *endpoint, MprDispatcher *dispatcher) |
Create a connection object. | |
HttpStage* | httpCreateConnector(cchar *name, MprModule *module) |
Create a connector stage. | |
HttpPacket* | httpCreateDataPacket(ssize size) |
Create a data packet. | |
HttpHost* | httpCreateDefaultHost() |
Create the default host. | |
HttpRoute* | httpCreateDefaultRoute(struct HttpHost *host) |
Create a default route for a host. | |
HttpPacket* | httpCreateEndPacket() |
Create an end-of-stream packet. | |
HttpEndpoint* | httpCreateEndpoint(cchar *ip, int port, MprDispatcher *dispatcher) |
Create an endpoint object. | |
HttpPacket* | httpCreateEntityPacket(MprOff pos, MprOff size, HttpFillProc fill) |
Create an entity data packet. | |
int | httpCreateEvent(uint64 seqno, HttpEventProc callback, void *data) |
Invoke a callback on a connection using a connection sequence number. | |
HttpStage* | httpCreateFilter(cchar *name, MprModule *module) |
Create a filter stage. | |
HttpStage* | httpCreateHandler(cchar *name, MprModule *module) |
Create a request handler stage. | |
HttpPacket* | httpCreateHeaderPacket() |
Create a response header packet. | |
HttpHost* | httpCreateHost() |
Create a host. | |
HttpRoute* | httpCreateInheritedRoute(HttpRoute *route) |
Create a route inherited from a parent route. | |
HttpLimits* | httpCreateLimits(int serverSide) |
Create a new limits object. | |
HttpPacket* | httpCreatePacket(ssize size) |
Create a data packet. | |
void | httpCreatePipeline(HttpConn *conn) |
Create the pipeline. | |
HttpRoute* | httpCreateRoute(struct HttpHost *host) |
Create a route for a host. | |
void | httpCreateRxPipeline(HttpConn *conn, struct HttpRoute *route) |
Create the receive request pipeline. | |
HttpSession* | httpCreateSession(HttpConn *conn) |
Create a session object. | |
HttpStage* | httpCreateStage(cchar *name, int flags, MprModule *module) |
Create a connector stage. | |
HttpTrace* | httpCreateTrace(HttpTrace *parent) |
Create a trace object. | |
HttpTx* | httpCreateTx(HttpConn *conn, MprHash *headers) |
Create the tx object. | |
void | httpCreateTxPipeline(HttpConn *conn, struct HttpRoute *route) |
Create the transmit request pipeline. | |
HttpUri* | httpCreateUri(cchar *uri, int flags) |
Create and initialize a URI. | |
HttpUri* | httpCreateUriFromParts(cchar *scheme, cchar *host, int port, cchar *path, cchar *reference, cchar *query, int flags) |
Create a URI from parts. | |
void | httpDefaultIncoming(HttpQueue *q, HttpPacket *packet) |
Default incoming put callback. | |
void | httpDefaultOutgoingServiceStage(HttpQueue *q) |
Default outgoing data handling. | |
void | httpDefineAction(cchar *uri, HttpAction fun) |
Define a function procedure to invoke when the specified URI is requested. | |
HttpRoute* | httpDefineRoute(HttpRoute *parent, cchar *methods, cchar *pattern, cchar *target, cchar *source) |
Define a route. | |
void | httpDefineRouteCondition(cchar *name, HttpRouteProc *proc) |
Define a route condition rule. | |
HttpRouteSetProc | httpDefineRouteSet(cchar *name, HttpRouteSetProc fn) |
Define a route set callback. | |
void | httpDefineRouteTarget(cchar *name, HttpRouteProc *proc) |
Define a route target rule. | |
void | httpDefineRouteUpdate(cchar *name, HttpRouteProc *proc) |
Define a route update rule. | |
void | httpDestroy() |
Destroy the Http service. | |
void | httpDestroyConn(HttpConn *conn) |
Destroy the connection object. | |
void | httpDestroyEndpoint(HttpEndpoint *endpoint) |
Destroy the endpoint. | |
void | httpDestroySession(HttpConn *conn) |
Destroy a session state object. | |
void | httpDestroyTx(HttpTx *tx) |
Destroy the tx object. | |
void | httpDetailTraceFormatter(HttpTrace *trace, struct HttpConn *conn, cchar *event, cchar *type, cchar *values, cchar *buf, ssize len) |
Detailed log trace formatter. | |
void | httpDisableQueue(HttpQueue *q) |
Disable a queue. | |
void | httpDiscardData(HttpConn *conn, int dir) |
Discard buffered transmit pipeline data. | |
void | httpDiscardQueueData(HttpQueue *q, bool removePackets) |
Discard all data from the queue. | |
void | httpDisconnect(HttpConn *conn) |
Disconnect the connection's socket. | |
void | httpDumpCounters() |
Print the monitor counters to the error log. | |
void | httpEaseLimits(HttpLimits *limits) |
Ease the limits. | |
void | httpEnableConnEvents(HttpConn *conn) |
Enable connection events. | |
void | httpEnableQueue(HttpQueue *q) |
Enable a queue after it has been disabled. | |
void | httpEnableUpload(HttpConn *conn) |
Enable Multipart-Mime File Upload for this request. | |
void | httpError(HttpConn *conn, int status, cchar *fmt, ...) PRINTF_ATTRIBUTE(3 |
Error handling for the connection. | |
cchar* | httpExpandRouteVars(HttpRoute *route, cchar *str) |
Expand route variables in a string. | |
void | httpFinalize(HttpConn *conn) |
Indicate the request is finalized. | |
void | httpFinalizeConnector(HttpConn *conn) |
Finalize connector output sending the response. | |
void | httpFinalizeOutput(HttpConn *conn) |
Finalize transmission of the http response. | |
void | httpFinalizeRoute(HttpRoute *route) |
Finalize a route. | |
void HttpConn* | httpFindConn(uint64 seqno, HttpEventProc proc, void *data) |
Find a connection given a connection sequence number. | |
void | httpFlush(HttpConn *conn) |
Flush transmit data. | |
void | httpFlushAll(HttpConn *conn) |
Flush transmit data and wait for all the data to be written to the socket. | |
bool | httpFlushQueue(HttpQueue *q, int flags) |
Flush queue data. | |
void | httpFollowRedirects(HttpConn *conn, bool follow) |
Follow redirctions. | |
void | httpFormatError(HttpConn *conn, int status, cchar *fmt, ...) PRINTF_ATTRIBUTE(3 |
Format an error transmission. | |
void ssize | httpFormatResponse(HttpConn *conn, cchar *fmt, ...) PRINTF_ATTRIBUTE(2 |
Format an alternate response. | |
ssize | httpFormatResponseBody(HttpConn *conn, cchar *title, cchar *fmt, ...) PRINTF_ATTRIBUTE(3 |
Format a response body. | |
void ssize ssize | httpFormatResponsev(HttpConn *conn, cchar *fmt, va_list args) |
Format an alternate response. | |
void | httpFormatTrace(HttpTrace *trace, struct HttpConn *conn, cchar *event, cchar *type, cchar *values, cchar *buf, ssize len) |
Convenience routine to format trace via the configured formatter. | |
char* | httpFormatUri(cchar *scheme, cchar *host, int port, cchar *path, cchar *ref, cchar *query, int flags) |
Format a URI. | |
int | httpGetAsync(HttpConn *conn) |
Get the async mode value for the connection. | |
cchar* | httpGetBodyInput(HttpConn *conn) |
Get the receive body input. | |
bool | httpGetBoolToken(cchar *tok) |
Parse a boolean token. | |
ssize | httpGetChunkSize(HttpConn *conn) |
Get the preferred chunked size for transfer chunk encoding. | |
void* | httpGetConnContext(HttpConn *conn) |
Get the connection context object. | |
int | httpGetConnEventMask(HttpConn *conn) |
Get an IO event mask for events of interest to the connection. | |
void* | httpGetConnHost(HttpConn *conn) |
Get the connection host object. | |
MprOff | httpGetContentLength(HttpConn *conn) |
Get the receive body content length. | |
void* | httpGetContext() |
Get the http context object. | |
cchar* | httpGetCookie(HttpConn *conn, cchar *name) |
Get a request cookie. | |
cchar* | httpGetCookies(HttpConn *conn) |
Get the request cookies. | |
char* | httpGetDateString(MprPath *sbuf) |
Get the time as an ISO date string. | |
HttpHost* | httpGetDefaultHost() |
Get the default host defined via httpSetDefaultHost. | |
HttpRoute* | httpGetDefaultRoute(HttpHost *host) |
Get the default route for a host. | |
cchar* | httpGetDir(HttpRoute *route, cchar *name) |
Get a route directory variable. | |
HttpDir* | httpGetDirObj(HttpRoute *route) |
Get the HttpDir object for a route. | |
void* | httpGetEndpointContext(HttpEndpoint *endpoint) |
Get the endpoint context object. | |
cchar* | httpGetError(HttpConn *conn) |
Get the error message associated with the last request. | |
char* | httpGetExt(HttpConn *conn) |
Get a URI extension. | |
cchar* | httpGetHeader(HttpConn *conn, cchar *key) |
Get an rx http header. | |
MprHash* | httpGetHeaderHash(HttpConn *conn) |
Get the hash table of rx Http headers. | |
char* | httpGetHeaders(HttpConn *conn) |
Get all the request http headers. | |
char* | httpGetHeadersFromHash(MprHash *hash) |
Get a header string from the given hash. | |
HttpRoute* | httpGetHostDefaultRoute(HttpHost *host) |
Return the default route for a host. | |
int | httpGetIntParam(HttpConn *conn, cchar *var, int defaultValue) |
Get a form variable as an integer. | |
int | httpGetKeepAliveCount(HttpConn *conn) |
Get the count of Keep-Alive requests that will be used for this connection object. | |
HttpLang* | httpGetLanguage(HttpConn *conn, MprHash *spoken, cchar *defaultLang) |
Get the language to use for the request. | |
void* | httpGetOption(MprHash *options, cchar *field, cchar *defaultValue) |
Extract a field value from an option string. | |
MprHash* | httpGetOptionHash(MprHash *options, cchar *field) |
Get an option value that is itself an object (hash). | |
MprHash* | httpGetOptions(cchar *options) |
Convert an options string into an options table. | |
HttpPacket* | httpGetPacket(struct HttpQueue *q) |
Get the next packet from a queue. | |
ssize | httpGetPacketContents(HttpPacket *packet) |
Get the packet data contents. | |
ssize | httpGetPacketLength(HttpPacket *packet) |
Get the length of the packet data contents. | |
char* | httpGetPacketStart(HttpPacket *packet) |
Get the start of the packet data contents. | |
char* | httpGetPacketString(HttpPacket *packet) |
Get the packet data contents as a string. | |
cchar* | httpGetParam(HttpConn *conn, cchar *var, cchar *defaultValue) |
Get a request param. | |
MprJson* | httpGetParams(HttpConn *conn) |
Get the request params table. | |
char* | httpGetParamsString(HttpConn *conn) |
Get the request params table as a string. | |
char* | httpGetPathExt(cchar *path) |
Get a path extension. | |
cchar* | httpGetQueryString(HttpConn *conn) |
Get the request query string. | |
void* | httpGetQueueData(HttpConn *conn) |
Get the queue data for the connection. | |
ssize | httpGetQueueRoom(HttpQueue *q) |
Get the room in the queue. | |
ssize | httpGetReadCount(HttpConn *conn) |
Get the number of bytes that can be read from the read queue. | |
HttpUri* | httpGetRelativeUri(HttpUri *base, HttpUri *target, int clone) |
Get a relative URI from the base to the target. | |
void* | httpGetRouteData(HttpRoute *route, cchar *key) |
Get extra route data. | |
cchar* | httpGetRouteDocuments(HttpRoute *route) |
Get the route documents directory. | |
cchar* | httpGetRouteHome(HttpRoute *route) |
Get the route home directory. | |
cchar* | httpGetRouteMethods(HttpRoute *route) |
Get the route method list. | |
cchar* | httpGetRouteTop(HttpConn *conn) |
Get a URL path to the top of the route from the current request (rx->pathInfo). | |
cchar* | httpGetRouteVar(HttpRoute *route, cchar *key) |
Get a path token variable. | |
cchar* | httpGetSecurityToken(HttpConn *conn, bool recreate) |
Get a unique security token. | |
HttpSession* | httpGetSession(HttpConn *conn, int create) |
Get a session state object. | |
cchar* | httpGetSessionID(HttpConn *conn) |
Get the session ID. | |
MprHash* | httpGetSessionObj(HttpConn *conn, cchar *key) |
Get an object from the session state store. | |
cchar* | httpGetSessionVar(HttpConn *conn, cchar *name, cchar *defaultValue) |
Get a session state variable. | |
cvoid* | httpGetStageData(struct HttpConn *conn, cchar *key) |
Get stage data. | |
void | httpGetStats(HttpStats *sp) |
Get the Http performance statistics. | |
int | httpGetStatus(HttpConn *conn) |
Get the response status. | |
char* | httpGetStatusMessage(HttpConn *conn) |
Get the Http response status message. | |
bool | httpGetStreaming(struct HttpHost *host, cchar *mime, cchar *uri) |
Determine if input body content should be streamed or buffered for requests with content of a given mime type. | |
int | httpGetTraceLevel() |
Get the current tracing level. | |
ssize cchar* | httpGetTxHeader(HttpConn *conn, cchar *key) |
Get a tx http header. | |
void | httpGetUserGroup() |
Get the user group. | |
cchar* | httpGetWebSocketCloseReason(HttpConn *conn) |
Get the close reason supplied by the peer. | |
void* | httpGetWebSocketData(HttpConn *conn) |
Get the WebSocket private data. | |
ssize | httpGetWebSocketMessageLength(HttpConn *conn) |
Get the message length for the current message. | |
char* | httpGetWebSocketProtocol(HttpConn *conn) |
Get the selected WebSocket protocol selected by the server. | |
ssize | httpGetWebSocketState(HttpConn *conn) |
Get the WebSocket state. | |
ssize | httpGetWriteQueueCount(HttpConn *conn) |
Get the count of bytes buffered on the write queue. | |
HttpLimits* | httpGraduateLimits(HttpRoute *route, HttpLimits *limits) |
Graduate the limits from the parent route. | |
void | httpHandleOptions(struct HttpConn *conn) |
Handle a Http Options method request. | |
void | httpHideRoute(HttpRoute *route, bool on) |
Hide the route from route tables. | |
void void void | httpIO(struct HttpConn *conn, int eventMask) |
Handle I/O on the connection. | |
void | httpIOEvent(struct HttpConn *conn, MprEvent *event) |
Respond to a HTTP I/O event. | |
void | httpInitConfig(HttpRoute *route) |
Initialize and prepare to load configuration files. | |
void | httpInitLimits(HttpLimits *limits, bool serverSide) |
Initialize a limits object with default values. | |
int | httpInitParser() |
Initialize the Http configuration parser. | |
void | httpInsertOption(MprHash *options, cchar *field, cchar *value) |
Add an option to the options table. | |
bool | httpIsAuthenticated(HttpConn *conn) |
Test if the user is authenticated. | |
int | httpIsChunked(HttpConn *conn) |
Return whether transfer chunked encoding will be used on this request. | |
int | httpIsEndpointAsync(HttpEndpoint *endpoint) |
Get if the endpoint is running in asynchronous mode. | |
bool | httpIsEof(struct HttpConn *conn) |
Test if the connection has received all incoming content. | |
int | httpIsFinalized(HttpConn *conn) |
Test if request has been finalized. | |
bool | httpIsLastPacket(HttpPacket *packet) |
Test if the packet is the last in a logical message. | |
int | httpIsOutputFinalized(HttpConn *conn) |
Test if request response has been fully generated. | |
bool | httpIsPacketTooBig(struct HttpQueue *q, HttpPacket *packet) |
Test if a packet is too big. | |
bool | httpIsQueueEmpty(HttpQueue *q) |
Determine if the queue is empty. | |
bool | httpIsQueueSuspended(HttpQueue *q) |
Test if a queue is suspended. | |
int | httpJoinPacket(HttpPacket *packet, HttpPacket *other) |
Join two packets. | |
void | httpJoinPacketForService(struct HttpQueue *q, HttpPacket *packet, bool serviceQ) |
Join a packet onto the service queue. | |
void | httpJoinPackets(HttpQueue *q, ssize size) |
Join packets together. | |
HttpUri* | httpJoinUri(HttpUri *base, int argc, HttpUri **others) |
Join URIs. | |
HttpUri* | httpJoinUriPath(HttpUri *result, HttpUri *base, HttpUri *other) |
Join a URI path. | |
void | httpLimitError(HttpConn *conn, int status, cchar *fmt, ...) PRINTF_ATTRIBUTE(3 |
Emit an error message for limit violations. | |
char* | httpLink(struct HttpConn *conn, cchar *target) |
Create a URI link. | |
char* | httpLinkAbs(struct HttpConn *conn, cchar *target) |
Create an absolute link that includes scheme and host. | |
char* | httpLinkEx(struct HttpConn *conn, cchar *target, MprHash *options) |
Extended URI link creation. | |
int | httpLoadConfig(HttpRoute *route, cchar *path) |
Load a JSON configuration file. | |
void | httpLogRoutes(HttpHost *host, bool full) |
Show the current route table to the error log. | |
bool | httpLogin(HttpConn *conn, cchar *username, cchar *password) |
Log the user in. | |
void | httpLogout(HttpConn *conn) |
Logout the user. | |
struct HttpEndpoint* | httpLookupEndpoint(cchar *ip, int port) |
Lookup a listening endpoint. | |
struct HttpHost* | httpLookupHost(cchar *name) |
Lookup a host by name. | |
struct HttpHost* | httpLookupHostOnEndpoint(HttpEndpoint *endpoint, cchar *name) |
Lookup a host name. | |
cchar* | httpLookupMimeType(cchar *ext) |
Get the mime type for an extension. | |
HttpRole* | httpLookupRole(HttpAuth *auth, cchar *name) |
Lookup a role by name. | |
HttpRoute* | httpLookupRoute(HttpHost *host, cchar *pattern) |
Lookup a route by pattern. | |
cchar* | httpLookupRouteErrorDocument(HttpRoute *route, int status) |
Lookup an error document by HTTP status code. | |
bool | httpLookupSessionID(cchar *id) |
Lookup a session ID. | |
struct HttpStage* | httpLookupStage(cchar *name) |
Lookup a stage by name. | |
void* | httpLookupStageData(cchar *name) |
Lookup stage data. | |
cchar* | httpLookupStatus(int status) |
Lookup a Http status code. | |
HttpUser* | httpLookupUser(HttpAuth *auth, cchar *name) |
Lookup a user by username. | |
char* | httpMakePath(HttpRoute *route, cchar *dir, cchar *path) |
Make a filename path. | |
HttpUri* | httpMakeUriLocal(HttpUri *uri) |
Make a URI local. | |
cchar* | httpMapContent(HttpConn *conn, cchar *filename) |
Map a content filename. | |
void | httpMapFile(HttpConn *conn) |
Map the request URI to a filename in physical storage for a handler. | |
struct HttpHost* | httpMatchHost(HttpConn *conn, cchar *hostname) |
Match the HttpHost object that should serve this request. | |
bool | httpMatchParam(HttpConn *conn, cchar *var, cchar *expected) |
Match a form variable with an expected value. | |
MprSsl* | httpMatchSsl(MprSocket *sp, cchar *hostname) |
Match the HttpHost object that should serve this request. | |
void | httpMemoryError(HttpConn *conn) |
Signal a memory allocation error. | |
int64 | httpMonitorEvent(struct HttpConn *conn, int counter, int64 adj) |
Monitor an event and validate against defined limits and monitored resources. | |
bool | httpNeedRetry(HttpConn *conn, char **url) |
Determine if the transmission needs a transparent retry to implement authentication or redirection. | |
bool | httpNextQueueFull(HttpQueue *q) |
Test if the next queue is full. | |
HttpUri* | httpNormalizeUri(HttpUri *uri) |
Normalize a URI. | |
char* | httpNormalizeUriPath(cchar *uri) |
Normalize a URI. | |
void | httpNotify(HttpConn *conn, int event, int arg) |
Inform notifiers of a connection event or state change. | |
void | httpOmitBody(HttpConn *conn) |
Tell the tx to omit sending any body. | |
bool | httpOption(MprHash *options, cchar *field, cchar *value, int useDefault) |
Test a field value from an option string. | |
void | httpParseAll(HttpRoute *route, cchar *key, MprJson *prop) |
Parse all the properties under the given key. | |
int | httpParsePlatform(cchar *platform, cchar **os, cchar **arch, cchar **profile) |
Parse a platform string. | |
void | httpPrepClientConn(HttpConn *conn, bool keepHeaders) |
Prepare a client connection for a new request. | |
void | httpProtocol(HttpConn *conn) |
HTTP protocol state machine for server-side requests and client-side responses. | |
bool | httpPumpOutput(HttpConn *conn) |
Get more output by invoking the handler's writable callback. | |
void | httpPutBackPacket(struct HttpQueue *q, HttpPacket *packet) |
Put a packet back onto a queue. | |
void | httpPutForService(struct HttpQueue *q, HttpPacket *packet, bool serviceQ) |
Put a packet into the service queue for deferred processing. | |
void | httpPutPacket(struct HttpQueue *q, HttpPacket *packet) |
Put a packet to the queue. | |
void | httpPutPacketToNext(struct HttpQueue *q, HttpPacket *packet) |
Put a packet to the next queue downstream. | |
bool | httpQueuesNeedService(HttpConn *conn) |
Test if the connection queues need service. | |
ssize | httpRead(HttpConn *conn, char *buffer, ssize size) |
Read rx body data. | |
ssize | httpReadBlock(HttpConn *conn, char *buffer, ssize size, MprTicks timeout, int flags) |
Read a block of rx body data. | |
char* | httpReadString(HttpConn *conn) |
Read response data as a string. | |
void | httpReadyHandler(HttpConn *conn) |
Run the handler ready callback. | |
void | httpRedirect(HttpConn *conn, int status, cchar *uri) |
Redirect the client. | |
void | httpRemoveCookie(HttpConn *conn, cchar *name) |
Remove a cookie from the client (browser) This will emit a Set-Cookie response header with the value set to "" and a one second lifespan. | |
int | httpRemoveHeader(HttpConn *conn, cchar *key) |
Remove a header from the transmission. | |
void | httpRemoveOption(MprHash *options, cchar *field) |
Remove an option. | |
void | httpRemoveParam(HttpConn *conn, cchar *var) |
Remove a request param. | |
void | httpRemoveQueue(HttpQueue *q) |
Remove a queue. | |
int | httpRemoveRole(HttpAuth *auth, cchar *role) |
Remove a role. | |
void | httpRemoveRouteMethods(HttpRoute *route, cchar *methods) |
Remove HTTP methods for the route. | |
int | httpRemoveSessionVar(HttpConn *conn, cchar *name) |
Remove a session state variable. | |
int | httpRemoveUser(HttpAuth *auth, cchar *user) |
Remove a user. | |
HttpConn* | httpRequest(cchar *method, cchar *uri, cchar *data, char **err) |
Issue a http request. | |
bool | httpRequestExpired(HttpConn *conn, MprTicks timeout) |
Test if a request has exceeded its timeout limits. | |
void | httpResetCredentials(HttpConn *conn) |
Reset the current security credentials. | |
void | httpResetRouteIndexes(HttpRoute *route) |
Reset all defined indexes. | |
void | httpResetRoutePipeline(HttpRoute *route) |
Reset the route pipeline. | |
void | httpResetRoutes(HttpHost *host) |
Reset the list of routes for the host. | |
HttpPacket* | httpResizePacket(struct HttpQueue *q, HttpPacket *packet, ssize size) |
Resize a packet. | |
HttpUri* | httpResolveUri(struct HttpConn *conn, HttpUri *base, HttpUri *target) |
Resolve URIs relative to a base. | |
void | httpResumeQueue(HttpQueue *q) |
Resume a queue. | |
void | httpReturnConn(HttpConn *conn) |
Return a borrowed a connection. | |
void | httpRouteRequest(HttpConn *conn) |
Route the request and select that matching route and handle to process the request. | |
void | httpScheduleConnTimeout(HttpConn *conn) |
Schedule a connection timeout event on a connection. | |
void | httpScheduleQueue(HttpQueue *q) |
Schedule a queue. | |
int | httpSecureEndpoint(HttpEndpoint *endpoint, struct MprSsl *ssl) |
Secure an endpoint. | |
int | httpSecureEndpointByName(cchar *name, struct MprSsl *ssl) |
Secure an endpoint by name. | |
ssize | httpSend(HttpConn *conn, cchar *fmt, ...) PRINTF_ATTRIBUTE(2 |
Send a UTF-8 text message to the WebSocket peer. | |
ssize | httpSendBlock(HttpConn *conn, int type, cchar *msg, ssize len, int flags) |
Send a message of a given type to the WebSocket peer. | |
ssize | httpSendClose(HttpConn *conn, int status, cchar *reason) |
Send a close message to the WebSocket peer. | |
bool | httpServerConn(HttpConn *conn) |
Test if the connection is a server-side connection. | |
void | httpServiceQueue(HttpQueue *q) |
Service a queue. | |
bool | httpServiceQueues(HttpConn *conn, int flags) |
Service pipeline queues to flow data. | |
void | httpSetAsync(HttpConn *conn, int enable) |
Set the async mode value for the connection. | |
void | httpSetAuthAllow(HttpAuth *auth, cchar *ip) |
Allow access by a client IP IP address. | |
void | httpSetAuthAnyValidUser(HttpAuth *auth) |
Allow access by any valid user. | |
void | httpSetAuthDeny(HttpAuth *auth, cchar *ip) |
Deny access by a client IP address. | |
void | httpSetAuthFormDetails(struct HttpRoute *route, cchar *loginPage, cchar *loginService, cchar *logoutService, cchar *loggedInPage, cchar *loggedOutPage) |
Define login service URLs for use with "form" authentication. | |
void | httpSetAuthLogin(HttpAuth *auth, cchar *uri) |
Define the login page for use with authentication. | |
void | httpSetAuthOrder(HttpAuth *auth, int order) |
Set the auth allow/deny order. | |
void | httpSetAuthPermittedUsers(HttpAuth *auth, cchar *users) |
Define the set of permitted users. | |
void | httpSetAuthQop(HttpAuth *auth, cchar *qop) |
Set the required quality of service for digest authentication. | |
void | httpSetAuthRealm(HttpAuth *auth, cchar *realm) |
Set the required realm for basic or digest authentication. | |
void | httpSetAuthRequiredAbilities(HttpAuth *auth, cchar *abilities) |
Set the required abilities for access. | |
void | httpSetAuthSession(HttpAuth *auth, bool noSession) |
Control whether a session and session cookie will be created for user logins for this authentication route. | |
int | httpSetAuthStore(HttpAuth *auth, cchar *store) |
Set the authentication password store to use. | |
void | httpSetAuthStoreSessions(HttpAuthStore *store, bool noSession) |
Control whether sessions and session cookies are created for user logins. | |
int | httpSetAuthType(HttpAuth *auth, cchar *proto, cchar *details) |
Set the authentication protocol type to use. | |
void | httpSetAuthUsername(HttpAuth *auth, cchar *username) |
Set an automatic login username. | |
void | httpSetAuthVerify(HttpAuth *auth, HttpVerifyUser verifyUser) |
Set the verify callback for a authentication store. | |
void | httpSetChunkSize(HttpConn *conn, ssize size) |
Set the chunk size for transfer chunked encoding. | |
void | httpSetConnContext(HttpConn *conn, void *context) |
Set the connection context object. | |
void | httpSetConnData(HttpConn *conn, void *data) |
Set the connection data field. | |
void | httpSetConnHost(HttpConn *conn, void *host) |
Set the connection host object. | |
void | httpSetConnNotifier(HttpConn *conn, HttpNotifier notifier) |
Define a notifier callback for this connection. | |
void | httpSetConnUser(HttpConn *conn, struct HttpUser *user) |
Set the logged in user associated with the connection. | |
void | httpSetContentLength(HttpConn *conn, MprOff length) |
Define a content length header in the transmission. | |
void | httpSetContentType(HttpConn *conn, cchar *mimeType) |
Set the transmission (response) content mime type. | |
void | httpSetContext(void *context) |
Set the http context object. | |
void | httpSetCookie(HttpConn *conn, cchar *name, cchar *value, cchar *path, cchar *domain, MprTicks lifespan, int flags) |
Set a transmission cookie. | |
void | httpSetCredentials(HttpConn *conn, cchar *user, cchar *password, cchar *authType) |
Set the Http credentials. | |
void | httpSetDefaultClientHost(cchar *host) |
Define a default client host. | |
void | httpSetDefaultClientPort(int port) |
Define a default client port. | |
void | httpSetDefaultHost(HttpHost *host) |
Set the default host for all servers. | |
void | httpSetDir(HttpRoute *route, cchar *name, cchar *value) |
Define a route directory path variable. | |
int | httpSetEndpointAddress(HttpEndpoint *endpoint, cchar *ip, int port) |
Set the endpoint IP address. | |
void | httpSetEndpointAsync(HttpEndpoint *endpoint, int enable) |
Control if the endpoint is running in asynchronous mode. | |
void | httpSetEndpointContext(HttpEndpoint *endpoint, void *context) |
Set the endpoint context object. | |
void | httpSetEndpointNotifier(HttpEndpoint *endpoint, HttpNotifier fn) |
Define a notifier callback for this endpoint. | |
void | httpSetEntityLength(HttpConn *conn, MprOff len) |
Define the length of the transmission content. | |
void | httpSetEof(HttpConn *conn) |
Set the HttpRx eof condition. | |
void | httpSetFileHandler(HttpConn *conn, cchar *path) |
Set the "fileHandler" to process the request. | |
bool | httpSetFilename(HttpConn *conn, cchar *filename, int flags) |
Set the filename to serve for a request. | |
void | httpSetForkCallback(MprForkCallback proc, void *arg) |
Set the fork callback. | |
int | httpSetGroupAccount(cchar *group) |
Set the group account. | |
void | httpSetHandler(HttpConn *conn, HttpStage *handler) |
Set the handler for this request Use this request from the Handler rewrite callback to change the selected handler to process a request. | |
void | httpSetHeader(HttpConn *conn, cchar *key, cchar *fmt, ...) PRINTF_ATTRIBUTE(3 |
Set a transmission header. | |
void void | httpSetHeaderString(HttpConn *conn, cchar *key, cchar *value) |
Set a simple key/value transmission header. | |
void | httpSetHeadersCallback(struct HttpConn *conn, HttpHeadersCallback fn, void *arg) |
Define a headers callback. | |
int | httpSetHostCanonicalName(HttpHost *host, cchar *name) |
Set the host canonical name. | |
void | httpSetHostDefaultEndpoint(HttpHost *host, HttpEndpoint *endpoint) |
Set the default endpoint for a host. | |
void | httpSetHostDefaultRoute(HttpHost *host, HttpRoute *route) |
Set the default route for a host. | |
int | httpSetHostName(HttpHost *host, cchar *name) |
Set the host name. | |
void | httpSetHostProtocol(HttpHost *host, cchar *protocol) |
Set the host HTTP protocol version. | |
void | httpSetHostRoot(HttpHost *host, cchar *root) |
Set the server root for a host. | |
void | httpSetHostSecureEndpoint(HttpHost *host, HttpEndpoint *endpoint) |
Set the default secure endpoint for a host. | |
void | httpSetIOCallback(struct HttpConn *conn, HttpIOCallback fn) |
Define an I/O callback for connections. | |
void | httpSetIntParam(HttpConn *conn, cchar *var, int value) |
Set an integer request param value. | |
void | httpSetKeepAliveCount(HttpConn *conn, int count) |
Control Http Keep-Alive for the connection. | |
void | httpSetMethod(HttpConn *conn, cchar *method) |
Set a new HTTP method for processing. | |
void | httpSetOption(MprHash *options, cchar *field, cchar *value) |
Set an option. | |
void | httpSetParam(HttpConn *conn, cchar *var, cchar *value) |
Set a request param value. | |
int | httpSetPlatform(cchar *platform) |
Set platform description. | |
int | httpSetPlatformDir(cchar *platform) |
Set platform directory location. | |
void | httpSetProtocol(HttpConn *conn, cchar *protocol) |
Set the Http protocol variant for this connection. | |
void | httpSetProxy(cchar *host, int port) |
Define a Http proxy host to use for all client connect requests. | |
void | httpSetQueueLimits(HttpQueue *q, ssize low, ssize max) |
Set a queue's flow control low and high water marks. | |
void | httpSetRequestCallback(HttpRequestCallback callback) |
Define a request completion callback. | |
void | httpSetResponded(HttpConn *conn) |
Set the responded flag for the request. | |
void | httpSetRetries(HttpConn *conn, int retries) |
Set the Http retry count. | |
void | httpSetRouteAuth(HttpRoute *route, HttpAuth *auth) |
Set the route authentication. | |
void | httpSetRouteAutoDelete(HttpRoute *route, bool on) |
Control file upload auto delete. | |
void | httpSetRouteAutoFinalize(HttpRoute *route, bool on) |
Control auto finalize for a route. | |
void | httpSetRouteCompile(HttpRoute *route, bool on) |
Define whether updating a request may compile from source. | |
int | httpSetRouteConnector(HttpRoute *route, cchar *name) |
Set the connector to use for a route. | |
void | httpSetRouteCookie(HttpRoute *route, cchar *cookie) |
Set the route session cookie. | |
void | httpSetRouteCookiePersist(HttpRoute *route, int enable) |
Persist the cookie to disk. | |
void | httpSetRouteData(HttpRoute *route, cchar *key, void *data) |
Set route data. | |
void | httpSetRouteDefaultLanguage(HttpRoute *route, cchar *language) |
Set the default language for the route. | |
void | httpSetRouteDocuments(HttpRoute *route, cchar *path) |
Set the route directory. | |
void | httpSetRouteEnvEscape(HttpRoute *route, bool on) |
Define whether shell special characters are escaped in environment variables. | |
void | httpSetRouteEnvPrefix(HttpRoute *route, cchar *prefix) |
Define a prefix string for environment variables. | |
void | httpSetRouteFlags(HttpRoute *route, int flags) |
Update the route flags. | |
int | httpSetRouteHandler(HttpRoute *route, cchar *name) |
Set the handler to use for a route. | |
void | httpSetRouteHome(HttpRoute *route, cchar *home) |
Set the route directory for configuration files. | |
void | httpSetRouteIgnoreEncodingErrors(HttpRoute *route, bool on) |
Set the route to ignore UTF encoding errors for WebSocket connections. | |
void | httpSetRouteMethods(HttpRoute *route, cchar *methods) |
Define the methods for the route. | |
void | httpSetRoutePattern(HttpRoute *route, cchar *pattern, int flags) |
Set the route pattern. | |
void | httpSetRoutePrefix(HttpRoute *route, cchar *prefix) |
Set the route prefix. | |
void | httpSetRoutePreserveFrames(HttpRoute *route, bool on) |
Set the route to preserve WebSocket frames boundaries. | |
void | httpSetRouteRenameUploads(HttpRoute *route, bool enable) |
Control the renaming of uploaded filenames. | |
void | httpSetRouteScript(HttpRoute *route, cchar *script, cchar *scriptPath) |
Set the script to service the route. | |
void | httpSetRouteSessionVisibility(HttpRoute *route, bool visible) |
Make session cookies that are visible to javascript. | |
void | httpSetRouteShowErrors(HttpRoute *route, bool on) |
Define whether to show errors to the client. | |
void | httpSetRouteSource(HttpRoute *route, cchar *source) |
Set the source code module for the route. | |
void | httpSetRouteStealth(HttpRoute *route, bool on) |
Set stealth mode for the route. | |
int | httpSetRouteTarget(HttpRoute *route, cchar *name, cchar *details) |
Set a route target. | |
void | httpSetRouteTemplate(HttpRoute *route, cchar *tplate) |
Set the route template. | |
void | httpSetRouteUpdate(HttpRoute *route, bool on) |
Define whether updating a cached request is required. | |
void | httpSetRouteUploadDir(HttpRoute *route, cchar *dir) |
Set the default upload directory for file uploads. | |
void | httpSetRouteVar(HttpRoute *route, cchar *token, cchar *value) |
Define a route variable. | |
void | httpSetRouteWorkers(HttpRoute *route, int workers) |
Define the maximum number of workers for a route. | |
void | httpSetRouteXsrf(HttpRoute *route, bool enable) |
Control whether an XSRF token will be emitted during a user login sequence. | |
void | httpSetSendConnector(HttpConn *conn, cchar *path) |
Set the "Send" connector to process the request. | |
void | httpSetSessionNotify(MprCacheProc notifyProc) |
Set a notification callback to be invoked for session notification events. | |
int | httpSetSessionObj(HttpConn *conn, cchar *key, MprHash *value) |
Set an object into the session state store. | |
int | httpSetSessionVar(HttpConn *conn, cchar *name, cchar *value) |
Set a session variable. | |
void | httpSetSoftware(cchar *description) |
Set the software description. | |
void | httpSetStageData(struct HttpConn *conn, cchar *key, cvoid *data) |
Set stage data. | |
void | httpSetState(HttpConn *conn, int state) |
Set the connection state and invoke notifiers. | |
void | httpSetStatus(HttpConn *conn, int status) |
Set a Http response status. | |
void | httpSetStreaming(struct HttpHost *host, cchar *mime, cchar *uri, bool streaming) |
Control if input body content should be streamed or buffered for requests with content of a given mime type. | |
void | httpSetTimeout(HttpConn *conn, MprTicks requestTimeout, MprTicks inactivityTimeout) |
Set the Http inactivity timeout. | |
void | httpSetTimestamp(MprTicks period) |
Define a timestamp in the MPR log file. | |
void | httpSetTraceContentSize(HttpTrace *trace, ssize size) |
Set the maximum content size to trace. | |
void | httpSetTraceEventLevel(HttpTrace *trace, cchar *type, int level) |
Configure the tracing level for an event type. | |
void | httpSetTraceFormat(HttpTrace *trace, cchar *format) |
Set the logging format. | |
HttpTraceFormatter | httpSetTraceFormatter(HttpTrace *trace, HttpTraceFormatter callback) |
Set the formatter callback to use with a trace object. | |
void | httpSetTraceFormatterName(HttpTrace *trace, cchar *name) |
Define the trace formatter by name. | |
void | httpSetTraceLevel(int level) |
Set the current tracing verbosity level. | |
int | httpSetTraceLogFile(HttpTrace *trace, cchar *path, ssize size, int backup, cchar *format, int flags) |
Configure the request trace log. | |
void | httpSetTraceLogger(HttpTrace *trace, HttpTraceLogger callback) |
Set the trace callback to use with a trace object. | |
int | httpSetUri(HttpConn *conn, cchar *uri) |
Set a new URI for processing. | |
int | httpSetUserAccount(cchar *user) |
Set the user account. | |
void | httpSetWebSocketData(HttpConn *conn, void *data) |
Set the WebSocket private data. | |
void | httpSetWebSocketPreserveFrames(HttpConn *conn, bool on) |
Preserve frames for incoming messages. | |
void | httpSetWebSocketProtocols(HttpConn *conn, cchar *protocols) |
Set a list of application-level protocols supported by the client. | |
void | httpSetupWaitHandler(HttpConn *conn, int eventMask) |
Setup a wait handler for the connection to wait for desired events. | |
bool | httpShouldRenderDirListing(HttpConn *conn) |
Test if a directory listing should be rendered for the request. | |
void | httpSocketBlocked(HttpConn *conn) |
Indicate that the transmission socket is blocked. | |
HttpPacket* | httpSplitPacket(HttpPacket *packet, ssize offset) |
Split a data packet. | |
int | httpStartEndpoint(HttpEndpoint *endpoint) |
Start listening for client connections on an endpoint. | |
int | httpStartEndpoints() |
Start listening for client connections on all endpoints. | |
void | httpStartPipeline(HttpConn *conn) |
Start the pipeline. | |
int | httpStartTracing(cchar *traceSpec) |
Start tracing for the given trace log file when instructed via a command line switch. | |
char* | httpStatsReport(int flags) |
Get an Http performance report. | |
MprSocket* | httpStealSocket(HttpConn *conn) |
Steal a socket from a connection. | |
Socket | httpStealSocketHandle(HttpConn *conn) |
Steal the O/S socket handle from the connection socket object. | |
void | httpStopConnections(void *data) |
Stop all connections owned by the data handle. | |
void | httpStopEndpoint(HttpEndpoint *endpoint) |
Stop the server listening for client connections. | |
void | httpStopEndpoints() |
Stop listening for client connections on all endpoints. | |
void | httpSuspendQueue(HttpQueue *q) |
Suspend a queue. | |
char* | httpTemplate(HttpConn *conn, cchar *tplate, MprHash *options) |
Expand a template string using given options. | |
int | httpTestParam(HttpConn *conn, cchar *var) |
Test if a request param is defined. | |
bool | httpTokenize(HttpRoute *route, cchar *str, cchar *fmt, ...) |
Tokenize a string based on route data. | |
bool | httpTokenizev(HttpRoute *route, cchar *str, cchar *fmt, va_list args) |
Tokenize a string based on route data. | |
bool | httpTrace(struct HttpConn *conn, cchar *event, cchar *type, cchar *values, ...) |
Trace an event of interest. | |
bool bool | httpTraceContent(struct HttpConn *conn, cchar *event, cchar *type, cchar *buf, ssize len, cchar *values, ...) PRINTF_ATTRIBUTE(6 |
Trace request content. | |
bool bool,bool | httpTracePacket(struct HttpConn *conn, cchar *event, cchar *type, struct HttpPacket *packet, cchar *values, ...) PRINTF_ATTRIBUTE(5 |
Trace request packet. | |
void | httpTrimExtraPath(HttpConn *conn) |
Trim extra path from the URI. | |
ssize | httpUpdateCache(HttpConn *conn, cchar *uri, cchar *data, MprTicks lifespan) |
Update the cached content for a URI. | |
int | httpUpgradeWebSocket(HttpConn *conn) |
Upgrade a client HTTP connection connection to use WebSockets. | |
char* | httpUriToString(HttpUri *uri, int flags) |
Convert a Uri to a string. | |
bool | httpValidUriChars(cchar *uri) |
Test if a URI is using only valid characters Note this does not test if the URI is fully legal. | |
char* | httpValidateUriPath(cchar *uri) |
Validate a URI path as expected in a HTTP request line. | |
bool | httpVerifyWebSocketsHandshake(HttpConn *conn) |
Verify the server handshake. | |
int | httpWait(HttpConn *conn, int state, MprTicks timeout) |
Wait for the client connection to achieve the requested state. | |
bool | httpWebSocketOrderlyClosed(HttpConn *conn) |
Test if WebSocket connection was orderly closed by sending an acknowledged close message. | |
bool | httpWillNextQueueAcceptPacket(HttpQueue *q, HttpPacket *packet) |
Determine if the downstream queue will accept this packet. | |
bool | httpWillNextQueueAcceptSize(HttpQueue *q, ssize size) |
Determine if the downstream queue will accept a certain amount of data. | |
bool | httpWillQueueAcceptPacket(HttpQueue *q, HttpPacket *packet, bool split) |
Determine if the given queue will accept this packet. | |
ssize | httpWrite(HttpQueue *q, cchar *fmt, ...) PRINTF_ATTRIBUTE(2 |
Write a formatted string. | |
ssize | httpWriteBlock(HttpQueue *q, cchar *buf, ssize size, int flags) |
Write a block of data to the queue. | |
ssize | httpWriteCached(HttpConn *conn) |
Write the cached content for a URI to the client. | |
void | httpWriteHeaders(HttpQueue *q, HttpPacket *packet) |
Write the transmission headers into the given packet. | |
int | httpWriteSession(HttpConn *conn) |
Write the session state to persistent data storage. | |
ssize | httpWriteString(HttpQueue *q, cchar *s) |
Write a string of data to the queue. | |
bool bool,bool,void | httpWriteTrace(HttpTrace *trace, cchar *buf, ssize len) |
Convenience routine to write trace to the trace logger. | |
void | httpWriteTraceLogFile(HttpTrace *trace, cchar *buf, ssize len) |
Write a message to the trace file logger. | |
ssize | httpWriteUploadData(HttpConn *conn, MprList *formData, MprList *fileData) |
Write Http upload body data. |
Typedefs
HttpAddress | Per-IP address structure. |
HttpAskLogin | AuthType callback to generate a response requesting the user login This should call httpError if such a response cannot be generated. |
HttpAuthStore | Password backend store. |
HttpAuthType | Authentication Protocol. |
HttpConfigureProc | Callback procedure for HttpConfigure. |
HttpCounter | Monitoring counter. |
HttpDefense | Monitor defense configuration. |
HttpEnvCallback | Set environment vars callback. |
HttpEventProc | Event callback function for httpCreateEvent. |
HttpFillProc | Callback procedure to fill a packet with data. |
HttpHeadersCallback | Callback to fill headers. |
HttpIOCallback | I/O callback for connections. |
HttpLang | Language definition record for routes. |
HttpListenCallback | Listen callback. |
HttpNotifier | Connection Http state change notification callback. |
HttpParseAuth | AuthType callback to parse the HTTP 'Authorize' (client) and 'www-authenticate' (server) headers. |
HttpParseCallback | Http JSON configuration parse callback. |
HttpRemedyProc | Defense remedy callback. |
HttpRequestCallback | Request completion callback. |
HttpRole | Authorization Roles. |
HttpRouteOp | Route operation record. |
HttpRouteProc | General route procedure. |
HttpRouteSetProc | RouteSet callback. |
HttpSetAuth | AuthType callback to set the necessary HTTP authorization headers for a client request. |
HttpTimeoutCallback | Timeout callback. |
HttpTraceFormatter | Trace formatter callback. |
HttpTraceLogger | Trace logger callback. |
HttpUser | User Authorization. |
HttpVerifyUser | AuthStore callback Verify the user credentials. |
Defines
#define | HTTP_ADDED_BODY_PARAMS 0x800 |
Body data added to params. | |
#define | HTTP_ADDED_QUERY_PARAMS 0x400 |
Query added to params. | |
#define | HTTP_ALLOW_DENY 0x1 |
Run allow checks before deny checks. | |
#define | HTTP_AUTH_NO_SESSION 0x4 |
Do not create a session when authenticated. | |
#define | HTTP_BLOCK 0x1 |
Flag for httpSendBlock and httpWriteBlock to indicate blocking operation. | |
#define | HTTP_BUFFER 0x4 |
Flag for httpSendBlock and httpWriteBlock to always absorb the data without blocking. | |
#define | HTTP_CACHE_CLIENT 0x1 |
Cache on the client side. | |
#define | HTTP_CACHE_HAS_PARAMS 0x20 |
Cache definition has params. | |
#define | HTTP_CACHE_MANUAL 0x4 |
Cache manually. | |
#define | HTTP_CACHE_RESET 0x8 |
Don't inherit cache config from outer routes. | |
#define | HTTP_CACHE_SERVER 0x2 |
Cache on the server side. | |
#define | HTTP_CACHE_STATIC 0x40 |
Cache extensions: css, gif, ico, jpg, js, html, pdf, ttf, txt, xml, woff. | |
#define | HTTP_CACHE_UNIQUE 0x10 |
Uniquely cache request with different params. | |
#define | HTTP_CHUNK_DATA 2 |
Start of chunk data. | |
#define | HTTP_CHUNK_EOF 3 |
End of last chunk. | |
#define | HTTP_CHUNK_START 1 |
Start of a new chunk. | |
#define | HTTP_CHUNK_UNCHUNKED 0 |
Data is not transfer-chunk encoded. | |
#define | HTTP_CHUNKED 0x200 |
Content is chunk encoded. | |
#define | HTTP_CLIENT_SIDE 0x1 |
Initialize the client-side support. | |
#define | HTTP_CODE_ACCEPTED 202 |
The request has been accepted and processing is continuing. | |
#define | HTTP_CODE_BAD_GATEWAY 502 |
The server cannot act as a gateway for the given request. | |
#define | HTTP_CODE_BAD_HANDSHAKE 551 |
The server handsake response is unacceptable. | |
#define | HTTP_CODE_BAD_METHOD 405 |
The request HTTP method was not supported by the resource. | |
#define | HTTP_CODE_BAD_REQUEST 400 |
The request is malformed. | |
#define | HTTP_CODE_BAD_VERSION 505 |
The server does not support the HTTP protocol version. | |
#define | HTTP_CODE_CERT_ERROR 495 |
The peer provided certificate is unacceptable. | |
#define | HTTP_CODE_COMMS_ERROR 550 |
The server had a communicationss error responding to the client. | |
#define | HTTP_CODE_CONFLICT 409 |
The request had a conflict in the request headers and URI. | |
#define | HTTP_CODE_CONTINUE 100 |
Continue with request, only partial content transmitted. | |
#define | HTTP_CODE_CREATED 201 |
The request has completed and a new resource was created. | |
#define | HTTP_CODE_EXPECTATION_FAILED 417 |
The server cannot satisfy the Expect header requirements. | |
#define | HTTP_CODE_FORBIDDEN 403 |
The request was legal, but the server refuses to process. | |
#define | HTTP_CODE_GATEWAY_TIMEOUT 504 |
The server gateway timed out waiting for the upstream server. | |
#define | HTTP_CODE_GONE 410 |
The requested resource is no longer available. | |
#define | HTTP_CODE_IM_A_TEAPOT 418 |
Short and stout error code (RFC 2324). | |
#define | HTTP_CODE_INSUFFICIENT_STORAGE 507 |
The server has insufficient storage to complete the request. | |
#define | HTTP_CODE_INTERNAL_SERVER_ERROR 500 |
Server processing or configuration error. | |
#define | HTTP_CODE_LENGTH_REQUIRED 411 |
The request did not specify a required content length. | |
#define | HTTP_CODE_MOVED_PERMANENTLY 301 |
The requested URI has moved permanently to a new location. | |
#define | HTTP_CODE_MOVED_TEMPORARILY 302 |
The URI has moved temporarily to a new location. | |
#define | HTTP_CODE_NO_CONTENT 204 |
The request has completed and there is no response to send. | |
#define | HTTP_CODE_NO_RESPONSE 444 |
The connection was closed with no response to the client. | |
#define | HTTP_CODE_NOT_ACCEPTABLE 406 |
The requested resource cannot generate the required content. | |
#define | HTTP_CODE_NOT_AUTHORITATIVE 203 |
The request has completed but content may be from another source. | |
#define | HTTP_CODE_NOT_FOUND 404 |
The requested resource was not found. | |
#define | HTTP_CODE_NOT_IMPLEMENTED 501 |
The server does not recognize the request or method. | |
#define | HTTP_CODE_NOT_MODIFIED 304 |
The requested resource has changed since the last request. | |
#define | HTTP_CODE_OK 200 |
The request completed successfully. | |
#define | HTTP_CODE_PARTIAL 206 |
The request has completed and is returning partial content. | |
#define | HTTP_CODE_PAYMENT_REQUIRED 402 |
Reserved for future use. | |
#define | HTTP_CODE_PRECOND_FAILED 412 |
The server cannot satisfy one of the request preconditions. | |
#define | HTTP_CODE_RANGE_NOT_SATISFIABLE 416 |
The request content range does not exist for the resource. | |
#define | HTTP_CODE_REQUEST_TIMEOUT 408 |
The server timed out waiting for the request to complete. | |
#define | HTTP_CODE_REQUEST_TOO_LARGE 413 |
The request is too large for the server to process. | |
#define | HTTP_CODE_REQUEST_URL_TOO_LARGE 414 |
The request URI is too long for the server to process. | |
#define | HTTP_CODE_RESET 205 |
The request has completed with no content. | |
#define | HTTP_CODE_SEE_OTHER 303 |
The requested URI can be found at another URI location. | |
#define | HTTP_CODE_SERVICE_UNAVAILABLE 503 |
The server is currently unavailable or overloaded. | |
#define | HTTP_CODE_SWITCHING 101 |
Switching protocols. | |
#define | HTTP_CODE_TEMPORARY_REDIRECT 307 |
The request should be repeated at another URI location. | |
#define | HTTP_CODE_UNAUTHORIZED 401 |
Authentication for the request has failed. | |
#define | HTTP_CODE_UNSUPPORTED_MEDIA_TYPE 415 |
The request media type is not supported by the server or resource. | |
#define | HTTP_CODE_USE_PROXY 305 |
The requested resource must be accessed via the location proxy. | |
#define | HTTP_COMPLETE_URI 0x1 |
Complete all missing URI fields. | |
#define | HTTP_COMPLETE_URI_PATH 0x2 |
Complete missing URI path. | |
#define | HTTP_COOKIE_HTTP 0x2 |
Flag for Set-Cookie httponly. | |
#define | HTTP_COOKIE_SECURE 0x1 |
Flag for Set-Cookie for SSL only. | |
#define | HTTP_COUNTER_ACTIVE_CLIENTS 0 |
Active unique client IP addresses. | |
#define | HTTP_COUNTER_ACTIVE_CONNECTIONS 1 |
Active connections per client. | |
#define | HTTP_COUNTER_ACTIVE_PROCESSES 3 |
Total processes for server. | |
#define | HTTP_COUNTER_ACTIVE_REQUESTS 2 |
Active requests per client. | |
#define | HTTP_COUNTER_BAD_REQUEST_ERRORS 4 |
Bad request format errors. | |
#define | HTTP_COUNTER_ERRORS 5 |
All errors. | |
#define | HTTP_COUNTER_LIMIT_ERRORS 6 |
Limit violation errors. | |
#define | HTTP_COUNTER_MEMORY 7 |
Total application memory for server. | |
#define | HTTP_COUNTER_NETWORK_IO 8 |
Network I/O. | |
#define | HTTP_COUNTER_NOT_FOUND_ERRORS 9 |
URI not found errors. | |
#define | HTTP_COUNTER_REQUESTS 10 |
Request count. | |
#define | HTTP_COUNTER_SSL_ERRORS 11 |
SSL upgrade errors. | |
#define | HTTP_CREATE_ENV 0x80 |
Must create env for this request. | |
#define | HTTP_DELAY_SERVICE 0 |
Delay servicing the queue. | |
#define | HTTP_DELETE 0x1 |
DELETE method. | |
#define | HTTP_DENY_ALLOW 0x2 |
Run deny checks before allow checks. | |
#define | HTTP_EVENT_APP_CLOSE 6 |
The request is now closed. | |
#define | HTTP_EVENT_DESTROY 5 |
The connection is being closed and destroyed. | |
#define | HTTP_EVENT_ERROR 4 |
The request has an error. | |
#define | HTTP_EVENT_MAX 8 |
Maximum event plus one. | |
#define | HTTP_EVENT_READABLE 2 |
The request has data available for reading. | |
#define | HTTP_EVENT_STATE 1 |
Notifier events. | |
#define | HTTP_EVENT_WRITABLE 3 |
The request is now writable (post / put data). | |
#define | HTTP_EXPECT_CONTINUE 0x1000 |
Client expects an HTTP 100 Continue response. | |
#define | HTTP_GET 0x2 |
GET method. | |
#define | HTTP_HEAD 0x4 |
HEAD method. | |
#define | HTTP_HOST_ATTACHED 0x100 |
Host name attached to an endpoint. | |
#define | HTTP_HOST_NO_TRACE 0x10 |
Host flag to disable the of TRACE HTTP method. | |
#define | HTTP_HOST_WILD_CONTAINS 0x40 |
Host name contains the host name. | |
#define | HTTP_HOST_WILD_REGEXP 0x80 |
Host name is a regular expression. | |
#define | HTTP_HOST_WILD_STARTS 0x20 |
Host name starts with pattern. | |
#define | HTTP_IF_MODIFIED 0x100 |
If-[un]modified-since supplied. | |
#define | HTTP_LANG_AFTER 0x2 |
Insert suffix after extension. | |
#define | HTTP_LANG_BEFORE 0x1 |
Insert suffix before extension. | |
#define | HTTP_MAX_QUEUE 2 |
Number of queue types. | |
#define | HTTP_MAX_SECRET 16 |
Size of secret data for auth. | |
#define | HTTP_MORE 0x1000 |
Flag for httpSendBlock to indicate there are more frames for this message. | |
#define | HTTP_NEW_DISPATCHER 0x1 |
New dispatcher for each connection. | |
#define | HTTP_NON_BLOCK 0x2 |
Flag for httpSendBlock and httpWriteBlock to indicate non-blocking operation. | |
#define | HTTP_OPTIONS 0x8 |
OPTIONS method. | |
#define | HTTP_PACKET_DATA 0x4 |
Packet contains actual content data. | |
#define | HTTP_PACKET_END 0x8 |
End of stream packet. | |
#define | HTTP_PACKET_HEADER 0x1 |
Packet contains HTTP headers. | |
#define | HTTP_PACKET_RANGE 0x2 |
Packet is a range boundary packet. | |
#define | HTTP_PACKET_SOLO 0x10 |
Don't join this packet. | |
#define | HTTP_POST 0x10 |
Post method. | |
#define | HTTP_PUT 0x20 |
PUT method. | |
#define | HTTP_QUEUE_ALL 0x8 |
Queue has all the data there is and will be. | |
#define | HTTP_QUEUE_EOF 0x20 |
Queue at end of data. | |
#define | HTTP_QUEUE_OPEN_TRIED 0x1 |
Queue's open routine has been called. | |
#define | HTTP_QUEUE_OPENED 0x2 |
Queue's open routine has been called. | |
#define | HTTP_QUEUE_READY 0x80 |
Handler stage ready routine called. | |
#define | HTTP_QUEUE_RESERVICE 0x100 |
Queue requires reservicing. | |
#define | HTTP_QUEUE_RX 1 |
Receive (read from client) queue. | |
#define | HTTP_QUEUE_SERVICED 0x10 |
Queue has been serviced at least once. | |
#define | HTTP_QUEUE_STARTED 0x40 |
Handler stage start routine called. | |
#define | HTTP_QUEUE_SUSPENDED 0x4 |
Queue's service routine is suspended due to flow control. | |
#define | HTTP_QUEUE_TX 0 |
Send (transmit to client) queue. | |
#define | HTTP_RETRIES 3 |
Default number of retries for client requests. | |
#define | HTTP_ROUTE_CORS 0x40 |
Cross-Origin resource sharing. | |
#define | HTTP_ROUTE_DOTNET_DIGEST_FIX 0x2000 |
NET digest auth omits query in MD5. | |
#define | HTTP_ROUTE_ENV_ESCAPE 0x1000 |
Escape env vars. | |
#define | HTTP_ROUTE_FREE 0x2 |
Free Route.mdata back to malloc when route is freed. | |
#define | HTTP_ROUTE_FREE_PATTERN 0x4 |
Free Route.patternCompiled back to malloc when route is freed. | |
#define | HTTP_ROUTE_HIDDEN 0x800 |
Hide this route in route tables. | |
#define | HTTP_ROUTE_HOSTED 0x10000 |
Route being hosted (appweb). | |
#define | HTTP_ROUTE_NO_LISTEN 0x20000 |
Not listening on endpoints. | |
#define | HTTP_ROUTE_NOT 0x1 |
Negate the route pattern test result. | |
#define | HTTP_ROUTE_OK 0 |
The route matches the request. | |
#define | HTTP_ROUTE_OMIT_FILTER 1 |
Omit filter. | |
#define | HTTP_ROUTE_OWN_LISTEN 0x80000 |
Override listening endpoints. | |
#define | HTTP_ROUTE_PERSIST_COOKIE 0x40000 |
Persist session cookie to disk. | |
#define | HTTP_ROUTE_PRESERVE_FRAMES 0x400 |
Preserve WebSocket frame boundaries. | |
#define | HTTP_ROUTE_RAW 0x8 |
Don't html encode the write data. | |
#define | HTTP_ROUTE_REDIRECT 0x4000 |
Redirect secureCondition. | |
#define | HTTP_ROUTE_REJECT 1 |
The route does not match the request. | |
#define | HTTP_ROUTE_REROUTE 2 |
Request has been modified and must be re-routed. | |
#define | HTTP_ROUTE_SHOW_ERRORS 0x100 |
Show errors to the client. | |
#define | HTTP_ROUTE_STARTED 0x10 |
Route initialized. | |
#define | HTTP_ROUTE_STEALTH 0x80 |
Stealth mode. | |
#define | HTTP_ROUTE_STRICT_TLS 0x8000 |
Emit Strict-Transport-Security header. | |
#define | HTTP_ROUTE_UTILITY 0x100000 |
Route hosted by a utility. | |
#define | HTTP_ROUTE_VISIBLE_SESSION 0x200 |
Create a session cookie visible to client Javascript. | |
#define | HTTP_ROUTE_XSRF 0x20 |
Generate XSRF tokens. | |
#define | HTTP_SCHEDULE_QUEUE 1 |
Schedule the queue for service. | |
#define | HTTP_SERVER_SIDE 0x2 |
Initialize the server-side support. | |
#define | HTTP_SESSION_COOKIE "-http-session-" |
Session cookie name. | |
#define | HTTP_SESSION_IP "__IP__" |
Connection IP address - prevents session hijack. | |
#define | HTTP_SESSION_USERNAME "__USERNAME__" |
Username variable. | |
#define | HTTP_STAGE_AUTO_DIR 0x10000 |
Want auto directory redirection. | |
#define | HTTP_STAGE_CONNECTOR 0x1000 |
Stage is a connector. | |
#define | HTTP_STAGE_FILTER 0x4000 |
Stage is a filter. | |
#define | HTTP_STAGE_HANDLER 0x2000 |
Stage is a handler. | |
#define | HTTP_STAGE_INTERNAL 0x100000 |
Internal stage - hidden. | |
#define | HTTP_STAGE_MODULE 0x8000 |
Stage is a filter. | |
#define | HTTP_STAGE_RX 0x40000 |
Stage to be used in the Rx direction. | |
#define | HTTP_STAGE_TX 0x80000 |
Stage to be used in the Tx direction. | |
#define | HTTP_STAGE_UNLOADED 0x20000 |
Stage module library has been unloaded. | |
#define | HTTP_STATE_BEGIN 1 |
Ready for a new request. | |
#define | HTTP_STATE_COMPLETE 9 |
Request complete. | |
#define | HTTP_STATE_CONNECTED 2 |
Connection received or made. | |
#define | HTTP_STATE_CONTENT 5 |
Reading posted content. | |
#define | HTTP_STATE_FINALIZED 8 |
Input received, request processed and response transmitted. | |
#define | HTTP_STATE_FIRST 3 |
First request line has been parsed. | |
#define | HTTP_STATE_PARSED 4 |
Headers have been parsed, handler can start. | |
#define | HTTP_STATE_READY 6 |
Handler ready - all body data received. | |
#define | HTTP_STATE_RUNNING 7 |
Handler running. | |
#define | HTTP_TIMER_PERIOD 1000 |
HttpTimer checks ever 1 second. | |
#define | HTTP_TRACE 0x40 |
TRACE method. | |
#define | HTTP_TRACE_MAX_SIZE (10 * 1024) |
Default maximum body size to trace. | |
#define | HTTP_TRACE_MIN_LOG_SIZE (10 * 1024) |
Minimum log file size. | |
#define | HTTP_TX_HAS_FILTERS 0x100 |
Has output filters. | |
#define | HTTP_TX_HEADERS_CREATED 0x2 |
Response headers have been created. | |
#define | HTTP_TX_NO_BODY 0x1 |
No transmission body, only send headers. | |
#define | HTTP_TX_NO_CHECK 0x10 |
Do not check if the filename is inside the route documents directory. | |
#define | HTTP_TX_NO_LENGTH 0x20 |
Do not emit a content length (used for TRACE). | |
#define | HTTP_TX_NO_MAP 0x40 |
Do not map the filename to compressed or minified alternatives. | |
#define | HTTP_TX_PIPELINE 0x80 |
Created Tx pipeline. | |
#define | HTTP_TX_SENDFILE 0x4 |
Relay output via send connector. | |
#define | HTTP_TX_USE_OWN_HEADERS 0x8 |
Skip adding default headers. | |
#define | ME_HTTP_BAN_PERIOD (5 * 60 * 1000) |
Default ban IP period. | |
#define | ME_HTTP_DEFAULT_METHODS "GET,POST" |
Default methods for routes. | |
#define | ME_HTTP_DELAY (2000) |
2 second delay per request - while delay enforced. | |
#define | ME_HTTP_DELAY_PERIOD (5 * 60 * 1000) |
Default delay IP period. | |
#define | ME_HTTP_MONITOR_PERIOD (15 * 1000) |
Monitor prune period. | |
#define | ME_HTTP_REMEDY_TIMEOUT (60 * 1000) |
Default remedy command timeout. | |
#define | ME_HTTP_SOFTWARE "Embedthis-http" |
Default Http protocol name used in Http Server header. | |
#define | ME_MAX_CACHE_DURATION (86400 * 1000) |
Default cache lifespan to 1 day. | |
#define | ME_MAX_CACHE_ITEM (256 * 1024) |
Maximum cachable item size. | |
#define | ME_MAX_CHUNK (8 * 1024) |
Maximum chunk size for transfer chunk encoding. | |
#define | ME_MAX_CLIENTS 32 |
Maximum unique client IP addresses. | |
#define | ME_MAX_CLIENTS_HASH 131 |
Hash table for client IP addresses. | |
#define | ME_MAX_CONNECTIONS 50 |
Maximum concurrent client endpoints. | |
#define | ME_MAX_HEADERS 8192 |
Maximum size of the headers (8K). | |
#define | ME_MAX_INACTIVITY_DURATION (30 * 1000) |
Default keep connection alive between requests timeout (30 sec). | |
#define | ME_MAX_IOVEC 16 |
Number of fragments in a single socket write. | |
#define | ME_MAX_KEEP_ALIVE 400 |
Maximum requests per connection. | |
#define | ME_MAX_NUM_HEADERS 64 |
Maximum number of header lines. | |
#define | ME_MAX_PARSE_DURATION (5 * 1000) |
Default request parse header timeout (5 sec). | |
#define | ME_MAX_PING_DURATION (30 * 1000) |
WSS ping defeat Keep-Alive timeouts (30 sec). | |
#define | ME_MAX_PROCESSES 10 |
Maximum concurrent processes. | |
#define | ME_MAX_REQUEST_DURATION (5 * 60 * 1000) |
Default request timeout (5 minutes). | |
#define | ME_MAX_REQUESTS_PER_CLIENT 20 |
Maximum concurrent requests per client. | |
#define | ME_MAX_REWRITE 20 |
Maximum URI rewrites. | |
#define | ME_MAX_ROUTE_MAP_HASH 17 |
Size of the route mapping hash. | |
#define | ME_MAX_ROUTE_MATCHES 32 |
Maximum number of submatches in routes. | |
#define | ME_MAX_RX_BODY (512 * 1024) |
Maximum incoming body size (512K). | |
#define | ME_MAX_RX_FORM (512 * 1024) |
Maximum incoming form size (512K). | |
#define | ME_MAX_SESSION_DURATION (5 * 60 * 1000) |
Default session inactivity timeout (5 mins). | |
#define | ME_MAX_SESSION_HASH 31 |
Hash table for session data. | |
#define | ME_MAX_SESSIONS 100 |
Maximum concurrent sessions. | |
#define | ME_MAX_TX_BODY HTTP_UNLIMITED |
Maximum buffer for response data. | |
#define | ME_MAX_UPLOAD HTTP_UNLIMITED |
Maximum file upload size. | |
#define | ME_MAX_URI 512 |
Reasonable URI size. | |
#define | ME_MAX_WSS_FRAME (4 * 1024) |
Default max WebSockets message frame size. | |
#define | ME_MAX_WSS_MESSAGE (2147483647) |
Default max WebSockets message size (2GB). | |
#define | ME_MAX_WSS_PACKET (8 * 1024) |
Default size to provide to application in one packet. | |
#define | ME_MAX_WSS_SOCKETS 25 |
Default max WebSockets. | |
#define | ME_XSRF_COOKIE "XSRF-TOKEN" |
CSRF token cookie name. | |
#define | ME_XSRF_HEADER "X-XSRF-TOKEN" |
CSRF token name in Http headers. | |
#define | ME_XSRF_PARAM "-xsrf-" |
CSRF parameter in form fields. | |
#define | WS_MAX_CONTROL 125 |
Maximum bytes in control message. | |
#define | WS_MSG_BINARY 0x2 |
httpSendBlock type for binary messages. | |
#define | WS_MSG_CLOSE 0x8 |
httpSendBlock type for close message. | |
#define | WS_MSG_CONT 0x0 |
Continuation of WebSocket message. | |
#define | WS_MSG_CONTROL 0x8 |
Start of control messages. | |
#define | WS_MSG_MAX 0xB |
Max message type for httpSendBlock. | |
#define | WS_MSG_PING 0x9 |
httpSendBlock type for ping messages. | |
#define | WS_MSG_PONG 0xA |
httpSendBlock type for pong messages. | |
#define | WS_MSG_TEXT 0x1 |
httpSendBlock type for text messages. | |
#define | WS_STATE_CLOSED 3 |
WebSocket is closed. | |
#define | WS_STATE_CLOSING 2 |
WebSocket is closing. | |
#define | WS_STATE_CONNECTING 0 |
WebSocket connection is being established. | |
#define | WS_STATE_OPEN 1 |
WebSocket handsake is complete and ready for communications. | |
#define | WS_STATUS_COMMS_ERROR 1006 |
TCP/IP communications error. | |
#define | WS_STATUS_FRAME_TOO_LARGE 1004 |
Reserved. | |
#define | WS_STATUS_GOING_AWAY 1001 |
Endpoint is going away. | |
#define | WS_STATUS_INTERNAL_ERROR 1011 |
Server terminating due to an internal error. | |
#define | WS_STATUS_INVALID_UTF8 1007 |
Text message has invalid UTF-8. | |
#define | WS_STATUS_MAX 5000 |
Maximum error status (less one). | |
#define | WS_STATUS_MESSAGE_TOO_LARGE 1009 |
Message is too large. | |
#define | WS_STATUS_MISSING_EXTENSION 1010 |
Unsupported WebSockets extension. | |
#define | WS_STATUS_NO_STATUS 1005 |
No status was received from the peer in closing. | |
#define | WS_STATUS_OK 1000 |
Normal closure. | |
#define | WS_STATUS_POLICY_VIOLATION 1008 |
Application level policy violation. | |
#define | WS_STATUS_PROTOCOL_ERROR 1002 |
WebSockets protocol error. | |
#define | WS_STATUS_TLS_ERROR 1015 |
TLS handshake error. | |
#define | WS_STATUS_UNSUPPORTED_TYPE 1003 |
Unsupported message data type. | |
#define | WS_VERSION 13 |
Current WebSocket specification version. |
Http
Http service object.
- Description:
- Configuration is not thread safe and must occur at initialization time when the application is single threaded. If the configuration is modified when the application is multithreaded, all requests must be first be quiesced.
- See Also:
- HttpConn, HttpEndpoint, httpConfigure, httpCreate, httpGetContext, httpGetDateString, httpLookupEndpoint, httpLookupStatus, httpSetContext, httpSetDefaultClientHost, httpSetDefaultClientPort, httpSetForkCallback, httpSetProxy, httpSetSoftware
- API Stability:
- Internal.
- Fields:
-
struct HttpStage * actionHandler Action handler. int activeProcesses Count of active external processes. MprHash * addresses Monitored per-IP-address counters. MprHash * authStores Available password stores. MprHash * authTypes Available authentication protocol types. MprTime booted Time the server started. struct HttpStage * cacheFilter Cache filter. struct HttpStage * cacheHandler Cache filter. struct HttpStage * cgiConnector CGI connector. struct HttpStage * cgiHandler CGI handler. struct HttpStage * chunkFilter Chunked transfer encoding filter. struct HttpStage * clientHandler Client-side handler (dummy). struct HttpLimits * clientLimits Client resource limits. struct HttpRoute * clientRoute Default route for clients. MprList * connections Currently open connection requests. void * context Embedding context. MprList * counters List of counters. char * currentDate Date string for HTTP response headers. MprTicks currentTime When currentDate was last calculated (ticks). MprHash * dateCache Cache of date modified times. char * defaultClientHost Default ip address. int defaultClientPort Default port. MprHash * defenses List of Defenses. struct HttpStage * dirHandler Directory listing handler. struct HttpStage * egiHandler Embedded Gateway Interface (EGI) handler. struct HttpStage * ejsHandler Ejscript Web Framework handler. MprList * endpoints Currently configured listening endpoints. HttpEnvCallback envCallback SetEnv callback. struct HttpStage * espHandler ESP Web Framework handler. struct HttpStage * fileHandler Static file handler. int flags Open flags. MprForkCallback forkCallback Callback in child after fork(). int gid Group Id. cchar * group O/S application group name. int groupChanged Group name changed. MprList * hosts List of host objects. HttpListenCallback listenCallback Invoked when creating listeners. cchar * localPlatform Local (dev) platform os-arch-profile (lower case). MprTicks monitorPeriod Minimum monitor period. MprList * monitors List of monitors. int monitorsStarted Monitors are running. MprMutex * mutex Multithread sync. struct HttpStage * netConnector Default network connector. int nextAuth Auth object version vector. MprTicks now Current time in ticks. MprHash * parsers Table config parser callbacks. struct HttpStage * passHandler Pass through handler. struct HttpStage * phpHandler PHP through handler. cchar * platform Target platform os-arch-profile (lower case). cchar * platformDir Path to platform directory containing binaries. char * protocol Default client protocol: HTTP/1.0 or HTTP/1.1. char * proxyHost Proxy ip address. int proxyPort Proxy port. struct HttpStage * rangeFilter Ranged requests filter. MprHash * remedies List of Defense Remedies. HttpRequestCallback requestCallback Request completion callback. MprHash * routeConditions Http route condition functions. MprHash * routeSets Http route sets functions. MprHash * routeTargets Http route target functions. MprHash * routeUpdates Http route update functions. char * secret Random bytes for authentication. struct HttpStage * sendConnector Optimized sendfile connector. struct HttpLimits * serverLimits Server resource limits. MprCache * sessionCache Session state cache. char * software Software name and version. MprHash * stages Possible stages in connection pipelines. int startLevel Start endpoint trace level. int staticLink Target platform is using a static linking. MprHash * statusCodes Http status codes. MprEvent * timer Admin service timer. MprEvent * timestamp Timestamp timer. uint64 totalConnections Total connections accepted. uint64 totalRequests Total requests served. HttpTrace * trace Default tracing configuration. int traceLevel Current request trace level. int uid User Id. struct HttpStage * uploadFilter Upload filter. cchar * user O/S application user name. int userChanged User name changed. struct HttpStage * webSocketFilter WebSocket filter.
Add an option to the options table.
- Parameters:
-
options Option table returned from httpGetOptions. field Field key name. value Value to use for the field.
- API Stability:
- Evolving.
Apply the changed group ID.
- Description:
- Apply configuration changes and actually change the group id.
- Returns:
- Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.
- API Stability:
- Evolving.
Apply the changed user ID.
- Description:
- Apply configuration changes and actually change the user id.
- API Stability:
- Evolving.
Apply the changed user and group ID.
- Description:
- Apply configuration changes and actually change the user and group id.
- Returns:
- Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.
- API Stability:
- Evolving.
Alter the configuration by first quiescing all Http activity.
This waits until there are no open connections and then invokes the configuration callback while blocking further connections. When the callback completes, connections are resumed with the new configuration. This callback is required because configuration of the Http engine must be done when single-threaded- Parameters:
-
proc Function of the type HttpConfigureProc. arg Reference argument to pass to the callback proc. Can be a managed or an unmanaged reference. timeout Timeout in milliseconds to wait. Set to -1 to use the default server inactivity timeout. Set to zero to wait forever.
- API Stability:
- Evolving.
Create a Http service object.
- Description:
- Create a http service object. One http service object should be created per application.
- Parameters:
-
flags Set to zero to initialize bo Initialize the client-side support only.
- Returns:
- The http service object.
- API Stability:
- Stable.
Destroy the Http service.
- Description:
- This routine is invoked as the final stage in shutting down the http service. It stops the request timeout timer and releases all http memory.
- API Stability:
- Internal.
Get the http context object.
- Returns:
- The http context object defined via httpSetContext.
- API Stability:
- Stable.
Get the time as an ISO date string.
- Parameters:
-
sbuf Optional path buffer. If supplied, the modified time of the path is used. If NULL, then the current time is used.
- Returns:
- RFC822 formatted date string.
- API Stability:
- Stable.
Extract a field value from an option string.
- Parameters:
-
options Option string of the form: "field='value' field='value'...". field Field key name. defaultValue Value to use if "field" is not found in options.
- Returns:
- Option value.
- API Stability:
- Evolving.
Get an option value that is itself an object (hash).
- Description:
- This returns an option value that is an instance of MprHash. When deserializing a JSON option string which contains multiple levels, this routine can be used to extract lower option container values.
- Parameters:
-
options Options object to examine. field Property to return.
- Returns:
- An MprHash instance for the given field. This will contain option sub-properties.
- API Stability:
- Evolving.
Convert an options string into an options table.
- Parameters:
-
options Option string of the form: "{field:'value', field:'value'}" This is a sub-set of the JSON syntax. Arrays are not supported.
- Returns:
- Options table.
- API Stability:
- Evolving.
Get the user group.
- Description:
- Get the user and group ID for the process.
- API Stability:
- Internal.
Initialize the Http configuration parser.
- Returns:
- Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.
- API Stability:
- Evolving.
Add an option to the options table.
- Description:
- If the field already exists, the added value is inserted prior to the existing value.
- Parameters:
-
options Option table returned from httpGetOptions. field Field key name. value Value to use for the field.
- API Stability:
- Evolving.
Lookup a listening endpoint.
- Parameters:
-
ip Listening IP address to look for. port Listening port number.
- Returns:
- HttpEndpoint object.
- API Stability:
- Stable.
Lookup a host by name.
- Parameters:
-
name The name of the host to find.
- Returns:
- The corresponding host object.
- API Stability:
- Stable.
Lookup a Http status code.
- Description:
- Lookup the code and return the corresponding text message briefly expaining the status.
- Parameters:
-
status Http status code.
- Returns:
- Text message corresponding to the status code.
- API Stability:
- Stable.
Test a field value from an option string.
- Parameters:
-
options Option string of the form: "field='value' field='value'...". field Field key name. value Test if the field is set to this value. useDefault If true and "field" is not found in options, return true.
- Returns:
- Allocated value string.
- API Stability:
- Evolving.
Parse a platform string.
- Parameters:
-
platform The platform string. Must be of the form: os-arch-profile. os Parsed O/S portion. arch Parsed architecture portion. profile Parsed profile portion.
- Returns:
- Zero if successful, otherwise a negative Mpr error code.
- API Stability:
- Evolving.
Remove an option.
- Description:
- Remove a property from an options hash.
- Parameters:
-
options Options table returned from httpGetOptions. field Property field to remove.
- API Stability:
- Evolving.
Set the http context object.
- Parameters:
-
context New context object.
- API Stability:
- Stable.
Define a default client host.
- Description:
- Define a default host to use for client connections if the URI does not specify a host.
- Parameters:
-
host Host or IP address.
- API Stability:
- Stable.
Define a default client port.
- Description:
- Define a default port to use for client connections if the URI does not define a port.
- Parameters:
-
port Integer port number.
- API Stability:
- Stable.
Set the group account.
- Description:
- Define the group account name under which to run the process.
- Parameters:
-
group Group name. Must be defined in the system group database.
- Returns:
- Zero if successful, otherwise a negative Mpr error code.
- API Stability:
- Evolving.
Set an option.
- Description:
- Set a property in an options hash.
- Parameters:
-
options Options table returned from httpGetOptions. field Property field to set. value Property value to use.
- API Stability:
- Evolving.
Set platform description.
- Description:
- Some web frameworks need to recompile sources before serving requests (ESP). These need access to the http libraries to link with.
- Parameters:
-
platform Platform string of the form: OS-ARCH-PROFILE.
- Returns:
- Zero if the platform string parses, otherwise a negative Mpr error code.
- API Stability:
- Evolving.
Set platform directory location.
- Description:
- Set the platform directory location which contains libraries and headers for the application.
- Parameters:
-
platform Path to the platform directory.
- Returns:
- Zero if successful, otherwise a negative Mpr error code.
- API Stability:
- Evolving.
Define a Http proxy host to use for all client connect requests.
- Description:
- Define a http proxy host to communicate via when accessing the net.
- Parameters:
-
host Proxy host name or IP address. port Proxy host port number.
- API Stability:
- Stable.
Set the software description.
- Parameters:
-
description String describing the Http software. By default, this is set to HTTP_NAME.
- API Stability:
- Stable.
Set the user account.
- Description:
- Define the user account name under which to run the process.
- Parameters:
-
user User name. Must be defined in the system password database.
- Returns:
- Zero if successful, otherwise a negative Mpr error code.
- API Stability:
- Evolving.
Stop all connections owned by the data handle.
- Description:
- This routine may be called by services to destory all connections owned by the service. It calls httpDestroyConnection on all owned connections. This call must only be made on the same dispatcher used by ALL the connections.
- Parameters:
-
data HttpConn data value to search for in current connections.
- API Stability:
- Internal.
HttpAuth
Authorization.
- Description:
- HttpAuth is the foundation authorization object and is used by HttpRoute. It stores the authorization configuration information required to determine if a client request should be permitted access to a given resource.
- See Also:
- HttpAskLogin, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
- API Stability:
- Internal.
- Fields:
-
MprHash * abilities Set of required abilities (all are required). MprHash * allow Clients to allow. char * cipher Encryption cipher. MprHash * deny Clients to deny. int flags Authorization flags. char * loggedInPage Target URI after logging in. char * loggedOutPage Target URI after logging out. char * loginPage Web page for user login for 'form' type. struct HttpAuth * parent Parent auth. MprHash * permittedUsers Set of valid users. char * qop Quality of service. char * realm Realm of access. MprHash * roles Hash of roles. HttpAuthStore * store Authorization password backend (system|file|custom). HttpAuthType * type Authorization protocol type (basic|digest|form|custom). MprHash * userCache Cache of authenticated users. char * username Automatic login username. Password not required if defined. HttpVerifyUser verifyUser Password verification.
Add a role.
If the role already exists, the role is updated- Description:
- This creates the role with given abilities. Ability words can also be other roles.
- Parameters:
-
auth Auth object allocated by httpCreateAuth role Role name to add. abilities Space separated list of abilities.
- Returns:
- Allocated role object.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Add a user.
If the user already exists, the user is updated- Description:
- This creates the user and adds the user to the authentication database.
- Parameters:
-
auth Auth object allocated by httpCreateAuth user User name to add. password User password. The password should not be encrypted. The backend will encrypt as required. abilities Space separated list of abilities.
- Returns:
- The User object allocated or NULL for an error.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Test if a user has the required abilities.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn object. abilities Comma separated list of abilities to test for. If null, then use the required abilities defined for the current request route.
- Returns:
- True if the user has all the required abilities.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Compute all the user abilities for a route using the given auth.
- Parameters:
-
auth Auth object allocated by httpCreateAuth
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Compute the user abilities for a given user in a route using the given auth.
- Parameters:
-
auth Auth object allocated by httpCreateAuth user User object.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Create an authentication object.
- Returns:
- An empty authentiction object.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Add an authorization store for password validation.
The pre-supplied types are "config" and "system"- Description:
- This creates an AuthType object with the defined name and callbacks.
- Parameters:
-
name Unique authorization type name. verifyUser Callback to verify the username and password contained in the HttpConn object passed to the callback.
- Returns:
- Auth store if successful, otherwise zero.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Create an authorization protocol type.
The pre-supplied types are 'basic', 'digest' and 'form'- Description:
- This creates an AuthType with the defined name and callbacks. The basic and digest types are supported by most browsers. The form type is implemented via web form requests over HTTP.
- Parameters:
-
name Unique authorization type name. askLogin Callback to generate a client login response. parse Callback to parse the HTTP authentication headers. setAuth Callback to set the HTTP response authentication headers.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Test if the user is authenticated.
- Parameters:
-
conn HttpConn connection object.
- Returns:
- True if the username and password have been authenticated.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Log the user in.
- Description:
- This will verify the supplied username and password. If the user is successfully logged in, the user identity will be stored in session state for fast authentication on subsequent requests. Note: this does not verify any user abilities.
- Parameters:
-
conn HttpConn connection object. username User name to authenticate. password Password for the user.
- Returns:
- True if the username and password have been authenticated.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Logout the user.
- Parameters:
-
conn HttpConn connection object.
- API Stability:
- Evolving.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Lookup a role by name.
- Parameters:
-
auth HttpAuth object. Stored in HttpConn.rx.route.auth. name Role name.
- Returns:
- Role object.
- API Stability:
- Evolving.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Lookup a user by username.
- Description:
- This looks up a user in the internal user store. This is only used i.
- Parameters:
-
auth HttpAuth object. Stored in HttpConn.rx.route.auth. name Username.
- Returns:
- User object.
- API Stability:
- Evolving.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Remove a role.
- Parameters:
-
auth Auth object allocated by httpCreateAuth role Role name to remove.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Remove a user.
- Parameters:
-
auth Auth object allocated by httpCreateAuth user User name to remove.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Allow access by a client IP IP address.
- Parameters:
-
auth Authorization object allocated by httpCreateAuth ip Client IP address to allow.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Allow access by any valid user.
- Description:
- This configures the basic or digest authentication for the authorization object.
- Parameters:
-
auth Authorization object allocated by httpCreateAuth
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Deny access by a client IP address.
- Parameters:
-
auth Authorization object allocated by httpCreateAuth ip Client IP address to deny. This must be an IP address string.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Define login service URLs for use with "form" authentication.
- Description:
- This defines the login form URL and login/out service URLs. Set arguments to null if they are not required because the application is implementing its own redirection management during login. This API should not be used for web frameworks like ESP or PHP that define their own login/out services.
- Parameters:
-
route Route from which to inherit when creating a route for the login pages and services. loginPage Web page URI for the user to enter username and password. loginService URI to use for the internal login service. To use your own login URI, set to this the empty string. logoutService URI to use to log the user out. To use your won logout URI, set this to the empty string. loggedInPage The client is redirected to this URI once logged in. Use a "referrer:" prefix to the URI to redirect the user to the referring URI before the loginPage. If the referrer cannot be determined, the base URI is utilized. loggedOutPage The client is redirected to this URI once logged in. Use a "referrer:" prefix to the URI to redirect the user to the referring URI before the loginPage. If the referrer cannot be determined, the base URI is utilized.
- API Stability:
- Evolving.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Define the login page for use with authentication.
- Parameters:
-
auth Authorization object allocated by httpCreateAuth uri URI for the login page. Can use "https:///page" to specify the SSL protocol with the current domain.
- API Stability:
- Evolving.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Set the auth allow/deny order.
- Parameters:
-
auth Auth object allocated by httpCreateAuth order Set to HTTP_ALLOW_DENY to run allow checks before deny checks. Set to HTTP_DENY_ALLOW to run deny checks before allow.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Define the set of permitted users.
- Parameters:
-
auth Auth object allocated by httpCreateAuth users Space separated list of acceptable users.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Set the required quality of service for digest authentication.
- Description:
- This configures the basic or digest authentication for the auth object.
- Parameters:
-
auth Auth object allocated by httpCreateAuth qop Quality of service description.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Set the required realm for basic or digest authentication.
- Description:
- This configures the authentication realm. The realm is displayed to the user in the browser login dialog box.
- Parameters:
-
auth Auth object allocated by httpCreateAuth realm Authentication realm.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Set the required abilities for access.
- Parameters:
-
auth Auth object allocated by httpCreateAuth abilities Space separated list of the required abilities. May supply roles in the abilities string.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthType, httpSetAuthUsername
Control whether a session and session cookie will be created for user logins for this authentication route.
- Description:
- By default, a session and response cookie are created when a user is authenticated via httpLogin. This boosts performance because subsequent requests can supply the cookie and bypass authentication for each subseqent request. This API permits the default behavior to be suppressed and thus no cookie or session will be created.
- Parameters:
-
auth Auth object created via httpCreateAuth noSession Set to true to suppress creation of sessions or cookies.
- API Stability:
- Evolving.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Set the authentication password store to use.
- Parameters:
-
auth Auth object allocated by httpCreateAuth store Password store to use. Select from: "app", "config" or "system".
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Control whether sessions and session cookies are created for user logins.
- Description:
- By default, a session and response cookie are created when a user is authenticated via httpLogin. This boosts performance because subsequent requests can supply the cookie and bypass authentication for each subseqent request. This API permits the default behavior to be suppressed and thus no cookie or session will be created.
- Parameters:
-
store AuthStore object created via httpCreateAuthStore noSession Set to true to suppress creation of sessions or cookies.
- API Stability:
- Evolving.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
Set the authentication protocol type to use.
- Parameters:
-
auth Auth object allocated by httpCreateAuth proto Protocol name to use. Select from: 'basic', 'digest', 'form' or 'none'. Set to NULL or 'none' to disable authentication. details Extra protocol details.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthUsername
Set an automatic login username.
- Description:
- If defined, no password is required and the user will be automatically logged in as this username.
- Parameters:
-
auth Auth object allocated by httpCreateAuth username Username to automatically login with.
- API Stability:
- Stable.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType
Set the verify callback for a authentication store.
- Parameters:
-
auth Auth object allocated by httpCreateAuth verifyUser Verification callback.
- API Stability:
- Evolving.
- See Also:
- HttpAskLogin, HttpAuth, HttpAuthType, HttpRole, HttpSetAuth, HttpUser, HttpVerifyUser, HttpVerifyUser, httpAddRole, httpAddUser, httpCanUser, httpComputeAllUserAbilities, httpComputeUserAbilities, httpCreateAuth, httpIsAuthenticated, httpLogin, httpRemoveRole, httpRemoveUser, httpSetAuthAllow, httpSetAuthAnyValidUser, httpSetAuthDeny, httpSetAuthLogin, httpSetAuthOrder, httpSetAuthPermittedUsers, httpSetAuthQop, httpSetAuthRealm, httpSetAuthRequiredAbilities, httpSetAuthType, httpSetAuthUsername
HttpCache
Cache Control.
- Description:
- Configuration is not thread safe and must occur at initialization time when the application is single threaded. If the configuration is modified when the application is multithreaded, all requests must be first be quiesced.
- See Also:
- httpAddCache, httpUpdateCache
- API Stability:
- Internal.
Add caching for response content.
- Description:
- This call configures caching for request responses. Caching may be used for any HTTP method, though typically it is most useful for state-less GET requests. Output data may be uniquely cached for requests with different request parameters (query, post, and route parameters).
When server-side caching is requested and manual-mode is not enabled, the request response will be automatically cached. Subsequent client requests will revalidate the cached content with the server. If the server-side cached content has not expired, a HTTP Not-Modified (304) response will be sent and the client will use its client-side cached content. This results in a very fast transaction with the client as no response data is sent. Server-side caching will cache both the response headers and content.
If manual server-side caching is requested, the response will be automatically cached, but subsequent requests will require the handler to explicitly send cached content by calling httpWriteCached.
If client-side caching is requested, a 'Cache-Control' Http header will be sent to the client with the caching 'max-age' set to the lifespan argument value (converted to seconds). This causes the client to serve client-cached content and to not contact the server at all until the max-age expires. Alternatively, you can use httpSetHeader to explicitly set a 'Cache-Control' header. For your reference, here are some keywords that can be used in the Cache-Control Http header.
'max-age' Maximum time in seconds the resource is considered fresh. 's-maxage' Maximum time in seconds the resource is considered fresh from a shared cache. 'public' marks authenticated responses as cacheable. 'private' shared caches may not store the response. 'no-cache' cache must re-submit request for validation before using cached copy. 'no-store' response may not be stored in a cache. 'must-revalidate' forces clients to revalidate the request with the server. 'proxy-revalidate' similar to must-revalidate except only for proxy caches.
Use client-side caching for static content that will rarely change or for content for which using 'reload' in the browser is an adequate solution to force a refresh. Use manual server-side caching for situations where you need to explicitly control when and how cached data is returned to the client. For most other situations, use server-side caching.
- Parameters:
-
route HttpRoute object. methods List of methods for which caching should be enabled. Set to a comma or space separated list of method names. Method names can be any case. Set to null or '*' for all methods. Example: 'GET, POST'. uris Set of URIs to cache. If the URI is set to '*' all URIs for that action are uniquely cached. If the request has POST data, the URI may include such post data in a sorted query format. E.g. {uri: /buy?item=scarf&quantity=1}. extensions List of document extensions for which caching should be enabled. Set to a comma or space separated list of extensions. Extensions should not have a period prefix. Set to null, '' or '*' for all extensions. Example: 'html, css, js'. The URI may include request parameters in sorted www-urlencoded format. For example: /example.esp?hobby=sailing&name=john. types List of document mime types for which caching should be enabled. Set to a comma or space separated list of types. The mime types are those that correspond to the document extension and NOT the content type defined by the handler serving the document. Set to null or '*' for all types. Example: image/gif, application/x-php. clientLifespan Lifespan of client cache items in milliseconds. If not set to positive integer, the lifespan will default to the route lifespan. serverLifespan Lifespan of server cache items in milliseconds. If not set to positive integer, the lifespan will default to the route lifespan. flags Cache control flags. Select HTTP_CACHE_MANUAL to enable manual mode. In manual mode, cached content will not be automatically sent. Use httpWriteCached in the request handler to write previously cached content.
Select HTTP_CACHE_CLIENT to enable client-side caching. In this mode a 'Cache-Control' Http header will be sent to the client with the caching 'max-age'. WARNING: the client will not send any request for this URI until the max-age timeout has expired.
Select HTTP_CACHE_RESET to first reset existing caching configuration for this route.
Select HTTP_CACHE_SERVER to define the server-side caching mode.
Select HTTP_CACHE_UNIQUE to uniquely cache requests with different request parameters.
- Returns:
- A count of the bytes actually written.
- API Stability:
- Evolving.
- See Also:
- HttpCache, httpUpdateCache
Update the cached content for a URI.
- Parameters:
-
conn HttpConn connection object. uri The request URI for which to update the cache. The URI may contain the request parameters in sorted www-urlencoded format. The URI should include any route prefix. data Data to cache for the URI. If you wish to cache response headers, include those at the start of the data followed by an additional new line. lifespan Lifespan in milliseconds for the cached content.
- API Stability:
- Evolving.
- See Also:
- HttpCache, httpAddCache
Write the cached content for a URI to the client.
- Description:
- This call explicitly writes cached content to the client. It is useful when the caching is configured in manual mode via the HTTP_CACHE_MANUAL flag to httpAddCache
- Parameters:
-
conn HttpConn connection object.
- API Stability:
- Evolving.
- See Also:
- HttpCache, httpAddCache, httpUpdateCache
HttpConn
Http Connections.
- Description:
- The HttpConn object represents a TCP/IP connection to the client. A connection object is created for each socket connection initiated by the client. One HttpConn object may service many Http requests due to HTTP/1.1 keep-alive. Each connection has a request timeout and inactivity timeout. These can be set via httpSetTimeout. The set of APIs that block and yield to the garbage collector are:
- httpFlushQueue(, HTTP_BLOCK)
- httpWriteBlock(, HTTP_BLOCK)
- httpSendBlock(, HTTP_BLOCK)
- httpRead() when in sync mode
- httpReadBlock(, HTTP_BLOCK)
- httpWait()
- httpWriteUploadData
https://www.embedthis.com/appweb/doc/ref/memory.html
- See Also:
- HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
- API Stability:
- Internal.
- Description:
- The Action Handler provides a simple mechanism to bind 'C' callback functions with URIs.
- API Stability:
- Stable.
- Fields:
-
int activeRequest Actively servicing a request. HttpAddress * address Per-client IP address reference. bool async Connection is in async mode (non-blocking). void * authData Authorization state data. bool authRequested Authorization requested based on user credentials. char * authType Type of authentication: set to basic, digest, post or a custom name. bool borrowed Connection has been borrowed. char * boundary File upload boundary. HttpQueue * connectorq Connector write queue. int connError A connection error has occurred. void * context Embedding context (EjsRequest). struct HttpQueue * currentq Current queue being serviced (just for GC). void * data Custom data for request - must be a managed reference. int delay Delay servicing request due to defense strategy. bool destroyed Connection has been destroyed. MprDispatcher * dispatcher Event dispatcher. void * ejs Embedding VM. bool encoded True if the password is MD5(username:realm:password). struct HttpEndpoint * endpoint Endpoint object (if set - indicates server-side). int error A connection and/or request error has occurred. bool errorDoc Processing an error document. char * errorMsg Error message for the last request (if any). bool followRedirects Follow redirects for client requests. void * grid Current request database grid for MVC apps. HttpHeadersCallback headersCallback Callback to fill headers. void * headersCallbackArg Arg to fillHeaders. struct HttpHost * host Host object (if relevant). Http * http Http service object. bool http10 Using legacy HTTP/1.0. HttpPacket * input Header packet. HttpIOCallback ioCallback I/O event callback. char * ip Remote client IP address. int keepAliveCount Count of remaining Keep-Alive requests for this connection. MprTicks lastActivity Last activity on the connection. ssize lastRead Length of new data last read into the input packet. HttpLimits * limits Service limits. Alias to HttpRoute.limits for this request. void * mark Reference for GC marking. bool mustClose Peer requested the connection be closed via "Connection: close". MprDispatcher * newDispatcher New dispatcher if using a worker thread. HttpNotifier notifier Connection Http state change notification callback. MprDispatcher * oldDispatcher Original dispatcher if using a worker thread. bool ownDispatcher Own the dispatcher and should destroy when closing connection. cchar * password Password for client requests (only). void * pool Pool of VMs. int port Remote port. char * protocol HTTP protocol. char * protocols Supported WebSocket protocols (clients). HttpQueue * readq End of the read pipeline. void * record Current request database record for MVC apps. void * reqData Extended request data for use by web frameworks. int retries Client request retries. struct HttpRx * rx Rx object. bool secure Using https. uint64 seqno Unique network sequence number. struct HttpQueue * serviceq List of queues that require service for request pipeline. MprSocket * sock Underlying socket handle. MprTicks started When the request started (ticks). uint64 startMark High resolution tick time of request. int state Connection state. void * staticData Custom data for request - must be an unmanaged reference. bool suppressTrace Do not trace this connection. int timeout Connection timeout indication. HttpTimeoutCallback timeoutCallback Request and inactivity timeout callback. MprEvent * timeoutEvent Connection or request timeout event. int totalRequests Total number of requests serviced. HttpTrace * trace Tracing configuration. struct HttpTx * tx Tx object. bool upgraded Request protocol upgraded. struct HttpUser * user Authorized User record for access checking. cchar * username Supplied user name. bool worker Use worker. MprEvent * workerEvent Event for running connection via a worker thread (used by ejs). HttpQueue * writeq Start of the write pipeline.
Do setup after an I/O event to receive future events.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Emit an error message for a badly formatted request.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn status Http status code. The status code can be ored with the flags HTTP_ABORT to immediately abort the connection or HTTP_CLOSE to close the connection at the completion of the request. fmt Printf style formatted string.
- API Stability:
- Evolving.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Borrow a connection.
- Description:
- Borrow the connection from Http. This effectively gains an exclusive loan of the connection so that it cannot be destroyed while the loan is active. After the loan is complete, you must call return the connection by calling httpReturnConn. Otherwise the connection will not be freed and memory will leak.
The httpBorrowConn routine is used to stabilize a connection while interacting with some outside service. Without this routine, the connection could be destroyed while waiting. Many things can happen while waiting. For example: the client could disconnect or the connection could timeout. These events will still be serviced while the connection is borrowed, but the connection object will not be destroyed.
While borrowed, you must not access the connection using foreign / non-MPR threads. If you need to do this, use mprCreateEvent to schedule an event to run on the connection's event dispatcher. This is essential to serialize access to the connection object. Inside the event callback, you should first check the connection state via HttpConn.state to ensure the request is still active. If the request has completed, the state will be HTTP_STATE_COMPLETE.
Before returning from the event callback, you must call httpReturnConn to end the exclusive loan. This restores normal processing of the connection and enables any required I/O events.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- API Stability:
- Deprecated.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Test if the connection is a client-side connection.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- Returns:
- True if the connection is client-side.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Destroy the request pipeline.
- Description:
- This is called at the conclusion of a request.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Create a connection object.
- Description:
- Most interactions with the Http library are via a connection object. It is used for server-side communications when responding to client requests and it is used to initiate outbound client requests.
- Parameters:
-
endpoint Endpoint object owning the connection. dispatcher Disptacher to use for I/O events on the connection.
- Returns:
- A new connection object.
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Invoke a callback on a connection using a connection sequence number.
- Description:
- This routine invokes a callback on a connection's event dispatcher in a thread-safe manner. This API is the only safe way to invoke APIs on a connection from foreign threads.
- Parameters:
-
seqno HttpStream->seqno identifier extracted when running in an MPR (Appweb) thread. callback Callback function to invoke. The callback will always be invoked if the call is successful so that you can free any allocated resources. If the connection is destroyed before the event is run, the callback will be invoked and the "conn" argument will be set to NULL.
If is important to check the HttpStream.error and HttpStream.state in the callback to ensure the Stream is in an acceptable state for your logic. Typically you want HttpStream.state to be greater than HTTP_STATE_BEGIN and less than HTTP_STATE_COMPLETE. You may also wish to check HttpStream.error incase the connection request has errored.data Data to pass to the callback.
- Returns:
- "Zero" if the connection can be found and the event is scheduled, Otherwise returns MPR_ERR_CANT_FIND.
- API Stability:
- Prototype.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Create the pipeline.
- Description:
- Create the processing pipeline.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Create the receive request pipeline.
- Parameters:
-
conn HttpConn object created via httpCreateConn route Route object controlling how the pipeline is configured for the request.
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Create the transmit request pipeline.
- Parameters:
-
conn HttpConn object created via httpCreateConn route Route object controlling how the pipeline is configured for the request.
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Destroy the connection object.
- Description:
- This call closes the connection socket, destroys the connection dispatcher, disconnects the HttpTx and HttpRx property objects and removes the connection from the HttpHost list of connections. Thereafter, the garbage collector can reclaim all memory. It may be called by client connections at any time from a top-level event running on the connection's dispatcher. Server-side code should not need to explicitly destroy the connection as it will be done automatically via httpIOEvent. This routine should not be called deep within the stack as it will zero the HttpConn.http property to signify the connection is destroyed.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Discard buffered transmit pipeline data.
- Parameters:
-
conn HttpConn object created via httpCreateConn dir Queue direction. Either HTTP_QUEUE_TX or HTTP_QUEUE_RX.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Disconnect the connection's socket.
- Description:
- This call will close the socket and signal a connection error by setting connError. Subsequent use of the connection socket will not be possible. It will also set HttpRx.eof and will finalize the request. Used internally when a connection times out and for abortive errors. This should not be generally used. Rather, httpDestroyConn and httpError should be used in preference.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Enable connection events.
- Description:
- Connection events are automatically disabled upon receipt of an I/O event on a connection. This permits a connection to process the I/O without fear of interruption by another I/O event. At the completion of processing of the I/O request, the connection should be re-enabled via httpEnableConnEvents. This call is made for requests in httpIOEvent. Client-side connections may need to enable connection events if the are running in async mode and encounter a blocking condition.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Enable Multipart-Mime File Upload for this request.
This will define a "Content-Type: multipart/form-data..." header and will create a mime content boundary for use to delimit the various upload content files and fields- Parameters:
-
conn HttpConn connection object.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Error handling for the connection.
- Description:
- The httpError call is used to flag the current request as failed. If httpError is called multiple times, those calls are ignored and only the first call to httpError has effect. This call will discard all data in the output pipeline queues. If some data has already been written to the client the connection will be aborted so the client can get some indication that an error has occurred after the headers have been transmitted.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn status Http status code. The status code can be ored with the flags HTTP_ABORT to immediately abort the connection or HTTP_CLOSE to close the connection at the completion of the request. fmt Printf style formatted string. ... Arguments for fmt.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Find a connection given a connection sequence number.
- Description:
- Find a connection in a thread-safe manner given a connection sequence number. Each connection has a unique 64-bit sequence number that can be used to retrieve a connection object. When using foreign threads, this is preferable as another thread may disconnect and destroy the connection at any time.
A callback may be provided which will be invoked if the connection is found before returning from the API. This should be used if utilizing this API in a foreign thread. httpFindConn will lock the connection while the callback is invoked.
- Parameters:
-
seqno HttpConn connection sequence number retrieved from HttpConn.seqno. proc Callback function to invoke with the signature void (*HttpEventProc)(struct HttpConn *conn, void *data);. data Data to pass to the callback.
- Returns:
- The steam object reference. Returns NULL if the connection is not found. Only use this value if invoked in an MPR thread. While foreign threads using this API may return a connection reference, the connection may be destroyed before the reference can be used.
- API Stability:
- Prototype.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Get the async mode value for the connection.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- Returns:
- True if the connection is in async mode.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Get the preferred chunked size for transfer chunk encoding.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- Returns:
- Chunk size. Returns "zero" if not yet defined.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Get the connection context object.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- Returns:
- The connection context object defined via httpSetConnContext.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Get an IO event mask for events of interest to the connection.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- Returns:
- Mask of MPR_READABLE and MPR_WRITABLE events.
- API Stability:
- Evolving.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Get the connection host object.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- Returns:
- The connection host object defined via httpSetConnHost.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Get the error message associated with the last request.
- Description:
- Error messages may be generated for internal or client side errors.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- Returns:
- A error string. The caller must not free this reference.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Get a URI extension.
- Description:
- If the URI has no extension and the response content filename (HttpTx.filename) has been calculated, it will be tested for an extension.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- Returns:
- The URI extension without the leading period.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Get the count of Keep-Alive requests that will be used for this connection object.
- Description:
- Http Keep-Alive means that the TCP/IP connection is preserved accross multiple requests. This typically means much higher performance and better response. Http Keep-Alive is enabled by default for Http/1.1 (the default). Disable Keep-Alive when talking to old, broken HTTP servers.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- Returns:
- The maximum count of Keep-Alive requests.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Get the count of bytes buffered on the write queue.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- Returns:
- The number of bytes buffered.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Handle I/O on the connection.
- Description:
- This routine responds to I/O described by the supplied eventMask. If any readable data is present, it allocates a standard sized packet and reads data into this and then invokes the httpProtocol engine.
- Parameters:
-
conn HttpConn object created via httpCreateConn eventMask Mask of MPR_READABLE or MPR_WRITABLE events of interest.
- API Stability:
- Evolving.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Respond to a HTTP I/O event.
- Description:
- This routine responds to an I/O event described by the supplied event and then invokes $httpIO.
- Parameters:
-
conn HttpConn object created via httpCreateConn event Event structure.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Emit an error message for limit violations.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn status Http status code. The status code can be ored with the flags HTTP_ABORT to immediately abort the connection or HTTP_CLOSE to close the connection at the completion of the request. fmt Printf style formatted string.
- API Stability:
- Evolving.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Match the HttpHost object that should serve this request.
- Description:
- This selects the appropriate host object for this request. If no suitable host can be found, httpError will be called and conn->error will be set.
- Parameters:
-
conn Connection object created via httpCreateConn hostname Host name to select.
- Returns:
- Host object to serve the request. Also sets conn->host.
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Match the HttpHost object that should serve this request.
- Description:
- This selects the appropriate SSL configuration for the request.
- Parameters:
-
sp Socket object. hostname Host name to select.
- Returns:
- SSL configuration object.
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Signal a memory allocation error.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Inform notifiers of a connection event or state change.
- Description:
- This is an internal API and should not be called by handler or user code.
- Parameters:
-
conn HttpConn object created via httpCreateConn event Event to issue. arg Argument to event.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Prepare a client connection for a new request.
- Parameters:
-
conn HttpConn object created via httpCreateConn keepHeaders If true, keep the headers already defined on the connection object.
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Get more output by invoking the handler's writable callback.
Called by processRunning. Also issues an HTTP_EVENT_WRITABLE for application level notification- Description:
- Get more output by invoking the handler's writable callback. Called by processRunning. Also issues an HTTP_EVENT_WRITABLE for application level notification.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Test if the connection queues need service.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- Returns:
- True if there are queues that require servicing.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Run the handler ready callback.
- Description:
- This will be called when all incoming data for the request has been fully received.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Test if a request has exceeded its timeout limits.
- Description:
- This tests the request against the HttpLimits.requestTimeout and HttpLimits.inactivityTimeout limits. It uses the HttpConn.started and HttpConn.lastActivity time markers.
- Parameters:
-
conn HttpConn object created via httpCreateConn timeout Overriding timeout in milliseconds. If timeout is zero, override default limits and wait forever. If timeout is < 0, use default connection inactivity and duration timeouts. If timeout is > 0, then use this timeout as an additional timeout.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Reset the current security credentials.
- Description:
- Remove any existing security credentials.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Return a borrowed a connection.
- Description:
- Returns a borrowed connection back to the Http engine. This ends the exclusive loan of the connection so that the current request can be completed. It also enables I/O events based on the current state of the connection.
While the connection is borrowed, you must not access the connection using foreign / non-MPR threads. Use mprCreateEvent to schedule an event to run on the connection's event dispatcher. This is essential to serialize access to the connection object.
You should only call this routine (once) after calling httpBorrowConn.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- API Stability:
- Deprecated.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Route the request and select that matching route and handle to process the request.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Schedule a connection timeout event on a connection.
- Description:
- This call schedules an event to run serialized on the connection dispatcher. When run, it will cancels the current request, disconnects the socket and issues an error to the error log. This call is normally invoked by the httpTimer which runs regularly to check for timed out requests.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Test if the connection is a server-side connection.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- Returns:
- True if the connection is client-side.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Service pipeline queues to flow data.
- Description:
- This routine should not be called by handlers, filters or user applications. It should only be called by the http pipeline and support routines.
- Parameters:
-
conn HttpConn object created via httpCreateConn flags Set to HTTP_BLOCK to yield for GC if due.
- Returns:
- True if work was done servicing queues.
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the async mode value for the connection.
- Parameters:
-
conn HttpConn object created via httpCreateConn enable Set to 1 to enable async mode.
- Returns:
- True if the connection is in async mode.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the chunk size for transfer chunked encoding.
When set, a "Transfer-Encoding: Chunked" header will be added to the request, and all write data will be broken into chunks of the requested size- Parameters:
-
conn HttpConn connection object created via httpCreateConn size Requested chunk size.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the connection context object.
- Parameters:
-
conn HttpConn object created via httpCreateConn context New context object. Must be a managed memory reference.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the connection host object.
- Parameters:
-
conn HttpConn object created via httpCreateConn host New context host.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Define a notifier callback for this connection.
- Description:
- The notifier callback will be invoked for state changes and I/O events as Http requests are processed. The supported events are:
- HTTP_EVENT_STATE
The request is changing state. Valid states are: HTTP_STATE_BEGIN, HTTP_STATE_CONNECTED, HTTP_STATE_FIRST, HTTP_STATE_CONTENT, HTTP_STATE_READY, HTTP_STATE_RUNNING, HTTP_STATE_FINALIZED and HTTP_STATE_COMPLETE. A request will always visit all states and the notifier will be invoked for each and every state. This is true even if the request has no content, the HTTP_STATE_CONTENT will still be visited. - HTTP_EVENT_READABLE
There is data available to read - HTTP_EVENT_WRITABLE
The outgoing pipeline can absorb more data. The WRITABLE event is issued when the outgoing pipeline is empties and can absorb more data. - HTTP_EVENT_ERROR
The request has encountered an error - HTTP_EVENT_DESTROY
The connection structure is about to be destoyed - HTTP_EVENT_APP_OPEN
The application layer is now open - HTTP_EVENT_APP_CLOSE
The application layer is now closed
- HTTP_EVENT_STATE
- Parameters:
-
conn HttpConn connection object created via httpCreateConn notifier Notifier function.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the logged in user associated with the connection.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn user User object.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the Http credentials.
- Description:
- Define a user and password to use with Http authentication for sites that require it. This will be used for the next client connection.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn user String user. password Decrypted password string. authType Authentication type. Set to basic or digest. Defaults to nothing.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the "fileHandler" to process the request.
- Description:
- This is used by handlers to relay file requests to the file handler. Should be called from the other handlers start entry point.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn path Optional filename to serve. If null, use HttpTx.filename.
- API Stability:
- Evolving.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the fork callback.
- Parameters:
-
proc Fork callback procedure. arg Argument to supply when the callback is invoked.
- API Stability:
- Evolving.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Define a headers callback.
- Description:
- The headers callback will run before the standard response headers are generated. This gives an opportunity to pre-populate the response headers.
- Parameters:
-
conn HttpConn object created via httpCreateConn fn Callback function to invoke. arg Argument to provide when invoking the headers callback.
- API Stability:
- Evolving.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Define an I/O callback for connections.
- Description:
- The I/O callback is invoked when I/O events are detected on the connection. The default I/O callback is httpIOEvent
- Parameters:
-
conn HttpConn object created via httpCreateConn fn Callback function to invoke.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Control Http Keep-Alive for the connection.
- Description:
- Http Keep-Alive means that the TCP/IP connection is preserved accross multiple requests. This typically means much higher performance and better response. Http Keep-Alive is enabled by default for Http/1.1 (the default). Disable Keep-Alive when talking to old, broken HTTP servers.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn count Count of Keep-Alive transactions to use before closing the connection. Set to zero to disable keep-alive.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the Http protocol variant for this connection.
- Description:
- Set the Http protocol variant to use.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn protocol String representing the protocol variant. Valid values are: "HTTP/1.0", "HTTP/1.1". This parameter must be persistent. Use HTTP/1.1 wherever possible.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the Http retry count.
- Description:
- Define the number of retries before failing a request. It is normative for network errors to require that requests be sometimes retried. The default retries is set to (2).
- Parameters:
-
conn HttpConn object created via httpCreateConn retries Count of retries.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the "Send" connector to process the request.
- Description:
- If the net connection has been selected, but the response content is a file, the pipeline connector can be upgraded to use the "Send" connector.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn path File name to send as a response.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the connection state and invoke notifiers.
- Description:
- The connection states are, in order : HTTP_STATE_BEGIN HTTP_STATE_CONNECTED HTTP_STATE_FIRST HTTP_STATE_PARSED HTTP_STATE_CONTENT HTTP_STATE_READY HTTP_STATE_RUNNING HTTP_STATE_FINALIZED HTTP_STATE_COMPLETE. When httpSetState advances the state it will invoke any registered HttpNotifier. If the state is set to a state beyond the next intermediate state, the HttpNotifier will be invoked for all intervening states. This is true even if the request has no content, the HTTP_STATE_CONTENT will still be visited.
- Parameters:
-
conn HttpConn object created via httpCreateConn state New state to enter.
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Set the Http inactivity timeout.
- Description:
- Define an inactivity timeout after which the Http connection will be closed.
- Parameters:
-
conn HttpConn object created via httpCreateConn requestTimeout Request timeout in msec. This is the total time for the request. Set to -1 to preserve the existing value. inactivityTimeout Inactivity timeout in msec. This is maximum connection idle time. Set to -1 to preserve the existing value.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimestamp, httpStartPipeline
Define a timestamp in the MPR log file.
- Description:
- This routine initiates the writing of a timestamp in the MPR log file.
- Parameters:
-
period Time in milliseconds between timestamps.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpStartPipeline
Setup a wait handler for the connection to wait for desired events.
- Parameters:
-
conn HttpConn object created via httpCreateConn eventMask Mask of events. MPR_READABLE | MPR_WRITABLE.
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Test if a directory listing should be rendered for the request.
- Parameters:
-
conn Connection object.
- Returns:
- True if a directory listing is configured to be rendered for this request.
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Start the pipeline.
This starts the request handler- Parameters:
-
conn HttpConn object created via httpCreateConn
- API Stability:
- Internal.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp
Steal a socket from a connection.
- Description:
- Steal the MprSocket object from a connection so the caller can assume total responsibility for the socket. This routine returns a clone of the connection's socket object with the socket O/S handle. The handle is removed from the connection's socket object. The connection retains ownership of the original socket object. This is done to preserve the HttpConn.sock object but remove the socket handle from its management.
Note: The current request is aborted and queue data is discarded. After calling, the normal Appweb request and inactivity timeouts will not apply to the returned socket object. It is the callers responsibility to call mprCloseSocket on the returned MprSocket when ready.
An alternative to this routine is httpBorrowConn which temporarily loans the connection and secures it from destruction.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- Returns:
- A clone of the connection's MprSocket object with the socket handle.
- API Stability:
- Evolving.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Steal the O/S socket handle from the connection socket object.
- Description:
- This removes the O/S socket handle from active management by the connection. After calling, normal request and inactivity timeouts will apply to the connection, but will not disturb the underlying actual socket handle. It is the callers responsibility to call close() on the socket handle when ready.
- Parameters:
-
conn HttpConn object created via httpCreateConn
- Returns:
- The O/S Socket handle.
- API Stability:
- Prototype.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Verify the server handshake.
- Parameters:
-
conn HttpConn connection object created via httpCreateConn
- Returns:
- True if the handshake is valid.
- API Stability:
- Evolving.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
Write Http upload body data.
- Description:
- Write files and form fields as request body data. This will use transfer chunk encoding. This routine will block until all the buffer is written. This routine may invoke mprYield before it blocks to consent for the garbage collector to turn. Callers must ensure they have retained all required temporary memory before invoking this routine.
- Parameters:
-
conn Http connection object created via httpCreateConn fileData List of string file names to upload. formData List of strings containing "key=value" pairs. The form data should be already www-urlencoded.
- Returns:
- Number of bytes successfully written.
- API Stability:
- Stable.
- See Also:
- HttpConn, HttpEnvCallback, HttpListenCallback, HttpNotifier, HttpQueue, HttpRx, HttpStage, HttpTx, httpAfterEvent, httpClosePipeline, httpCreateConn, httpCreateRxPipeline, httpCreateTxPipeline, httpDestroyConn, httpDiscardData, httpDisconnect, httpEnableUpload, httpError, httpFinalizeConnector, httpGetAsync, httpGetChunkSize, httpGetConnContext, httpGetConnHost, httpGetError, httpGetExt, httpGetKeepAliveCount, httpGetWriteQueueCount, httpIOEvent, httpMatchHost, httpMemoryError, httpPrepClientConn, httpResetCredentials, httpRouteRequest, httpScheduleConnTimeout, httpSetAsync, httpSetChunkSize, httpSetConnContext, httpSetConnHost, httpSetConnNotifier, httpSetCredentials, httpSetFileHandler, httpSetKeepAliveCount, httpSetProtocol, httpSetRetries, httpSetSendConnector, httpSetState, httpSetTimeout, httpSetTimestamp, httpStartPipeline
HttpDir
Directory object for the DirHandler.
- API Stability:
- Internal.
- Fields:
-
Get the HttpDir object for a route.
- API Stability:
- Evolving.
- See Also:
HttpEndpoint
Listening endpoints.
- See Also:
- httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
- API Stability:
- Internal.
- Fields:
-
int async Listening is in async mode (non-blocking). void * context Embedding context. MprDispatcher * dispatcher Event dispatcher. int flags Endpoint control flags. MprList * hosts List of host objects. Http * http Http service object. char * ip Listen IP address. May be null if listening on all interfaces. HttpLimits * limits Alias for first host, default route resource limits. MprMutex * mutex Multithread sync. HttpNotifier notifier Default connection notifier callback. int port Listen port. MprSocket * sock Listening socket. MprSsl * ssl SSL configurations to use.
Accept a new connection.
Accept a new client connection on a new socket. If multithreaded, this will come in on a worker thread dedicated to this connection. This is called from the listen wait handler- Parameters:
-
endpoint The endpoint on which the server was listening. event Mpr event object.
- Returns:
- A HttpConn object representing the new connection.
- API Stability:
- Internal.
- See Also:
- HttpEndpoint, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Add a host to an endpoint.
- Description:
- Add the host to the endpoint's list of hosts. A listening endpoint may have multiple virutal hosts.
- Parameters:
-
endpoint Endpoint to which the host will be added. host HttpHost object to add.
- Returns:
- "Zero" if the host can be added.
- API Stability:
- Internal.
- See Also:
- HttpEndpoint, httpAcceptConn, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Create and configure a new endpoint.
- Description:
- Convenience function to create and configure a new endpoint without using a config file. If no host is supplied, a default host and route are created.
- Parameters:
-
host Optional HttpHost object. home Home directory for configuration files for the endpoint. documents Directory containing the. ip IP address to use for the endpoint. Set to null to listen on all interfaces. port Listening port number to use for the endpoint.
- Returns:
- A configured HttpEndpoint object instance.
- API Stability:
- Internal.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Create an endpoint object.
- Description:
- Creates a listening endpoint on the given IP:PORT. Use httpStartEndpoint to begin listening for client connections.
- Parameters:
-
ip IP address on which to listen. port IP port number. dispatcher Dispatcher to use. Can be null.
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Destroy the endpoint.
- Description:
- This destroys the endpoint created by httpCreateEndpoint. Calling this routine should not normally be necessary as the garbage collector will invoke as required.
- Parameters:
-
endpoint HttpEndpoint object returned from httpCreateEndpoint
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Get the endpoint context object.
- Parameters:
-
endpoint HttpEndpoint object created via httpCreateEndpoint
- Returns:
- The endpoint context object defined via httpSetEndpointContext.
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Get if the endpoint is running in asynchronous mode.
- Parameters:
-
endpoint HttpEndpoint object created via httpCreateEndpoint
- Returns:
- True if the endpoint is in async mode.
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Lookup a host name.
- Description:
- Lookup a host by name in the set of defined hosts for this endpoint.
- Parameters:
-
endpoint HttpEndpoint object created via httpCreateEndpoint name Host name to search for.
- Returns:
- An HttpHost object instance or null if the host cannot be found.
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Secure an endpoint.
- Description:
- Define the SSL parameters for an endpoint. This must be done before starting listening on the endpoint via httpStartEndpoint
- Parameters:
-
endpoint HttpEndpoint object created via httpCreateEndpoint ssl MprSsl object.
- Returns:
- "Zero" if successful, otherwise a negative MPR error code.
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Secure an endpoint by name.
- Description:
- Define the SSL parameters for an endpoint that is selected by name. This must be done before starting listening on the endpoint via httpStartEndpoint
- Parameters:
-
name Endpoint name. The endpoint name is comprised of the IP and port. For example: "127.0.0.1:7777". ssl MprSsl object.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Set the endpoint IP address.
- Description:
- This call defines the endpoint's IP address and port number. If the endpoint has already been started, this will stop and restart the endpoint. Current requests will not be disturbed. This is useful to modify the endpoints address when using dynamically assigned IP addresses.
- Parameters:
-
endpoint HttpEndpoint object created via httpCreateEndpoint ip IP address to use for the endpoint. Set to null to listen on all interfaces. port Listening port number to use for the endpoint.
- Returns:
- "Zero" if successful, otherwise a negative MPR error code.
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Control if the endpoint is running in asynchronous mode.
- Parameters:
-
endpoint HttpEndpoint object created via httpCreateEndpoint enable Set to 1 to enable async mode.
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Set the endpoint context object.
- Parameters:
-
endpoint HttpEndpoint object created via httpCreateEndpoint context New context object.
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Define a notifier callback for this endpoint.
- Description:
- The notifier callback will be invoked as Http requests are processed.
- Parameters:
-
endpoint HttpEndpoint object created via httpCreateEndpoint fn Notifier function.
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpStartEndpoint, httpStopEndpoint
Start listening for client connections on an endpoint.
- Description:
- Opens the endpoint socket and starts listening for connections.
- Parameters:
-
endpoint HttpEndpoint object created via httpCreateEndpoint
- Returns:
- "Zero" if successful, otherwise a negative MPR error code.
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStopEndpoint
Start listening for client connections on all endpoints.
- Description:
- Opens all endpoints and starts listening for connections.
- Returns:
- "Zero" if successful, otherwise a negative MPR error code.
- API Stability:
- Evolving.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
Stop the server listening for client connections.
- Description:
- Closes the socket endpoint. This preserves connections accepted via the listening endpoint.
- Parameters:
-
endpoint HttpEndpoint object created via httpCreateEndpoint
- API Stability:
- Stable.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint
Stop listening for client connections on all endpoints.
- Description:
- Closes all endpoints and stops listening for connections. Does not impact running requests.
- Returns:
- "Zero" if successful, otherwise a negative MPR error code.
- See Also:
- HttpEndpoint, httpAcceptConn, httpAddHostToEndpoint, httpCreateConfiguredEndpoint, httpCreateEndpoint, httpDestroyEndpoint, httpGetEndpointContext, httpIsEndpointAsync, httpLookupHostOnEndpoint, httpSecureEndpoint, httpSecureEndpointByName, httpSetEndpointAddress, httpSetEndpointAsync, httpSetEndpointContext, httpSetEndpointNotifier, httpStartEndpoint, httpStopEndpoint
HttpHost
Host Object.
- Description:
- A Host object represents a logical host. Several logical hosts may share a single HttpEndpoint.
- See Also:
- httpAddRoute, httpCloneHost, httpCreateHost, httpResetRoutes, httpSetHostName, httpSetHostProtocol
- API Stability:
- Internal.
- Fields:
-
HttpUri * canonical Canonical host name (optional canonial public name for redirections). HttpEndpoint * defaultEndpoint Default endpoint for host. HttpRoute * defaultRoute Default route for the host. int flags Host flags. cchar * hostname Host name portion only. cchar * name Full host name with port. void * nameCompiled Compiled name regular expression (not alloced). struct HttpHost * parent Parent host to inherit aliases, dirs, routes. MprCache * responseCache Response content caching store. MprList * routes List of Route defintions. HttpEndpoint * secureEndpoint Secure endpoint for host. MprHash * streams Hash of mime-types to stream record.
Add a route to a host.
- Description:
- Add the route to the host list of routes. During request route matching, routes are processed in order, so it is important to define routes in the order in which you wish to match them.
- Parameters:
-
host HttpHost object. route Route to add.
- Returns:
- "Zero" if the route can be added.
- API Stability:
- Stable.
Clone a host.
- Description:
- The parent host is cloned and a new host returned. The new host inherites the parent's configuration.
- Parameters:
-
parent Parent HttpHost object to clone.
- Returns:
- The new HttpHost object.
- API Stability:
- Stable.
Create the default host.
- Description:
- Create and define a default host. The host is added to the Http service's list of hosts. A default route is created for the host.
- Returns:
- The new HttpHost object.
- API Stability:
- Evolving.
Create a host.
- Description:
- Create a new host object. The host is added to the Http service's list of hosts.
- Returns:
- The new HttpHost object.
- API Stability:
- Stable.
Get the default host defined via httpSetDefaultHost.
- Returns:
- The defaul thost object.
- API Stability:
- Stable.
Determine if input body content should be streamed or buffered for requests with content of a given mime type.
- Description:
- The mime type and URI are used to match the request.
- Parameters:
-
host Host to modify. mime Mime type to configure. uri URI prefix to match with.
- Returns:
- True if input should be streamed. False if it should be buffered.
- API Stability:
- Evolving.
Reset the list of routes for the host.
- Parameters:
-
host HttpHost object.
- API Stability:
- Stable.
Set the default host for all servers.
- Parameters:
-
host Host to define as the default host.
- API Stability:
- Stable.
Set the host canonical name.
- Description:
- The host canonical name is the public perferred name to use for the server. This is used when redirecting client requests for directories.
- Parameters:
-
host HttpHost object. name Host canonical name to use.
- Returns:
- Zero if successful. May return a negative MPR error code if the name is a regular expression and cannot be compiled.
- API Stability:
- Stable.
Set the default endpoint for a host.
- Description:
- The host may have a default endpoint that is used when doing redirections to http.
- Parameters:
-
host Host to examine. endpoint Secure endpoint to use as the default.
- API Stability:
- Stable.
Set the default route for a host.
- Description:
- The host has a default route which holds default configuration. Typically the default route is not directly used when routing URIs. Rather other routes inherit from the default route and are used to respond to client requests.
- Parameters:
-
host Host to examine. route Route to define as the default.
- API Stability:
- Stable.
Set the host name.
- Description:
- The host name is used when matching client requests to virtual hosts using the Http request Host header. If the host name starts with "*", it will match names that contain the name. If the host name ends with "*", it will match names that start with the name. If the host name begins and ends with a "/", the name is assumed to be a regular expression. Regular expressions may match multiple host names by using the "|" character to separate names.
- Parameters:
-
host HttpHost object. name Host name to use.
- Returns:
- Zero if successful. May return a negative MPR error code if the name is a regular expression and cannot be compiled.
- API Stability:
- Stable.
Set the host HTTP protocol version.
- Description:
- Set the host protocol version to either HTTP/1.0 or HTTP/1.1.
- Parameters:
-
host HttpHost object. protocol Set to either HTTP/1.0 or HTTP/1.1.
- API Stability:
- Stable.
- See Also:
- HttpHost, httpAddRoute, httpCloneHost, httpCreateHost, httpResetRoutes, httpSetHostName
Set the server root for a host.
- Description:
- The server root is used as the default directory to locate configuration files for the host.
- Parameters:
-
host HttpHost object. root Directory path for the host server root.
- API Stability:
- Stable.
Set the default secure endpoint for a host.
- Description:
- The host may have a default secure endpoint that is used when doing redirections to https.
- Parameters:
-
host Host to examine. endpoint Secure endpoint to use as the default.
- API Stability:
- Stable.
Control if input body content should be streamed or buffered for requests with content of a given mime type.
- Parameters:
-
host Host to modify. mime Mime type to configure. uri URI prefix to match. streaming Set to true to enable streaming for this mime type.
- API Stability:
- Evolving.
HttpLimits
Http limits.
- See Also:
- httpCreateLimits, httpEaseLimits, httpInitLimits
- API Stability:
- Internal.
- Fields:
-
ssize bufferSize Maximum buffering by any pipeline stage. ssize cacheItemSize Maximum size of a cachable item. ssize chunkSize Maximum chunk size for transfer encoding. int clientMax Maximum number of unique clients IP addresses. int connectionsMax Maximum number of simultaneous client connections. int headerMax Maximum number of header lines. ssize headerSize Maximum size of the total header. MprTicks inactivityTimeout Timeout for keep-alive and idle requests (msec). int keepAliveMax Maximum number of Keep-Alive requests to perform per socket. int processMax Maximum number of processes (CGI). int requestMax Maximum number of simultaneous concurrent requests. MprTicks requestParseTimeout Time a request can take to parse the request headers (msec). int requestsPerClientMax Maximum number of requests per client IP. MprTicks requestTimeout Time a request can take (msec). MprOff rxBodySize Maximum size of receive body data. MprOff rxFormSize Maximum size of form data. int sessionMax Maximum number of sessions. MprTicks sessionTimeout Time a session can persist (msec). MprOff txBodySize Maximum size of transmission body content. MprOff uploadSize Maximum size of an uploaded file. ssize uriSize Maximum size of a uri. ssize webSocketsFrameSize Maximum size of sent WebSocket frames. Incoming frames have no limit except message size. int webSocketsMax Maximum number of WebSockets. ssize webSocketsMessageSize Maximum total size of a WebSocket message including all frames. ssize webSocketsPacketSize Maximum size of a WebSocket packet exchanged with the user callback. MprTicks webSocketsPing Time between pings.
Create a new limits object.
- Description:
- Create and initialize a new limits object with default values.
- Parameters:
-
serverSide Set to "true" for server side limits. Set to "false" for client side default limits.
- Returns:
- The allocated limits object.
- API Stability:
- Stable.
- See Also:
- HttpLimits, httpEaseLimits, httpInitLimits
Ease the limits.
- Description:
- This increases the receive body size, transmission body size and upload size to the maximum sizes supported by the system. Client side limits are eased by default.
- Parameters:
-
limits Limits object. This can be either HttpHost.limits HttpConn.limits or HttpEndpoint.limits.
- API Stability:
- Stable.
- See Also:
- HttpLimits, httpCreateLimits, httpInitLimits
Initialize a limits object with default values.
- Parameters:
-
limits Limits object to modify. serverSide Set to "true" for server side limits. Set to "false" for client side default limits.
- API Stability:
- Stable.
- See Also:
- HttpLimits, httpCreateLimits, httpEaseLimits
HttpMonitor
Monitor control structure.
- API Stability:
- Internal.
- Fields:
-
int counterIndex Counter item index to monitor. cchar * counterName Name of counter to monitor. MprList * defenses List of defensive measures. int expr Expression. Set to '<' or '>'. uint64 limit Comparison limit value. MprTicks period Frequence of comparison. MprEvent * timer Monitor timer.
Add a counter to be monitored.
- Parameters:
-
name Name of the counter.
- Returns:
- The counter index in HttpAddress.counters[] to use.
- API Stability:
- Evolving.
- See Also:
Add a defense.
- Parameters:
-
name Name of defensive policy. remedy Remedy action to invoke. Standard remedies include: ban, cmd, delay, email, http and log. This can be null and the remedy can be specified via REMEDY=remedy in the args. args Arguments to pass to the remedy. These may include ${tokens}.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- API Stability:
- Evolving.
- See Also:
Add a defense using JSON arguments.
- Parameters:
-
name Name of defensive policy. remedy Remedy action to invoke. Standard remedies include: ban, cmd, delay, email, http and log. This can be null and the remedy can be specified via REMEDY=remedy in the args. jargs Arguments to pass to the remedy as a JSON object. These may include ${tokens}.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- API Stability:
- Evolving.
- See Also:
Add a monitor.
- Parameters:
-
counter Name of counter to monitor. Some of the standard counter names are: ActiveClients, ActiveConnections, ActiveRequests, ActiveProcesses, BadRequestErrors, LimitErrors, Memory, NotFoundErrors, NetworkIO, Requests, SSLErrors, TotalErrors. expr Expression operator. Select from "<" or ">". limit Limit value to compare with the counter value. period Time period over which to determine the counter value. defenses List of defenses to invoke if the counter exceeds the limit value over the designated period.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- API Stability:
- Evolving.
- See Also:
Add a remedy.
- Parameters:
-
name Name of the remedy. remedy Remedy callback function.
- Returns:
- Zero if successful, otherwise a negative MPR error code.
- API Stability:
- Evolving.
- See Also:
Ban a client IP from service.
- Parameters:
-
ip Client IP address to ban. period Period in milliseconds to ban the client. status If non-zero, then return a HTTP response to the client with this HTTP status. msg If non-null, then return a HTTP response with this message. If both status and msg are zero and null respectively, then do not send a response to the client, rather immediately close the connection.
- API Stability:
- Evolving.
- See Also:
Print the monitor counters to the error log.
- API Stability:
- Evolving.
- See Also:
Monitor an event and validate against defined limits and monitored resources.
- Description:
- The Http library supports a suite of resource limits that restrict the impact of a request on the system. This call validates a processing event for the current request against the server's endpoint limits.
- Parameters:
-
conn Connection object. counter The counter to adjust. conn HttpConn connection object. adj Value to adjust the counter by. May be positive or negative.
- Returns:
- Monitor value after applying the adjustment.
- API Stability:
- Evolving.
- See Also:
HttpPacket
Packet object.
- Description:
- The request/response pipeline sends data and control information in HttpPacket objects. The output stream typically consists of a HEADER packet followed by zero or more data packets and terminated by an END packet. If the request has input data, the input stream consists of one or more data packets followed by an END packet.
Packets contain data and optional prefix or suffix headers. Packets can be split, joined, filled, or emptied. The pipeline stages will fill or transform packet data as required.
- See Also:
- HttpFillProc, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
- API Stability:
- Internal.
- Fields:
-
MprBuf * content Chunk content. MprOff epos Data position in entity (file). MprOff esize Data size in entity (file). HttpFillProc fill Callback to fill packet with data. uint flags Packet flags. uint last Last packet in a message. struct HttpPacket * next Next packet in chain. MprBuf * prefix Prefix message to be emitted before the content. uint type Packet type extension.
Adjust the packet end position.
- Description:
- This adjusts the packet content by the given size. The packet length (size) is decremented by the requested amount. If the packet describes entity data, the Packet.esize field is reduced by the requested size amount. If the packet has actual data buffered in Packet.content, the content buffer end position is reduced by by the size amount.
- Parameters:
-
packet Packet to modify. size Size to adjust packet end position.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Adjust the packet starting position.
- Description:
- This adjusts the packet content by the given size. The packet position is incremented by start and the packet length (size) is decremented. If the packet describes entity data, the given size amount to the Packet.epos and decrements the Packet.esize fields. If the packet has actual data buffered in Packet.content, the content buffer start is incremeneted by the size amount.
- Parameters:
-
packet Packet to modify. size Size to add to the packet current position.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Clone a packet.
- Parameters:
-
orig Original packet to clone.
- Returns:
- A new packet equivalent to the original.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Create a data packet.
- Description:
- Create a packet and set the HTTP_PACKET_DATA flag Data packets convey data through the response pipeline.
- Parameters:
-
size Size of the package data storage.
- Returns:
- HttpPacket object.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Create an end-of-stream packet.
- Description:
- Create an end-of-stream packet and set the HTTP_PACKET_END flag. The end pack signifies the end of data. It is used on both incoming and outgoing streams through the request/response pipeline.
- Returns:
- HttpPacket object.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Create an entity data packet.
- Description:
- Create an entity packet and set the HTTP_PACKET_DATA flag. Entity packets describe the resource (entity) to send to the client and provide a HttpFillProc procedure used to fill packets with data from the entity.
- Parameters:
-
pos Position within the entity for packet data. size Size of the entity data. fill HttpFillProc callback to supply the entity data.
- Returns:
- HttpPacket object.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Create a response header packet.
- Description:
- Create a response header packet and set the HTTP_PACKET_HEADER flag. A header packet is used by the pipeline to hold the response headers.
- Returns:
- HttpPacket object.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Create a data packet.
- Description:
- Create a packet of the required size.
- Parameters:
-
size Size of the package data storage.
- Returns:
- HttpPacket object.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Get the packet data contents.
- Description:
- Get the packet content reference. This is an MprBuf object.
- Parameters:
-
packet Packet to examine.
- Returns:
- MprBuf reference or zero if there are not contents.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Get the length of the packet data contents.
- Description:
- Get the content length of a packet. This does not include the prefix or virtual data length
just the pure buffered data contents.
- Parameters:
-
packet Packet to examine.
- Returns:
- Count of bytes contained by the packet.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Get the start of the packet data contents.
- Parameters:
-
packet Packet to examine.
- Returns:
- A reference to the start of the packet contents.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Get the packet data contents as a string.
- Description:
- Get the packet content reference. The packet contents will be null terminated.
- Parameters:
-
packet Packet to examine.
- Returns:
- A reference to the start of the packet contents.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Test if the packet is the last in a logical message.
- Description:
- Useful for WebSockets to test if the packet is the last frame in a message.
- Parameters:
-
packet Packet to examine.
- Returns:
- True if the packet is the last in a message.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Join two packets.
- Description:
- Join the contents of one packet to another by copying the data from the other packet into the first packet.
- Parameters:
-
packet Destination packet. other Other packet to copy data from.
- Returns:
- "Zero" if successful, otherwise a negative Mpr error code.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpSplitPacket
Split a data packet.
- Description:
- Split a data packet at the specified offset. Packets may need to be split so that downstream stages can digest their contents. If a packet is too large for the queue maximum size, it should be split. When the packet is split, a new packet is created containing the data after the offset. Any suffix headers are moved to the new packet. NOTE: when splitting packets, the HttpPacket.content reference may be modified.
- Parameters:
-
packet Packet to split. offset Route in the original packet at which to split.
- Returns:
- New HttpPacket object containing the data after the offset. No need to free, unless you have a very long running request. Otherwise the packet memory will be released automatically when the request completes.
- API Stability:
- Stable.
- See Also:
- HttpFillProc, HttpPacket, HttpQueue, httpAdjustPacketEnd, httpAdjustPacketStart, httpClonePacket, httpCreateDataPacket, httpCreateEndPacket, httpCreateEntityPacket, httpCreateHeaderPacket, httpCreatePacket, httpGetPacket, httpGetPacketLength, httpIsLastPacket, httpJoinPacket, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext
HttpQueue
Queue object.
- Description:
- The request pipeline consists of a full-duplex pipeline of stages. Each stage has two queues, one for outgoing data and one for incoming. A HttpQueue object manages the data flow for a request stage and has the ability to queue and process data, manage flow control, and schedule packets for service.
Queue's provide open, close, put, and service methods. These methods manage and respond to incoming packets. A queue can respond immediately to an incoming packet by processing or dispatching a packet in its put() method. Alternatively, the queue can defer processing by queueing the packet on it's service queue and then waiting for it's service() method to be invoked.
If a queue does not define a put() method, the default put() method will be used which queues data onto the service queue. The default incoming put() method joins incoming packets into a single packet on the service queue.
Data flows downstream from one queue to the next queue linked via the nextQ field.
- See Also:
- HttpConn, HttpPacket, httpDisableQueue, httpDiscardQueueData, httpEnableQueue, httpFlushQueue, httpGetQueueRoom, httpIsEof, httpIsPacketTooBig, httpIsQueueEmpty, httpIsQueueSuspended, httpJoinPacketForService, httpJoinPackets, httpPutBackPacket, httpPutForService, httpPutPacket, httpPutPacketToNext, httpRemoveQueue, httpResizePacket, httpResumeQueue, httpScheduleQueue, httpServiceQueue, httpSetQueueLimits, httpSuspendQueue, httpWillNextQueueAcceptPacket, httpWillNextQueueAcceptSize, httpWrite, httpWriteBlock, httpWriteString
- API Stability:
- Internal.
- Fields:
-
HttpQueueClose close Close the queue. struct HttpConn * conn Connection owning this queue. ssize count Bytes in queue (Does not include virt packet data). int direction Flow direction. HttpPacket * first First packet in queue (singly linked). int flags Queue flags. MprOff ioCount Count of bytes in iovec including file I/O. int ioFile Sending a file. int ioIndex Next index into iovec. MprOff ioPos Position in file for sendfile. HttpPacket * last Last packet in queue (tail pointer). ssize low Low water mark for flow control. ssize max Advisory maxiumum queue size. cchar * name Queue name for debugging. struct HttpQueue * nextQ Downstream queue for next stage. HttpQueueOpen open Open the queue. ssize packetSize Maximum acceptable packet size. struct HttpQueue * pair Queue for the same stage in the opposite direction. struct HttpQueue * prevQ Upstream queue for prior stage. HttpQueueData put Callback to receive a packet. void * queueData Stage instance data - must be a managed reference. struct HttpQueue * scheduleNext Next linkage when queue is on the service queue. struct HttpQueue * schedulePrev Previous linkage when queue is on the service queue. HttpQueueService service Service the queue. int servicing Currently being serviced. struct HttpStage * stage Stage owning this queue. HttpQueueStart start Start the queue. void * staticData Stage instance data - must be an unmanaged reference.