The current http-header-parser already guaranteed that it is, but this
change just adds extra guarantees that it won't break in future. Besides,
this change improves the performance slightly by avoiding strlen().
{
struct http_response_header *hdr;
struct http_parser hparser;
+ void *value;
hdr = array_append_space(&parser->response->headers);
hdr->key = p_strdup(parser->response_pool, name);
- hdr->value = p_strndup(parser->response_pool, data, size);
+ hdr->value = value = p_malloc(parser->response_pool, size+1);
+ memcpy(value, data, size);
hdr->size = size;
switch (name[0]) {