]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Save a few cycles in 'h2_alt_svc_parse'.
authorChristophe Jaillet <jailletc36@apache.org>
Thu, 17 Dec 2015 20:36:12 +0000 (20:36 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Thu, 17 Dec 2015 20:36:12 +0000 (20:36 +0000)
Save a few bytes in the request pool if sending a 'Alt-Svc' Header.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1720646 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_alt_svc.c

index dea16af7ebefc56a85d276e8510c81d21a3f04c7..2ccea963c156d6f00e76944e8a108c76179b7163 100644 (file)
@@ -41,17 +41,18 @@ void h2_alt_svc_register_hooks(void)
  * - do not percent encode token values
  * - do not use quotation marks
  */
-h2_alt_svc *h2_alt_svc_parse(const char *s, apr_pool_t *pool) {
+h2_alt_svc *h2_alt_svc_parse(const char *s, apr_pool_t *pool)
+{
     const char *sep = ap_strchr_c(s, '=');
     if (sep) {
-        const char *alpn = apr_pstrndup(pool, s, sep - s);
+        const char *alpn = apr_pstrmemdup(pool, s, sep - s);
         const char *host = NULL;
         int port = 0;
         s = sep + 1;
         sep = ap_strchr_c(s, ':');  /* mandatory : */
         if (sep) {
             if (sep != s) {    /* optional host */
-                host = apr_pstrndup(pool, s, sep - s);
+                host = apr_pstrmemdup(pool, s, sep - s);
             }
             s = sep + 1;
             if (*s) {          /* must be a port number */
@@ -120,11 +121,10 @@ static int h2_alt_svc_handler(request_rec *r)
                 }
             }
             if (*alt_svc) {
-                apr_table_set(r->headers_out, "Alt-Svc", alt_svc);
+                apr_table_setn(r->headers_out, "Alt-Svc", alt_svc);
             }
         }
     }
     
     return DECLINED;
 }
-