Appweb Native API

Components

MaAlias Aliases.
MaAuth Authorization The MaAuth struct is the foundation authorization object and is used as base class by MaDirectory and MaLocation.
MaConfigState Current config parse state.
MaConn Http Connections.
MaDir Directory Control.
MaFilter Filter Stages.
MaGroup Group Authorization.
MaHost Host Object A Host object represents a single listening HTTP connection endpoint.
MaHostAddress Host Address Mapping.
MaHttp Http Service.
MaLimits Server limits.
MaListen Listen endpoint.
MaLocation Location Control.
MaMimeType Mime Type hash table entry (the URL extension is the key).
MaRange Content range structure.
MaRequest Http Requests.
MaServer Http Server Control An application may have any number of HTTP servers, each managed by an instance of the Server class.
MaUploadFile Upload File Each uploaded file has an MaUploadedFile entry.
MaUser User Authorization File based authorization backend.

Functions

MaHttp*maCreateHttp(MprCtx ctx)
 Create the MaHttp object.
intmaSetHttpGroup(MaHttp *http, cchar *group)
 Set the Http Group.
intmaSetHttpUser(MaHttp *http, cchar *user)
 Set the Http User.
intmaStartHttp(MaHttp *http)
 Start Http services.
intmaStopHttp(MaHttp *http)
 Stop Http services.
voidmaAddVars(MprHashTable *table, cchar *buf, int len)
 Add query and post form variables.
intmaCompareFormVar(MaConn *conn, cchar *var, cchar *value)
 Compare a form variable.
cchar*maGetCookies(MaConn *conn)
 Get the cookies.
cchar*maGetFormVar(MaConn *conn, cchar *var, cchar *defaultValue)
 Get a form variable.
intmaGetIntFormVar(MaConn *conn, cchar *var, int defaultValue)
 Get a form variable as an integer.
cchar*maGetQueryString(MaConn *conn)
 Get the request query string.
voidmaSetFormVar(MaConn *conn, cchar *var, cchar *value)
 Set a form variable value.
voidmaSetIntFormVar(MaConn *conn, cchar *var, int value)
 Set a form variable value.
intmaTestFormVar(MaConn *conn, cchar *var)
 Test if a form variable is defined.
intmaConfigureServer(MprCtx ctx, MaHttp *http, MaServer *server, cchar *configFile, cchar *ipAddr, int port, cchar *documentRoot)
 Configure a web server.
MaServer*maCreateServer(MaHttp *http, cchar *name, cchar *root, cchar *ipAddr, int port)
 Create a MaServer object.
MaHttp*maCreateWebServer(cchar *configFile)
 Create a web server.
voidmaLoadStaticModules(MaHttp *http)
 Load static modules.
intmaRunSimpleWebServer(cchar *ipAddress, int port, cchar *docRoot)
 Create and run a simple web server listening on a single IP address.
intmaRunWebServer(cchar *configFile)
 Create and run a web server based on a configuration file.
intmaServiceWebServer(MaHttp *http)
 Service a web server.

Typedefs

Defines

#define_h_APPWEB_MONITOR   1
 appwebMonitor.h - Monitor Header.
#define_h_HTTP_TUNE   1
 httpTune.h - Tunable parameters for the Embedthis Http Web Server.
#defineMA_BUFSIZE   (4 * 1024)
 Default I/O buffer size.
#defineMA_CGI_PERIOD   20
 CGI poll period (only for windows).
#defineMA_CGI_TIMEOUT   4000
 Time to wait to reap exit status.
#defineMA_CHUNK_DATA   2
 Start of chunk data.
#defineMA_CHUNK_EOF   3
 End of last chunk.
#defineMA_CHUNK_START   1
 Start of a new chunk.
#defineMA_CONN_CASE_INSENSITIVE   0x2
 System case-insensitive for file matches.
#defineMA_CONN_CLEAN_MASK   0x1
 Mask to clear flags after a request completes.
#defineMA_CONN_CLOSE   0x1
 Connection needs to be closed.
#defineMA_CONN_PIPE_CREATED   0x4
 Request pipeline created.
#defineMA_DEFAULT_MAX_THREADS   10
 Default number of threads.
#defineMA_KEEP_TIMEOUT   60000
 Keep connection alive timeout.
#defineMA_LOC_APP   0x2
 Location defines an application.
#defineMA_LOC_APP_DIR   0x4
 Location defines a directory of applications.
#defineMA_LOC_AUTO_SESSION   0x8
 Auto create sessions in this location.
#defineMA_LOC_BROWSER   0x10
 Send errors back to the browser for this location.
#defineMA_LOC_PUT_DELETE   0x20
 Support PUT|DELETE.
#defineMA_MAX_ACCESS_LOG   (20971520)
 Access file size (20 MB).
#defineMA_MAX_IOVEC   16
 Number of fragments in a single socket write.
#defineMA_MAX_KEEP_ALIVE   100
 Default requests per TCP conn.
#defineMA_MAX_PASS   64
 Size of password.
#defineMA_MAX_QUEUE   2
 Number of queue types.
#defineMA_MAX_SECRET   32
 Number of random bytes to use.
#defineMA_MAX_STAGE_BUFFER   (4 * 1024)
 Max buffer for any stage.
#defineMA_MIN_PACKET   512
 Minimum packet size.
#defineMA_PACKET_DATA   0x4
 Packet contains actual content data.
#defineMA_PACKET_END   0x8
 End of stream packet.
#defineMA_PACKET_HEADER   0x1
 Packet contains HTTP headers.
#defineMA_PACKET_RANGE   0x2
 Packet is a range boundary packet.
#defineMA_QUEUE_ALL   0x8
 Queue has all the data there is and will be.
#defineMA_QUEUE_DISABLED   0x2
 Queue's service routine is disabled.
#defineMA_QUEUE_EOF   0x40
 Queue at end of data.
#defineMA_QUEUE_FULL   0x4
 Queue is full.
#defineMA_QUEUE_OPEN   0x1
 Queue's open routine has been called.
#defineMA_QUEUE_RECEIVE   1
 Receive (read from client) queue.
#defineMA_QUEUE_SEND   0
 Send (transmit to client) queue.
#defineMA_QUEUE_SERVICED   0x10
 Queue has been serviced at least once.
#defineMA_QUEUE_STARTED   0x20
 Queue's start routine has been called.
#defineMA_REQ_CHUNKED   0x4
 Content is chunk encoded.
#defineMA_REQ_CREATE_ENV   0x1
 Must create env for this request.
#defineMA_REQ_DELETE   0x1
 DELETE method.
#defineMA_REQ_GET   0x2
 GET method.
#defineMA_REQ_HEAD   0x4
 HEAD method.
#defineMA_REQ_IF_MODIFIED   0x2
 If-[un]modified-since supplied.
#defineMA_REQ_MASK   0x7F
 Method mask.
#defineMA_REQ_MEM   ((1 * 1024 * 1024) - MPR_HEAP_OVERHEAD)
 Initial virt memory arena size.
#defineMA_REQ_MEM   1
 Initial virt memory arena size.
#defineMA_REQ_OPTIONS   0x8
 OPTIONS method.
#defineMA_REQ_POST   0x10
 Post method.
#defineMA_REQ_PUT   0x20
 PUT method.
#defineMA_REQ_TRACE   0x40
 TRACE method.
#defineMA_REQ_UPLOADING   0x8
 Content contains upload files.
#defineMA_RESP_DONT_CACHE   0x1
 Add no-cache to the response.
#defineMA_RESP_DONT_FINISH   0x2
 Don't auto finish the request.
#defineMA_RESP_HEADERS_CREATED   0x8
 Response headers have been created.
#defineMA_RESP_NO_BODY   0x4
 No respose body, only return headers to client.
#defineMA_STAGE_ALL   MA_REQ_MASK
 Mask for all methods.
#defineMA_STAGE_AUTO_DIR   0x100000
 Want auto directory redirection.
#defineMA_STAGE_CONNECTOR   0x1000
 Stage is a connector.
#defineMA_STAGE_DELETE   MA_REQ_DELETE
 Support DELETE requests.
#defineMA_STAGE_ENV_VARS   0x20000
 Create CGI style environment variables table.
#defineMA_STAGE_FILTER   0x4000
 Stage is a filter.
#defineMA_STAGE_GET   MA_REQ_GET
 Support GET requests.
#defineMA_STAGE_HANDLER   0x2000
 Stage is a handler.
#defineMA_STAGE_HEAD   MA_REQ_HEAD
 Support HEAD requests.
#defineMA_STAGE_MISSING_EXT   0x400000
 Handle URIs with missing extensions.
#defineMA_STAGE_MODULE   0x8000
 Stage is a filter.
#defineMA_STAGE_OPTIONS   MA_REQ_OPTIONS
 Support OPTIONS requests.
#defineMA_STAGE_PATH_INFO   0x80000
 Always do path info processing.
#defineMA_STAGE_POST   MA_REQ_POST
 Support POST requests.
#defineMA_STAGE_PUT   MA_REQ_PUT
 Support PUT requests.
#defineMA_STAGE_TRACE   MA_REQ_TRACE
 Support TRACE requests.
#defineMA_STAGE_UNLOADED   0x800000
 Stage library has been unloaded.
#defineMA_STAGE_VARS   0x10000
 Create query and form variables table.
#defineMA_STAGE_VERIFY_ENTITY   0x200000
 Verify the request entity exists.
#defineMA_STAGE_VIRTUAL   0x40000
 Handler serves virtual resources not the physical file system.
#defineMA_TIMER_PERIOD   1000
 Timer checks ever 1 second.

MaAlias

MaAlias

Aliases.

API Stability:
Evolving.
See Also:
Fields:
char *filename Alias to a physical path name.
char *prefix Original URI prefix.
intprefixLen Prefix length.
char *uri Redirect to a uri.

MaAuth

MaAuth

Authorization The MaAuth struct is the foundation authorization object and is used as base class by MaDirectory and MaLocation.

API Stability:
Evolving.
See Also:
Fields:

MaConfigState

MaConfigState

Current config parse state.

API Stability:
Evolving.
See Also:

MaConn

MaConn

Http Connections.

Description:
The MaConn object represents a TCP/IP connection to the client. A connection object is created for each socket connection initiated by the client. One MaConn object may service many Http requests due to HTTP/1.1 keep-alive.
API Stability:
Evolving.
See Also:
MaQueue, MaRequest, MaResponse, MaStage
Fields:
MaHostAddress *address Host address structure for this connection.
MprHeap *arena Connection memory arena.
intcanProceed State machine should continue to process the request.
intconnectionFailed Request failed and connection protocol is compromised.
void *data Connection data for stages.
intdedicated Dedicate the current thread to the request.
intdisconnected Connection is disconnected. Abandon current request.
inteventMask Desired events anded with this mask.
MprTimeexpire When the connection should expire.
intflags Connection flags.
MaHost *host Owning host for this request.
MaHttp *http Http handle.
MaPacket *input Header packet.
intkeepAliveCount Count of remaining keep alive requests for this connection.
MprMutex *mutex Optional multi-thread sync.
MaHost *originalHost Owning host for this connection. May be changed by Host header.
intprotocol HTTP protocol version 0 == HTTP/1.0, 1 == HTTP/1.1.
char *remoteIpAddr Remote client IP address (REMOTE_ADDR).
intremotePort Remote client IP port number.
struct MaRequest *request Request object.
intrequestFailed Request failed. Abbreviate request processing.
struct MaResponse *response Response object.
intseqno Unique connection sequence number.
struct MaQueueserviceq List of queues that require service for request pipeline.
MprSocket *sock Underlying socket handle.
MprTimestarted When the connection started.
intstate Connection state.
MprTimetime Cached current time.
inttimeout Timeout period in msec.
inttrace Current request should be traced.

MaDir

MaDir

Directory Control.

API Stability:
Evolving.
See Also:

MaFilter

MaFilter

Filter Stages.

API Stability:
Evolving.
See Also:
Fields:

MaGroup

MaGroup

Group Authorization.

API Stability:
Evolving.
See Also:
Fields:

MaHost

MaHost

Host Object A Host object represents a single listening HTTP connection endpoint.

API Stability:
Evolving.
See Also:

MaHostAddress

MaHostAddress

Host Address Mapping.

API Stability:
Evolving.
See Also:
Fields:
intflags Mapping flags.
char *ipAddr IP Address for this endpoint.
intport Port for this endpoint.
MprList *vhosts Vhosts using this address.

MaHttp

MaHttp

Http Service.

Description:
There is one instance of MaHttp per application. It manages a list of HTTP servers running in the application.
API Stability:
Evolving.
See Also:
maCreateHttp, maStartHttp, maStopHttp
Fields:
struct MaStage *authFilter Authorization filter (digest and basic).
struct MaStage *cgiHandler CGI handler.
struct MaStage *chunkFilter Chunked transfer encoding filter.
struct MaServer *defaultServer Default web server object.
struct MaStage *dirHandler Directory listing handler.
struct MaStage *egiHandler Embedded Gateway Interface (EGI) handler.
struct MaStage *ejsHandler Ejscript Web Framework handler.
struct MaStage *fileHandler Static file handler.
intgid Group Id.
char *groupname Http server group name.
MaLimitslimits Security and resource limits.
MaListenCallbacklistenCallback Invoked when creating listeners.
MprMutex *mutex Multi-thread sync.
struct MaStage *netConnector Network connector.
struct MaStage *passHandler Pass through handler.
struct MaStage *phpHandler PHP handler.
struct MaStage *rangeFilter Ranged requests filter.
struct MaStage *sendConnector Send file connector.
MprList *servers List of web servers objects.
MprHashTable *stages Hash table of stages.
intuid User Id.
char *username Http server user name.
MaHttp * maCreateHttp (MprCtx ctx)

Create the MaHttp object.

Description:
The Appweb library uses a singleton MaHttp object to manage multiple embedded web servers.
Parameters:
ctxAny memory context object returned by mprAlloc.
Returns:
A MaHttp object. Use mprFree to close and release.
See Also:
MaHttp, maStartHttp, maStopHttp
int maSetHttpGroup (MaHttp *http, cchar *group)

Set the Http Group.

Description:
Define the group name under which to run the Appweb service.
Parameters:
httpMaHttp object created via maCreateHttp.
groupGroup name. Must be defined in the system group file.
Returns:
Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.
See Also:
MaHttp, maCreateHttp, maStartHttp, maStopHttp
int maSetHttpUser (MaHttp *http, cchar *user)

Set the Http User.

Description:
Define the user name under which to run the Appweb service.
Parameters:
httpMaHttp object created via maCreateHttp.
userUser name. Must be defined in the system password file.
Returns:
Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.
See Also:
MaHttp, maCreateHttp, maStartHttp, maStopHttp
int maStartHttp (MaHttp *http)

Start Http services.

Description:
This starts listening for requests on all configured servers.
Parameters:
httpMaHttp object created via maCreateHttp.
Returns:
Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.
See Also:
MaHttp, maCreateHttp, maStopHttp
int maStopHttp (MaHttp *http)

Stop Http services.

Description:
This stops listening for requests on all configured servers. Shutdown is somewhat graceful.
Parameters:
httpMaHttp object created via maCreateHttp.
Returns:
Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.
See Also:
MaHttp, maCreateHttp, maStartHttp

MaLimits

MaLimits

Server limits.

API Stability:
Evolving.
See Also:

MaListen

MaListen

Listen endpoint.

API Stability:
Evolving.
See Also:
Fields:
intflags Listen flags.
char *ipAddr IP address on which to listen.
intport Port number to listen on.
struct MaServer *server Server owning this listening endpoint.
MprSocket *sock Underlying socket.
struct MprSsl *ssl SSL configuration.

MaLocation

MaLocation

Location Control.

API Stability:
Evolving.
See Also:
Fields:
MaAuth *auth Per location block authentication.
intautoDelete Auto delete uploaded files.
struct MaStage *connector Network connector.
char *ejsPath EjsPath search path.
MprHashTable *expires Expiry of content by mime type.
MprHashTable *extensions Hash of handlers by extensions.
intflags Location flags.
struct MaStage *handler Set handler.
void *handlerData Data reserved for the handler.
MprList *handlers List of handlers for this location.
MprList *inputStages Input stages.
MprList *outputStages Output stages.
struct MaLocation *parent Parent location.
char *prefix Location prefix name.
intprefixLen Length of the prefix name.
intsessionTimeout Session timeout for this location.
struct MprSsl *ssl SSL configuration.
char *uploadDir Upload directory.

MaMimeType

MaMimeType

Mime Type hash table entry (the URL extension is the key).

API Stability:
Evolving.
See Also:
Fields:

MaRange

MaRange

Content range structure.

Range: 0, 49 First 50 bytes Range: -1, -50 Last 50 bytes Range: 1, -1 Skip first byte then select content to the end.
API Stability:
Evolving.
See Also:

MaRequest

MaRequest

Http Requests.

Description:
Most of the APIs in the Request group still take a MaConn object as their first parameter. This is to make the API easier to remember - APIs take a connection object rather than a request or response object.
API Stability:
Evolving.
See Also:
MaConn, MaResponse, maCompareFormVar, maGetCookies, maGetFormVar, maGetIntFormVar, maGetQueryString, maSetFormVar, maSetIntFormVar, maTestFormVar
Fields:
void maAddVars (MprHashTable *table, cchar *buf, int len)

Add query and post form variables.

Description:
Add new variables encoded in the supplied buffer.
Parameters:
tableMprHashTable Hash table to modify.
bufBuffer containing www-urlencoded data.
lenLength of buf.
See Also:
MaConn, MaRequest, MaResponse, maCompareFormVar, maGetCookies, maGetFormVar, maGetIntFormVar, maGetQueryString, maSetFormVar, maSetIntFormVar, maTestFormVar
int maCompareFormVar (MaConn *conn, cchar *var, cchar *value)

Compare a form variable.

Description:
Compare a form variable and return true if it exists and its value matches.
Parameters:
connMaConn connection object.
varName of the form variable.
valueValue to compare.
Returns:
True if the value matches.
See Also:
MaConn, MaRequest, MaResponse, maGetCookies, maGetFormVar, maGetIntFormVar, maGetQueryString, maSetFormVar, maSetIntFormVar, maTestFormVar
cchar * maGetCookies (MaConn *conn)

Get the cookies.

Description:
Get the cookies defined in the current requeset.
Parameters:
connMaConn connection object.
Returns:
Return a string containing the cookies sent in the Http header of the last request.
See Also:
MaConn, MaRequest, MaResponse, maCompareFormVar, maGetFormVar, maGetIntFormVar, maGetQueryString, maSetFormVar, maSetIntFormVar, maTestFormVar
cchar * maGetFormVar (MaConn *conn, cchar *var, cchar *defaultValue)

Get a form variable.

Description:
Get the value of a named form variable. Form variables are define via www-urlencoded query or post data contained in the request.
Parameters:
connMaConn connection object.
varName of the form variable to retrieve.
defaultValueDefault value to return if the variable is not defined. Can be null.
Returns:
String containing the form variable's value. Caller should not free.
See Also:
MaConn, MaRequest, MaResponse, maCompareFormVar, maGetCookies, maGetIntFormVar, maGetQueryString, maSetFormVar, maSetIntFormVar, maTestFormVar
int maGetIntFormVar (MaConn *conn, cchar *var, int defaultValue)

Get a form variable as an integer.

Description:
Get the value of a named form variable as an integer. Form variables are define via www-urlencoded query or post data contained in the request.
Parameters:
connMaConn connection object.
varName of the form variable to retrieve.
defaultValueDefault value to return if the variable is not defined. Can be null.
Returns:
Integer containing the form variable's value.
See Also:
MaConn, MaRequest, MaResponse, maCompareFormVar, maGetCookies, maGetFormVar, maGetQueryString, maSetFormVar, maSetIntFormVar, maTestFormVar
cchar * maGetQueryString (MaConn *conn)

Get the request query string.

Description:
Get query string sent with the current request.
Parameters:
connMaConn connection object.
Returns:
String containing the request query string. Caller should not free.
See Also:
MaConn, MaRequest, MaResponse, maCompareFormVar, maGetCookies, maGetFormVar, maGetIntFormVar, maSetFormVar, maSetIntFormVar, maTestFormVar
void maSetFormVar (MaConn *conn, cchar *var, cchar *value)

Set a form variable value.

Description:
Set the value of a named form variable to a string value. Form variables are define via www-urlencoded query or post data contained in the request.
Parameters:
connMaConn connection object.
varName of the form variable to retrieve.
valueDefault value to return if the variable is not defined. Can be null.
See Also:
MaConn, MaRequest, MaResponse, maCompareFormVar, maGetCookies, maGetFormVar, maGetIntFormVar, maGetQueryString, maSetIntFormVar, maTestFormVar
void maSetIntFormVar (MaConn *conn, cchar *var, int value)

Set a form variable value.

Description:
Set the value of a named form variable to an integer value. Form variables are define via www-urlencoded query or post data contained in the request.
Parameters:
connMaConn connection object.
varName of the form variable to retrieve.
valueDefault value to return if the variable is not defined. Can be null.
See Also:
MaConn, MaRequest, MaResponse, maCompareFormVar, maGetCookies, maGetFormVar, maGetIntFormVar, maGetQueryString, maSetFormVar, maTestFormVar
int maTestFormVar (MaConn *conn, cchar *var)

Test if a form variable is defined.

Parameters:
connMaConn connection object.
varName of the form variable to retrieve.
Returns:
True if the form variable is defined.
See Also:
MaConn, MaRequest, MaResponse, maCompareFormVar, maGetCookies, maGetFormVar, maGetIntFormVar, maGetQueryString, maSetFormVar, maSetIntFormVar

MaServer

MaServer

Http Server Control An application may have any number of HTTP servers, each managed by an instance of the Server class.

API Stability:
Evolving.
See Also:
maConfigureServer, maCreateServer, maCreateWebServer, maLoadStaticModules, maRunSimpleWebServer, maRunWebServer, maServiceWebServer
Fields:
int maConfigureServer (MprCtx ctx, MaHttp *http, MaServer *server, cchar *configFile, cchar *ipAddr, int port, cchar *documentRoot)

Configure a web server.

Description:
This will configure a web server based on either a configuration file or using the supplied IP address and port.
Parameters:
ctxAny memory context object returned by mprAlloc.
httpMaHttp object created via maCreateHttp.
serverMaServer object created via maCreateServer.
configFileFile name of the Appweb configuration file (appweb.conf) that defines the web server configuration.
ipAddrIf using a config file, set to null. Otherwise, set to a host name or IP address.
portIf using a config file, set to -1. Otherwise, set to the port number to listen on.
documentRootIf not using a config file, set this to the directory containing the web documents to serve.
Returns:
Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.
See Also:
MaServer, maCreateServer, maCreateWebServer, maLoadStaticModules, maRunSimpleWebServer, maRunWebServer, maServiceWebServer
MaServer * maCreateServer (MaHttp *http, cchar *name, cchar *root, cchar *ipAddr, int port)

Create a MaServer object.

Description:
Create new MaServer object. This routine creates a bare MaServer object, loads any required static modules and performs minimal configuration. To use the server object created, more configuration will be required before starting Http services. If you want a one-line embedding of Appweb, use maRunWebServer or maRunSimpleWebServer.
Parameters:
httpHttp object returned from maCreateHttp.
nameName of the web server. This name is used as the initial server name.
rootServer root directory.
ipAddrIf not-null, create and open a listening endpoint on this IP address. If you are configuring via a config file, use maConfigureServer and set ipAddr to null.
portPort number to listen on. Set to -1 if you do not want to open a listening endpoint on ipAddr:port.
Returns:
MaServer A newly created MaServer object. Use mprFree to free and release.
See Also:
MaServer, maConfigureServer, maCreateWebServer, maLoadStaticModules, maRunSimpleWebServer, maRunWebServer, maServiceWebServer
MaHttp * maCreateWebServer (cchar *configFile)

Create a web server.

Description:
Create a web server configuration based on the supplied config file. Once created, the web server should be run by calling maServiceWebServer. Use this routine when you need access to the MaHttp object. If you want a one-line embedding of Appweb, use maRunWebServer or maRunSimpleWebServer.
Parameters:
configFileFile name of the Appweb configuration file (appweb.conf) that defines the web server configuration.
Returns:
MaHttp object.
See Also:
MaServer, maConfigureServer, maCreateServer, maLoadStaticModules, maRunSimpleWebServer, maRunWebServer, maServiceWebServer
void maLoadStaticModules (MaHttp *http)

Load static modules.

Description:
Load the statically configured modules, handlers, filters and connectors. The configure program can specify a static or shared build of Appweb. The maCreateServer routine will call maLoadStaticModules automatically. It should not be called by in user programs.
Parameters:
httpMaHttp object created via maCreateHttp.
See Also:
MaServer, maConfigureServer, maCreateServer, maCreateWebServer, maRunSimpleWebServer, maRunWebServer, maServiceWebServer
int maRunSimpleWebServer (cchar *ipAddress, int port, cchar *docRoot)

Create and run a simple web server listening on a single IP address.

Description:
Create a simple web server without using a configuration file. The server is created to listen on the specified IP addresss and port. This routine provides is a one-line embedding of Appweb. If you want to use a config file, try the maRunWebServer instead. If you need more control, try maCreateWebServer which exposes the MaHttp object.
Parameters:
ipAddressIP address on which to listen. Set to "0.0.0.0" to listen on all interfaces.
portPort number to listen to.
docRootDirectory containing the documents to serve.
Returns:
Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.
See Also:
MaServer, maConfigureServer, maCreateServer, maCreateWebServer, maLoadStaticModules, maRunWebServer, maServiceWebServer
int maRunWebServer (cchar *configFile)

Create and run a web server based on a configuration file.

Description:
Create a web server configuration based on the supplied config file. This routine provides is a one-line embedding of Appweb. If you don't want to use a config file, try the maRunSimpleWebServer instead. If you need more control, try maCreateWebServer which exposes the MaHttp object.
Parameters:
configFileFile name of the Appweb configuration file (appweb.conf) that defines the web server configuration.
Returns:
Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.
See Also:
MaServer, maConfigureServer, maCreateServer, maCreateWebServer, maLoadStaticModules, maRunSimpleWebServer, maServiceWebServer
int maServiceWebServer (MaHttp *http)

Service a web server.

Description:
Run a web server configuration. This is will start http services via maStartHttp and will service incoming Http requests until instructed to exit. This is often used in conjunction with maCreateWebServer.
Parameters:
httpHttp object created via maCreateWebServer or maCreateHttp.
Returns:
Zero if successful, otherwise a negative Mpr error code. See the Appweb log for diagnostics.
See Also:
MaServer, maConfigureServer, maCreateServer, maCreateWebServer, maLoadStaticModules, maRunSimpleWebServer, maRunWebServer

MaUploadFile

MaUploadFile

Upload File Each uploaded file has an MaUploadedFile entry.

API Stability:
Evolving.
See Also:
Fields:

MaUser

MaUser

User Authorization File based authorization backend.

API Stability:
Evolving.
See Also:

Functions

Typedefs