nghttpx: Fix crash with API request
This commit is contained in:
parent
0422f8a844
commit
32826466f5
|
@ -191,9 +191,11 @@ Downstream::~Downstream() {
|
|||
#ifdef HAVE_MRUBY
|
||||
if (dconn_) {
|
||||
const auto &group = dconn_->get_downstream_addr_group();
|
||||
if (group) {
|
||||
const auto &mruby_ctx = group->mruby_ctx;
|
||||
mruby_ctx->delete_downstream(this);
|
||||
}
|
||||
}
|
||||
#endif // HAVE_MRUBY
|
||||
|
||||
// DownstreamConnection may refer to this object. Delete it now
|
||||
|
@ -227,8 +229,10 @@ void Downstream::detach_downstream_connection() {
|
|||
|
||||
#ifdef HAVE_MRUBY
|
||||
const auto &group = dconn_->get_downstream_addr_group();
|
||||
if (group) {
|
||||
const auto &mruby_ctx = group->mruby_ctx;
|
||||
mruby_ctx->delete_downstream(this);
|
||||
}
|
||||
#endif // HAVE_MRUBY
|
||||
|
||||
dconn_->detach_downstream(this);
|
||||
|
@ -250,8 +254,10 @@ std::unique_ptr<DownstreamConnection> Downstream::pop_downstream_connection() {
|
|||
}
|
||||
|
||||
const auto &group = dconn_->get_downstream_addr_group();
|
||||
if (group) {
|
||||
const auto &mruby_ctx = group->mruby_ctx;
|
||||
mruby_ctx->delete_downstream(this);
|
||||
}
|
||||
#endif // HAVE_MRUBY
|
||||
|
||||
return std::unique_ptr<DownstreamConnection>(dconn_.release());
|
||||
|
|
|
@ -480,6 +480,7 @@ void Http2Upstream::initiate_downstream(Downstream *downstream) {
|
|||
|
||||
#ifdef HAVE_MRUBY
|
||||
const auto &group = dconn_ptr->get_downstream_addr_group();
|
||||
if (group) {
|
||||
const auto &mruby_ctx = group->mruby_ctx;
|
||||
if (mruby_ctx->run_on_request_proc(downstream) != 0) {
|
||||
if (error_reply(downstream, 500) != 0) {
|
||||
|
@ -494,6 +495,7 @@ void Http2Upstream::initiate_downstream(Downstream *downstream) {
|
|||
if (downstream->get_response_state() == Downstream::MSG_COMPLETE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // HAVE_MRUBY
|
||||
|
||||
rv = downstream->push_request_headers();
|
||||
|
@ -1635,6 +1637,7 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) {
|
|||
if (!downstream->get_non_final_response()) {
|
||||
auto dconn = downstream->get_downstream_connection();
|
||||
const auto &group = dconn->get_downstream_addr_group();
|
||||
if (group) {
|
||||
const auto &dmruby_ctx = group->mruby_ctx;
|
||||
|
||||
if (dmruby_ctx->run_on_response_proc(downstream) != 0) {
|
||||
|
@ -1648,6 +1651,7 @@ int Http2Upstream::on_downstream_header_complete(Downstream *downstream) {
|
|||
if (downstream->get_response_state() == Downstream::MSG_COMPLETE) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
auto worker = handler_->get_worker();
|
||||
auto mruby_ctx = worker->get_mruby_context();
|
||||
|
|
|
@ -442,6 +442,7 @@ int htp_hdrs_completecb(http_parser *htp) {
|
|||
|
||||
#ifdef HAVE_MRUBY
|
||||
const auto &group = dconn_ptr->get_downstream_addr_group();
|
||||
if (group) {
|
||||
const auto &dmruby_ctx = group->mruby_ctx;
|
||||
|
||||
if (dmruby_ctx->run_on_request_proc(downstream) != 0) {
|
||||
|
@ -452,6 +453,7 @@ int htp_hdrs_completecb(http_parser *htp) {
|
|||
if (downstream->get_response_state() == Downstream::MSG_COMPLETE) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif // HAVE_MRUBY
|
||||
|
||||
rv = downstream->push_request_headers();
|
||||
|
@ -1050,6 +1052,7 @@ int HttpsUpstream::on_downstream_header_complete(Downstream *downstream) {
|
|||
#ifdef HAVE_MRUBY
|
||||
if (!downstream->get_non_final_response()) {
|
||||
const auto &group = dconn->get_downstream_addr_group();
|
||||
if (group) {
|
||||
const auto &dmruby_ctx = group->mruby_ctx;
|
||||
|
||||
if (dmruby_ctx->run_on_response_proc(downstream) != 0) {
|
||||
|
@ -1060,6 +1063,7 @@ int HttpsUpstream::on_downstream_header_complete(Downstream *downstream) {
|
|||
if (downstream->get_response_state() == Downstream::MSG_COMPLETE) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
auto worker = handler_->get_worker();
|
||||
auto mruby_ctx = worker->get_mruby_context();
|
||||
|
|
Loading…
Reference in New Issue