MINOR: session: only call http_send_name_header() when changing the server

Till now we used to call the function until the connection established, which
means that the header rewriting was performed for nothing upon each even (eg:
uploaded contents) until the server responded or timed out.

Now we only call the function when we assign the server.
This commit is contained in:
Willy Tarreau 2013-04-07 18:19:16 +02:00
parent 9d9179b581
commit 1e5dfdad77

View File

@ -2194,14 +2194,9 @@ struct task *process_session(struct task *t)
*/
if (s->si[1].state != SI_ST_REQ)
sess_update_stream_int(s, &s->si[1]);
if (s->si[1].state == SI_ST_REQ)
if (s->si[1].state == SI_ST_REQ) {
sess_prepare_conn_req(s, &s->si[1]);
srv = objt_server(s->target);
if (s->si[1].state == SI_ST_ASS && srv && srv->rdr_len && (s->flags & SN_REDIRECTABLE))
http_perform_server_redirect(s, &s->si[1]);
} while (s->si[1].state == SI_ST_ASS);
/* Now we can add the server name to a header (if requested) */
/* check for HTTP mode and proxy server_name_hdr_name != NULL */
if ((s->flags & SN_BE_ASSIGNED) &&
@ -2211,6 +2206,12 @@ struct task *process_session(struct task *t)
}
}
srv = objt_server(s->target);
if (s->si[1].state == SI_ST_ASS && srv && srv->rdr_len && (s->flags & SN_REDIRECTABLE))
http_perform_server_redirect(s, &s->si[1]);
} while (s->si[1].state == SI_ST_ASS);
}
/* Benchmarks have shown that it's optimal to do a full resync now */
if (s->req->prod->state == SI_ST_DIS || s->req->cons->state == SI_ST_DIS)
goto resync_stream_interface;