[MEDIUM] do not add Connection: close in HTTP/1.0 mode

If we already are in HTTP/1.0 and if no connection: has been seen,
it is not necessary to add Connection: close.
This commit is contained in:
Willy Tarreau 2007-03-25 23:47:23 +02:00
parent 5eb0917954
commit 2807efdb02
1 changed files with 12 additions and 6 deletions

View File

@ -1695,10 +1695,13 @@ int process_cli(struct session *t)
/*
* 10: add "Connection: close" if needed and not yet set.
* Note that we do not need to add it in case of HTTP/1.0.
*/
if (((t->fe->options | t->be->beprm->options) & PR_O_HTTP_CLOSE) &&
!(t->flags & SN_CONN_CLOSED)) {
if (unlikely(http_header_add_tail2(req, &txn->req, &txn->hdr_idx,
if (!(t->flags & SN_CONN_CLOSED) &&
((t->fe->options | t->be->beprm->options) & PR_O_HTTP_CLOSE)) {
if ((unlikely(msg->sl.rq.v_l != 8) ||
unlikely(req->data[msg->som + msg->sl.rq.v + 7] != '0')) &&
unlikely(http_header_add_tail2(req, &txn->req, &txn->hdr_idx,
"Connection: close", 17)) < 0)
goto return_bad_req;
t->flags |= SN_CONN_CLOSED;
@ -2737,10 +2740,13 @@ int process_srv(struct session *t)
/*
* 8: add "Connection: close" if needed and not yet set.
* Note that we do not need to add it in case of HTTP/1.0.
*/
if (((t->fe->options | t->be->beprm->options) & PR_O_HTTP_CLOSE) &&
!(t->flags & SN_CONN_CLOSED)) {
if (unlikely(http_header_add_tail2(rep, &txn->rsp, &txn->hdr_idx,
if (!(t->flags & SN_CONN_CLOSED) &&
((t->fe->options | t->be->beprm->options) & PR_O_HTTP_CLOSE)) {
if ((unlikely(msg->sl.st.v_l != 8) ||
unlikely(req->data[msg->som + 7] != '0')) &&
unlikely(http_header_add_tail2(rep, &txn->rsp, &txn->hdr_idx,
"Connection: close", 17)) < 0)
goto return_bad_resp;
t->flags |= SN_CONN_CLOSED;