#define H1_MF_CLEN 0x00000001 // content-length present
#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
/* basic HTTP/1 message state for use in parsers. The err_pos field is special,
/* assumes sol points to the first char */
if (likely(HTTP_IS_TOKEN(*ptr))) {
/* turn it to lower case if needed */
- if (isupper((unsigned char)*ptr))
+ if (isupper((unsigned char)*ptr) && h1m->flags & H1_MF_TOLOWER)
*ptr = tolower(*ptr);
EAT_AND_JUMP_OR_RETURN(ptr, end, http_msg_hdr_name, http_msg_ood, state, H1_MSG_HDR_NAME);
}
h1m->flags |= H1_MF_CLEN;
h1m->curr_len = h1m->body_len = 0;
}
- else if (isteq(n, ist("transfer-encoding"))) {
+ else if (isteqi(n, ist("transfer-encoding"))) {
h1m->flags &= ~H1_MF_CLEN;
h1m->flags |= H1_MF_CHNK;
}
- else if (isteq(n, ist("content-length")) && !(h1m->flags & H1_MF_CHNK)) {
+ else if (isteqi(n, ist("content-length")) && !(h1m->flags & H1_MF_CHNK)) {
h1m->flags |= H1_MF_CLEN;
strl2llrc(v.ptr, v.len, &cl);
h1m->curr_len = h1m->body_len = cl;
h2s->rxbuf = BUF_NULL;
h1m_init_res(&h2s->h1m);
h2s->h1m.err_pos = -1; // don't care about errors on the response path
+ h2s->h1m.flags |= H1_MF_TOLOWER;
h2s->by_id.key = h2s->id = id;
h2c->max_id = id;
/* we'll let the caller check if it has more headers to send */
h1m_init_res(h1m);
h1m->err_pos = -1; // don't care about errors on the response path
+ h2s->h1m.flags |= H1_MF_TOLOWER;
goto end;
}