Код: Выделить всё
ngx_int_t (*ngx_http_output_body_filter_pt)(ngx_http_request_t *r, ngx_chain_t *chain)
// A callback to a body filter. In modules this is normally used as follows:
static ngx_http_output_body_filter_pt ngx_http_next_body_filter;
// https://tengine.taobao.org/book/chapter_12.html#subrequest-99
typedef struct ngx_http_my_ctx_s {
const char* pattern_pending; // save the position if partial match
} ngx_http_my_ctx_t;
//https://serverfault.com/questions/480352/modify-data-being-proxied-by-nginx-on-the-fly
/* Intercepts HTTP Response Message Body by our module
* \param r the request structure pointer containing the details of a request and response
* \param chain the chained buffers containing the received response this time
*/
ngx_int_t ngx_http_output_body_filter_by_me(ngx_http_request_t *r, ngx_chain_t *chain) {
// TODO Auto-generated method stub
//logdf("%.*s", ARGS_NGX_STR(req->unparsed_uri));
const char* pattern = "substring";
size_t pattern_length = strlen(pattern);
const char* pattern_pending;
for (ngx_chain_t *cl = chain; cl; cl = cl->next) {
ngx_buf_t *buf = cl->buf;
// logdf("%.*s", (int)(buf->last - buf->pos), buf->pos);
for (u_char* pch = buf->pos; pch last; ++pch) {
// ctx->pattern_pending = pattern + pos;
}
}
}
< /code>
ссылки < /h1>
[*] Руководство пользователя Netty для 4.x - дело с транспортом на основе потока Модуль ngx_http_sub_module [*] openresty/reply-filter-nginx-module ngx_replace_filter -потоковая замена регулярного выражения в телах реагирования. Замените фильтр. Анатомия фильтра тела < /li>
< /ul>
nginx ссылки < /h1>
расширение nginx - api модуля - http api - структуры - ngx_http_request_t < /li>
extending nginx -api -api -api -api -api -api -api -api -api -api -api -api -api -api -api -api ngx_buf_t & ngx_chain_t
[*] Руководство по разработке Nginx - http - запрос (ngx_http_request_t)
[*] Руководство по разработке Nginx - Buffer
Руководство по разработке htt /> Руководство по разработке Nginx - HTTP - фильтры тела (ответ) < /li>
Расширение Nginx - Module API - HTTP API - обратные вызовы < /li>
< /ul>
Подробнее здесь: https://stackoverflow.com/questions/653 ... -algorithm
Мобильная версия