You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2016/02/26 16:56:20 UTC

svn commit: r1732507 - /httpd/httpd/trunk/modules/http2/h2_push.c

Author: icing
Date: Fri Feb 26 15:56:20 2016
New Revision: 1732507

URL: http://svn.apache.org/viewvc?rev=1732507&view=rev
Log:
adding accep,accept-encoding headers from initiating request to push promises

Modified:
    httpd/httpd/trunk/modules/http2/h2_push.c

Modified: httpd/httpd/trunk/modules/http2/h2_push.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http2/h2_push.c?rev=1732507&r1=1732506&r2=1732507&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/http2/h2_push.c (original)
+++ httpd/httpd/trunk/modules/http2/h2_push.c Fri Feb 26 15:56:20 2016
@@ -276,9 +276,16 @@ static int same_authority(const h2_reque
     return 1;
 }
 
-static int set_header(void *ctx, const char *key, const char *value) 
+static int set_push_header(void *ctx, const char *key, const char *value) 
 {
-    apr_table_setn(ctx, key, value);
+    size_t klen = strlen(key);
+    if (H2_HD_MATCH_LIT("User-Agent", key, klen)
+        || H2_HD_MATCH_LIT("Accept", key, klen)
+        || H2_HD_MATCH_LIT("Accept-Encoding", key, klen)
+        || H2_HD_MATCH_LIT("Accept-Language", key, klen)
+        || H2_HD_MATCH_LIT("Cache-Control", key, klen)) {
+        apr_table_setn(ctx, key, value);
+    }
     return 1;
 }
 
@@ -338,11 +345,7 @@ static int add_push(link_ctx *ctx)
                         break;
                 }
                 headers = apr_table_make(ctx->pool, 5);
-                apr_table_do(set_header, headers, ctx->req->headers,
-                             "User-Agent",
-                             "Cache-Control",
-                             "Accept-Language",
-                             NULL);
+                apr_table_do(set_push_header, headers, ctx->req->headers, NULL);
                 req = h2_request_createn(0, ctx->pool, method, ctx->req->scheme,
                                          ctx->req->authority, path, headers,
                                          ctx->req->serialize);