Welcome! Log In Create A New Profile

Advanced

How to send a empty response

August 11, 2009 05:42AM
Hi, all, I'am working a module that simply send out a few set cookie header
the module works fine under 'HEAD' request, but for 'GET' request, I find that some bytes must be put into output buffer or nginx will not write anything to clien, eg:
[code]
r->headers_out.status = NGX_HTTP_OK;
r->headers_out.content_length_n = 0;

b->pos = (u_char *) ' ';
b->last = b->pos + 1;
b->memory = 1;
b->last_buf = 1;

out.buf = b;
out.next = NULL;

if (ngx_http_send_header(r))
return NGX_ERROR;
return ngx_http_output_filter(r, &out);
[/code]

but in some modules, this job could be done by just simply call ngx_http_send_header(), but does't work for me, any ideas?
[code]
if (r != r->main && of.size == 0) {
return ngx_http_send_header(r);
}
[/code]
Subject Author Posted

How to send a empty response

georgexsh August 11, 2009 05:42AM

Re: How to send a empty response

Piotr Sikora August 11, 2009 06:13AM

Re: How to send a empty response

georgexsh August 11, 2009 11:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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