How to get Original response before gzip or another module filter rewrite response I made a mistake
hack988
hack988 at 163.com
Wed Sep 9 00:01:44 UTC 2015
Hello,
Sorry,i made a mistake in my last email.
===========================================================================================
What I want to do:
Nginx Call header,body filter like this:
header filter1->header filter2->body filter1->body filter1
Myself module is in:
header filter1->header filter2->body filter1->myself body filter->body filter2
I want to save response buffer which body filter1 rewrite to a file.
hack988
From: hack988
Date: 2015-09-08 23:43
To: nginx-devel
Subject: Re: Re: How to get Original response before gzip or another module filter rewrite response
Hello,
I has already read ngx_http_proxy_module.c twice(source code version 1.9.4),Sadness that i'm hadn't find ngx_write_chain_to_file or ngx_write_chain_to_temp_file function in this source file.
I found other code:
=================================================================================================
line 1551
for ( ;; ) {
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"proxy output chunk: %d", ngx_buf_size(cl->buf));
size += ngx_buf_size(cl->buf);
if (cl->buf->flush
|| cl->buf->sync
|| ngx_buf_in_memory(cl->buf)
|| cl->buf->in_file)
{
tl = ngx_alloc_chain_link(r->pool);
if (tl == NULL) {
return NGX_ERROR;
}
tl->buf = cl->buf;
*ll = tl;
ll = &tl->next;
}
if (cl->next == NULL) {
break;
}
cl = cl->next;
}
line 1653
out:
rc = ngx_chain_writer(&r->upstream->writer, out);
I guss that nginx get response from buffer and rewrite output buffer directly.
===============================================================================================
line 459
{ ngx_string("proxy_cache_path"),
NGX_HTTP_MAIN_CONF|NGX_CONF_2MORE,
ngx_http_file_cache_set_slot,
NGX_HTTP_MAIN_CONF_OFFSET,
offsetof(ngx_http_proxy_main_conf_t, caches),
&ngx_http_proxy_module },
proxy_cache_path is set to ngx_http_proxy_main_conf_t->caches varible,but it doesn't be used in proxy moudle's source code to write cache file.
=================================================================================================
What I want to do:
Nginx Call header,body handler like this:
header handle1->header handler2->body handler1->body hander2
Myself module is in:
header handle1->header handler2->body handler1->myself body handle->body hander2
I want to save response buffer which body handler1 rewrite to a file.
hack988
From: Hung Nguyen
Date: 2015-09-08 11:01
To: nginx-devel
Subject: Re: How to get Original response before gzip or another module filter rewrite response
Hello,
I don’t know which context you are trying to do, but in order to write a chain buffer (this’s what contain nginx’s response) to file, you can use ngx_write_chain_to_file or ngx_write_chain_to_temp_file function.
Many nginx modules already use these function, take a look at ngx_http_proxy_module for more detail.
—
Hưng
On Sep 7, 2015, at 9:07 PM, hack988 <hack988 at 163.com> wrote:
Hello everybody:
Is Anyone can anwer my question? thanks very mach;
hack988
From: hack988
Date: 2015-09-05 21:20
To: nginx-devel
Subject: How to get Original response before gzip or another module filter rewrite response
Dear All:
I'm a beginner for nginx development,Although i'm read Emiller's Guide and another article about Nginx develop for several days,I still don't know how to read whole original response buffer chain copy to myself module's temporary buffer,before another module(gzip,gunzip,gzip_static) rewrite buffer.
How to check another module is written output buffer to diffrent content type?
I want to copy buffer to a file that no compress or chunked.
I'm sorry for my poor english ,thx.
hack988
_______________________________________________
nginx-devel mailing list
nginx-devel at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20150909/6001e85d/attachment.html>
More information about the nginx-devel
mailing list