Hello,<div><br></div><div>I'm writing my first module (actually a copy from mod_strip with some simple modifications)</div><div><br></div><div>I have this simple function that for testing purposes should simply make a simple substitution of all chars to A. I used gdb and chain_link->buf->start indeed has all the characters replaced with A. However the output in the end is the original file without any other modification. </div>
<div><br></div><div>Could someone shed some light on this mistery? </div><div><br></div><div>Thanks</div><div><br></div><div>AM</div><div><br></div><div><div>static ngx_int_t</div><div>ngx_http_strip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)</div>
<div>{</div><div> ngx_http_strip_ctx_t *ctx;</div><div> ngx_chain_t *chain_link;</div><div><br></div><div><br></div><div> u_char *reader;</div><div> u_char *writer;</div><div><br></div><div> ngx_log_t *log;</div>
<div><br></div><div> log = r->connection->log;</div><div><br></div><div> ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "In strip strip body filter 1 ");</div><div><br></div><div> ctx = ngx_http_get_module_ctx(r, ngx_http_strip_filter_module);</div>
<div> if (ctx == NULL) {</div><div> ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "In strip strip body filter 2 ");</div><div> return ngx_http_next_body_filter(r, in);</div><div> }</div><div> ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "In strip strip body filter 3 ");</div>
<div><br></div><div><br></div><div> for (chain_link = in; chain_link; chain_link = chain_link->next) {</div><div> for (writer = chain_link->buf->pos, reader = chain_link->buf->pos; reader < chain_link->buf->last; reader++) { </div>
<div> ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "w: \"%c\"", *reader);</div><div><br></div><div> *reader = 'A' ; </div><div> if (reader < chain_link->buf->last) </div>
<div> *writer++ = *reader;</div><div> }</div><div> ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "In strip_body_filter writer: \"%s\"", writer);</div><div><br></div>
<div> chain_link->buf->last = writer;</div><div><br></div><div> } </div><div><br></div><div> return ngx_http_next_body_filter(r, in);</div><div>}</div></div><div><br></div>