diff --git a/src/hlua.c b/src/hlua.c index 0499ea392..dc75473e2 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -2814,6 +2814,10 @@ __LJMP static int hlua_http_get_headers(lua_State *L, struct hlua_txn *htxn, str struct hdr_idx_elem *cur_hdr; const char *hn, *hv; int hnl, hvl; + int type; + const char *in; + char *out; + int len; /* Create the table. */ lua_newtable(L); @@ -2855,10 +2859,48 @@ __LJMP static int hlua_http_get_headers(lua_State *L, struct hlua_txn *htxn, str hv = p; hvl = cur_ptr+cur_hdr->len-p; - /* Push values in the table. */ - lua_pushlstring(L, hn, hnl); - lua_pushlstring(L, hv, hvl); - lua_settable(L, -3); + /* Lowercase the key. Don't check the size of trash, it have + * the size of one buffer and the input data contains in one + * buffer. + */ + out = trash.str; + for (in=hn; in