kore-doc

The kore documentation found under https://docs.kore.io/
Commits | Files | Refs | README | git clone https://git.kore.io/kore-doc.git

commit 73348df7fa37d081ccad14c7ca52893c56595154
parent bb5009e6213ee49a69458c3a297fa84ea06c3779
Author: Joris Vink <joris@coders.se>
Date:   Sat, 11 May 2019 11:35:30 +0200

add http_state_[get|cleanup]()

Diffstat:
api/http.md | 51+++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/api/http.md b/api/http.md @@ -18,6 +18,8 @@ This page contains all available public functions related to understanding and r * [http\_body\_read](#http_body_read) * [http\_state\_run](#http_state_run) * [http\_state\_create](#http_state_create) +* [http\_state\_get](#http_state_get) +* [http\_state\_cleanup](#http_state_cleanup) * [http\_status\_text](#http_status_text) * [http\_method\_text](#http_method_text) * [http\_argument\_get\_string](#http_argument_get_string) @@ -364,12 +366,13 @@ This should be called from a page handler. ### Synopsis ``` -void * http_state_create(struct http_request *req, size_t len, void (*onfree)(struct http_request *)) +void *http_state_create(struct http_request *req, size_t len, void (*onfree)(struct http_request *)) ``` ### Description -Creates an HTTP state machine. +Allocates a state attached to the HTTP request that the user can use to +store temporary data for the request. | Parameter | Description | | --- | --- | @@ -383,6 +386,50 @@ The state context. --- +# http\_state\_get {#http_state_get} + +### Synopsis + +``` +void *http_state_get(struct http_request *req) +``` + +### Description + +Get the user-defined state attached to the HTTP request. + +| Parameter | Description | +| --- | --- | +| req | The HTTP request. | + +### Returns + +The state context or NULL if none was set. + +--- + +# http\_state\_cleanup {#http_state_cleanup} + +### Synopsis + +``` +void http_state_cleanup(struct http_request *req) +``` + +### Description + +Free the previously allocated user-defined state attached to the HTTP request. + +| Parameter | Description | +| --- | --- | +| req | The HTTP request. | + +### Returns + +Nothing + +--- + # http\_status\_text {#http_status_text} ### Synopsis