httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 53064] New: Missing parsebody function in mod_lua
Date Wed, 11 Apr 2012 16:41:00 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=53064

             Bug #: 53064
           Summary: Missing parsebody function in mod_lua
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_lua
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: humbedooh@apache.org
    Classification: Unclassified


According to the mod_lua documentation, there should be a function called
r:parsebody, which parses the POST data and converts it into a Lua table, but I
have yet to actually find this function declared inside the mod_lua code.

With 2.4, adding this functionality should be pretty straightforward: 
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* r:parsebody() returning a lua table */
static int req_parsebody(lua_State *L)
{
    apr_array_header_t          *fields;
    int                         i;
    apr_table_entry_t           *e = 0;
    request_rec *r = ap_lua_check_request_rec(L, 1);
    lua_newtable(L);
    lua_newtable(L);            /* [table, table] */
    ap_parse_form_data(r, NULL, &fields, -1, MAX_STRING_LEN); /* Maybe increase
this value? */
    e = (apr_table_entry_t *) fields->elts;
    for(i = 0; i < fields->nelts; i++) {
        req_aprtable2luatable_cb(L, e[i].key, e[i].val);
    }
    return 2;                   /* [table<string, string>, table<string,
array<string>>] */
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

(The function would also have to be declared in ap_lua_load_request_lmodule)

I hope this little snippet will at least give some food for thought, and I hope
that the issue can be resolved at some point in time, as we clearly need more
Lua in the world.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message