summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_http_request.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_http_request.c')
-rw-r--r--src/nxt_http_request.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nxt_http_request.c b/src/nxt_http_request.c
index 3bcf3d94..e72a7492 100644
--- a/src/nxt_http_request.c
+++ b/src/nxt_http_request.c
@@ -7,6 +7,8 @@
#include <nxt_router.h>
#include <nxt_http.h>
+#include "nxt_http_filter.h"
+
static nxt_int_t nxt_http_validate_host(nxt_str_t *host, nxt_mp_t *mp);
static void nxt_http_request_start(nxt_task_t *task, void *obj, void *data);
@@ -262,6 +264,11 @@ nxt_http_request_create(nxt_task_t *task)
goto fail;
}
+ r->response_filters = nxt_list_create(mp, 1, sizeof(nxt_http_filter_handler_t));
+ if (nxt_slow_path(r->response_filters == NULL)) {
+ goto fail;
+ }
+
last = nxt_mp_zget(mp, NXT_BUF_SYNC_SIZE);
if (nxt_slow_path(last == NULL)) {
goto fail;
@@ -723,6 +730,12 @@ nxt_http_request_ws_frame_start(nxt_task_t *task, nxt_http_request_t *r,
void
nxt_http_request_send(nxt_task_t *task, nxt_http_request_t *r, nxt_buf_t *out)
{
+ nxt_http_filter_handler_t *filter;
+
+ nxt_list_each(filter, r->response_filters) {
+ filter->filter_handler(task, &out, filter->data);
+ } nxt_list_loop;
+
if (nxt_fast_path(r->proto.any != NULL)) {
nxt_http_proto[r->protocol].send(task, r, out);
}