oschaaf closed pull request #1559: Properly iterate modules looking for gzip commands URL: https://github.com/apache/incubator-pagespeed-ngx/pull/1559
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/src/ngx_gzip_setter.cc b/src/ngx_gzip_setter.cc index 68f6a0ac4..31414d614 100644 --- a/src/ngx_gzip_setter.cc +++ b/src/ngx_gzip_setter.cc @@ -108,10 +108,10 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) { #if (NGX_HTTP_GZIP) bool gzip_signature_mismatch = false; bool other_signature_mismatch = false; - for (int m = 0; ngx_modules[m] != NULL; m++) { - if (ngx_modules[m]->commands != NULL) { - for (int c = 0; ngx_modules[m]->commands[c].name.len; c++) { - ngx_command_t* current_command =& ngx_modules[m]->commands[c]; + for (int m = 0; cf->cycle->modules[m] != NULL; m++) { + if (cf->cycle->modules[m]->commands != NULL) { + for (int c = 0; cf->cycle->modules[m]->commands[c].name.len; c++) { + ngx_command_t* current_command =& cf->cycle->modules[m]->commands[c]; // We look for the gzip command, and the exact signature we trust // this means configured as an config location offset @@ -124,7 +124,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) { if (IsNgxFlagCommand(current_command)) { current_command->set = ngx_gzip_redirect_conf_set_flag_slot; gzip_command_.command_ = current_command; - gzip_command_.module_ = ngx_modules[m]; + gzip_command_.module_ = cf->cycle->modules[m]; enabled_ = 1; } else { ngx_conf_log_error( @@ -139,7 +139,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) { if (IsNgxEnumCommand(current_command)) { current_command->set = ngx_gzip_redirect_conf_set_enum_slot; gzip_http_version_command_.command_ = current_command; - gzip_http_version_command_.module_ = ngx_modules[m]; + gzip_http_version_command_.module_ = cf->cycle->modules[m]; } else { ngx_conf_log_error( NGX_LOG_WARN, cf, 0, @@ -153,7 +153,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) { if (IsNgxBitmaskCommand(current_command)) { current_command->set = ngx_gzip_redirect_conf_set_bitmask_slot; gzip_proxied_command_.command_ = current_command; - gzip_proxied_command_.module_ = ngx_modules[m]; + gzip_proxied_command_.module_ = cf->cycle->modules[m]; } else { ngx_conf_log_error( NGX_LOG_WARN, cf, 0, @@ -167,7 +167,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) { if (IsNgxHttpTypesCommand(current_command)) { current_command->set = ngx_gzip_redirect_http_types_slot; gzip_http_types_command_.command_ = current_command; - gzip_http_types_command_.module_ = ngx_modules[m]; + gzip_http_types_command_.module_ = cf->cycle->modules[m]; } else { ngx_conf_log_error( NGX_LOG_WARN, cf, 0, @@ -181,7 +181,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) { if (IsNgxFlagCommand(current_command)) { current_command->set = ngx_gzip_redirect_conf_set_flag_slot; gzip_vary_command_.command_ = current_command; - gzip_vary_command_.module_ = ngx_modules[m]; + gzip_vary_command_.module_ = cf->cycle->modules[m]; } else { ngx_conf_log_error( NGX_LOG_WARN, cf, 0, ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services