Compare commits
26 Commits
jefftk-fix-travis
...
35
| Author | SHA1 | Date | |
|---|---|---|---|
| 11ba8ea542 | |||
| a760c28de8 | |||
| 01e99fb3ef | |||
| 93e72cf910 | |||
| 1beaa2efb1 | |||
| 8266c75867 | |||
| 8de5d7e443 | |||
| 49006858d1 | |||
| 11f67d9bc7 | |||
| 6f94abef67 | |||
| 662c1e1c5a | |||
| a897f64ce8 | |||
| 4d9e5fcb0c | |||
| 65761a2393 | |||
| 76500396ff | |||
| ef3899515e | |||
| c67f664244 | |||
| 54847f6d1d | |||
| 5631800479 | |||
| a7d1f91dc3 | |||
| 61b949c5e5 | |||
| 5b307745ce | |||
| f78058b6c4 | |||
| 8a0b080229 | |||
| cb56136fe1 | |||
| a4ac43e4d4 |
-18
@@ -1,18 +0,0 @@
|
||||
[submodule "testing-dependencies/mod_pagespeed"]
|
||||
path = testing-dependencies/mod_pagespeed
|
||||
url = https://github.com/pagespeed/mod_pagespeed.git
|
||||
[submodule "testing-dependencies/ngx_cache_purge"]
|
||||
path = testing-dependencies/ngx_cache_purge
|
||||
url = https://github.com/FRiCKLE/ngx_cache_purge.git
|
||||
[submodule "testing-dependencies/nginx"]
|
||||
path = testing-dependencies/nginx
|
||||
url = https://github.com/nginx/nginx.git
|
||||
[submodule "testing-dependencies/set-misc-nginx-module"]
|
||||
path = testing-dependencies/set-misc-nginx-module
|
||||
url = https://github.com/openresty/set-misc-nginx-module
|
||||
[submodule "testing-dependencies/ngx_devel_kit"]
|
||||
path = testing-dependencies/ngx_devel_kit
|
||||
url = https://github.com/simpl/ngx_devel_kit
|
||||
[submodule "testing-dependencies/headers-more-nginx-module"]
|
||||
path = testing-dependencies/headers-more-nginx-module
|
||||
url = https://github.com/openresty/headers-more-nginx-module
|
||||
|
||||
+5
-1
@@ -9,6 +9,9 @@ env:
|
||||
# jobs=8: 179s (29s to install new git, 150s to run the downloads)
|
||||
# We can't use --depth=1, though, because github doesn't have
|
||||
# allowReachableSHA1InWant set.
|
||||
#
|
||||
# TODO(jefftk): once we're running on a server with git 2.8 or later we can have
|
||||
# --jobs without installing a new git.
|
||||
git:
|
||||
submodules: false
|
||||
before_install:
|
||||
@@ -21,9 +24,10 @@ install:
|
||||
script:
|
||||
test/run_tests.sh $PWD/testing-dependencies/mod_pagespeed/ \
|
||||
$PWD/nginx/sbin/nginx
|
||||
dist: trusty
|
||||
sudo: required
|
||||
compiler:
|
||||
- gcc
|
||||
notifications:
|
||||
email:
|
||||
- jefftk@google.com
|
||||
- pagespeed-ci@googlegroups.com
|
||||
|
||||
+1
-4
@@ -1,4 +1 @@
|
||||
In a release this file would contain the URL to download the pre-compiled PSOL
|
||||
binary, but on development branches (like this one) you have to build PSOL from
|
||||
source yourself. See:
|
||||
https://github.com/pagespeed/ngx_pagespeed/wiki/Building-PSOL-From-Source
|
||||
https://dl.google.com/dl/page-speed/psol/1.13.35.2-$BIT_SIZE_NAME.tar.gz
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
# Environment Variables (Optional):
|
||||
# MOD_PAGESPEED_DIR: absolute path to the mod_pagespeed/src directory
|
||||
# PSOL_BINARY: absolute path to pagespeed_automatic.a
|
||||
# PSOL_BUILDTYPE: Release or Debug
|
||||
|
||||
mod_pagespeed_dir="${MOD_PAGESPEED_DIR:-unset}"
|
||||
position_aux="${POSITION_AUX:-unset}"
|
||||
psol_buildtype="${PSOL_BUILDTYPE:-unset}"
|
||||
|
||||
if [ "$mod_pagespeed_dir" = "unset" ] ; then
|
||||
mod_pagespeed_dir="$ngx_addon_dir/psol/include"
|
||||
@@ -75,12 +77,16 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$NGX_DEBUG" = "YES" ]; then
|
||||
buildtype=Debug
|
||||
# If we're using a psol tarball that doesn't contain Debug/ (which is the case
|
||||
# from 1.12 onward) then this will be overriden to buildtype=Release below.
|
||||
if [ "$psol_buildtype" = "unset" ] ; then
|
||||
if [ "$NGX_DEBUG" = "YES" ]; then
|
||||
buildtype=Debug
|
||||
# If we're using a psol tarball that doesn't contain Debug/ (which is the case
|
||||
# from 1.12 onward) then this will be overriden to buildtype=Release below.
|
||||
else
|
||||
buildtype=Release
|
||||
fi
|
||||
else
|
||||
buildtype=Release
|
||||
buildtype=$psol_buildtype
|
||||
fi
|
||||
|
||||
# If the compiler is gcc, we want to use g++ to link, if at all possible,
|
||||
@@ -198,7 +204,7 @@ pagespeed_include="\
|
||||
$mod_pagespeed_dir/url"
|
||||
ngx_feature_path="$pagespeed_include"
|
||||
|
||||
pagespeed_libs="$psol_binary $pagespeed_libs -lrt -pthread -lm"
|
||||
pagespeed_libs="$psol_binary $pagespeed_libs -lrt -pthread -lm -luuid"
|
||||
ngx_feature_libs="$pagespeed_libs"
|
||||
ngx_feature_test="
|
||||
|
||||
|
||||
@@ -80,6 +80,13 @@ Options:
|
||||
Assume the answer to all prompts is 'yes, please continue'. Intended for
|
||||
automated usage, such as buildbots.
|
||||
|
||||
-a, --additional-nginx-configure-arguments
|
||||
When running ./configure for nginx, you may want to specify additional
|
||||
arguments, such as --with-http_ssl_module. By default this script will
|
||||
pause and prompt you for them, but this option lets you pass them in. For
|
||||
example, you might do:
|
||||
-a '--with-http_ssl_module --with-cc-opt=\"-I /usr/local/include\"'
|
||||
|
||||
-d, --dryrun
|
||||
Don't make any changes to the system, just print what changes you
|
||||
would have made.
|
||||
@@ -302,10 +309,10 @@ function build_ngx_pagespeed() {
|
||||
fail "Your version of getopt is too old. Exiting with no changes made."
|
||||
fi
|
||||
|
||||
opts=$(getopt -o v:n:mb:pslt:ydh \
|
||||
opts=$(getopt -o v:n:mb:pslt:ya:dh \
|
||||
--longoptions ngx-pagespeed-version:,nginx-version:,dynamic-module \
|
||||
--longoptions buildir:,no-deps-check,psol-from-source,devel,build-type: \
|
||||
--longoptions assume-yes,dryrun,help \
|
||||
--longoptions assume-yes,additional-nginx-configure-arguments:,dryrun,help \
|
||||
-n "$(basename "$0")" -- "$@")
|
||||
if [ $? != 0 ]; then
|
||||
usage
|
||||
@@ -356,6 +363,10 @@ function build_ngx_pagespeed() {
|
||||
-y | --assume-yes) shift
|
||||
ASSUME_YES="true"
|
||||
;;
|
||||
-a | --additional-nginx-configure-arguments) shift
|
||||
ADDITIONAL_NGINX_CONFIGURE_ARGUMENTS="$1"
|
||||
shift
|
||||
;;
|
||||
-d | --dryrun) shift
|
||||
DRYRUN="true"
|
||||
;;
|
||||
@@ -475,7 +486,7 @@ add support for dynamic modules in a way compatible with ngx_pagespeed until
|
||||
status "Detected debian-based distro."
|
||||
|
||||
install_dependencies "apt-get install" debian_is_installed \
|
||||
"build-essential zlib1g-dev libpcre3 libpcre3-dev unzip"
|
||||
build-essential zlib1g-dev libpcre3 libpcre3-dev unzip uuid-dev
|
||||
|
||||
if gcc_too_old; then
|
||||
if [ ! -e /usr/lib/gcc-mozilla/bin/gcc ]; then
|
||||
@@ -493,7 +504,7 @@ add support for dynamic modules in a way compatible with ngx_pagespeed until
|
||||
status "Detected redhat-based distro."
|
||||
|
||||
install_dependencies "yum install" redhat_is_installed \
|
||||
"gcc-c++ pcre-devel zlib-devel make unzip wget"
|
||||
gcc-c++ pcre-devel zlib-devel make unzip wget libuuid-devel
|
||||
if gcc_too_old; then
|
||||
if [ ! -e /opt/rh/devtoolset-2/root/usr/bin/gcc ]; then
|
||||
redhat_major_version=$(
|
||||
@@ -623,7 +634,13 @@ Not deleting $directory; name is suspiciously short. Something is wrong."
|
||||
run make apache_debug_psol
|
||||
PSOL_BINARY="$MOD_PAGESPEED_DIR/out/$BUILD_TYPE/pagespeed_automatic.a"
|
||||
else
|
||||
run install/build_psol.sh --skip_tests --skip_packaging
|
||||
if "$DO_DEPS_CHECK"; then
|
||||
skip_deps_arg=""
|
||||
else
|
||||
skip_deps_arg="--skip_deps"
|
||||
fi
|
||||
|
||||
run install/build_psol.sh --skip_tests --skip_packaging "$skip_deps_arg"
|
||||
PSOL_BINARY="$MOD_PAGESPEED_DIR/pagespeed/automatic/pagespeed_automatic.a"
|
||||
fi
|
||||
run popd
|
||||
@@ -721,19 +738,26 @@ Not deleting $directory; name is suspiciously short. Something is wrong."
|
||||
run cd "$nginx_dir"
|
||||
|
||||
configure=("$configure_location/configure" "${configure_args[@]}")
|
||||
if ! "$ASSUME_YES"; then
|
||||
echo "About to build nginx. Do you have any additional ./configure"
|
||||
echo "arguments you would like to set? For example, if you would like"
|
||||
echo "to build nginx with https support give --with-http_ssl_module"
|
||||
echo "If you don't have any, just press enter."
|
||||
read -p "> " additional_configure_args
|
||||
if [ -n "$additional_configure_args" ]; then
|
||||
# Split additional_configure_args respecting any internal quotation.
|
||||
# Otherwise things like --with-cc-opt='-foo -bar' won't work.
|
||||
eval additional_configure_args=("$additional_configure_args")
|
||||
configure=("${configure[@]}" "${additional_configure_args[@]}")
|
||||
additional_configure_args=""
|
||||
if [ -z "${ADDITIONAL_NGINX_CONFIGURE_ARGUMENTS+x}" ]; then
|
||||
if ! "$ASSUME_YES"; then
|
||||
echo "About to build nginx. Do you have any additional ./configure"
|
||||
echo "arguments you would like to set? For example, if you would like"
|
||||
echo "to build nginx with https support give --with-http_ssl_module"
|
||||
echo "If you don't have any, just press enter."
|
||||
read -p "> " additional_configure_args
|
||||
fi
|
||||
else
|
||||
additional_configure_args="$ADDITIONAL_NGINX_CONFIGURE_ARGUMENTS"
|
||||
fi
|
||||
|
||||
if [ -n "$additional_configure_args" ]; then
|
||||
# Split additional_configure_args respecting any internal quotation.
|
||||
# Otherwise things like --with-cc-opt='-foo -bar' won't work.
|
||||
eval additional_configure_args=("$additional_configure_args")
|
||||
configure=("${configure[@]}" "${additional_configure_args[@]}")
|
||||
fi
|
||||
|
||||
echo "About to configure nginx with:"
|
||||
echo " $(quote_arguments "${configure[@]}")"
|
||||
continue_or_exit "Does this look right?"
|
||||
@@ -749,25 +773,13 @@ Not deleting $directory; name is suspiciously short. Something is wrong."
|
||||
if "$DEVEL"; then
|
||||
run make install
|
||||
|
||||
status "Nginx installed with ngx_pagespeed, and set up for testing."
|
||||
# TODO(jefftk): pull these out into separate scripts.
|
||||
echo "To run tests, pick a pair of ports like 8050 and 8051 and run:"
|
||||
status "Nginx installed with ngx_pagespeed, and set up for development."
|
||||
echo "To run tests:"
|
||||
echo " cd $nps_module_dir"
|
||||
echo " RUN_TESTS=true \\"
|
||||
echo " USE_VALGRIND=false \\"
|
||||
echo " TEST_NATIVE_FETCHER=false \\"
|
||||
echo " TEST_SERF_FETCHER=true \\"
|
||||
echo " test/run_tests.sh \\"
|
||||
echo " $MOD_PAGESPEED_DIR \\"
|
||||
echo " $install_dir/nginx/sbin/nginx"
|
||||
echo " test/run_tests.sh"
|
||||
echo
|
||||
echo "To rebuild after changes:"
|
||||
echo " First, if you change things in PSOL or update it:"
|
||||
echo " cd $MOD_PAGESPEED_DIR/devel"
|
||||
echo " make apache_debug_psol"
|
||||
echo " Then, whether or not you updated PSOL, rebuild nginx:"
|
||||
echo " cd $install_dir/nginx"
|
||||
echo " make && make install"
|
||||
echo " scripts/rebuild.sh"
|
||||
else
|
||||
continue_or_exit "Install nginx?"
|
||||
run sudo make install
|
||||
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2016 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Usage: scripts/rebuild.sh
|
||||
#
|
||||
# After building with "scripts/build_ngx_pagespeed.sh --devel", if you make
|
||||
# changes to ngx_pagespeed you'll need to rebuild it. The underlying commands
|
||||
# aren't complicated, but it's faster to work if it's automated.
|
||||
|
||||
set -e # exit script if any command returns an error
|
||||
set -u # exit the script if any variable is uninitialized
|
||||
|
||||
this_dir="$(dirname $0)"
|
||||
cd "$this_dir/.."
|
||||
nps_dir="$PWD"
|
||||
|
||||
cd "$nps_dir/testing-dependencies/mod_pagespeed/devel"
|
||||
make apache_debug_psol
|
||||
|
||||
cd "$nps_dir/testing-dependencies/nginx/"
|
||||
make
|
||||
make install
|
||||
@@ -52,6 +52,14 @@ bool NgxEventConnection::Init(ngx_cycle_t* cycle) {
|
||||
} else {
|
||||
pipe_read_fd_ = file_descriptors[0];
|
||||
pipe_write_fd_ = file_descriptors[1];
|
||||
// Attempt to bump the pipe capacity, because running out of buffer space
|
||||
// can potentially lead up to writes spinning on EAGAIN.
|
||||
// See https://github.com/pagespeed/ngx_pagespeed/issues/1380
|
||||
// TODO(oschaaf): Consider implementing a queueing mechanism for retrying
|
||||
// failed writes.
|
||||
#ifdef F_SETPIPE_SZ
|
||||
fcntl(pipe_write_fd_, F_SETPIPE_SZ, 200*1024 /* minimal amount of bytes */);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
close(file_descriptors[0]);
|
||||
|
||||
+47
-22
@@ -84,6 +84,7 @@ extern ngx_module_t ngx_pagespeed;
|
||||
|
||||
// Needed for SystemRewriteDriverFactory to use shared memory.
|
||||
#define PAGESPEED_SUPPORT_POSIX_SHARED_MEM
|
||||
#define NGINX_1_13_4 1013004
|
||||
|
||||
net_instaweb::NgxRewriteDriverFactory* active_driver_factory = NULL;
|
||||
|
||||
@@ -239,6 +240,9 @@ ngx_http_output_body_filter_pt ngx_http_next_body_filter;
|
||||
ngx_int_t ps_base_fetch_filter(ngx_http_request_t* r, ngx_chain_t* in) {
|
||||
ps_request_ctx_t* ctx = ps_get_request_context(r);
|
||||
|
||||
if (r->header_only) {
|
||||
return NGX_OK;
|
||||
}
|
||||
if (ctx == NULL || ctx->base_fetch == NULL) {
|
||||
return ngx_http_next_body_filter(r, in);
|
||||
}
|
||||
@@ -749,6 +753,11 @@ 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));
|
||||
@@ -881,8 +890,7 @@ char* ps_configure(ngx_conf_t* cf,
|
||||
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
||||
ngx_http_cycle_get_module_main_conf(cf->cycle, ngx_pagespeed));
|
||||
if (*options == NULL) {
|
||||
*options = new NgxRewriteOptions(
|
||||
cfg_m->driver_factory->thread_system());
|
||||
*options = new NgxRewriteOptions(cfg_m->driver_factory->thread_system());
|
||||
}
|
||||
|
||||
ProcessScriptVariablesMode script_mode =
|
||||
@@ -1148,13 +1156,17 @@ char* ps_merge_srv_conf(ngx_conf_t* cf, void* parent, void* child) {
|
||||
delete cfg_s->options;
|
||||
cfg_s->options = NULL;
|
||||
|
||||
if (cfg_s->server_context->global_options()->enabled()) {
|
||||
if (!cfg_s->server_context->global_options()->unplugged()) {
|
||||
// Validate FileCachePath
|
||||
GoogleMessageHandler handler;
|
||||
const char* file_cache_path =
|
||||
cfg_s->server_context->config()->file_cache_path().c_str();
|
||||
if (file_cache_path[0] == '\0') {
|
||||
return const_cast<char*>("FileCachePath must be set");
|
||||
if (!cfg_s->server_context->global_options()->standby()) {
|
||||
return const_cast<char*>("FileCachePath must be set, even for standby");
|
||||
} else {
|
||||
return const_cast<char*>("FileCachePath must be set");
|
||||
}
|
||||
} else if (!cfg_m->driver_factory->file_system()->IsDir(
|
||||
file_cache_path, &handler).is_true()) {
|
||||
return const_cast<char*>(
|
||||
@@ -1191,7 +1203,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 (cfg_s->server_context == NULL) {
|
||||
if (ps_disabled(cfg_s)) {
|
||||
// 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.
|
||||
@@ -1698,7 +1710,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 (!cfg_s->server_context->global_options()->enabled()) {
|
||||
if (ps_disabled(cfg_s)) {
|
||||
// Not enabled for this server block.
|
||||
return RequestRouting::kPagespeedDisabled;
|
||||
}
|
||||
@@ -1840,11 +1852,6 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
||||
options = cfg_s->server_context->global_options();
|
||||
}
|
||||
|
||||
if (!options->enabled()) {
|
||||
// Disabled via query params or request headers.
|
||||
return NGX_DECLINED;
|
||||
}
|
||||
|
||||
request_context->set_options(options->ComputeHttpOptions());
|
||||
|
||||
// ps_determine_options modified url, removing any ModPagespeedFoo=Bar query
|
||||
@@ -1871,6 +1878,14 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
||||
response_category == RequestRouting::kGlobalAdmin ||
|
||||
response_category == RequestRouting::kCachePurge;
|
||||
|
||||
// Normally if we're disabled we won't handle any requests, but if we're in
|
||||
// standby mode we do want to handle requests for .pagespeed. resources.
|
||||
if (options->unplugged() ||
|
||||
(!options->enabled() && !pagespeed_resource)) {
|
||||
// Disabled via query params or request headers.
|
||||
return NGX_DECLINED;
|
||||
}
|
||||
|
||||
if (!html_rewrite) {
|
||||
// create request ctx
|
||||
CHECK(ctx == NULL);
|
||||
@@ -2050,8 +2065,8 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
||||
if (options->in_place_rewriting_enabled() &&
|
||||
options->enabled() &&
|
||||
options->IsAllowed(url.Spec())) {
|
||||
ps_create_base_fetch(url.Spec(), ctx, request_context, request_headers.release(),
|
||||
kIproLookup, options);
|
||||
ps_create_base_fetch(url.Spec(), ctx, request_context,
|
||||
request_headers.release(), kIproLookup, options);
|
||||
|
||||
// Do not store driver in request_context, it's not safe.
|
||||
RewriteDriver* driver;
|
||||
@@ -2277,8 +2292,7 @@ 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 (cfg_s->server_context == NULL) {
|
||||
// Pagespeed is on for some server block but not this one.
|
||||
if (ps_disabled(cfg_s)) {
|
||||
return ngx_http_next_header_filter(r);
|
||||
}
|
||||
|
||||
@@ -2362,8 +2376,7 @@ 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 (cfg_s->server_context == NULL) {
|
||||
// Pagespeed is on for some server block but not this one.
|
||||
if (ps_disabled(cfg_s)) {
|
||||
return ngx_http_next_body_filter(r, in);
|
||||
}
|
||||
|
||||
@@ -2691,8 +2704,7 @@ ngx_int_t ps_simple_handler(ngx_http_request_t* r,
|
||||
}
|
||||
}
|
||||
|
||||
send_out_headers_and_body(r, response_headers, output);
|
||||
return NGX_OK;
|
||||
return send_out_headers_and_body(r, response_headers, output);
|
||||
}
|
||||
|
||||
void ps_beacon_handler_helper(ngx_http_request_t* r,
|
||||
@@ -2887,8 +2899,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 (cfg_s->server_context == NULL) {
|
||||
// Pagespeed is on for some server block but not this one.
|
||||
if (ps_disabled(cfg_s)) {
|
||||
// Pagespeed is not on for this server block.
|
||||
return NGX_DECLINED;
|
||||
}
|
||||
|
||||
@@ -3007,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 < NGINX_1_13_4)
|
||||
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;
|
||||
@@ -3069,8 +3085,17 @@ 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_PREACCESS_PHASE;
|
||||
|
||||
// As of nginx 1.13.4, try_files has changed.
|
||||
// https://github.com/nginx/nginx/commit/129b06dc5dfab7b4513a4f274b3778cd9b8a6a22
|
||||
#if (nginx_version >= NGINX_1_13_4)
|
||||
phase = NGX_HTTP_PRECONTENT_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;
|
||||
}
|
||||
|
||||
@@ -192,15 +192,18 @@ RewriteOptions::OptionScope NgxRewriteOptions::GetOptionScope(
|
||||
|
||||
RewriteOptions::OptionSettingResult NgxRewriteOptions::ParseAndSetOptions0(
|
||||
StringPiece directive, GoogleString* msg, MessageHandler* handler) {
|
||||
if (IsDirective(directive, "on")) {
|
||||
set_enabled(RewriteOptions::kEnabledOn);
|
||||
} else if (IsDirective(directive, "off")) {
|
||||
set_enabled(RewriteOptions::kEnabledOff);
|
||||
} else if (IsDirective(directive, "unplugged")) {
|
||||
set_enabled(RewriteOptions::kEnabledUnplugged);
|
||||
} else {
|
||||
EnabledEnum enabled;
|
||||
if (!ParseFromString(directive, &enabled)) {
|
||||
return RewriteOptions::kOptionNameUnknown;
|
||||
}
|
||||
if (enabled == RewriteOptions::kEnabledOff) {
|
||||
// In ngx_pagespeed, for historical reasons, we treat "off" as "unplugged".
|
||||
// Also, "off" is deprecated and people should be using "standby" or
|
||||
// "unplugged" now depending on which sense they want. See comment on
|
||||
// RewriteOptions::EnabledEnum.
|
||||
enabled = RewriteOptions::kEnabledUnplugged;
|
||||
}
|
||||
set_enabled(enabled);
|
||||
return RewriteOptions::kOptionOk;
|
||||
}
|
||||
|
||||
|
||||
@@ -369,6 +369,13 @@ fi
|
||||
# wants different ones than we want, so we need to reset our positional args.
|
||||
set -- "$PRIMARY_HOSTNAME"
|
||||
source $SYSTEM_TEST_FILE
|
||||
|
||||
# If we were only asked to run a single test, it ran in SYSTEM_TEST_FILE, so
|
||||
# we're done now and should exit.
|
||||
if [ -n ${TEST_TO_RUN+x} ]; then
|
||||
check_failures_and_exit
|
||||
fi
|
||||
|
||||
source $REMOTE_CONFIG_TEST_FILE
|
||||
|
||||
# nginx-specific system tests
|
||||
|
||||
@@ -88,6 +88,16 @@ http {
|
||||
# Expanded to CentralControllerPort directive when RUN_CONTROLLER_TEST=on
|
||||
@@CONTROLLER@@
|
||||
|
||||
server {
|
||||
# This is the default vhost for @@SECONDARY_PORT@@
|
||||
# Your request will land here when you pass in an unknown host.
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name default.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed RewriteLevel CoreFilters;
|
||||
}
|
||||
|
||||
server {
|
||||
# Sets up a logical home-page server on
|
||||
# max-cacheable-content-length.example.com. This server is only used to
|
||||
@@ -132,6 +142,42 @@ http {
|
||||
"@@SERVER_ROOT@@/mod_pagespeed_example/styles/";
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name pagespeed-off.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed off;
|
||||
pagespeed EnableFilters collapse_whitespace;
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name pagespeed-on.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed on;
|
||||
pagespeed EnableFilters collapse_whitespace;
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name pagespeed-standby.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed standby;
|
||||
pagespeed EnableFilters collapse_whitespace;
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name pagespeed-unplugged.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed unplugged;
|
||||
pagespeed EnableFilters collapse_whitespace;
|
||||
}
|
||||
|
||||
pagespeed UseNativeFetcher "@@NATIVE_FETCHER@@";
|
||||
@@RESOLVER@@
|
||||
|
||||
@@ -1749,6 +1795,25 @@ http {
|
||||
pagespeed DisableFilters add_instrumentation;
|
||||
pagespeed CriticalImagesBeaconEnabled false;
|
||||
}
|
||||
server {
|
||||
pagespeed on;
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name image-rewrite-with-flush.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed RewriteLevel PassThrough;
|
||||
pagespeed UrlValuedAttribute li data-thumb image;
|
||||
pagespeed EnableFilters core;
|
||||
location ~ \.php$ {
|
||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
fastcgi_param QUERY_STRING $query_string;
|
||||
fastcgi_param REQUEST_METHOD $request_method;
|
||||
fastcgi_param CONTENT_TYPE $content_type;
|
||||
fastcgi_param CONTENT_LENGTH $content_length;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_buffering off;
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen @@PRIMARY_PORT@@;
|
||||
listen [::]:@@PRIMARY_PORT@@;
|
||||
|
||||
+15
-5
@@ -23,8 +23,15 @@
|
||||
# Exits with status 2 if command line args are wrong.
|
||||
#
|
||||
# Usage:
|
||||
# ./run_tests.sh
|
||||
# Or:
|
||||
# ./run_tests.sh /path/to/mod_pagespeed /path/to/nginx/binary
|
||||
#
|
||||
# If you built ngx_pagespeed with "scripts/build_ngx_pagespeed.sh --devel" then
|
||||
# you don't need to pass any arguments to run_tests.sh. Otherwise, you'll need
|
||||
# to tell it where to find a mod_pagespeed checkout (for example html files etc)
|
||||
# and the nginx binary to test.
|
||||
#
|
||||
# By default the test script uses several ports. If you have a port conflict
|
||||
# and need to override one you can do that by setting the relevant environment
|
||||
# variable. For example:
|
||||
@@ -45,14 +52,17 @@ RUN_TESTS=${RUN_TESTS:-true}
|
||||
# true.
|
||||
USE_VALGRIND=${USE_VALGRIND:-false}
|
||||
|
||||
if [ "$#" -ne 2 ] ; then
|
||||
echo "Usage: $0 mod_pagespeed_dir nginx_executable"
|
||||
if [ "$#" -eq 0 ]; then
|
||||
MOD_PAGESPEED_DIR="testing-dependencies/mod_pagespeed/"
|
||||
NGINX_EXECUTABLE="nginx/sbin/nginx"
|
||||
elif [ "$#" -eq 2 ]; then
|
||||
MOD_PAGESPEED_DIR="$1"
|
||||
NGINX_EXECUTABLE="$2"
|
||||
else
|
||||
echo "Usage: $0 [mod_pagespeed_dir nginx_executable]"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
MOD_PAGESPEED_DIR="$1"
|
||||
NGINX_EXECUTABLE="$2"
|
||||
|
||||
: ${PRIMARY_PORT:=8050}
|
||||
: ${SECONDARY_PORT:=8051}
|
||||
: ${CONTROLLER_PORT:=8053}
|
||||
|
||||
Submodule testing-dependencies/headers-more-nginx-module deleted from 30fb25901c
Submodule testing-dependencies/mod_pagespeed deleted from 91662d08ae
Submodule testing-dependencies/nginx deleted from 6917d29d40
Submodule testing-dependencies/ngx_cache_purge deleted from 331fe43e8d
Submodule testing-dependencies/ngx_devel_kit deleted from e443262071
Submodule testing-dependencies/set-misc-nginx-module deleted from 72be6512cf
Reference in New Issue
Block a user