BUG/MINOR: mux-h1: Remove the connection header when it is useless
When the connection mode can be deduced from the HTTP version, we remove the redundant connection header. So "keep-alive" connection header is removed from HTTP/1.1 messages and "close" connection header is remove from HTTP/1.0 messages.
This commit is contained in:
parent
e2778a43d4
commit
ce85149629
24
src/mux_h1.c
24
src/mux_h1.c
|
@ -689,6 +689,12 @@ static void h1_update_req_conn_hdr(struct h1s *h1s, struct h1m *h1m,
|
|||
if (htx)
|
||||
h1_add_conn_hdr(h1m, htx, ist("keep-alive"));
|
||||
}
|
||||
if ((h1m->flags & (H1_MF_VER_11|H1_MF_CONN_KAL)) == (H1_MF_VER_11|H1_MF_CONN_KAL)) {
|
||||
if (conn_val)
|
||||
*conn_val = ist("");
|
||||
if (htx)
|
||||
h1_remove_conn_hdrs(h1m, htx);
|
||||
}
|
||||
}
|
||||
else { /* H1S_F_WANT_CLO && !PR_O2_FAKE_KA */
|
||||
if (h1m->flags & H1_MF_CONN_KAL) {
|
||||
|
@ -703,6 +709,12 @@ static void h1_update_req_conn_hdr(struct h1s *h1s, struct h1m *h1m,
|
|||
if (htx)
|
||||
h1_add_conn_hdr(h1m, htx, ist("close"));
|
||||
}
|
||||
if ((h1m->flags & (H1_MF_VER_11|H1_MF_CONN_CLO)) == H1_MF_CONN_CLO) {
|
||||
if (conn_val)
|
||||
*conn_val = ist("");
|
||||
if (htx)
|
||||
h1_remove_conn_hdrs(h1m, htx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -728,6 +740,12 @@ static void h1_update_res_conn_hdr(struct h1s *h1s, struct h1m *h1m,
|
|||
if (htx)
|
||||
h1_add_conn_hdr(h1m, htx, ist("keep-alive"));
|
||||
}
|
||||
if ((h1m->flags & (H1_MF_VER_11|H1_MF_CONN_KAL)) == (H1_MF_VER_11|H1_MF_CONN_KAL)) {
|
||||
if (conn_val)
|
||||
*conn_val = ist("");
|
||||
if (htx)
|
||||
h1_remove_conn_hdrs(h1m, htx);
|
||||
}
|
||||
}
|
||||
else { /* H1S_F_WANT_CLO */
|
||||
if (h1m->flags & H1_MF_CONN_KAL) {
|
||||
|
@ -742,6 +760,12 @@ static void h1_update_res_conn_hdr(struct h1s *h1s, struct h1m *h1m,
|
|||
if (htx)
|
||||
h1_add_conn_hdr(h1m, htx, ist("close"));
|
||||
}
|
||||
if ((h1m->flags & (H1_MF_VER_11|H1_MF_CONN_CLO)) == H1_MF_CONN_CLO) {
|
||||
if (conn_val)
|
||||
*conn_val = ist("");
|
||||
if (htx)
|
||||
h1_remove_conn_hdrs(h1m, htx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue