[Klone-users] GET/POST confused methods

Mickael Auger mickael.auger at gmail.com
Thu Apr 17 11:03:30 EDT 2008


Hi Stefano,

> so how would you patch klone?
>adding two *distinct* arrays holding GET and POST variables indipendently?
I think that the existing way must be preserved.
The current way concatenates the GET and POST variables with the
"request_parse_urlencoded_data" function.
When the GET and POST variables have the same name, the POST variables are
ignored because the "vars_add_urlvar" function doesn't add two variables
with the same name (it's normal).

To distinguish GET and POST methods, I could process as

The "struct request_s", defined in request.c, should have two fields
==========================
   vars_t *getargs;            /* get args */
   vars_t *postargs;           /* post args */
==========================


This C file could have the next methods :
==========================
vars_t *request_get_getargs(request_t *rq)
{
    dbg_return_if (rq == NULL, NULL);
    return rq->getargs;
}

const char *request_get_getarg(request_t *rq, const char *name)
{
    var_t *v;
    dbg_return_if (rq == NULL, NULL);
    dbg_return_if (name == NULL, NULL);
    v = vars_get(rq->getargs, name);
    return v ? var_get_value(v): NULL;
}
==========================
idem for POST.

The "request_parse_urlencoded_data" function should memorize the GET
variables in "getargs" and the POST variables in "postargs" in the "struct
request_s" before the concatenation between GET and POST variables.

This feature could be desactivate to the compilation with the presence or
not of a "#define".

Thank you.

-- 
Mickaël AUGER
mickael.auger at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://koanlogic.com/pipermail/klone-users/attachments/20080417/14698d69/attachment.html


More information about the klone-users mailing list