[PATCH] HTTP/2: expose function to push single resource to modules

Alessandro Ghedini alessandro at ghedini.me
Thu Feb 8 16:52:59 UTC 2018


# HG changeset patch
# User Alessandro Ghedini <alessandro at ghedini.me>
# Date 1518108716 0
#      Thu Feb 08 16:51:56 2018 +0000
# Branch expose-push
# Node ID 1bb98b06d5536dfc80a407aabd8d06f9309f8df6
# Parent  a49af443656f2b65ca5de9d8cad5594f44e18ff7
HTTP/2: expose function to push single resource to modules.

This makes it possible for 3rd party modules to implement alternative
methods for deciding which resources to push to clients on a per-request
basis (e.g. by parsing HTML from the response body, by using a custom
Link header parser, ...).

No functional changes.

diff -r a49af443656f -r 1bb98b06d553 src/http/v2/ngx_http_v2.h
--- a/src/http/v2/ngx_http_v2.h	Thu Feb 08 12:11:30 2018 +0300
+++ b/src/http/v2/ngx_http_v2.h	Thu Feb 08 16:51:56 2018 +0000
@@ -304,6 +304,9 @@
 size_t ngx_http_v2_huff_encode(u_char *src, size_t len, u_char *dst,
     ngx_uint_t lower);
 
+ngx_int_t ngx_http_v2_push_resource(ngx_http_request_t *r, ngx_str_t *path,
+    ngx_str_t *authority);
+
 
 #define ngx_http_v2_prefix(bits)  ((1 << (bits)) - 1)
 
diff -r a49af443656f -r 1bb98b06d553 src/http/v2/ngx_http_v2_filter_module.c
--- a/src/http/v2/ngx_http_v2_filter_module.c	Thu Feb 08 12:11:30 2018 +0300
+++ b/src/http/v2/ngx_http_v2_filter_module.c	Thu Feb 08 16:51:56 2018 +0000
@@ -62,8 +62,6 @@
 
 
 static ngx_int_t ngx_http_v2_push_resources(ngx_http_request_t *r);
-static ngx_int_t ngx_http_v2_push_resource(ngx_http_request_t *r,
-    ngx_str_t *path, ngx_str_t *authority);
 
 static u_char *ngx_http_v2_string_encode(u_char *dst, u_char *src, size_t len,
     u_char *tmp, ngx_uint_t lower);
@@ -903,7 +901,7 @@
 }
 
 
-static ngx_int_t
+ngx_int_t
 ngx_http_v2_push_resource(ngx_http_request_t *r, ngx_str_t *path,
     ngx_str_t *authority)
 {


More information about the nginx-devel mailing list