nghttpx: Call request phase hook for pushed resource as well

This commit is contained in:
Tatsuhiro Tsujikawa 2015-09-06 15:21:36 +09:00
parent 28defbfb4a
commit 1b63e6d478
2 changed files with 18 additions and 1 deletions

View File

@ -289,7 +289,10 @@ and :rb:attr:`Nghttpx::Env#resp` respectively.
method is noop. *uri* can be absolute URI, absolute path or method is noop. *uri* can be absolute URI, absolute path or
relative path to the current request. For absolute or relative path to the current request. For absolute or
relative path, scheme and authority are inherited from the relative path, scheme and authority are inherited from the
current request. Currently, method is always GET. current request. Currently, method is always GET. nghttpx
will issue request to backend servers to fulfill this request.
The request and response phase hooks will be called for pushed
resource as well.
.. rb:class:: Response .. rb:class:: Response

View File

@ -587,6 +587,20 @@ int on_frame_send_callback(nghttp2_session *session, const nghttp2_frame *frame,
// downstream is in pending queue. // downstream is in pending queue.
auto ptr = downstream.get(); auto ptr = downstream.get();
upstream->add_pending_downstream(std::move(downstream)); upstream->add_pending_downstream(std::move(downstream));
#ifdef HAVE_MRUBY
auto worker = handler->get_worker();
auto mruby_ctx = worker->get_mruby_context();
if (mruby_ctx->run_on_request_proc(ptr) != 0) {
if (upstream->error_reply(ptr, 500) != 0) {
upstream->rst_stream(ptr, NGHTTP2_INTERNAL_ERROR);
return 0;
}
return 0;
}
#endif // HAVE_MRUBY
upstream->start_downstream(ptr); upstream->start_downstream(ptr);
return 0; return 0;