Welcome! Log In Create A New Profile

Advanced

gzip filter is not work with my handler

December 07, 2011 01:08AM
I wrote a very simple nginx handler,just output some text (size 100B to 10KB).

the code works properly with nginx( ver 1.0.6)

but I found gzip filter can not work with the handler .


when I turn gzip on in nginx.conf, the gzip works file with static html files.

but, the handler's response is not compressed with gzip.

after a lot of search job, I still can not find the answer.

any comments ? thanks a lot. :-)


//my code :
static ngx_int_t ngx_http_test_handler(ngx_http_request_t *r){
ngx_chain_t out;
ngx_buf_t *b;

b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));

......
//writing text to buffer
......
r->headers_out.status = NGX_HTTP_OK;
r->headers_out.content_length_n = len;
r->headers_out.content_type.len = sizeof("text/html")-1;
r->headers_out.content_type.data = (u_char *) "text/html";

out.buf = b;
out.next = NULL;
return ngx_http_output_filter(r, &out);
}
Subject Author Posted

gzip filter is not work with my handler

helloryan December 07, 2011 01:08AM

Re: gzip filter is not work with my handler

helloryan December 07, 2011 01:38PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 61
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