Hi Francis,
Thank you for your comments.
Actually I have requirement to add value to header and then read same value
like cookies values,URL.
Is any API which I can use for the same.
Please suggest.
On 14 Apr 2016 22:25, "Francis Daly" <francis@daoine.org> wrote:
> On Thu, Apr 14, 2016 at 03:34:40PM +0530, Pankaj Chaudhary wrote:
>
> Hi there,
>
> > i am trying to set value in header with the help of below code snippet .
>
> Web searches for how to write nginx modules tend to point towards
> "Emiller's Guide" or the "Nginx Development Kit".
>
> You may find good background reading there (allowing for any changes
> to the nginx internals since they were written) to help you create a
> "hello world" module.
>
> After that, you'll have a skeleton into which you can add your specific
> pieces, knowing that the basic starting point does work for you.
>
> > ngx_table_elt_t *h1;
> > h1 = ngx_list_push(&r->headers_out.headers);
> > h1->hash = 1;
> > ngx_str_set(&h1->key, "http_user_agent");
> > ngx_str_set(&h1->value, "user_agent_value");
> >
> > if i try to retrieve the same value then getting response "(52) Empty
> reply
> > from server"
>
> There, it looks like you wrote something to a "headers_out.headers"
> data structure.
>
> > ngx_http_core_loc_conf_t *clcf;
> > ngx_str_t *type;
> > ngx_uint_t hash;
> > ngx_str_t name = ngx_string("http_user_agent");
> > clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
> > hash = ngx_hash_key_lc(name.data, name.len);
> > type = ngx_hash_find(&clcf->types_hash, hash, name.data, name.len);
>
> And there it looks like you tried to read something from a "types_hash"
> data structure. So the "type" variable is probably NULL, and your code
> should do something sensible with that value.
>
> Good luck with it,
>
> f
> --
> Francis Daly francis@daoine.org
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx