Scol standard library package  0.3.1
Common and usefull functions for all Scol applications
Classes | Typedefs | Functions | Variables
httpsrv.pkg File Reference

Scol Standard Library - Simple HTTP server API. More...

Classes

struct  STD_HTTP_SERVER
 Internal http server structure. You should not call it directly, use API instead ! More...
 
struct  STD_HTTP_SERVER_REQUEST
 Internal http connection request structure. You should not call it directly, use API instead ! More...
 

Typedefs

typedef struct mkSTD_HTTP_SERVER STD_HTTP_SERVER
 
typedef struct mkSTD_HTTP_SERVER_REQUEST STD_HTTP_SERVER_REQUEST
 

Functions

 std_httpsrv_itoh4 (i)
 
 std_httpsrv_itoh8 (i)
 
 std_httpsrvcb2 (con, o)
 
 std_httpsrvcbAsync (con, o, request)
 
 std_httpsrvcbSync (con, o, request)
 
 std_httpsrvClose (o)
 Close a server and its opened conections. All active connections will be closed too. More...
 
 std_httpsrvcloseallcon (oreq, o)
 
 std_httpsrvCloseRequest (o, oreq)
 Close an opened connection request. More...
 
 std_httpsrvdate ()
 
 std_httpsrvfoo (o, s)
 
 std_httpsrvGetActives (o)
 Get the current number of active (opened) connections. More...
 
 std_httpsrvGetCallback (o)
 Return the current called function when a request is received. More...
 
 std_httpsrvGetCallbackAccept (o)
 Return the current called function when a connection is accepted. More...
 
 std_httpsrvGetHeader (o)
 Return the current default header for the answers. More...
 
 std_httpsrvGetId (o)
 Get the internal id of a server. More...
 
 std_httpsrvGetLogged (o)
 Return if the operations are (or not) currently logged in the application log file (depending on the Scol settings). More...
 
 std_httpsrvGetMaxSizePost (o)
 Return the current max size for a POST request. More...
 
 std_httpsrvGetPort (o)
 Return the listened port. More...
 
 std_httpsrvGetRequest (oreq)
 Get the full received request. More...
 
 std_httpsrvGetRequestClose (oreq)
 Return the defined callback when a connection is closed. More...
 
 std_httpsrvGetRequestHeader (oreq)
 Get the current defined header for a request object. More...
 
 std_httpsrvGetRequestId (oreq)
 Return the id of a connection. More...
 
 std_httpsrvGetRequestIP (oreq)
 Return the IP address of the client (or its proxy, ...). More...
 
 std_httpsrvGetRequestSize (oreq)
 Return the size of the buffer request. More...
 
 std_httpsrvGetStats (o)
 Returns few stats about this server. More...
 
 std_httpsrvGetType (o)
 Return if the server is synchronous or asynchronous. More...
 
 std_httpsrvKeyValue (str, verb)
 Function to convert a string parameters like a=b&c=d ... to a list key,value. More...
 
 std_httpsrvnew (port, cbfun, type)
 
 std_httpsrvNewAsync (chn, port, cbfun)
 Create a new asynchronous Simple HTTP server. More...
 
 std_httpsrvNewSync (chn, port, cbfun)
 Create a new synchronous Simple HTTP server. More...
 
 std_httpsrvParseRequest (oreq)
 Parse a received request. More...
 
 std_httpsrvreqcmp (r, c)
 
 std_httpsrvreqinc (o)
 
 std_httpsrvRequestBody (oreq)
 Return the body of a received request object. More...
 
 std_httpsrvrequestcbclose (con, oreq)
 
 std_httpsrvRequestHeader (oreq)
 Return the header of a received request object. More...
 
 std_httpsrvrequestnew (con, o, request)
 
 std_httpsrvSend (o, oreq)
 Send an anwser to a client by an opened connection request. You should set std_httpsrvSetResponseS or std_httpsrvSetResponseP before use this function. More...
 
 std_httpsrvSetCallback (o, cbfun)
 Set the reflex function which is called when a request is received. This callback can be changed as you want. More...
 
 std_httpsrvSetCallbackAccept (o, cbfun)
 Set the reflex function which is called when a connection is accepted. The request object given by the callback doesn't contain the string request yet. This string will be present in the request object in the received callback only. This callback can be changed as you want. More...
 
 std_httpsrvSetHeader (o, szDefaultHeader)
 Set the default header for the answers. More...
 
 std_httpsrvSetLogged (o, state)
 Set if the operations are (or not) currently logged in the application log file (depending on the Scol settings). More...
 
 std_httpsrvSetMaxSizePost (o, size)
 Set the max size for a POST request. More...
 
 std_httpsrvSetRequestClose (oreq, cbfun)
 Set the callback when a connection is closed. More...
 
 std_httpsrvSetRequestHeader (oreq, szHeader)
 Set the header answer of a specific received request. By default, it is the default server header. More...
 
 std_httpsrvSetResponseP (oreq, pFile)
 Set the file to send to a specific received request. The header will be automatically added when the answser is sent. The content file won't loaded in Scol memory. More...
 
 std_httpsrvSetResponseS (oreq, szResponse)
 Set the answer of a specific received request. The header will be automatically added when the answser is sent. More...
 
 std_httpsrvtypestr (o)
 

Variables

var STD_HTTPSRV_ASYNC =1
 
var STD_HTTPSRV_ID =-1
 
var STD_HTTPSRV_IDCON =-1
 
var STD_HTTPSRV_SYNC =0
 
proto std_httpsrvcbAsync =fun [HTTPcon STD_HTTP_SERVER S] S
 

Detailed Description

Scol Standard Library - Simple HTTP server API.

Author
Scol team
Version
0.1

This API provides some options to write a simple HTTP server for Scol

Remarks
This API requires the list API ( lib/std/list.pkg ) and the string API ( lib/std/string.pkg )