From: Brian Pane Date: Thu, 22 Nov 2001 21:04:28 +0000 (+0000) Subject: added inlined string concatenation to form_header_field() for speed X-Git-Tag: 2.0.29~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=db91d6cf85890c1351e687ceb43bff4cb01459da;p=apache added inlined string concatenation to form_header_field() for speed git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92137 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 294a8d2537..450de1bc5f 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -749,9 +749,23 @@ static int form_header_field(header_struct *h, { char *headfield; apr_size_t len; - - headfield = apr_pstrcat(h->pool, fieldname, ": ", fieldval, CRLF, NULL); - len = strlen(headfield); + apr_size_t name_len; + apr_size_t val_len; + char *next; + + name_len = strlen(fieldname); + val_len = strlen(fieldval); + len = name_len + val_len + 4; /* 4 for ": " plus CRLF */ + headfield = (char *)apr_palloc(h->pool, len + 1); + memcpy(headfield, fieldname, name_len); + next = headfield + name_len; + *next++ = ':'; + *next++ = ' '; + memcpy(next, fieldval, val_len); + next += val_len; + *next++ = CR; + *next++ = LF; + *next = 0; ap_xlate_proto_to_ascii(headfield, len); apr_brigade_write(h->bb, NULL, NULL, headfield, len); return 1;