|
|
|
@ -813,23 +813,6 @@ static chunk * connection_read_header_more(connection *con, chunkqueue *cq, chun
|
|
|
|
|
: NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
__attribute_hot__
|
|
|
|
|
static uint32_t connection_read_header_hoff(const char *n, const uint32_t clen, unsigned short hoff[8192]) {
|
|
|
|
|
uint32_t hlen = 0;
|
|
|
|
|
for (const char *b; (n = memchr((b = n),'\n',clen-hlen)); ++n) {
|
|
|
|
|
uint32_t x = (uint32_t)(n - b + 1);
|
|
|
|
|
hlen += x;
|
|
|
|
|
if (x <= 2 && (x == 1 || n[-1] == '\r')) {
|
|
|
|
|
hoff[hoff[0]+1] = hlen;
|
|
|
|
|
return hlen;
|
|
|
|
|
}
|
|
|
|
|
if (++hoff[0] >= /*sizeof(hoff)/sizeof(hoff[0])-1*/ 8192-1) break;
|
|
|
|
|
hoff[hoff[0]] = hlen;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
http_request_headers_process (request_st * const r, char * const hdrs, unsigned short * const hoff, const int scheme_port)
|
|
|
|
|
{
|
|
|
|
@ -904,8 +887,7 @@ static int connection_handle_read_state(connection * const con) {
|
|
|
|
|
hoff[1] = (unsigned short)c->offset; /* base offset for all lines */
|
|
|
|
|
/*hoff[2] = ...;*/ /* offset from base for 2nd line */
|
|
|
|
|
|
|
|
|
|
header_len =
|
|
|
|
|
connection_read_header_hoff(c->mem->ptr + c->offset, clen, hoff);
|
|
|
|
|
header_len = http_header_parse_hoff(c->mem->ptr + c->offset,clen,hoff);
|
|
|
|
|
|
|
|
|
|
/* casting to (unsigned short) might truncate, and the hoff[]
|
|
|
|
|
* addition might overflow, but max_request_field_size is USHRT_MAX,
|
|
|
|
|