|
|
|
@ -154,13 +154,13 @@ static int HttpGetHeader(lua_State *luastate, int dir)
|
|
|
|
|
if (name == NULL)
|
|
|
|
|
return LuaCallbackError(luastate, "1st argument missing, empty or wrong type");
|
|
|
|
|
|
|
|
|
|
const htp_headers_t *headers = htp_tx_request_headers(tx);
|
|
|
|
|
if (dir == 1)
|
|
|
|
|
headers = htp_tx_response_headers(tx);
|
|
|
|
|
if (headers == NULL)
|
|
|
|
|
return LuaCallbackError(luastate, "tx has no headers");
|
|
|
|
|
const htp_header_t *h = NULL;
|
|
|
|
|
if (dir == 0) {
|
|
|
|
|
h = htp_tx_request_header(tx, name);
|
|
|
|
|
} else {
|
|
|
|
|
h = htp_tx_response_header(tx, name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
htp_header_t *h = (htp_header_t *)htp_table_get_c(headers, name);
|
|
|
|
|
if (h == NULL || htp_header_value_len(h) == 0)
|
|
|
|
|
return LuaCallbackError(luastate, "header not found");
|
|
|
|
|
|
|
|
|
@ -226,11 +226,11 @@ static int HttpGetHeaders(lua_State *luastate, int dir)
|
|
|
|
|
const htp_headers_t *table = htp_tx_request_headers(tx);
|
|
|
|
|
if (dir == 1)
|
|
|
|
|
table = htp_tx_response_headers(tx);
|
|
|
|
|
if (htp_tx_request_headers(tx) == NULL)
|
|
|
|
|
if (table == NULL)
|
|
|
|
|
return LuaCallbackError(luastate, "no headers");
|
|
|
|
|
|
|
|
|
|
lua_newtable(luastate);
|
|
|
|
|
htp_header_t *h = NULL;
|
|
|
|
|
const htp_header_t *h = NULL;
|
|
|
|
|
size_t i = 0;
|
|
|
|
|
size_t no_of_headers = htp_headers_size(table);
|
|
|
|
|
for (; i < no_of_headers; i++) {
|
|
|
|
|