From 6f52da834bb7bb7b21b5bc9577d82487d967e8fb Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 16 Apr 2016 18:52:14 +0900 Subject: [PATCH] nghttpx: Fix bug that server push from mruby script did not work --- src/shrpx_http2_upstream.cc | 3 ++- src/shrpx_upstream.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index d0267d89..29eca0b6 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -1893,7 +1893,8 @@ bool Http2Upstream::push_enabled() const { int Http2Upstream::initiate_push(Downstream *downstream, const StringRef &uri) { int rv; - if (uri.empty() || !push_enabled() || (downstream->get_stream_id() % 2)) { + if (uri.empty() || !push_enabled() || + (downstream->get_stream_id() % 2) == 0) { return 0; } diff --git a/src/shrpx_upstream.h b/src/shrpx_upstream.h index df96830e..f85bb776 100644 --- a/src/shrpx_upstream.h +++ b/src/shrpx_upstream.h @@ -68,6 +68,9 @@ public: virtual int send_reply(Downstream *downstream, const uint8_t *body, size_t bodylen) = 0; + // Starts server push. The |downstream| is an associated stream for + // the pushed resource. This function returns 0 if it succeeds, + // otherwise -1. virtual int initiate_push(Downstream *downstream, const StringRef &uri) = 0; // Fills response data in |iov| whose capacity is |iovcnt|. Returns