CLEANUP: http: remove the useless "if (1)" inherited from version 1.4

This block has been enclosed inside an "if (1)" statement when migrating
1.3 to 1.4 to avoid a massive reindent. Let's get rid of it now.
This commit is contained in:
Willy Tarreau 2014-04-24 21:13:57 +02:00
parent f1fd9dc8fb
commit 5897567273

View File

@ -5856,9 +5856,8 @@ int http_process_res_common(struct session *s, struct channel *rep, int an_bit,
/* we want to have the response time before we start processing it */ /* we want to have the response time before we start processing it */
s->logs.t_data = tv_ms_elapsed(&s->logs.tv_accept, &now); s->logs.t_data = tv_ms_elapsed(&s->logs.tv_accept, &now);
if (1) {
/* /*
* 3: we will have to evaluate the filters. * We will have to evaluate the filters.
* As opposed to version 1.2, now they will be evaluated in the * As opposed to version 1.2, now they will be evaluated in the
* filters order and not in the header order. This means that * filters order and not in the header order. This means that
* each filter has to be validated among all headers. * each filter has to be validated among all headers.
@ -5934,27 +5933,25 @@ int http_process_res_common(struct session *s, struct channel *rep, int an_bit,
cur_proxy = s->fe; cur_proxy = s->fe;
} }
/* OK that's all we can do for 1xx responses */
if (unlikely(txn->status < 200)) if (unlikely(txn->status < 200))
goto skip_header_mangling; goto skip_header_mangling;
/* we don't have any 1xx status code now */
/* /*
* 4: check for server cookie. * Now check for a server cookie.
*/ */
if (s->be->cookie_name || s->be->appsession_name || s->fe->capture_name || if (s->be->cookie_name || s->be->appsession_name || s->fe->capture_name ||
(s->be->options & PR_O_CHK_CACHE)) (s->be->options & PR_O_CHK_CACHE))
manage_server_side_cookies(s, rep); manage_server_side_cookies(s, rep);
/* /*
* 5: check for cache-control or pragma headers if required. * Check for cache-control or pragma headers if required.
*/ */
if ((s->be->options & PR_O_CHK_CACHE) || (s->be->ck_opts & PR_CK_NOC)) if ((s->be->options & PR_O_CHK_CACHE) || (s->be->ck_opts & PR_CK_NOC))
check_response_for_cacheability(s, rep); check_response_for_cacheability(s, rep);
/* /*
* 6: add server cookie in the response if needed * Add server cookie in the response if needed
*/ */
if (objt_server(s->target) && (s->be->ck_opts & PR_CK_INS) && if (objt_server(s->target) && (s->be->ck_opts & PR_CK_INS) &&
!((txn->flags & TX_SCK_FOUND) && (s->be->ck_opts & PR_CK_PSV)) && !((txn->flags & TX_SCK_FOUND) && (s->be->ck_opts & PR_CK_PSV)) &&
@ -6034,14 +6031,13 @@ int http_process_res_common(struct session *s, struct channel *rep, int an_bit,
} }
/* /*
* 7: check if result will be cacheable with a cookie. * Check if result will be cacheable with a cookie.
* We'll block the response if security checks have caught * We'll block the response if security checks have caught
* nasty things such as a cacheable cookie. * nasty things such as a cacheable cookie.
*/ */
if (((txn->flags & (TX_CACHEABLE | TX_CACHE_COOK | TX_SCK_PRESENT)) == if (((txn->flags & (TX_CACHEABLE | TX_CACHE_COOK | TX_SCK_PRESENT)) ==
(TX_CACHEABLE | TX_CACHE_COOK | TX_SCK_PRESENT)) && (TX_CACHEABLE | TX_CACHE_COOK | TX_SCK_PRESENT)) &&
(s->be->options & PR_O_CHK_CACHE)) { (s->be->options & PR_O_CHK_CACHE)) {
/* we're in presence of a cacheable response containing /* we're in presence of a cacheable response containing
* a set-cookie header. We'll block it as requested by * a set-cookie header. We'll block it as requested by
* the 'checkcache' option, and send an alert. * the 'checkcache' option, and send an alert.
@ -6063,7 +6059,7 @@ int http_process_res_common(struct session *s, struct channel *rep, int an_bit,
} }
/* /*
* 8: adjust "Connection: close" or "Connection: keep-alive" if needed. * Adjust "Connection: close" or "Connection: keep-alive" if needed.
* If an "Upgrade" token is found, the header is left untouched in order * If an "Upgrade" token is found, the header is left untouched in order
* not to have to deal with some client bugs : some of them fail an upgrade * not to have to deal with some client bugs : some of them fail an upgrade
* if anything but "Upgrade" is present in the Connection header. * if anything but "Upgrade" is present in the Connection header.
@ -6099,11 +6095,6 @@ int http_process_res_common(struct session *s, struct channel *rep, int an_bit,
(txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_TUN) (txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_TUN)
rep->analysers |= AN_RES_HTTP_XFER_BODY; rep->analysers |= AN_RES_HTTP_XFER_BODY;
/*************************************************************
* OK, that's finished for the headers. We have done what we *
* could. Let's switch to the DATA state. *
************************************************************/
/* if the user wants to log as soon as possible, without counting /* if the user wants to log as soon as possible, without counting
* bytes from the server, then this is the right moment. We have * bytes from the server, then this is the right moment. We have
* to temporarily assign bytes_out to log what we currently have. * to temporarily assign bytes_out to log what we currently have.
@ -6114,13 +6105,6 @@ int http_process_res_common(struct session *s, struct channel *rep, int an_bit,
s->do_log(s); s->do_log(s);
s->logs.bytes_out = 0; s->logs.bytes_out = 0;
} }
/* Note: we must not try to cheat by jumping directly to DATA,
* otherwise we would not let the client side wake up.
*/
return 1;
}
return 1; return 1;
} }