MINOR: frontend: initialize HTTP layer after the debugging code

For HTTP/2 we'll have to choose the upper layer based on the
advertised protocol name here and we want to keep debugging,
so let's move debugging earlier.
This commit is contained in:
Willy Tarreau 2016-12-04 18:39:22 +01:00
parent 9b82d941c5
commit 0a6bed2394

View File

@ -57,30 +57,6 @@ int frontend_accept(struct stream *s)
struct listener *l = sess->listener; struct listener *l = sess->listener;
struct proxy *fe = sess->fe; struct proxy *fe = sess->fe;
if (unlikely(fe->nb_req_cap > 0)) {
if ((s->req_cap = pool_alloc2(fe->req_cap_pool)) == NULL)
goto out_return; /* no memory */
memset(s->req_cap, 0, fe->nb_req_cap * sizeof(void *));
}
if (unlikely(fe->nb_rsp_cap > 0)) {
if ((s->res_cap = pool_alloc2(fe->rsp_cap_pool)) == NULL)
goto out_free_reqcap; /* no memory */
memset(s->res_cap, 0, fe->nb_rsp_cap * sizeof(void *));
}
if (fe->http_needed) {
/* we have to allocate header indexes only if we know
* that we may make use of them. This of course includes
* (mode == PR_MODE_HTTP).
*/
if (unlikely(!http_alloc_txn(s)))
goto out_free_rspcap; /* no memory */
/* and now initialize the HTTP transaction state */
http_init_txn(s);
}
if ((fe->mode == PR_MODE_TCP || fe->mode == PR_MODE_HTTP) if ((fe->mode == PR_MODE_TCP || fe->mode == PR_MODE_HTTP)
&& (!LIST_ISEMPTY(&fe->logsrvs))) { && (!LIST_ISEMPTY(&fe->logsrvs))) {
if (likely(!LIST_ISEMPTY(&fe->logformat))) { if (likely(!LIST_ISEMPTY(&fe->logformat))) {
@ -141,6 +117,30 @@ int frontend_accept(struct stream *s)
if (fe->mode == PR_MODE_HTTP) if (fe->mode == PR_MODE_HTTP)
s->req.flags |= CF_READ_DONTWAIT; /* one read is usually enough */ s->req.flags |= CF_READ_DONTWAIT; /* one read is usually enough */
if (unlikely(fe->nb_req_cap > 0)) {
if ((s->req_cap = pool_alloc2(fe->req_cap_pool)) == NULL)
goto out_return; /* no memory */
memset(s->req_cap, 0, fe->nb_req_cap * sizeof(void *));
}
if (unlikely(fe->nb_rsp_cap > 0)) {
if ((s->res_cap = pool_alloc2(fe->rsp_cap_pool)) == NULL)
goto out_free_reqcap; /* no memory */
memset(s->res_cap, 0, fe->nb_rsp_cap * sizeof(void *));
}
if (fe->http_needed) {
/* we have to allocate header indexes only if we know
* that we may make use of them. This of course includes
* (mode == PR_MODE_HTTP).
*/
if (unlikely(!http_alloc_txn(s)))
goto out_free_rspcap; /* no memory */
/* and now initialize the HTTP transaction state */
http_init_txn(s);
}
/* everything's OK, let's go on */ /* everything's OK, let's go on */
return 1; return 1;