Welcome! Log In Create A New Profile


Deleting Request-Headers

April 10, 2011 06:43AM
i'm trying to extend the lua-module with some features... currently i'm still bugging around with the Request/Response Headers...

With older nginx-versions (0.7.x) you were able to completeley remove Request-Headers for cgi-scripts when the "hash"-value of the header was set to zero.

Sadly this method is not working with the current stable (0.8.54) anymore :( - As a workaround i name the Key and Value of the header "deleted" for now.

Is there something i can use to completely remove the header?

Here's the sample-code i use:

ngx_http_lua_req_header_rm(lua_State *L)
ngx_http_request_t *r;
ngx_str_t temp_key;
ngx_str_t del_text;
ngx_list_part_t *header_part;

r = lua_touserdata(L, -1);
lua_pop(L, 1);

temp_key.data = (u_char*) luaL_checkstring(L,1);
temp_key.len = strlen(luaL_checkstring(L,1));

del_text.data = (u_char*) "deleted";
del_text.len = strlen("deleted");

for(header_part = &(r->headers_in.headers.part) ; header_part ; header_part = header_part->next)
unsigned int i;
ngx_table_elt_t *header = header_part->elts;
for(i = 0; i < header_part->nelts; ++i)
if( aod_strcmp(header[i].key, temp_key) == 0 )
header[i].hash = 0;
header[i].key = del_text;
header[i].value = del_text;

return 0;
Subject Author Posted

Deleting Request-Headers

andiL April 10, 2011 06:43AM

Re: Deleting Request-Headers

agentzh April 18, 2011 01:08AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 88
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready