Webs | GoAhead request structure. |
WebsAuth | GoAhead Authentication. |
WebsBuf | A WebsBuf (ring queue) allows maximum utilization of memory for data storage and is ideal for input/output buffering. |
WebsHash | Hash table entry structure. |
WebsRoute | Request route structure. |
WebsRuntime | GoAhead Web Server Runtime. |
WebsSession | Session state storage. |
WebsSocket | Socket control structure. |
WebsUpload | File upload structure. |
void | assert(bool cond) |
Assure that an assert condition is true. | |
void | bufAddNull(WebsBuf *bp) |
Add a trailing null to the buffer. | |
void | bufAdjustEnd(WebsBuf *bp, ssize size) |
Adjust the endp pointer by the specified size. | |
void | bufAdjustStart(WebsBuf *bp, ssize count) |
Adjust the start (servp) reference. | |
void | bufCompact(WebsBuf *bp) |
Compact the data in the buffer and move to the start of the buffer. | |
int | bufCreate(WebsBuf *bp, int increment, int maxsize) |
Create a buffer. | |
void | bufFlush(WebsBuf *bp) |
Flush all data in the buffer and reset the pointers. | |
void | bufFree(WebsBuf *bp) |
Free allocated storage for the buffer. | |
ssize | bufGetBlk(WebsBuf *bp, char *blk, ssize len) |
Copy a block of from the buffer and adjust the servp. | |
ssize | bufGetBlkMax(WebsBuf *bp) |
Return the maximum number of bytes the buffer can provide via a single block copy. | |
int | bufGetc(WebsBuf *bp) |
Get a character from the buffer and increment the servp. | |
bool | bufGrow(WebsBuf *bp, ssize room) |
Grow the buffer by at least the required amount of room. | |
int | bufInsertc(WebsBuf *bp, char c) |
Insert a character to the buffer before the servp position and decrement the servp. | |
ssize | bufLen(WebsBuf *bp) |
Get the length of available data in the buffer. | |
ssize | bufPut(WebsBuf *bp, char *fmt, ...) PRINTF_ATTRIBUTE(2 |
Append a formatted string to the buffer at the endp position and increment the endp. | |
ssize | bufPutBlk(WebsBuf *bp, char *blk, ssize len) |
Put a block to the buffer. | |
ssize ssize | bufPutStr(WebsBuf *bp, char *str) |
Append a string to the buffer at the endp position and increment the endp. | |
int | bufPutc(WebsBuf *bp, char c) |
Append a character to the buffer at the endp position and increment the endp. | |
void | bufReset(WebsBuf *bp) |
Reset the buffer pointers to the start of the buffer if empty. | |
ssize | bufRoom(WebsBuf *bp) |
Determine the room available in the buffer. | |
char* | bufStart(WebsBuf *bp) |
Get a reference to the start of buffer data. | |
void | error(char *fmt, ...) |
Emit an error message. | |
char* | fmt(char *buf, ssize maxSize, char *format, ...) |
Format a string into a static buffer. | |
WebsHash | hashCreate(int size) |
Create a hash table. | |
int | hashDelete(WebsHash id, char *name) |
Delete a key by name. | |
WebsKey* | hashEnter(WebsHash id, char *name, WebsValue value, int arg) |
Enter a new key and value into the hash table. | |
WebsKey* | hashFirst(WebsHash id) |
Start walking the hash keys by returning the first key entry in the hash. | |
void | hashFree(WebsHash id) |
Free a hash table. | |
WebsKey* | hashLookup(WebsHash id, char *name) |
Lookup a name in the hash table. | |
void* | hashLookupSymbol(WebsHash sd, char *name) |
Lookup a name in the hash table and return a symbol reference. | |
WebsKey* | hashNext(WebsHash id, WebsKey *last) |
Continue walking the hash keys by returning the next key entry in the hash. | |
uint | hextoi(char *str) |
Convert a hex string to an integer. | |
char* | itosbuf(char *buf, ssize size, int64 value, int radix) |
Convert an integer to a string buffer. | |
void | logClose() |
Close the log logging module. | |
WebsLogHandler | logGetHandler() |
Get the log callback. | |
int | logOpen() |
Open the log logging module. | |
WebsLogHandler | logSetHandler(WebsLogHandler handler) |
Set a log callback. | |
void | logSetPath(char *path) |
Set the filename to save logging output. | |
void | logmsgProc(int level, char *fmt, ...) |
Emit a message to the log. | |
int | scaselesscmp(char *s1, char *s2) |
Compare strings ignoring case. | |
bool | scaselessmatch(char *s1, char *s2) |
Compare strings ignoring case. | |
char* | sclone(char *str) |
Clone a string. | |
int | scmp(char *s1, char *s2) |
Compare strings. | |
ssize | scopy(char *dest, ssize destMax, char *src) |
Copy a string. | |
char* | sfmt(char *format, ...) |
Format a string. | |
char* | sfmtv(char *format, va_list args) |
Format a string with varargs. | |
ssize | slen(cchar *str) |
Return the length of a string. | |
char* | slower(char *str) |
Convert a string to lower case. | |
bool | smatch(char *s1, char *s2) |
Compare strings. | |
int | sncaselesscmp(char *s1, char *s2, ssize len) |
Compare strings ignoring case. | |
char* | snclone(char *str, ssize len) |
Clone a substring. | |
int | sncmp(char *s1, char *s2, ssize len) |
Compare strings. | |
ssize | sncopy(char *dest, ssize destMax, char *src, ssize count) |
Copy characters from a string. | |
int | socketAddress(struct sockaddr *addr, int addrlen, char *ipbuf, int ipLen, int *port) |
Extract the numerical IP address and port for the given socket info. | |
bool | socketAddressIsV6(char *ip) |
Determine if an IP address is an IPv6 address. | |
int | socketAlloc(char *host, int port, SocketAccept accept, int flags) |
Allocate a socket object. | |
void | socketClose() |
Close the socket module. | |
void | socketCloseConnection(int sid) |
Close a socket connection. | |
int | socketConnect(char *host, int port, int flags) |
Connect to a server and create a new socket. | |
void | socketCreateHandler(int sid, int mask, SocketHandler handler, void *arg) |
Create a socket handler that will be invoked when I/O events occur. | |
void | socketDeleteHandler(int sid) |
Delete a socket handler created via socketCreateHandler. | |
bool | socketEof(int sid) |
Determine if the socket is at end-of-file for input. | |
void | socketFree(int sid) |
Free (and close) the socket. | |
int | socketGetBlock(int sid) |
Get the current blocking mode. | |
int | socketGetError() |
Get the error code for the last socket operation on this thread. | |
Socket | socketGetHandle(int sid) |
Get the underlying socket operating system socket/file handle. | |
WebsSocket** | socketGetList() |
Get the list of sockets. | |
int | socketGetPort(int sid) |
Get the IP port associated with this socket. | |
bool | socketHasDualNetworkStack() |
Indicate if the system has a dual IPv4 and IPv6 stack. | |
bool | socketHasIPv6() |
Indicate if the system has IPv6 support. | |
void | socketHiddenData(WebsSocket *sp, ssize len, int dir) |
Indicate that the application layer has buffered data for the socket. | |
int | socketInfo(char *ip, int port, int *family, int *protocol, struct sockaddr_storage *addr, Socklen *addrlen) |
Get a socket address structure for the specified IP:Port. | |
bool | socketIsV6(int sid) |
Determine if a socket is bound to an IPv6 address. | |
int | socketListen(char *host, int port, SocketAccept accept, int flags) |
Open a listening socket. | |
int | socketOpen() |
Open the socket module. | |
int | socketParseAddress(char *ipAddrPort, char **pip, int *pport, int *secure, int defaultPort) |
Parse an IP address into its constituent parts. | |
void | socketProcess() |
Process pending socket I/O events. | |
WebsSocket* | socketPtr(int sid) |
Return the socket object for the socket ID. | |
ssize | socketRead(int sid, void *buf, ssize len) |
Read data from a socket. | |
void | socketRegisterInterest(int sid, int mask) |
Register interest in socket I/OEvents. | |
void | socketReservice(int sid) |
Request that the socket be reserviced. | |
int | socketSelect(int sid, int timeout) |
Wait for I/O on a socket. | |
int | socketSetBlock(int sid, int on) |
Set the socket blocking mode. | |
void | socketSetError(int error) |
Set the error code for the last socket operation on this thread. | |
int | socketSetNoDelay(int sid, bool on) |
Set the socket delay mode. | |
int | socketWaitForEvent(WebsSocket *sp, int mask) |
Wait for a socket I/O event. | |
ssize | socketWrite(int sid, void *buf, ssize len) |
Write data to the socket. | |
void | sslClose() |
Close the ssl module. | |
void | sslFree(Webs *wp) |
Free a ssl connection associated with a request. | |
int | sslOpen() |
Open the ssl module. | |
ssize | sslRead(Webs *wp, void *buf, ssize len) |
Read data from a secure socket. | |
int | sslUpgrade(Webs *wp) |
Upgrade a request connection to utilize SSL. | |
ssize | sslWrite(Webs *wp, void *buf, ssize len) |
WRite data to a secure socket. | |
char* | ssplit(char *str, cchar *delim, char **last) |
Split a string at a delimiter. | |
bool | sstarts(cchar *str, cchar *prefix) |
Test if the string starts with a given pattern. | |
char* | stok(char *str, char *delim, char **last) |
Tokenize a string. | |
char* | strim(char *str, char *set, int where) |
Trim a string. | |
char* | supper(char *str) |
Convert a string to upper case. | |
void | traceProc(int level, char *fmt, ...) |
Emit a debug trace message to the log. | |
void | valueFree(WebsValue *value) |
Free any allocated string in a value. | |
WebsValue | valueInteger(long value) |
Create an integer value. | |
WebsValue | valueString(char *value, int flags) |
Create an string value. | |
WebsValue | valueSymbol(void *value) |
Create an symbol value containing an object reference. | |
void* | walloc(ssize size) |
Allocate a block of the requested size. | |
int | wallocHandle(void *map) |
Allocate a handle from a map. | |
int | wallocObject(void *map, int *max, int size) |
Allocate an object in a halloc map. | |
void | wcloseAlloc() |
Close the GoAhead memory allocator. | |
void* | wdup(cvoid *ptr, size_t usize) |
Duplicate memory. | |
int | websAccept(int sid, char *ipaddr, int port, int listenSid) |
Accept a new connection. | |
void | websActionOpen() |
Open the action handler. | |
WebsRole* | websAddRole(char *role, WebsHash abilities) |
Add a role. | |
WebsRoute* | websAddRoute(char *uri, char *handler, int pos) |
Add a route to the routing tables. | |
WebsUser* | websAddUser(char *username, char *password, char *roles) |
Add a user. | |
int | websAlloc(int sid) |
Allocate a new Webs object. | |
WebsSession* | websAllocSession(Webs *wp, char *id, int lifespan) |
Test if a user possesses the required ability. | |
bool | websAuthenticate(Webs *wp) |
Authenticate a user. | |
bool | websCan(Webs *wp, WebsHash ability) |
Test if a user possesses the required ability. | |
void | websCancelTimeout(Webs *wp) |
Cancel the request timeout. | |
int | websCgiHandler(Webs *wp) |
CGI handler service callback. | |
int | websCgiOpen() |
Open the CGI handler. | |
int | websCgiPoll() |
Poll for output from CGI processes and output. | |
bool | websCheckPassword(char *plainTextPassword, char *passwordHash) |
Check a plain-text password against the defined hashed password. | |
void | websClose() |
Close the core GoAhead web server module. | |
void | websCloseAuth() |
Close the authentication module. | |
void | websCloseFile(int fd) |
Close an open file. | |
void | websCloseRoute() |
Close the route module. | |
int | websCompareVar(Webs *wp, char *var, char *value) |
Compare a request variable. | |
void | websComputeAllUserAbilities() |
Compute the abilities for all users by resolving roles into abilities. | |
void | websConsumeInput(Webs *wp, ssize nbytes) |
Consume input from the request input buffer. | |
WebsSession* | websCreateSession(Webs *wp) |
Test if a user possesses the required ability. | |
char* | websCryptPassword(char *password, char *salt, int rounds) |
Encrypt a password using the Blowfish algorithm. | |
char* | websDecode64(char *str) |
Decode the string using base-64 encoding. | |
char* | websDecode64Block(char *str, ssize *len, int flags) |
Decode a block using base-46 encoding. | |
void | websDecodeUrl(char *decoded, char *input, ssize len) |
Decode a URL expanding NN encoding. | |
int | websDefineAction(cchar *name, void *fun) |
Define an action callback for use with the action handler. | |
int | websDefineHandler(char *name, WebsHandlerProc match, WebsHandlerProc service, WebsHandlerClose close, int flags) |
Define a request handler. | |
int | websDefineJst(char *name, WebsJstProc fn) |
Define a Javscript native function. | |
void | websDestroySession(Webs *wp) |
Destroy the webs session object. | |
void | websDone(Webs *wp) |
Complete a request. | |
char* | websEncode64(char *str) |
Encode a string using base-64 encoding. | |
char* | websEncode64Block(char *str, ssize len) |
Encode a block using base-64 encoding. | |
void | websError(Webs *wp, int code, char *fmt, ...) |
Complete a request with an error response. | |
char* | websErrorMsg(int code) |
Get a message for a HTTP status code. | |
char* | websEscapeHtml(char *str) |
Escape unsafe characters in a string. | |
void | websFileOpen() |
Open and initialize the file handler. | |
int | websFlush(Webs *wp, bool block) |
Flush buffered transmit data and compact the transmit buffer to make room for more data. | |
void | websFree(Webs *wp) |
Free the webs request object. | |
void | websFreeUpload(Webs *wp) |
Free file upload data structures. | |
void | websFsClose() |
Close the file system module. | |
int | websFsOpen() |
Open the file system module. | |
int | websGetBackground() |
Get the background execution flag. | |
char* | websGetCgiCommName() |
Get a unique temporary filename for CGI communications. | |
char* | websGetCookie(Webs *wp) |
Get the request cookie if supplied. | |
char* | websGetDateString(WebsFileInfo *sbuf) |
Get a date as a string. | |
int | websGetDebug() |
Get the debug flag. | |
char* | websGetDir(Webs *wp) |
Get the base file directory for a request. | |
char* | websGetDocuments() |
Get the GoAhead base documents directory. | |
int | websGetEof(Webs *wp) |
Get the request EOF status. | |
char* | websGetExt(Webs *wp) |
Get the request URI extension. | |
char* | websGetFilename(Webs *wp) |
Get the request filename. | |
char* | websGetHost(Webs *wp) |
Get the request host. | |
char* | websGetIfaddr(Webs *wp) |
Get the request interface address. | |
char* | websGetIndex() |
Get the default index document name. | |
int | websGetLogLevel() |
Get the current trace log level. | |
char* | websGetMethod(Webs *wp) |
Get the request method. | |
char* | websGetPassword(Webs *wp) |
Get the request password. | |
WebsVerify | websGetPasswordStoreVerify() |
Set the password store verify callback. | |
char* | websGetPath(Webs *wp) |
Get the request path. | |
int | websGetPort(Webs *wp) |
Get the request TCP/IP port. | |
char* | websGetProtocol(Webs *wp) |
Get the request HTTP protocol. | |
char* | websGetQuery(Webs *wp) |
Get the request query component. | |
int | websGetRandomBytes(char *buf, ssize length, bool block) |
Get some random data. | |
WebsHash | websGetRoles() |
Get the roles hash. | |
char* | websGetServer() |
Get the server host name. | |
char* | websGetServerAddress() |
Get the server IP address. | |
char* | websGetServerAddressUrl() |
Get the server IP address with port number. | |
char* | websGetServerUrl() |
Get the server host name with port number. | |
WebsSession* | websGetSession(Webs *wp, int create) |
Get the session state object for the current request. | |
char* | websGetSessionID(Webs *wp) |
Get the session ID. | |
char* | websGetSessionVar(Webs *wp, char *name, char *defaultValue) |
Get a session variable. | |
WebsHash | websGetUpload(struct Webs *wp) |
Get the hash of uploaded files for the request. | |
char* | websGetUrl(Webs *wp) |
Get the request URI. | |
char* | websGetUserAgent(Webs *wp) |
Get the client User-Agent HTTP header. | |
char* | websGetUsername(Webs *wp) |
Get the request username. | |
WebsHash | websGetUsers() |
Get the users hash. | |
char* | websGetVar(Webs *wp, char *name, char *defaultValue) |
Get a request variable. | |
int | websJstOpen() |
Open the Javascript module. | |
int | websJstWrite(int jid, Webs *wp, int argc, char **argv) |
Write data to the response. | |
int | websListen(char *endpoint) |
Listen on a TCP/IP address endpoint. | |
int | websLoad(char *path) |
Load routing tables from the specified filename. | |
bool | websLoginUser(Webs *wp, char *username, char *password) |
Login a user by verifying the login credentials. | |
bool | websLogoutUser(Webs *wp) |
Logout a user and remove the user login session. | |
WebsUpload* | websLookupUpload(struct Webs *wp, char *key) |
Open the file upload filter. | |
WebsUser* | websLookupUser(char *username) |
Lookup if a user exists. | |
char* | websMD5(char *str) |
Get an MD5 digest of a string. | |
char* | websMD5Block(char *buf, ssize length, char *prefix) |
Get an MD5 digest of a block and optionally prepend a prefix. | |
char* | websMakePassword(char *password, int saltLength, int rounds) |
Make a password hash for a plain-text password using the Blowfish algorithm. | |
char* | websMakeSalt(ssize size) |
Make salt for adding to a password. | |
char* | websNormalizeUriPath(char *path) |
Normalize a URI path. | |
void | websNoteRequestActivity(Webs *wp) |
Take not of the request activity and mark the time. | |
int | websOpen(char *documents, char *routes) |
Open the web server. | |
int | websOpenAuth(int minimal) |
Open the authentication module. | |
int | websOpenFile(char *path, int flags, int mode) |
Open the web page document for the current request. | |
int | websOpenRoute() |
Open the routing module. | |
int | websOptionsOpen() |
Open the options handler. | |
void | websOsClose() |
Close the O/S dependant code. | |
int | websOsOpen() |
Open the O/S dependant code. | |
void | websPageClose(Webs *wp) |
Close the document page. | |
int | websPageIsDirectory(Webs *wp) |
Test if the document page for the request corresponds to a directory. | |
int | websPageOpen(Webs *wp, int mode, int perms) |
Open a web page document for a request. | |
ssize | websPageReadData(Webs *wp, char *buf, ssize size) |
Read data from the request page document. | |
void | websPageSeek(Webs *wp, Offset offset, int origin) |
Seek to a position in the request page document. | |
int | websPageStat(Webs *wp, WebsFileInfo *sbuf) |
Get file status for the current request document. | |
int | websParseDateTime(WebsTime *time, char *date, struct tm *defaults) |
Parse a date/time string. | |
bool | websProcessCgiData(Webs *wp) |
Process CGI request body data. | |
bool | websProcessUploadData(Webs *wp) |
Process upload data for form, multipart mime file upload. | |
void | websPump(Webs *wp) |
Pump the state machine. | |
ssize | websReadFile(int fd, char *buf, ssize size) |
Read data from an open file. | |
char* | websReadPassword(char *prompt) |
Get a password from the terminal console. | |
char* | websReadWholeFile(char *path) |
Read all the data from a file. | |
void | websRedirect(Webs *wp, char *url) |
Redirect the client to a new URL. | |
int | websRedirectByStatus(Webs *wp, int status) |
Redirect the client to a new URI. | |
int | websRemoveRole(char *role) |
Remove a role from the system. | |
int | websRemoveRoute(char *uri) |
Remove a route from the routing tables. | |
void | websRemoveSessionVar(Webs *wp, char *name) |
Remove a session variable. | |
int | websRemoveUser(char *name) |
Remove a user from the system. | |
void | websResponse(Webs *wp, int status, char *msg) |
Create and send a request response. | |
void | websRestartEvent(int id, int delay) |
Restart an event. | |
int | websRewriteRequest(Webs *wp, char *url) |
Rewrite a request. | |
void | websRouteRequest(Webs *wp) |
Route a request. | |
int | websRunEvents() |
Run due events. | |
bool | websRunRequest(Webs *wp) |
Run a request handler. | |
void | websRuntimeClose() |
Close the runtime code. | |
int | websRuntimeOpen() |
Open the runtime code. | |
Offset | websSeekFile(int fd, Offset offset, int origin) |
Seek to a position in the current request page document. | |
int | websServer(char *endpoint, char *documents) |
One line embedding API. | |
void | websServiceEvents(int *finished) |
Service I/O events until finished. | |
void | websSetBackground(int on) |
Set the background processing flag. | |
void | websSetBackgroundWriter(Webs *wp, WebsWriteProc proc) |
Define a background write I/O event callback. | |
void | websSetCookie(Webs *wp, char *name, char *value, char *path, char *domain, int lifespan, int flags) |
Define a cookie to include in the response. | |
void | websSetDebug(int on) |
Set the debug processing flag. | |
void | websSetDocuments(char *dir) |
Set the web documents directory. | |
void | websSetEnv(Webs *wp) |
Create the CGI environment variables for the current request. | |
void | websSetFormVars(Webs *wp) |
Create request variables for query and POST body data. | |
void | websSetHost(char *host) |
Define the host name for the server. | |
void | websSetIndex(char *filename) |
Create and send a request response. | |
void | websSetIpAddr(char *ipaddr) |
Define the host IP address. | |
void | websSetLogLevel(int level) |
Set the current trace log level. | |
void | websSetMemNotifier(WebsMemNotifier cback) |
Define a global memory allocation notifier. | |
void | websSetPasswordStoreVerify(WebsVerify verify) |
Set the password store verify callback. | |
void | websSetQueryVars(Webs *wp) |
Create request variables for query string data. | |
int | websSetRouteAuth(WebsRoute *route, char *authType) |
Set route authentication scheme. | |
int | websSetRouteMatch(WebsRoute *route, char *dir, char *protocol, WebsHash methods, WebsHash extensions, WebsHash abilities, WebsHash redirects) |
Configure a route by adding matching criteria. | |
int | websSetSessionVar(Webs *wp, char *name, char *value) |
Set a session variable name value. | |
void | websSetStatus(Webs *wp, int status) |
Set the response HTTP status code. | |
void | websSetTxLength(Webs *wp, ssize length) |
Set the response body content length. | |
int | websSetUserPassword(char *username, char *password) |
Set a password for the user. | |
int | websSetUserRoles(char *username, char *roles) |
Define the set of roles for a user. | |
WebsKey* | websSetVar(Webs *wp, char *name, char *value) |
Set a request variable to a string value. | |
WebsKey* | websSetVarFmt(Webs *wp, char *name, char *fmt, ...) |
Set a request variable to a formatted string value. | |
int | websStartEvent(int delay, WebsEventProc proc, void *data) |
Start a callback event. | |
int | websStatFile(char *path, WebsFileInfo *sbuf) |
Get file status for a file. | |
void | websStopEvent(int id) |
Stop an event. | |
char* | websTempFile(char *dir, char *prefix) |
Create a temporary filename This does not guarantee the filename is unique or that it is not already in use by another application. | |
bool | websTestVar(Webs *wp, char *name) |
Test if a request variable is defined. | |
void | websTimeClose() |
Close the date/time parsing module. | |
int | websTimeOpen() |
Open the date/time parsing module. | |
void | websUploadOpen() |
Open the file upload filter. | |
int | websUrlParse(char *url, char **buf, char **protocol, char **host, char **port, char **path, char **ext, char **reference, char **query) |
Parse a URL into its components. | |
bool | websValid(Webs *wp) |
Test if a webs object is valid. | |
bool | websValidUriChars(char *uri) |
Test if a URI is using only valid characters Note this does not test if the URI is fully legal. | |
char* | websValidateUriPath(char *uri) |
Validate a URI path as expected in a HTTP request line. | |
bool | websVerifyPasswordFromCustom(Webs *wp) |
User password verification routine from a custom password back-end store. | |
bool | websVerifyPasswordFromFile(Webs *wp) |
User password verification routine from auth.txt. | |
ssize | websWrite(Webs *wp, char *fmt, ...) |
Write data to the response. | |
ssize | websWriteBlock(Webs *wp, char *buf, ssize size) |
Write a block of data to the response. | |
void | websWriteEndHeaders(Webs *wp) |
Signify the end of the response headers. | |
ssize | websWriteFile(int fd, char *buf, ssize size) |
Write data to the open file. | |
int | websWriteHeader(Webs *wp, char *key, char *fmt, ...) |
Write a response header. | |
void | websWriteHeaders(Webs *wp, ssize contentLength, char *redirect) |
Write a set of standard response headers. | |
ssize | websWriteSocket(Webs *wp, char *buf, ssize size) |
Write a block of data to the network. | |
void | wfree(void *blk) |
Free an allocated block of memory. | |
int | wfreeHandle(void *map, int handle) |
Free a handle in the map. | |
int | wopenAlloc(void *buf, int bufsize, int flags) |
Initialize the walloc module. | |
void* | wrealloc(void *blk, ssize newsize) |
Reallocate a block of memory and grow its size. |
SocketAccept | Socket accept callback. |
SocketHandler | Socket I/O callback. |
WebsAction | Action callback. |
WebsAskLogin | Callback to prompt the user for their password. |
WebsError | Error code list. |
WebsEventProc | Callback function for events. |
WebsFileInfo | File information structure. |
WebsHandler | GoAhead handler object. |
WebsHandlerClose | GoAhead handler close to release memory prior to shutdown. |
WebsHandlerProc | GoAhead handler service callback. |
WebsHash | Hash table ID returned by hashCreate. |
WebsJstProc | Javascript native function. |
WebsLogHandler | Callback for emitting trace log output. |
WebsMime | Mime type list. |
WebsParseAuth | Callback to parse authentication details submitted with the web request. |
WebsRole | Role definition structure. |
WebsRomIndex | Compiled Rom Page Index. |
WebsStat | File status structure. |
WebsTime | System native time type. |
WebsUser | User definition structure. |
WebsValue | Value union to store primitive value types. |
WebsVerify | Callback to verify the username and password. |
WebsWriteProc | Callback for write I/O events. |
#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_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_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_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_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 | ME_MAX_IP 64 |
Maximum IP address size. | |
#define | SOCKET_AGAIN 4 |
Issue the request again. | |
#define | SOCKET_ASYNC 0x8 |
Use async connect. | |
#define | SOCKET_BLOCK 0x10 |
Use blocking I/O. | |
#define | SOCKET_BUFFERED_READ 0x200 |
Message pending on this socket. | |
#define | SOCKET_BUFFERED_WRITE 0x400 |
Message pending on this socket. | |
#define | SOCKET_CLOSING 0x40 |
Socket is closing. | |
#define | SOCKET_CONNECTING 0x2 |
Connect in progress. | |
#define | SOCKET_CONNRESET 0x80 |
Socket connection was reset. | |
#define | SOCKET_EOF 0x1 |
Seen end of file. | |
#define | SOCKET_EXCEPTION 0x8 |
Interested in exceptions. | |
#define | SOCKET_HANDSHAKING 0x100 |
Doing SSL handshake. | |
#define | SOCKET_INTR 5 |
Call was interrupted. | |
#define | SOCKET_INVAL 6 |
Invalid. | |
#define | SOCKET_LISTENING 0x20 |
Socket is server listener. | |
#define | SOCKET_NETDOWN 3 |
Network is down. | |
#define | SOCKET_NODELAY 0x800 |
Disable Nagle algorithm. | |
#define | SOCKET_PORT_MAX 0xffff |
Max Port size. | |
#define | SOCKET_READABLE 0x2 |
Make socket readable. | |
#define | SOCKET_RESERVICE 0x4 |
Socket needs re-servicing. | |
#define | SOCKET_RESET 2 |
Socket has been reset. | |
#define | SOCKET_WOULDBLOCK 1 |
Socket would block on I/O. | |
#define | SOCKET_WRITABLE 0x4 |
Make socket writable. | |
#define | VALUE_ALLOCATE 0x1 |
Allocate strings using malloc. | |
#define | value_numeric (t >= byteint && t <= big) |
The value is a numeric type. | |
#define | value_ok (t > undefined && t <= symbol) |
The value is valid supported type. | |
#define | value_str (t >= string && t <= bytes) |
The value is a string type. | |
#define | WEBS_ACCEPTED 0x1 |
TLS connection accepted. | |
#define | WEBS_ASSERT_MSG 0x10 |
Originated from assert. | |
#define | WEBS_BEGIN 0 |
Beginning state. | |
#define | WEBS_CHUNK_DATA 3 |
Start of chunk data. | |
#define | WEBS_CHUNK_HEADER 2 |
Preparing tx chunk header. | |
#define | WEBS_CHUNK_START 1 |
Start of a new chunk. | |
#define | WEBS_CHUNK_UNCHUNKED 0 |
Data is not transfer-chunk encoded. | |
#define | WEBS_CHUNKING 0x2 |
Currently chunking output body data. | |
#define | WEBS_CLOSE 0x20000 |
Close connection. | |
#define | WEBS_CLOSED 0x4 |
Connection closed, ready to free. | |
#define | WEBS_CODE_MASK 0xFFFF |
Mask valid status codes. | |
#define | WEBS_COMPLETE 4 |
Request complete. | |
#define | WEBS_CONFIG 2 |
Configuration settings trace level. | |
#define | WEBS_CONTENT 1 |
Ready for body data. | |
#define | WEBS_COOKIE 0x8 |
Cookie supplied in request. | |
#define | WEBS_COOKIE_HTTP 0x2 |
Flag for websSetCookie for http cookies (http only). | |
#define | WEBS_COOKIE_SECURE 0x1 |
Flag for websSetCookie for secure cookies (https only). | |
#define | WEBS_DECODE_TOKEQ 1 |
Decode base 64 blocks up to a NULL or equals. | |
#define | WEBS_ERROR 1 |
Standard logging trace levels are 0 to 9 with 0 being the most verbose. | |
#define | WEBS_ERROR_MSG 0x20 |
Originated from error. | |
#define | WEBS_FINALIZED 0x10 |
Output is finalized. | |
#define | WEBS_FORM 0x20 |
Request is a form (url encoded data). | |
#define | WEBS_HEADERS_CREATED 0x40 |
Headers have been created and buffered. | |
#define | WEBS_HTTP11 0x80 |
Request is using HTTP/1.1. | |
#define | WEBS_JSON 0x100 |
Request has a JSON payload. | |
#define | WEBS_KEEP_ALIVE 0x200 |
HTTP/1.1 keep alive. | |
#define | WEBS_LEVEL_MASK 0xF |
Level mask. | |
#define | WEBS_LOG_MSG 0x100 |
Originated from logmsg. | |
#define | WEBS_MAX_LISTEN 8 |
Maximum number of listen endpoints. | |
#define | WEBS_MAX_PASSWORD 32 |
Default maximum password. | |
#define | WEBS_NOLOG 0x40000 |
Don't write error to log. | |
#define | WEBS_RAW_MSG 0x200 |
Raw message output. | |
#define | WEBS_READY 2 |
Ready to route and start handler. | |
#define | WEBS_REROUTE 0x400 |
Restart route matching. | |
#define | WEBS_RESPONSE_TRACED 0x800 |
Started tracing the response. | |
#define | WEBS_RUNNING 3 |
Processing request. | |
#define | WEBS_SECURE 0x1000 |
Connection uses SSL. | |
#define | WEBS_SMALL_HASH 31 |
General small hash size. | |
#define | WEBS_TRACE_MSG 0x400 |
Originated from trace. | |
#define | WEBS_TRIM_BOTH 0x3 |
Flag for strim to trim from both the start and the end of the string. | |
#define | WEBS_TRIM_END 0x2 |
Flag for strim to trim from the end of the string. | |
#define | WEBS_TRIM_START 0x1 |
Flag for strim to trim from the start of the string. | |
#define | WEBS_UPLOAD 0x2000 |
Multipart-mime file upload. | |
#define | WEBS_VARS_ADDED 0x4000 |
Query and body form vars added. | |
#define | WEBS_VERBOSE 9 |
Highest level of trace. | |
#define | WEBS_WARN 2 |
Soft warning trace level. |
GoAhead request structure.
char * | authDetails | Http header auth details. | |
char * | authResponse | Outgoing auth header. | |
char * | authType | Authorization type (Basic/DAA). | |
char * | boundary | Mime boundary (static). | |
ssize | boundaryLen | Boundary length. | |
int | cgifd | File handle for CGI program input. | |
char * | cgiStdin | Filename for CGI program input. | |
WebsBuf | chunkbuf | Pre-chunking data buffer. | |
char * | clientFilename | Current file filename. | |
int | code | Response status code. | |
int | connError | Request has a connection error. | |
char * | contentType | Body content type. | |
char * | cookie | Request cookie string. | |
WebsUpload * | currentFile | Current file context. | |
char * | decodedQuery | Decoded request query. | |
char * | digest | Password digest. | |
int | docfd | File descriptor for document being served. | |
int | encoded | True if the password is MD5(username:realm:password). | |
bool | eof | If at the end of the request content. | |
int | error | Request has an error. | |
char * | ext | Path extension. | |
char * | filename | Document path name. | |
WebsHash | files | Uploaded files. | |
int | finalized | Request has been completed. | |
int | flags |
Current flags |
|
char * | host | Requested host. | |
char | ifaddr[ME_MAX_IP] | Local interface ipaddress. | |
WebsBuf | input | Receive buffer after de-chunking. | |
char | ipaddr[ME_MAX_IP] | Connecting ipaddress. | |
ssize | lastRead | Number of bytes last read from the socket. | |
int | listenSid | Listen Socket id. | |
char * | method | HTTP request method. | |
WebsBuf | output | Transmit buffer after chunking. | |
char * | password | Authorization password. | |
char * | path | Path name without query. This is decoded. | |
int | port | Request port number. | |
char * | protocol | Protocol scheme (normally http|https). | |
char * | protoVersion | Protocol version (HTTP/1.1). | |
ssize | putLen | Bytes read by a PUT request. | |
char * | putname | PUT temporary filename. | |
char * | query | Request query. This is decoded. | |
char * | realm | Realm field supplied in auth header. | |
char * | referrer | The referring page. | |
char * | responseCookie | Outgoing cookie. | |
struct WebsRoute * | route | Request route. | |
int | routeCount | Route count limiter. | |
WebsBuf | rxbuf | Raw receive buffer. | |
ssize | rxChunkSize | Rx chunk size. | |
int | rxChunkState | Rx chunk encoding state. | |
char * | rxEndp | Pointer to end of raw data in input beyond endp. | |
ssize | rxLen | Rx content length. | |
ssize | rxRemaining | Remaining content to read from client. | |
struct WebsSession * | session | Session record. | |
int | sid | Socket id (handler). | |
WebsTime | since | Parsed if-modified-since time. | |
void * | ssl | SSL context. | |
int | state | Current state. | |
int | timeout | Timeout handle. | |
WebsTime | timestamp | Last transaction with browser. | |
ssize | txChunkLen | Length of the chunk. | |
char | txChunkPrefix[16] | Transmit chunk prefix. | |
ssize | txChunkPrefixLen | Length of prefix. | |
char * | txChunkPrefixNext | Current I/O pos in txChunkPrefix. | |
int | txChunkState | Transmit chunk state. | |
ssize | txLen | Tx content length header value. | |
int | upfd | Upload file handle. | |
int | uploadState | Current file upload state. | |
char * | uploadTmp | Current temp filename for upload data. | |
char * | uploadVar | Current upload form variable name. | |
char * | url | Full request url. This is not decoded. | |
struct WebsUser * | user | User auth record. | |
char * | userAgent | User agent (browser). | |
char * | username | Authorization username. | |
WebsHash | vars | CGI standard variables. | |
int | wid | Index into webs. | |
WebsWriteProc | writeData | Handler write I/O event callback. Used by fileHandler. | |
ssize | written | Bytes actually transferred. |
Close the ssl module.
Free a ssl connection associated with a request.
wp | Webs request object. |
Open the ssl module.
Read data from a secure socket.
wp | Webs request object. |
buf | Buffer into which to read data. |
len | Size of buf. |
Upgrade a request connection to utilize SSL.
wp | Webs request object. |
WRite data to a secure socket.
wp | Webs request object. |
buf | Buffer from which to write data. |
len | Size of buf. |
Accept a new connection.
sid | Socket ID handle for the newly accepted socket. |
ipaddr | IP address originating the connection. |
port | Port number originating the connection. |
listenSid | Socket ID of the listening socket. |
Open the action handler.
Allocate a new Webs object.
sid | Socket ID handle for the newly accepted socket. |
Cancel the request timeout.
wp | Webs request object. |
CGI handler service callback.
wp | Webs object. |
Open the CGI handler.
Poll for output from CGI processes and output.
Close the core GoAhead web server module.
Close an open file.
fd | Open file handle returned by websOpenFile. |
Compare a request variable.
wp | Webs request object. |
var | Variable name. |
value | Value to compare with. |
Consume input from the request input buffer.
wp | Webs request object. |
nbytes | Number of bytes the handler has consumed from the input buffer. |
Decode the string using base-64 encoding.
str | String to decode. |
Decode a block using base-46 encoding.
str | String to decode. The string must be null terminated. |
len | Reference to an integer holding the length of the decoded string. |
flags | Reserved. |
Decode a URL expanding NN encoding.
decoded | Buffer to hold the decoded URL. |
input | Input URL or buffer to decode. |
len | Length of the decoded buffer. |
Define an action callback for use with the action handler.
name | URI path suffix. This suffix is added to "/action" to form the bound URI path. |
fun | Callback function. The signature is void (*WebsAction)(Webs *wp);. |
Define a request handler.
name | Name of the handler. |
match | Handler callback match procedure. Invoked to match the request with the handler. The handler should return true to accept the request. |
service | Handler callback service procedure. Invoked to service each request. |
close | Handler callback close procedure. Called when GoAhead is shutting down. |
flags | Set to WEBS_LEGACY_HANDLER to support the legacy handler API calling sequence. |
Define a Javscript native function.
name | Javascript function name. |
fn | C function to invoke. |
Complete a request.
wp | Webs request object. |
Encode a string using base-64 encoding.
str | String to encode. |
Encode a block using base-64 encoding.
str | String to encode. |
len | Length of string to encode. |
Complete a request with an error response.
wp | Webs request object. |
code | HTTP status code. |
fmt | Message printf style format. |
... | Format args. |
Get a message for a HTTP status code.
code | HTTP status code. |
Escape unsafe characters in a string.
str | String to escape. |
Open and initialize the file handler.
Flush buffered transmit data and compact the transmit buffer to make room for more data.
wp | Webs request object. |
block | Set to true to wait for all data to be written to the socket. Set to false to write whatever the socket can absorb without blocking. |
Free the webs request object.
wp | Webs request object. |
Free file upload data structures.
wp | Webs request object. |
Close the file system module.
Open the file system module.
Get the background execution flag.
Get a unique temporary filename for CGI communications.
Get the request cookie if supplied.
wp | Webs request object. |
Get a date as a string.
sbuf | File info object. |
Get the debug flag.
Get the base file directory for a request.
wp | Webs request object. |
Get the GoAhead base documents directory.
Get the request EOF status.
wp | Webs request object. |
Get the request URI extension.
wp | Webs request object. |
Get the request filename.
wp | Webs request object. |
Get the request host.
wp | Webs request object. |
Get the request interface address.
wp | Webs request object. |
Get the default index document name.
Get the current trace log level.
Get the request method.
wp | Webs request object. |
Get the request password.
wp | Webs request object. |
Get the request path.
wp | Webs request object. |
Get the request TCP/IP port.
wp | Webs request object. |
Get the request HTTP protocol.
wp | Webs request object. |
Get the request query component.
wp | Webs request object. |
Get the server host name.
Get the server IP address.
Get the server IP address with port number.
Get the server host name with port number.
Get the request URI.
wp | Webs request object. |
Get the client User-Agent HTTP header.
wp | Webs request object. |
Get the request username.
wp | Webs request object. |
Get a request variable.
wp | Webs request object. |
name | Variable name. |
defaultValue | Default value to return if the variable is not defined. |
Open the Javascript module.
Write data to the response.
jid | Javascript ID handle. |
wp | Webs request object. |
argc | Count of arguments. |
argv | Array arguments. |
Listen on a TCP/IP address endpoint.
endpoint | IPv4 or IPv6 address on which to listen. |
Get an MD5 digest of a string.
str | String to analyze. |
Get an MD5 digest of a block and optionally prepend a prefix.
buf | Block to analyze. |
length | Length of block. |
prefix | Optional prefix to prepend to the MD5 sum. |
Normalize a URI path.
path | URI path to normalize. |
Take not of the request activity and mark the time.
wp | Webs request object. |
Open the web server.
documents | Optional web documents directory. If set to null, the build time ME_GOAHEAD_DOCUMENTS value is used for the documents directory. |
routes | Optional filename for a route configuration file to load. Additional route or authentication configuration files can be loaded via websLoad. |
routes | Webs request object. |
Open the web page document for the current request.
path | Filename path to open. |
flags | File open flags. |
mode | Permissions mask. |
Open the options handler.
Close the O/S dependant code.
Open the O/S dependant code.
Close the document page.
wp | Webs request object. |
Test if the document page for the request corresponds to a directory.
wp | Webs request object. |
Open a web page document for a request.
wp | Webs request object. |
mode | File open mode. Select from O_RDONLY and O_BINARY. Rom files systems ignore this argument. |
perms | Ignored. |
Read data from the request page document.
wp | Webs request object. |
buf | Buffer for the read data. |
size | Size of buf. |
Seek to a position in the request page document.
wp | Webs request object. |
offset | Offset of location in the file to seek to. This is relative to the specified origin. |
origin | Set to SEEK_CUR, SEEK_SET or SEEK_END to position relative to the current position, beginning or end of the document. |
Get file status for the current request document.
wp | Webs request object. |
sbuf | File information structure to modify with file status. |
Parse a date/time string.
time | Reference to a. |
date | Date/time string to parse. |
defaults | Optionally supply missing components for the date/time. Set to NULL if not used. |
Process CGI request body data.
wp | Webs request object. |
Process upload data for form, multipart mime file upload.
wp | Webs request object. |
Pump the state machine.
wp | Webs request object. |
Read data from an open file.
fd | Open file handle returned by websOpenFile. |
buf | Buffer for the read data. |
size | Size of buf. |
Read all the data from a file.
path | File path to read from. |
Redirect the client to a new URL.
wp | Webs request object. |
url | URL to direct the client to. |
Redirect the client to a new URI.
wp | Webs request object. |
status | HTTP status code to use in selecting the route redirection. |
Create and send a request response.
wp | Webs request object. |
status | HTTP status code. |
msg | Response message body. |
Rewrite a request.
wp | Webs request object. |
url | New request URL. |
Close the runtime code.
Open the runtime code.
Seek to a position in the current request page document.
fd | Open file handle returned by websOpenFile. |
offset | Location in the file to seek to. |
origin | Set to SEEK_CUR, SEEK_SET or SEEK_END to position relative to the current position, beginning or end of the document. |
One line embedding API.
endpoint | IP:PORT address on which to listen. |
documents | Directory containing web documents to serve. |
Service I/O events until finished.
finished | Integer location to test. If set to true, then exit. Note: setting finished will not automatically wake up the service routine. |
Set the background processing flag.
on | Value to set the background flag to. |
Define a cookie to include in the response.
wp | Webs request object. |
name | Cookie name. |
value | Cookie value. |
path | URI path prefix applicable for this cookie. |
domain | Domain applicable for this cookie. |
lifespan | Cookie lifespan in seconds. |
flags | Set to WEBS_COOKIE_SECURE for https only. Set to WEBS_COOKIE_HTTP for http only. Otherwise the cookie applies to both http and https requests. |
Set the debug processing flag.
on | Value to set the debug flag to. |
Set the web documents directory.
dir | Directory path to use. |
Create the CGI environment variables for the current request.
wp | Webs request object. |
Create request variables for query and POST body data.
wp | Webs request object. |
Define the host name for the server.
host | String host name. |
Create and send a request response.
filename | Web document name to use as the index. This should not contain any directory components. |
Define the host IP address.
ipaddr | Host IP address. |
Set the current trace log level.
Create request variables for query string data.
wp | Webs request object. |
Set the response HTTP status code.
wp | Webs request object. |
status | HTTP status code. |
Set the response body content length.
wp | Webs request object. |
length | Length value to use. |
Set a request variable to a string value.
wp | Webs request object. |
name | Variable name to set. |
value | Value to set. |
Set a request variable to a formatted string value.
wp | Webs request object. |
name | Variable name to set. |
fmt | Value format string. |
... | Args to format. |
Get file status for a file.
path | Filename path. |
sbuf | File information structure to modify with file status. |
Create a temporary filename This does not guarantee the filename is unique or that it is not already in use by another application.
dir | Directory to locate the temp file. Defaults to the O/S default temporary directory (usually /tmp). |
prefix | Filename prefix. |
Test if a request variable is defined.
wp | Webs request object. |
name | Variable name. |
Close the date/time parsing module.
Open the date/time parsing module.
Parse a URL into its components.
url | URL to parse. |
buf | Buffer to hold storage for various parsed components. Caller must free. NOTE: the parsed components may point to locations in this buffer. |
protocol | Parsed URL protocol component. |
host | Parsed hostname. |
port | Parsed URL port. |
path | Parsed URL path component. |
ext | Parsed URL extension. |
reference | Parsed URL reference portion (#reference). |
query | Parsed URL query component. |
Test if a webs object is valid.
wp | Webs request object. |
Validate a URI path as expected in a HTTP request line.
uri | URI to validate. |
Test if a URI is using only valid characters Note this does not test if the URI is fully legal.
Some components of the URI have restricted character sets that this routine does not test. This tests if the URI has only characters valid to use in a URI before decoding. i.e. It will permit NN encodings. The set of valid characters is: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=%"uri | Uri to test. |
Write data to the response.
wp | Webs request object. |
fmt | Printf style format string. |
... | Arguments to the format string. |
Write a block of data to the response.
wp | Webs request object. |
buf | Buffer of data to write. |
size | Length of buf. |
Signify the end of the response headers.
wp | Webs request object. |
Write data to the open file.
fd | Open file handle returned by websOpenFile. |
buf | Buffer for the read data. |
size | Size of buf. |
Write a response header.
wp | Webs request object. |
key | Header key value. |
fmt | Header value format string. |
... | Arguments to the format string. |
Write a set of standard response headers.
wp | Webs request object. |
contentLength | Value for the Content-Length header which describes the length of the response body. |
redirect | Value for the Location header which redirects the client to a new URL. |
Write a block of data to the network.
wp | Webs request object. |
buf | Buffer of data to write. |
size | Length of buf. |
GoAhead Authentication.
Add a role.
role | Role name. |
abilities | Hash of abilities for the role. |
Add a user.
username | User name. |
password | User password (encrypted). |
roles | Space separated list of roles. This may also contain abilities. |
Authenticate a user.
wp | Webs request object. |
Test if a user possesses the required ability.
wp | Webs request object. |
ability | Set of required abilities. |
Close the authentication module.
Compute the abilities for all users by resolving roles into abilities.
Set the password store verify callback.
Get the roles hash.
Get the users hash.
Login a user by verifying the login credentials.
wp | Webs request object. |
username | User name. |
password | User password (encrypted). |
Logout a user and remove the user login session.
wp | Webs request object. |
Lookup if a user exists.
username | User name to search for. |
Open the authentication module.
minimal | Reserved. Set to zero. |
Remove a role from the system.
role | Role name. |
Remove a user from the system.
name | User name. |
Set the password store verify callback.
verify | WebsVerify callback function. |
Set a password for the user.
username | User name. |
password | Null terminated password string. |
Define the set of roles for a user.
username | User name. |
roles | Space separated list of roles or abilities. |
User password verification routine from a custom password back-end store.
wp | Webs request object. |
User password verification routine from auth.txt.
wp | Webs request object. |
A WebsBuf (ring queue) allows maximum utilization of memory for data storage and is ideal for input/output buffering.
char * | buf | Holding buffer for data. | |
ssize | buflen | Length of ring queue. | |
char * | endbuf | Pointer to end of buffer. | |
char * | endp | Pointer to end of data. | |
int | increment | Growth increment. | |
ssize | maxsize | Maximum size. | |
char * | servp | Pointer to start of data. |
Add a trailing null to the buffer.
The end pointer is not changedbp | Buffer reference. |
Adjust the endp pointer by the specified size.
bp | Buffer reference. |
size | Size of adjustment. May be positive or negative value. |
Adjust the start (servp) reference.
bp | Buffer reference. |
count | Number of bytes to adjust. |
Compact the data in the buffer and move to the start of the buffer.
bp | Buffer reference. |
Create a buffer.
bp | Buffer reference. |
increment | Incremental size to grow the buffer. This will be increased by a power of two each time the buffer grows. |
maxsize | Maximum size of the buffer. |
Flush all data in the buffer and reset the pointers.
bp | Buffer reference. |
Free allocated storage for the buffer.
bp | Buffer reference. |
Copy a block of from the buffer and adjust the servp.
bp | Buffer reference. |
blk | Block into which to place the data. |
len | Length of the block. |
Return the maximum number of bytes the buffer can provide via a single block copy.
bp | Buffer reference. |
Get a character from the buffer and increment the servp.
bp | Buffer reference. |
Grow the buffer by at least the required amount of room.
bp | Buffer reference. |
room | Available size required after growing the buffer. |
Insert a character to the buffer before the servp position and decrement the servp.
bp | Buffer reference. |
c | Character to insert. |
Get the length of available data in the buffer.
bp | Buffer reference. |
Append a formatted string to the buffer at the endp position and increment the endp.
bp | Buffer reference. |
fmt | Printf style format string. |
... | Variable arguments for the format string. |
Put a block to the buffer.
bp | Buffer reference. |
blk | Block to append to the buffer. |
len | Size of the block. |
Append a character to the buffer at the endp position and increment the endp.
bp | Buffer reference. |
c | Character to append. |
Append a string to the buffer at the endp position and increment the endp.
bp | Buffer reference. |
str | String to append. |
Reset the buffer pointers to the start of the buffer if empty.
bp | Buffer reference. |
Determine the room available in the buffer.
bp | Buffer reference. |
Get a reference to the start of buffer data.
bp | Buffer reference. |
Hash table entry structure.
Create a hash table.
size | Minimum size of the hash index. |
Delete a key by name.
id | Hash table id returned by hashCreate. |
name | Key name to delete. |
Enter a new key and value into the hash table.
id | Hash table id returned by hashCreate. |
name | Key name to create. |
value | Key value to enter. |
arg | Optional extra argument to store with the value. |
Start walking the hash keys by returning the first key entry in the hash.
id | Hash table id returned by hashCreate. |
Free a hash table.
id | Hash table id returned by hashCreate. |
Lookup a name in the hash table.
id | Hash table id returned by hashCreate. |
name | Key name to search for. |
Lookup a name in the hash table and return a symbol reference.
sd | Hash table id returned by hashCreate. |
name | Key name to search for. |
Continue walking the hash keys by returning the next key entry in the hash.
id | Hash table id returned by hashCreate. |
last | Reference to a WebsKey to hold the current traversal key state. |
Request route structure.
WebsHash | abilities | Required user abilities. | |
WebsAskLogin | askLogin | Route path prefix. | |
char * | authType | Authentication type. | |
char * | dir | Filesystem base directory for route documents. | |
WebsHash | extensions | Permissible URI extensions. | |
int | flags | Route control flags. | |
WebsHandler * | handler | Request handler to service requests. | |
WebsHash | methods | Supported HTTP methods. | |
WebsParseAuth | parseAuth | Parse authentication details callback. | |
char * | prefix | Route path prefix. | |
ssize | prefixLen | Prefix length. | |
char * | protocol | HTTP protocol to use for this route. | |
WebsHash | redirects | Response redirections. | |
WebsVerify | verify | Verify password callback. |
Add a route to the routing tables.
uri | Matching URI prefix. |
handler | Request handler to service routed requests. |
pos | Position in the list of routes. Zero inserts at the front of the list. A value of -1 will append to the end of the list. |
Close the route module.
Load routing tables from the specified filename.
path | Route configuration filename. |
Open the routing module.
Remove a route from the routing tables.
uri | Matching URI prefix. |
Route a request.
wp | Webs request object. |
Run a request handler.
wp | Webs request object. |
Set route authentication scheme.
route | Route to modify. |
authType | Set to "basic", "digest" or "form". |
Configure a route by adding matching criteria.
route | Route to modify. |
dir | Set the route documents directory filename. |
protocol | Set the matching HTTP protocol (http or https). |
methods | Hash of permissible HTTP methods. (GET, HEAD, POST, PUT). |
extensions | Hash of permissible URI filename extensions. |
abilities | Required user abilities. The user must be authenticated. |
abilities | Required user abilities. If abilities are required, the user must be authenticated. |
redirects | Set of applicable response redirections when completing the request. |
GoAhead Web Server Runtime.
Format a string into a static buffer.
buf | Pointer to the buffer. |
maxSize | Size of the buffer. |
format | Printf style format string. |
... | Variable arguments to format. |
Convert a hex string to an integer.
str | Pointer to the string to parse. |
Convert an integer to a string buffer.
buf | Pointer to the buffer that will hold the string. |
size | Size of the buffer. |
value | Integer value to convert. |
radix | The base radix to use when encoding the number. |
Compare strings ignoring case.
This is a safe replacement for strcasecmp. It can handle NULL argss1 | First string to compare. |
s2 | Second string to compare. |
Compare strings ignoring case.
This is similar to scaselesscmp but it returns a booleans1 | First string to compare. |
s2 | Second string to compare. |
Clone a string.
str | Pointer to the block to duplicate. |
Compare strings.
s1 | First string to compare. |
s2 | Second string to compare. |
Copy a string.
dest | Pointer to a pointer that will hold the address of the allocated block. |
destMax | Maximum size of the target string in characters. |
src | String to copy. |
Format a string.
This is a secure verion of printf that can handle null argsformat | Printf style format string. |
... | Variable arguments for the format string. |
Format a string with varargs.
This is a secure verion of printf that can handle null argsformat | Printf style format string. |
args | Varargs argument obtained from va_start. |
Return the length of a string.
str | String to measure. |
Convert a string to lower case.
str | String to convert. This string is modified. |
Compare strings.
s1 | First string to compare. |
s2 | Second string to compare. |
Compare strings ignoring case.
s1 | First string to compare. |
s2 | Second string to compare. |
len | Length of characters to compare. |
Clone a substring.
str | Pointer to the block to duplicate. |
len | Number of bytes to copy. The actual length copied is the minimum of the given length and the length of the supplied string. The result is null terminated. |
Compare strings.
s1 | First string to compare. |
s2 | Second string to compare. |
len | Length of characters to compare. |
Copy characters from a string.
dest | Pointer to a pointer that will hold the address of the allocated block. |
destMax | Maximum size of the target string in characters. |
src | String to copy. |
count | Maximum count of characters to copy. |
Split a string at a delimiter.
str | String to tokenize. |
delim | Set of characters that are used as token separators. |
last | Reference to the portion after the delimiters. Will return an empty string if is not trailing portion. |
Tokenize a string.
str | String to tokenize. |
delim | String of characters to use as token separators. |
last | Last token pointer. |
Trim a string.
str | String to trim. |
set | String of characters to remove. |
where | Flags to indicate trim from the start, end or both. Use WEBS_TRIM_START, WEBS_TRIM_END, WEBS_TRIM_BOTH. |
Convert a string to upper case.
str | String to convert. This string is modified. |
Allocate a handle from a map.
map | Reference to a location holding the map reference. On the first call, the map is allocated. |
Allocate an object in a halloc map.
map | Reference to a location holding the map reference. On the first call, the map is allocated. |
max | Reference to an integer that holds the maximum handle in the map. |
size | Size of the object to allocate. |
Restart an event.
id | Event id allocated by websStartEvent. |
delay | Delay in milliseconds till the event next runs. |
Run due events.
Start a callback event.
delay | Delay in milliseconds in which to run the callback. |
proc | Callback procedure function. Signature is: void (*fn)(void *data, int id). |
data | Data reference to pass to the callback. |
Stop an event.
id | Event id allocated by websStartEvent. |
Free a handle in the map.
map | Reference to a location to hold the map reference. |
handle | Handle to free in the map. |
Session state storage.
WebsHash | cache | Cache of session variables. | |
WebsTime | expires | When the session expires. | |
char * | id | Session ID key. | |
int | lifespan | Session inactivity timeout (secs). |
Test if a user possesses the required ability.
wp | Webs request object. |
id | Session ID to use. Set to null to allocate a new session ID. |
lifespan | Lifespan of the session in seconds. |
Test if a user possesses the required ability.
wp | Webs request object. |
Destroy the webs session object.
wp | Webs request object. |
Get the session state object for the current request.
wp | Webs request object. |
create | Set to true to create a new session if one does not already exist. |
Get the session ID.
wp | Webs request object. |
Get a session variable.
wp | Webs request object. |
name | Session variable name. |
defaultValue | Default value to return if the variable does not exist. |
Remove a session variable.
wp | Webs request object. |
name | Session variable name. |
Set a session variable name value.
wp | Webs request object. |
name | Session variable name. |
value | Value to set the variable to. |
Socket control structure.
SocketAccept | accept | Accept handler. | |
int | currentEvents | Mask of ready events (FD_xx). | |
int | error | Last error. | |
int | fileHandle | ID of the file handler. | |
int | flags | Current state flags. | |
SocketHandler | handler | User I/O handler. | |
void * | handler_data | User handler data. | |
int | handlerMask | Handler events of interest. | |
int | handshakes | Number of renegotiations. | |
int | interestEvents | Mask of events to watch for. | |
char * | ip | Server listen address or remote client address. | |
WebsBuf | lineBuf | Line ring queue. | |
int | port | Port to listen on. | |
int | saveMask | saved Mask for socketFlush. | |
int | secure | Socket is using SSL. | |
int | selectEvents | Events being selected. | |
int | sid | Index into socket[]. | |
Socket | sock | Actual socket handle. |
Extract the numerical IP address and port for the given socket info.
addr | Reference to the socket address. |
addrlen | Length of the socket address. |
ipbuf | Buffer to contain the parsed IP address. |
ipLen | Size of ipbuf. |
port | Reference to an integer to hold the parsed port. |
Determine if an IP address is an IPv6 address.
ip | String IP address. |
Allocate a socket object.
host | String host IP address. |
port | Socket port. |
accept | Optional SocketAccept accept callback function. |
flags | Control flags. |
Close the socket module.
Close a socket connection.
sid | Socket ID handle returned from socketConnect or socketAccept. |
Connect to a server and create a new socket.
host | Host IP address. |
port | Port number to connect to. |
flags | Set to SOCKET_BLOCK for blocking I/O. Otherwise non-blocking I/O is used. |
Create a socket handler that will be invoked when I/O events occur.
sid | Socket ID handle returned from socketConnect or socketAccept. |
mask | Mask of events of interest. Set to SOCKET_READABLE | SOCKET_WRITABLE | SOCKET_EXCEPTION. |
handler | Socket handler function. |
arg | Arbitrary object reference to pass to the SocketHandler callback function. |
Delete a socket handler created via socketCreateHandler.
sid | Socket ID handle returned from socketConnect or socketAccept. |
Determine if the socket is at end-of-file for input.
sid | Socket ID handle returned from socketConnect or socketAccept. |
Free (and close) the socket.
sid | Socket ID handle returned from socketConnect or socketAccept. |
Get the current blocking mode.
sid | Socket ID handle returned from socketConnect or socketAccept. |
Get the error code for the last socket operation on this thread.
Get the underlying socket operating system socket/file handle.
sid | Socket ID handle returned from socketConnect or socketAccept. |
Get the list of sockets.
Get the IP port associated with this socket.
sid | Socket ID handle returned from socketConnect or socketAccept. |
Indicate if the system has a dual IPv4 and IPv6 stack.
Indicate if the system has IPv6 support.
Indicate that the application layer has buffered data for the socket.
sp | Socket object returned from socketPtr |
len | Length of buffered data in bytes. |
dir | Buffer direction. Set to MPR_READABLE for buffered read data and MPR_WRITABLE for buffered write data. |
Get a socket address structure for the specified IP:Port.
ip | IP address to parse. |
port | TCP/IP port number. |
family | Reference to an integer to hold the address family. |
protocol | Reference to an integer to hold the address protocol. |
addr | Reference to an integer to hold the address structure. |
addrlen | Reference to an integer to hold the address structure length. |
Determine if a socket is bound to an IPv6 address.
sid | Socket ID handle returned from socketConnect or socketAccept. |
Open a listening socket.
host | Host IP address on which to listen. Set to NULL to listen on all interfaces. |
port | TCP/IP port on which to listen. |
accept | SocketAccept callback function to invoke to receive incoming connections. |
flags | Reserved. |
Open the socket module.
Parse an IP address into its constituent parts.
ipAddrPort | IP address which may contain an optional ":port" component. |
pip | Returns a reference to an allocated string containing the IP address portion. Caller must free. |
pport | Reference to an integer to hold the port component. |
secure | Reference to an integer to be set to true if the address is using SSL/TLS. |
defaultPort | Default port number to use if no port specifier is included in ipAddrPort. |
Process pending socket I/O events.
Return the socket object for the socket ID.
sid | Socket ID handle returned from socketConnect or socketAccept. |
Read data from a socket.
sid | Socket ID handle returned from socketConnect or socketAccept. |
buf | Buffer to hold read data. |
len | Size of the buffer. |
Register interest in socket I/OEvents.
sid | Socket ID handle returned from socketConnect or socketAccept. |
mask | Mask of events of interest. Set to SOCKET_READABLE | SOCKET_WRITABLE | SOCKET_EXCEPTION. |
Request that the socket be reserviced.
sid | Socket ID handle returned from socketConnect or socketAccept. |
Wait for I/O on a socket.
sid | Socket ID handle returned from socketConnect or socketAccept. |
timeout | Timeout in milliseconds. |
Set the socket blocking mode.
sid | Socket ID handle returned from socketConnect or socketAccept. |
on | Set to 1 to enable blocking. |
Set the error code for the last socket operation on this thread.
error | Integer error code. See errno or GetLastError() on windows. |
Set the socket delay mode.
sid | Socket ID handle returned from socketConnect or socketAccept. |
on | Set to 1 to disable the Nagle algorithm. |
Wait for a socket I/O event.
sp | Socket object. |
mask | Mask of events of interest. Set to SOCKET_READABLE | SOCKET_WRITABLE | SOCKET_EXCEPTION. |
Write data to the socket.
sid | Socket ID handle returned from socketConnect or socketAccept. |
buf | Buffer containing data to write. |
len | Size of buf. |
File upload structure.
char * | clientFilename | Client side name of the file. | |
char * | contentType | Content type. | |
char * | filename | Local (temp) name of the file. | |
ssize | size | Uploaded file size. |
Get the hash of uploaded files for the request.
wp | Webs request object. |
Open the file upload filter.
wp | Webs request object. |
key | Form upload name. |
Assure that an assert condition is true.
cond | Boolean result of a conditional test. |
Emit an error message.
Close the log logging module.
Get the log callback.
Emit a message to the log.
level | Integer verbosity level (0-9). |
fmt | Printf style format string. |
... | Arguments for the format string. |
Open the log logging module.
Set a log callback.
handler | Callback handler function of type WebsLogHandler. |
Set the filename to save logging output.
path | Filename path to use. |
Test if the string starts with a given pattern.
str | String to examine. |
prefix | Pattern to search for. |
Emit a debug trace message to the log.
level | Integer verbosity level (0-9). |
fmt | Printf style format string. |
... | Arguments for the format string. |
Free any allocated string in a value.
value | Value object. |
Create an integer value.
value | Integer long value. |
Create an string value.
value | String long value. |
flags | Set to VALUE_ALLOCATE to store a copy of the string reference. |
Create an symbol value containing an object reference.
value | Value reference. |
Allocate a block of the requested size.
size | Memory size required. |
Close the GoAhead memory allocator.
Duplicate memory.
ptr | Original block reference. |
usize | Size to allocate. |
Check a plain-text password against the defined hashed password.
plainTextPassword | User's plain-text-password to check. |
passwordHash | Required password in hashed format previously computed by websMakePassword. |
Encrypt a password using the Blowfish algorithm.
password | User's password to encrypt. |
salt | Salt text to add to password. Helps to make each user's password unique. |
rounds | Number of times to encrypt. More times, makes the routine slower and passwords harder to crack. |
Get some random data.
buf | Reference to a buffer to hold the random data. |
length | Size of the buffer. |
block | Set to true if it is acceptable to block while accumulating entropy sufficient to provide good random data. Setting to false will cause this API to not block and may return random data of a lower quality. |
Make a password hash for a plain-text password using the Blowfish algorithm.
password | User's password to encrypt. |
saltLength | Length of salt text to add to password. Helps to make each user's password unique. |
rounds | Number of times to encrypt. More times, makes the routine slower and passwords harder to crack. |
Make salt for adding to a password.
size | Size in bytes of the salt text. |
Get a password from the terminal console.
prompt | Text prompt to display before reading the password. |
Define a background write I/O event callback.
wp | Webs request object. |
proc | Write callback. |
Define a global memory allocation notifier.
cback | Callback function to invoke for allocation failures. |
Free an allocated block of memory.
blk | Reference to the memory block to free. |
Initialize the walloc module.
buf | Optional user supplied block of memory to use for allocations. |
bufsize | Size of buf. |
flags | Allocation flags. Set to WEBS_USE_MALLOC to permit the use of malloc() to grow memory. |
Reallocate a block of memory and grow its size.
blk | Original block reference. |
newsize | Size of the new block. |
Hash table ID returned by hashCreate.
Callback for emitting trace log output.
level | Integer between 0 and 9. Zero is the lowest trace level used for the most important messages. |
msg | Message to log. |
File status structure.
System native time type.
This is the time in seconds. This may be 32 or 64 bits and may be signed or unsigned on some systemsCallback for write I/O events.
Action callback.
wp | Webs request object. |
Callback to prompt the user for their password.
wp | Webs request object. |
GoAhead handler close to release memory prior to shutdown.
GoAhead handler service callback.
wp | Webs request object. |
Javascript native function.
jid | JavaScript engine ID. |
wp | Webs request object. |
argc | Count of function arguments. |
argv | Array of function arguments. |
defaultValue | Default value to return if the variable is not defined. |
Callback to parse authentication details submitted with the web request.
wp | Webs request object. |
Callback to verify the username and password.
wp | Webs request object. |
Callback function for events.
data | Opaque data argument. |
id | Event ID. |
Socket accept callback.
sid | Socket ID handle for the newly accepted socket. |
ipaddr | IP address of the connecting client. |
port | Port of the connecting client. |
listenSid | Socket ID for the listening socket. |
Socket I/O callback.
sid | Socket ID handle returned from socketConnect or when a new socket is passed to a SocketAccept callback. |
mask | Mask of events of interest. Set to SOCKET_READABLE | SOCKET_WRITABLE | SOCKET_EXCEPTION. |
data | Data argument to pass to the callback function. |
Error code list.
int | code | HTTP error code. | |
char * | msg | HTTP error message. |
File information structure.
int | isDir | Set if directory. | |
WebsTime | mtime | Modified time. | |
ulong | size | File length. |
GoAhead handler object.
WebsHandlerClose | close | Handler close callback. | |
int | flags | Handler control flags. | |
WebsHandlerProc | match | Handler match callback. | |
char * | name | Handler name. | |
WebsHandlerProc | service | Handler service callback. |
Mime type list.
char * | ext | File extension. | |
char * | type | Mime type. |
Role definition structure.
WebsHash | abilities | Resolved role abilities. |
Compiled Rom Page Index.
uchar * | page | Web page data. | |
char * | path | Web page URL path. | |
Offset | pos | Current read position. | |
int | size | Size of web page in bytes. |
User definition structure.
WebsHash | abilities | Resolved user abilities. | |
char * | name | User name. | |
char * | password | User password (encrypted). | |
char * | roles | User roles. |
Value union to store primitive value types.