<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }div.foxdiv20150909075739302932 { }body { font-size: 10.5pt; font-family: 宋体; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<div><span></span>Hello,</div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">    Sorry,i</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;"> made a mistake in my last email.</span></div><div><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;">===========================================================================================</span></div><div><div>What I want to do:</div><div>Nginx Call header,body filter like this:</div><div>header filter1->header filter2->body filter1->body filter1 </div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"><br></span></div><div>Myself module is in:</div><div>header filter1->header filter2->body filter1->myself body filter->body filter2 </div><div><br></div><div>I want to save response buffer which <span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">body </span>filter1<span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"> rewrite to a file.</span></div></div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"><br></span></div>
<div> </div>
<hr style="WIDTH: 210px; HEIGHT: 1px" align="left" color="#b5c4df" size="1">
<div><span>hack988</span></div><blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;"><div> </div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"><div style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 12px;FONT-FAMILY:tahoma;COLOR:#000000; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px"><div><b>From:</b> <a href="mailto:hack988@163.com">hack988</a></div><div><b>Date:</b> 2015-09-08 23:43</div><div><b>To:</b> <a href="mailto:nginx-devel@nginx.org">nginx-devel</a></div><div><b>Subject:</b> Re: Re: How to get Original response before gzip or another module filter rewrite response</div></div></div><div><div class="FoxDiv20150909075739302932">
<div><span></span>Hello, </div><div>I has already read ngx_http_proxy_module.c twice(source code version 1.9.4),Sadness that i'm hadn't find <span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">ngx_write_chain_to_file or ngx_write_chain_to_temp_file function in this source file.</span></div><div>I found other code:</div><div>=================================================================================================</div><div><span style="background-color: rgba(0, 0, 0, 0);">line 1551</span></div><div><span style="background-color: rgba(0, 0, 0, 0);">  for ( ;; ) {
<br>        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
<br>                       "proxy output chunk: %d", ngx_buf_size(cl->buf));
<br>
<br>        size += ngx_buf_size(cl->buf);
<br>
<br>        if (cl->buf->flush
<br>            || cl->buf->sync
<br>            || ngx_buf_in_memory(cl->buf)
<br>            || cl->buf->in_file)
<br>        {
<br>            tl = ngx_alloc_chain_link(r->pool);
<br>            if (tl == NULL) {
<br>                return NGX_ERROR;
<br>            }
<br>
<br>            tl->buf = cl->buf;
<br>            *ll = tl;
<br>            ll = &tl->next;
<br>        }
<br>
<br>        if (cl->next == NULL) {
<br>            break;
<br>        }
<br>
<br>        cl = cl->next;
<br>    } <br></span></div><div><span style="background-color: rgba(0, 0, 0, 0);">line 1653</span></div><div><span style="background-color: rgba(0, 0, 0, 0);">out:
<br>
<br>    rc = ngx_chain_writer(&r->upstream->writer, out);</span></div><div><br></div>
<div>I guss that nginx get response from buffer and rewrite output buffer directly.</div><div>===============================================================================================</div><div>line 459</div><div><span style="background-color: rgba(0, 0, 0, 0);">   { ngx_string("proxy_cache_path"),
<br>      NGX_HTTP_MAIN_CONF|NGX_CONF_2MORE,
<br>      ngx_http_file_cache_set_slot,
<br>      NGX_HTTP_MAIN_CONF_OFFSET,
<br>      offsetof(ngx_http_proxy_main_conf_t, caches),
<br>      &ngx_http_proxy_module },</span></div><div><span style="background-color: rgba(0, 0, 0, 0);"><br></span></div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">proxy_cache_path is set to </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">ngx_http_proxy_main_conf_t-></span><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">caches varible,but it doesn't be used in proxy moudle's source code to write cache file.</span></div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">=================================================================================================</span></div><div>What I want to do:</div><div>Nginx Call header,body handler like this:</div><div>header handle1->header handler2->body handler1->body hander2 </div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"><br></span></div><div>Myself module is in:</div><div>header handle1->header handler2->body handler1->myself body handle->body hander2 </div><div><br></div><div>I want to save response buffer which <span style="font-size: 10.5pt; line-height: 1.5; background-color: window;">body handler1 rewrite to a file.</span></div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"><br></span></div><div><span style="font-size: 10.5pt; line-height: 1.5; background-color: window;"> </span></div><div><br></div>
<hr style="WIDTH: 210px; HEIGHT: 1px" align="left" color="#b5c4df" size="1">
<div><span>hack988</span></div><blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;"><div> </div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"><div style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 12px;FONT-FAMILY:tahoma;COLOR:#000000; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px"><div><b>From:</b> <a href="mailto:hungnv@opensource.com.vn">Hung Nguyen</a></div><div><b>Date:</b> 2015-09-08 11:01</div><div><b>To:</b> <a href="mailto:nginx-devel@nginx.org">nginx-devel</a></div><div><b>Subject:</b> Re: How to get Original response before gzip or another module filter rewrite response</div></div></div><div><div class="FoxDiv20150908215851780788" style="word-wrap: break-word; -webkit-line-break: after-white-space;"><div class="">Hello,</div><div class=""><br class=""></div><div class="">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. </div><div class="">Many nginx modules already use these function, take a look at ngx_http_proxy_module for more detail. </div><div class=""><br class=""></div><div class="">—</div><div class="">Hưng</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class="" style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;"><div class="">On Sep 7, 2015, at 9:07 PM, hack988 <<a href="mailto:hack988@163.com" class="">hack988@163.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span class=""></span>Hello everybody:</div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;" class="">   </span><span style="background-color: rgba(0, 0, 0, 0);" class=""><span class="Apple-converted-space"> </span>Is Anyone can anwer my question? thanks very mach; </span> </div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""> </div><hr align="left" size="1" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; width: 210px; height: 1px;" class=""><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span class="">hack988</span></div><blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class=""> </div><div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0cm 0cm;" class=""><div style="padding: 8px; font-size: 12px; font-family: tahoma; background-color: rgb(239, 239, 239);" class=""><div class=""><b class="">From:</b> <a href="mailto:hack988@163.com" class="">hack988</a></div><div class=""><b class="">Date:</b> 2015-09-05 21:20</div><div class=""><b class="">To:</b> <a href="mailto:nginx-devel@nginx.org" class="">nginx-devel</a></div><div class=""><b class="">Subject:</b> How to get Original response before gzip or another module filter rewrite response</div></div></div><div class=""><div class="FoxDiv20150907215924561246"><div class=""><span class=""></span> Dear All:</div><div class=""><span style="background-color: rgba(0, 0, 0, 0);" class="">    I'm a beginner for nginx development,</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;" class="">Although </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: rgba(0, 0, 0, 0);" class="">i'm read </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: rgba(0, 0, 0, 0);" class="">Emiller's Guide</span><span style="font-size: 10.5pt; line-height: 1.5; background-color: rgba(0, 0, 0, 0);" class=""> and another article about Nginx develop for </span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;" class="">several days,I still don't know how to read </span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;" class="">whole o</span><span style="background-color: rgba(0, 0, 0, 0); font-size: 10.5pt; line-height: 1.5;" class="">riginal </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: rgba(0, 0, 0, 0);" class="">response buffer chain<span class="Apple-converted-space"> </span></span><span style="font-size: 10.5pt; line-height: 1.5; background-color: rgba(0, 0, 0, 0);" class="">copy to myself module's </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: rgba(0, 0, 0, 0);" class="">temporary </span><span style="font-size: 10.5pt; line-height: 1.5; background-color: rgba(0, 0, 0, 0);" class="">buffer,before another module(gzip,gunzip,gzip_static) rewrite buffer.</span></div><div class="">How to check another module is written output buffer to diffrent content type?</div><div class="">I want to copy buffer to a file that no compress or chunked.</div><div class="">I'm sorry for my <span style="background-color: rgba(0, 0, 0, 0);" class=""><span class="Apple-converted-space"> </span>poor </span>english ,thx.</div><div class=""> </div><hr align="left" size="1" style="width: 210px; height: 1px;" class=""><div class=""><span class="">hack988</span></div></div></div></blockquote><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">nginx-devel mailing list</span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="mailto:nginx-devel@nginx.org" class="">nginx-devel@nginx.org</a></span><br style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 21px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class=""><a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" class="">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a></span></div></blockquote></div><br class=""></div></div></blockquote>
</div></div></blockquote>
</body></html>