CGI Request Parsing API.
qDecoder supports parsing of
And parsed elements are stored in qentry_t linked-list structure.
The order of parsing sequence is (1)COOKIE (2)POST (3)GET. Thus if there is a same query name existing in different methods, COOKIE values will be stored first than POST, GET values will be added at the very last into a qentry linked-list.
Below is an example to parse only two given methods. Please note that when multiple methods are specified, it'll be parsed in the order of COOKIE, POST and GET.
To change the order of parsing sequence, you can call qcgireq_parse() multiple times in the order that you want as below.
In terms of multipart/form-data encoding(used for file uploading), qDecoder can handle that in two different ways internally.
You can switch to file mode by calling qcgireq_setoption().
Basically, when file is uploaded qDecoder store it's meta information like below.
Functions | |
qentry_t * | qcgireq_setoption (qentry_t *request, bool filemode, const char *basepath, int clearold) |
Set request parsing option for file uploading in case of multipart/form-data encoding. More... | |
qentry_t * | qcgireq_parse (qentry_t *request, Q_CGI_T method) |
Parse one or more request(COOKIE/POST/GET) queries. More... | |
char * | qcgireq_getquery (Q_CGI_T method) |
Get raw query string. More... | |
qentry_t* qcgireq_setoption | ( | qentry_t * | request, |
bool | filemode, | ||
const char * | basepath, | ||
int | clearold | ||
) |
Set request parsing option for file uploading in case of multipart/form-data encoding.
request | qentry_t container pointer that options will be set. NULL can be used to create a new container. |
filemode | false for parsing in memory, true for storing attached files into file-system directly. |
basepath | the base path where the uploaded files are located. Set to NULL if filemode is false. |
clearold | saved files older than this seconds will be removed automatically. Set to 0 to disable. |
Parse one or more request(COOKIE/POST/GET) queries.
request | qentry_t container pointer that parsed key/value pairs will be stored. NULL can be used to create a new container. |
method | Target mask consists of one or more of Q_CGI_COOKIE, Q_CGI_POST and Q_CGI_GET. Q_CGI_ALL or 0 can be used for parsing all of those types. |
char* qcgireq_getquery | ( | Q_CGI_T | method | ) |
Get raw query string.
method | One of Q_CGI_COOKIE, Q_CGI_POST or Q_CGI_GET. |