dovecot-2.2: lib-http: Minor change to make sure http_response_h...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jul 11 10:26:07 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/69cc86583da2
changeset: 16602:69cc86583da2
user: Timo Sirainen <tss at iki.fi>
date: Thu Jul 11 10:25:32 2013 +0300
description:
lib-http: Minor change to make sure http_response_header.size is always correct.
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().
diffstat:
src/lib-http/http-response-parser.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diffs (17 lines):
diff -r dbda2f84aeaa -r 69cc86583da2 src/lib-http/http-response-parser.c
--- a/src/lib-http/http-response-parser.c Thu Jul 11 10:19:43 2013 +0300
+++ b/src/lib-http/http-response-parser.c Thu Jul 11 10:25:32 2013 +0300
@@ -267,10 +267,12 @@
{
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]) {
More information about the dovecot-cvs
mailing list