4 messages in ru.sysoev.nginxRe: about the Guide to Nginx Module D...
FromSent OnAttachments
Manlio PerilloAug 19, 2007 9:18 am 
Evan MillerAug 20, 2007 12:31 am 
Evan MillerAug 20, 2007 12:39 am 
Manlio PerilloAug 20, 2007 2:57 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: about the Guide to Nginx Module DevelopmentActions...
From:Evan Miller (emmi@public.gmane.org)
Date:Aug 20, 2007 12:39:55 am
List:ru.sysoev.nginx

Evan Miller wrote:

To set a header, I think you'd use functions in the Headers module, something like (making it up here):

ngx_http_headers_conf_t *hcf = ngx_http_get_module_loc_conf(r, ngx_http_headers_module);

ngx_http_header_val_t *h = ngx_array_push(hcf->headers);

if (h == NULL) { return NGX_ERROR; }

h->value.hash = 1; h->value.key = ngx_string("X-My-Header"); h->value.value = ngx_string("Some value");

Actually, I think you can get away with:

ngx_table_elt_t *out;

if ((out = ngx_list_push(&r->headers_out.headers)) == NULL) { return NGX_ERROR; }

out->hash = 1; out->key = ngx_string("X-My-Header"); out->value = ngx_string("Some value");

No need to mess with the Header module.