#define H1_MF_XFER_LEN 0x00000100 // message xfer size can be determined
#define H1_MF_XFER_ENC 0x00000200 // transfer-encoding is present
#define H1_MF_NO_PHDR 0x00000400 // don't add pseudo-headers in the header list
+#define H1_MF_HDRS_ONLY 0x00000800 // parse headers only
/* Note: for a connection to be persistent, we need this for the request :
* - one of CLEN or CHNK
* checked. In case of an unparsable response message, a negative value will be
* returned with h1m->err_pos and h1m->err_state matching the location and
* state where the error was met. Leading blank likes are tolerated but not
- * recommended.
+ * recommended. If flag H1_MF_HDRS_ONLY is set in h1m->flags, only headers are
+ * parsed and the start line is skipped. It is not required to set h1m->state
+ * nor h1m->next in this case.
*
* This function returns :
* -1 in case of error. In this case, h1m->err_state is filled (if h1m is
sl.st.status = 0;
skip_update = restarting = 0;
+ if (h1m->flags & H1_MF_HDRS_ONLY) {
+ state = H1_MSG_HDR_FIRST;
+ h1m->next = 0;
+ }
+ else if (h1m->state == H1_MSG_RQBEFORE || h1m->state == H1_MSG_RPBEFORE)
+ state = h1m->state;
+ else
+ restarting = 1;
+
ptr = start + h1m->next;
end = stop;
- state = h1m->state;
-
- if (state != H1_MSG_RQBEFORE && state != H1_MSG_RPBEFORE)
- restarting = 1;
if (unlikely(ptr >= end))
goto http_msg_ood;