Revert "stop crashing when unplugged" (#1400)

This is just for the branch. 1.12.34.2 will be marked as
stable, backing out this change avoids having to test a new
beta.

This reverts commit 149c47ace4.
This commit is contained in:
Otto van der Schaaf
2017-03-30 22:28:09 +02:00
committed by GitHub
parent 149c47ace4
commit b70c70ecb9
+8 -11
View File
@@ -749,11 +749,6 @@ ngx_command_t ps_commands[] = {
ngx_null_command
};
bool ps_disabled(ps_srv_conf_t* cfg_s) {
return cfg_s->server_context == NULL ||
cfg_s->server_context->config()->unplugged();
}
void ps_ignore_sigpipe() {
struct sigaction act;
ngx_memzero(&act, sizeof(act));
@@ -1196,7 +1191,7 @@ char* ps_merge_loc_conf(ngx_conf_t* cf, void* parent, void* child) {
ps_srv_conf_t* cfg_s = static_cast<ps_srv_conf_t*>(
ngx_http_conf_get_module_srv_conf(cf, ngx_pagespeed));
if (ps_disabled(cfg_s)) {
if (cfg_s->server_context == NULL) {
// Pagespeed options cannot be defined only in location blocks. There must
// be at least a single "pagespeed off" in the main block or a server
// block.
@@ -1703,7 +1698,7 @@ void ps_release_request_context(void* data) {
RequestRouting::Response ps_route_request(ngx_http_request_t* r) {
ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
if (ps_disabled(cfg_s)) {
if (!cfg_s->server_context->global_options()->enabled()) {
// Not enabled for this server block.
return RequestRouting::kPagespeedDisabled;
}
@@ -2282,7 +2277,8 @@ ngx_http_output_body_filter_pt ngx_http_next_body_filter;
// nginx so it can send them out to the browser.
ngx_int_t ps_html_rewrite_header_filter(ngx_http_request_t* r) {
ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
if (ps_disabled(cfg_s)) {
if (cfg_s->server_context == NULL) {
// Pagespeed is on for some server block but not this one.
return ngx_http_next_header_filter(r);
}
@@ -2366,7 +2362,8 @@ ngx_int_t ps_html_rewrite_header_filter(ngx_http_request_t* r) {
ngx_int_t ps_html_rewrite_body_filter(ngx_http_request_t* r, ngx_chain_t* in) {
ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
if (ps_disabled(cfg_s)) {
if (cfg_s->server_context == NULL) {
// Pagespeed is on for some server block but not this one.
return ngx_http_next_body_filter(r, in);
}
@@ -2890,8 +2887,8 @@ ngx_int_t ps_beacon_handler(ngx_http_request_t* r) {
// supply it to the user.
ngx_int_t ps_content_handler(ngx_http_request_t* r) {
ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
if (ps_disabled(cfg_s)) {
// Pagespeed is not on for this server block.
if (cfg_s->server_context == NULL) {
// Pagespeed is on for some server block but not this one.
return NGX_DECLINED;
}