Project

General

Profile

Scol standard library package  0.3.1
Common and usefull functions for all Scol applications
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.
 std_httpsrvcloseallcon (oreq, o)
 std_httpsrvCloseRequest (o, oreq)
 Close an opened connection request.
 std_httpsrvdate ()
 std_httpsrvfoo (o, s)
 std_httpsrvGetActives (o)
 Get the current number of active (opened) connections.
 std_httpsrvGetCallback (o)
 Return the current called function when a request is received.
 std_httpsrvGetCallbackAccept (o)
 Return the current called function when a connection is accepted.
 std_httpsrvGetHeader (o)
 Return the current default header for the answers.
 std_httpsrvGetId (o)
 Get the internal id of a server.
 std_httpsrvGetLogged (o)
 Return if the operations are (or not) currently logged in the application log file (depending on the Scol settings).
 std_httpsrvGetMaxSizePost (o)
 Return the current max size for a POST request.
 std_httpsrvGetPort (o)
 Return the listened port.
 std_httpsrvGetRequest (oreq)
 Get the full received request.
 std_httpsrvGetRequestClose (oreq)
 Return the defined callback when a connection is closed.
 std_httpsrvGetRequestHeader (oreq)
 Get the current defined header for a request object.
 std_httpsrvGetRequestId (oreq)
 Return the id of a connection.
 std_httpsrvGetRequestIP (oreq)
 Return the IP address of the client (or its proxy, ...).
 std_httpsrvGetRequestSize (oreq)
 Return the size of the buffer request.
 std_httpsrvGetStats (o)
 Returns few stats about this server.
 std_httpsrvGetType (o)
 Return if the server is synchronous or asynchronous.
 std_httpsrvKeyValue (str, verb)
 Function to convert a string parameters like a=b&c=d ... to a list key,value.
 std_httpsrvnew (port, cbfun, type)
 std_httpsrvNewAsync (chn, port, cbfun)
 Create a new asynchronous Simple HTTP server.
 std_httpsrvNewSync (chn, port, cbfun)
 Create a new synchronous Simple HTTP server.
 std_httpsrvParseRequest (oreq)
 Parse a received request.
 std_httpsrvreqcmp (r, c)
 std_httpsrvreqinc (o)
 std_httpsrvRequestBody (oreq)
 Return the body of a received request object.
 std_httpsrvrequestcbclose (con, oreq)
 std_httpsrvRequestHeader (oreq)
 Return the header of a received request object.
 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.
 std_httpsrvSetCallback (o, cbfun)
 Set the reflex function which is called when a request is received. This callback can be changed as you want.
 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.
 std_httpsrvSetHeader (o, szDefaultHeader)
 Set the default header for the answers.
 std_httpsrvSetLogged (o, state)
 Set if the operations are (or not) currently logged in the application log file (depending on the Scol settings).
 std_httpsrvSetMaxSizePost (o, size)
 Set the max size for a POST request.
 std_httpsrvSetRequestClose (oreq, cbfun)
 Set the callback when a connection is closed.
 std_httpsrvSetRequestHeader (oreq, szHeader)
 Set the header answer of a specific received request. By default, it is the default server header.
 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.
 std_httpsrvSetResponseS (oreq, szResponse)
 Set the answer of a specific received request. The header will be automatically added when the answser is sent.
 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 )