MINOR: h1: report in the h1m struct if the HTTP version is 1.1 or above

This will be needed for the mux to know how to process the Connection
header, and will save it from having to re-parse the request line since
it's captured on the fly.
This commit is contained in:
Willy Tarreau 2018-09-13 11:32:51 +02:00
parent db72da0432
commit ba5fbca33f
2 changed files with 12 additions and 0 deletions

View File

@ -140,6 +140,7 @@ enum h1m_state {
#define H1_MF_CHNK 0x00000002 // chunk present, exclusive with c-l
#define H1_MF_RESP 0x00000004 // this message is the response message
#define H1_MF_TOLOWER 0x00000008 // turn the header names to lower case
#define H1_MF_VER_11 0x00000010 // message indicates version 1.1 or above
/* basic HTTP/1 message state for use in parsers. The err_pos field is special,

View File

@ -896,6 +896,11 @@ int h1_headers_to_hdr_list(char *start, const char *stop,
*/
if (likely(!skip_update)) {
if ((sl.rq.v_l == 8) &&
((start[sl.rq.v + 5] > '1') ||
((start[sl.rq.v + 5] == '1') && (start[sl.rq.v + 7] >= '1'))))
h1m->flags |= H1_MF_VER_11;
if (unlikely(hdr_count >= hdr_num)) {
state = H1_MSG_RQVER;
goto http_output_full;
@ -979,6 +984,12 @@ int h1_headers_to_hdr_list(char *start, const char *stop,
if (likely(HTTP_IS_SPHT(*ptr))) {
sl.st.v_l = ptr - start;
if ((sl.st.v_l == 8) &&
((start[sl.st.v + 5] > '1') ||
((start[sl.st.v + 5] == '1') && (start[sl.st.v + 7] >= '1'))))
h1m->flags |= H1_MF_VER_11;
EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_rpver_sp, http_msg_ood, state, H1_MSG_RPVER_SP);
}
state = H1_MSG_RPVER;