Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
nginx 1.13.4: Fix compilation error
Browse files Browse the repository at this point in the history
Compilation of ngx_pagespeed broke with the following commit in
nginx: nginx/nginx@129b06d

This change intends to unbreak it while maintaining backwards
compatibility.

Fixes #1451
  • Loading branch information
oschaaf committed Aug 10, 2017
1 parent 54847f6 commit e17c0a9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 13 additions & 1 deletion src/ngx_pagespeed.cc
Expand Up @@ -3019,13 +3019,17 @@ ngx_int_t ps_preaccess_handler(ngx_http_request_t* r) {
ph = cmcf->phase_engine.handlers;

i = r->phase_handler;

// move handlers before try_files && content phase
// As of nginx 1.13.4 we will be right before the try_files module
#if (nginx_version < 1013004)
while (ph[i + 1].checker != ngx_http_core_try_files_phase &&
ph[i + 1].checker != ngx_http_core_content_phase) {
ph[i] = ph[i + 1];
ph[i].next--;
i++;
}
#endif

// insert ps phase handler
ph[i].checker = ps_phase_handler;
Expand Down Expand Up @@ -3081,8 +3085,16 @@ ngx_int_t ps_init(ngx_conf_t* cf) {
ngx_http_core_main_conf_t* cmcf = static_cast<ngx_http_core_main_conf_t*>(
ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module));

int phase = NGX_HTTP_PRECONTENT_PHASE;

// As of nginx 1.13.4, try_files has changed.
#if (nginx_version < 1013004)
phase = NGX_HTTP_PREACCESS_PHASE;
#endif

ngx_http_handler_pt* h = static_cast<ngx_http_handler_pt*>(
ngx_array_push(&cmcf->phases[NGX_HTTP_PREACCESS_PHASE].handlers));
ngx_array_push(&cmcf->phases[phase].handlers));

if (h == NULL) {
return NGX_ERROR;
}
Expand Down
2 changes: 1 addition & 1 deletion testing-dependencies/nginx
Submodule nginx updated 174 files

0 comments on commit e17c0a9

Please sign in to comment.