Scol standard library package
0.3.1
Common and usefull functions for all Scol applications
|
Functions | |
std_httpAddUrl (o, p) | |
Add an url / header / data to send. More... | |
std_httpAddUrlOnly (o, szUrl) | |
Add an url only, without header nor data to send. These two last parameters will be nil, thus, this conivience function should be use to a GET request only. More... | |
std_httpGetCallbacks (o) | |
Return the current callbacks, defined in a persistent request object. More... | |
std_httpGetContinueAll (o) | |
Return if all urls should be processed one by one (1) or not (0). More... | |
std_httpGetEnsabled (o) | |
Return if a request object is enabled (1) or disabled (0) More... | |
std_httpGetLastObject () | |
Return the last request object added. More... | |
std_httpGetObjects () | |
Return all request objects. More... | |
std_httpGetPersistent (o) | |
Return if a request object is persistent (1) or not (0) More... | |
std_httpGetRemoveInSuccess (o) | |
Return if urls should be removed if the process is a success. More... | |
std_httpGetSimple (szUrl, cbOk, cbCur, cbError) | |
GET http asynchronous request. More... | |
std_httpGetTest () | |
Return the current url to test the connection. More... | |
std_httpGetTestConection (o) | |
Return if the connection must be testes before each request or not. More... | |
std_httpGetUrl (o) | |
Return the current url, defined in a request object. More... | |
std_httpGetVerb (o) | |
Return the verb to the given request object. More... | |
std_httpNew (szUrl) | |
Create a new persistent request object. More... | |
std_httpRun (o) | |
Run the process according to the choosen parameters (see others functions in this API) More... | |
std_httpSetCallbacks (o, cbOk, cbCur, cbError) | |
Set the callbacks to a persistent request object. More... | |
std_httpSetContinueAll (o, state) | |
Set if the all urls should be processed one by one (1) or not (0). If 0, std_httpRun should be called manually after each previous result. More... | |
std_httpSetEnabled (o, state) | |
Set if a request object is enabled or disabled. More... | |
std_httpSetRemoveInSuccess (o, state) | |
Set if the urls should be removed in the list if the end of the request is a success. More... | |
std_httpSetTest (szUrl) | |
Set the url to test the connection. More... | |
std_httpSetTestConection (o, state) | |
Set if the connection must be testes before each request or not. This is helpful in a local request for example. More... | |
std_httpSetUrl (o, lUrl) | |
Set the urls / headers / datas to send. More... | |
std_httpSetVerb (o, szVerb) | |
Set the verb to the all process in this object. More... | |
std_httpSupportedVerb () | |
Return a list of supported request (GET, POST, ...) More... | |
Package to load : lib/std/http.pkg
This API provides some options to write HTTP client request routines for Scol. This is older than the Libcurl API ( lib/std/curl.pkg ).
Dependancies :
This API uses the legacy INET Scol API.
std_httpGetSimple | ( | szUrl | , |
cbOk | , | ||
cbCur | , | ||
cbError | |||
) |
GET http asynchronous request.
Prototype : fun [S fun [STD_HTTP_CLIENT S] I fun [STD_HTTP_CLIENT I] I fun [STD_HTTP_CLIENT I] I] STD_HTTP_CLIENT
S | : url to get |
fun | [STD_HTTP_CLIENT S] I : function to call when the response is whole. The string argument is the datas received from the server. |
fun | [STD_HTTP_CLIENT I] I : function to call when a part of the response is received. The integer argument is the size of this part. |
fun | [STD_HTTP_CLIENT I] I : function to call when an error occurs (and when the response is complete). The integer argument is a following value.
|
std_httpNew | ( | szUrl | ) |
Create a new persistent request object.
A such object can be prepared and reused. By default, it is enabled and persistent. No callback are defined by default.
Prototype : fun [S] STD_HTTP_CLIENT
S | : an url (can be nil) |
std_httpSetUrl | ( | o | , |
lUrl | |||
) |
Set the urls / headers / datas to send.
Prototype : fun [STD_HTTP_CLIENT [S r1]] STD_HTTP_CLIENT
STD_HTTP_CLIENT | : a persistent request object |
[[S | S S] r1] : a list of urls/headers/datas to send, headers and datas should be nil if the used verb is GET. |
std_httpAddUrl | ( | o | , |
p | |||
) |
Add an url / header / data to send.
Prototype : fun [STD_HTTP_CLIENT [S S S]] STD_HTTP_CLIENT
STD_HTTP_CLIENT | : a persistent request object |
[S | S S] : an url, an header, any datas to send |
std_httpAddUrlOnly | ( | o | , |
szUrl | |||
) |
Add an url only, without header nor data to send. These two last parameters will be nil, thus, this conivience function should be use to a GET request only.
Prototype : fun [STD_HTTP_CLIENT S] STD_HTTP_CLIENT
STD_HTTP_CLIENT | : a persistent request object |
S | : an url |
std_httpGetUrl | ( | o | ) |
Return the current url, defined in a request object.
Prototype : fun [STD_HTTP_CLIENT] [S r1]
STD_HTTP_CLIENT | : a request object |
std_httpSetCallbacks | ( | o | , |
cbOk | , | ||
cbCur | , | ||
cbError | |||
) |
Set the callbacks to a persistent request object.
Prototype : fun [STD_HTTP_CLIENT fun [STD_HTTP_CLIENT S] I fun [STD_HTTP_CLIENT I] fun [STD_HTTP_CLIENT I]] STD_HTTP_CLIENT
STD_HTTP_CLIENT | : a persistent request object |
fun | [STD_HTTP_CLIENT S] I : the callback (success) |
fun | [STD_HTTP_CLIENT I] I : the calback (ongoing) |
fun | [STD_HTTP_CLIENT I] I : the callback (errors) |
std_httpGetCallbacks | ( | o | ) |
Return the current callbacks, defined in a persistent request object.
Prototype : fun [STD_HTTP_CLIENT] [fun [STD_HTTP_CLIENT S] I fun [STD_HTTP_CLIENT I] fun [STD_HTTP_CLIENT I]]
STD_HTTP_CLIENT | : a persistent request object |
std_httpSetVerb | ( | o | , |
szVerb | |||
) |
Set the verb to the all process in this object.
Prototype : fun [STD_HTTP_CLIENT S] STD_HTTP_CLIENT
STD_HTTP_CLIENT | : a persistent request object |
S | : a new valid verb. |
std_httpGetVerb | ( | o | ) |
Return the verb to the given request object.
Prototype : fun [STD_HTTP_CLIENT] S
STD_HTTP_CLIENT | : a request object |
std_httpSetEnabled | ( | o | , |
state | |||
) |
Set if a request object is enabled or disabled.
If the request object is persistent, no operation can be done while it is disabled. If the request object is not persistent, the current operation will be stopped and destroyed if the new state is 'disabled'.
Prototype : fun [STD_HTTP_CLIENT I] STD_HTTP_CLIENT
STD_HTTP_CLIENT | : a persistent request object |
I | : a new state (1 : enabled, 0 disabled, all other values are ignored. |
std_httpGetEnsabled | ( | o | ) |
Return if a request object is enabled (1) or disabled (0)
Prototype : fun [STD_HTTP_CLIENT] I
STD_HTTP_CLIENT | : a request object |
std_httpGetPersistent | ( | o | ) |
Return if a request object is persistent (1) or not (0)
Prototype : fun [STD_HTTP_CLIENT] I
STD_HTTP_CLIENT | : a request object |
std_httpSetRemoveInSuccess | ( | o | , |
state | |||
) |
Set if the urls should be removed in the list if the end of the request is a success.
Prototype : fun [STD_HTTP_CLIENT I] STD_HTTP_CLIENT
STD_HTTP_CLIENT | : a persistent request object |
I | : a new state (1 : enabled (default), 0 disabled, all other values are ignored. |
std_httpGetRemoveInSuccess | ( | o | ) |
Return if urls should be removed if the process is a success.
Prototype : fun [STD_HTTP_CLIENT] I
STD_HTTP_CLIENT | : a request object |
std_httpSetTestConection | ( | o | , |
state | |||
) |
Set if the connection must be testes before each request or not. This is helpful in a local request for example.
Prototype : fun [STD_HTTP_CLIENT I] STD_HTTP_CLIENT
STD_HTTP_CLIENT | : a persistent request object |
I | : a new state (1 : yes (default), 0 no, all other values are ignored. |
std_httpGetTestConection | ( | o | ) |
Return if the connection must be testes before each request or not.
Prototype : fun [STD_HTTP_CLIENT] I
STD_HTTP_CLIENT | : a request object |
std_httpSetContinueAll | ( | o | , |
state | |||
) |
Set if the all urls should be processed one by one (1) or not (0). If 0, std_httpRun should be called manually after each previous result.
Prototype : fun [STD_HTTP_CLIENT I] STD_HTTP_CLIENT
STD_HTTP_CLIENT | : a persistent request object |
I | : a new state (1 : one by one, state by default, 0 disabled, all other values are ignored. |
std_httpGetContinueAll | ( | o | ) |
Return if all urls should be processed one by one (1) or not (0).
Prototype : fun [STD_HTTP_CLIENT] I
STD_HTTP_CLIENT | : a request object |
std_httpRun | ( | o | ) |
Run the process according to the choosen parameters (see others functions in this API)
Prototype : fun [STD_HTTP_CLIENT] STD_HTTP_CLIENT
STD_HTTP_CLIENT | : a persistent request object |
std_httpGetTest | ( | ) |
Return the current url to test the connection.
Prototype : fun [] S
std_httpSetTest | ( | szUrl | ) |
Set the url to test the connection.
Prototype : fun [S] S
S | : an url |
std_httpGetObjects | ( | ) |
Return all request objects.
Prototype : fun [] [STD_HTTP_CLIENT r1]
std_httpGetLastObject | ( | ) |
Return the last request object added.
Prototype : fun [] STD_HTTP_CLIENT
std_httpSupportedVerb | ( | ) |
Return a list of supported request (GET, POST, ...)
Prototype : fun [] [S r]