diff --git a/include/types/protocols.h b/include/types/protocols.h index 0816351f6..4c64551bb 100644 --- a/include/types/protocols.h +++ b/include/types/protocols.h @@ -88,6 +88,7 @@ struct listener { void (*handler)(struct task *t, int *next); /* protocol handler */ int *timeout; /* pointer to client-side timeout */ void *private; /* any private data which may be used by accept() */ + unsigned int analysers; /* bitmap of required protocol analysers */ union { /* protocol-dependant access restrictions */ struct { /* UNIX socket permissions */ uid_t uid; /* -1 to leave unchanged */ diff --git a/src/cfgparse.c b/src/cfgparse.c index 5f4e1238a..df297b6ab 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -46,6 +46,7 @@ #include #include #include +#include #include @@ -3218,6 +3219,13 @@ int readcfgfile(const char *file) listener->timeout = &curproxy->timeout.client; listener->accept = event_accept; listener->private = curproxy; + listener->handler = process_session; + + if (curproxy->mode == PR_MODE_HTTP) + listener->analysers |= AN_REQ_HTTP_HDR; + + if (curproxy->tcp_req.inspect_delay) + listener->analysers |= AN_REQ_INSPECT; listener = listener->next; } diff --git a/src/client.c b/src/client.c index bf7f55c7e..65ffdaae6 100644 --- a/src/client.c +++ b/src/client.c @@ -153,7 +153,7 @@ int event_accept(int fd) { setsockopt(cfd, SOL_SOCKET, SO_LINGER, (struct linger *) &nolinger, sizeof(struct linger)); task_init(t); - t->process = process_session; + t->process = l->handler; t->context = s; s->task = t; @@ -366,11 +366,8 @@ int event_accept(int fd) { if (p->mode == PR_MODE_HTTP) /* reserve some space for header rewriting */ s->req->rlim -= MAXREWRITE; - if (s->fe->tcp_req.inspect_delay) - s->req->analysers |= AN_REQ_INSPECT; - - if (p->mode == PR_MODE_HTTP) - s->req->analysers |= AN_REQ_HTTP_HDR; + /* activate default analysers enabled for this listener */ + s->req->analysers = l->analysers; if (!s->req->analysers) buffer_write_ena(s->req); /* don't wait to establish connection */