You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2015/12/17 21:36:12 UTC
svn commit: r1720646 - /httpd/httpd/trunk/modules/http2/h2_alt_svc.c
Author: jailletc36
Date: Thu Dec 17 20:36:12 2015
New Revision: 1720646
URL: http://svn.apache.org/viewvc?rev=1720646&view=rev
Log:
Save a few cycles in 'h2_alt_svc_parse'.
Save a few bytes in the request pool if sending a 'Alt-Svc' Header.
Modified:
httpd/httpd/trunk/modules/http2/h2_alt_svc.c
Modified: httpd/httpd/trunk/modules/http2/h2_alt_svc.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_alt_svc.c?rev=1720646&r1=1720645&r2=1720646&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_alt_svc.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_alt_svc.c Thu Dec 17 20:36:12 2015
@@ -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_re
}
}
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;
}
-