Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e6931ba037 | |||
| f4124cb5d1 | |||
| cf57d720e0 | |||
| 6320f71a7c | |||
| f5eccb7618 | |||
| 257c2bcb54 | |||
| b70c70ecb9 | |||
| 149c47ace4 | |||
| 0ca15283c8 | |||
| f3c64ca8a2 | |||
| ecd323ea60 | |||
| a1fc37a9f2 | |||
| 4c51a5ce60 | |||
| 0dfc12ffe2 |
+1
-6
@@ -42,9 +42,4 @@ compiler:
|
|||||||
- gcc
|
- gcc
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
- cheesy@google.com
|
- pagespeed-ci@googlegroups.com
|
||||||
- jefftk@google.com
|
|
||||||
- morlovich@google.com
|
|
||||||
- jmarantz@google.com
|
|
||||||
- huibao@google.com
|
|
||||||
- jcrowell@google.com
|
|
||||||
|
|||||||
+1
-4
@@ -1,4 +1 @@
|
|||||||
In a release this file would contain the URL to download the pre-compiled PSOL
|
https://dl.google.com/dl/page-speed/psol/1.12.34.2-$BIT_SIZE_NAME.tar.gz
|
||||||
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
|
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ if [ "$mod_pagespeed_dir" = "unset" ] ; then
|
|||||||
if [ ! -e "$mod_pagespeed_dir" ] ; then
|
if [ ! -e "$mod_pagespeed_dir" ] ; then
|
||||||
echo "ngx_pagespeed: pagespeed optimization library not found:"
|
echo "ngx_pagespeed: pagespeed optimization library not found:"
|
||||||
|
|
||||||
psol_binary_url="$(cat $ngx_addon_dir/PSOL_BINARY_URL)"
|
psol_binary_url="$($ngx_addon_dir/scripts/format_binary_url.sh \
|
||||||
|
$ngx_addon_dir/PSOL_BINARY_URL)"
|
||||||
if [[ "$psol_binary_url" != https://* ]]; then
|
if [[ "$psol_binary_url" != https://* ]]; then
|
||||||
echo "
|
echo "
|
||||||
This is a development branch of ngx_pagespeed, which means there is no
|
This is a development branch of ngx_pagespeed, which means there is no
|
||||||
@@ -76,6 +77,8 @@ fi
|
|||||||
|
|
||||||
if [ "$NGX_DEBUG" = "YES" ]; then
|
if [ "$NGX_DEBUG" = "YES" ]; then
|
||||||
buildtype=Debug
|
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
|
else
|
||||||
buildtype=Release
|
buildtype=Release
|
||||||
fi
|
fi
|
||||||
@@ -143,6 +146,22 @@ if [ "$psol_binary" = "unset" ] ; then
|
|||||||
psol_binary="\
|
psol_binary="\
|
||||||
$mod_pagespeed_dir/pagespeed/automatic/pagespeed_automatic.a"
|
$mod_pagespeed_dir/pagespeed/automatic/pagespeed_automatic.a"
|
||||||
else
|
else
|
||||||
|
if ! [ -d "$ngx_addon_dir/psol/lib/$buildtype" ]; then
|
||||||
|
echo "
|
||||||
|
You have set --with-debug for building nginx, but precompiled Debug binaries for
|
||||||
|
PSOL, which ngx_pagespeed depends on, aren't available. If you're trying to
|
||||||
|
debug PSOL you need to build it from source. If you just want to run nginx with
|
||||||
|
debug-level logging you can use the Release binaries."
|
||||||
|
echo -n "
|
||||||
|
Use the available Release binaries?"
|
||||||
|
read -p " [Y/n] " yn
|
||||||
|
if [[ "$yn" == N* || "$yn" == n* ]]; then
|
||||||
|
echo "Cancelled."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
buildtype=Release
|
||||||
|
fi
|
||||||
psol_library_dir="$ngx_addon_dir/psol/lib/$buildtype/$os_name/$arch_name"
|
psol_library_dir="$ngx_addon_dir/psol/lib/$buildtype/$os_name/$arch_name"
|
||||||
psol_binary="$psol_library_dir/pagespeed_automatic.a"
|
psol_binary="$psol_library_dir/pagespeed_automatic.a"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -428,7 +428,7 @@ Not deleting $directory; name is suspiciously short. Something is wrong."
|
|||||||
elif [ -e PSOL_BINARY_URL ]; then
|
elif [ -e PSOL_BINARY_URL ]; then
|
||||||
# Releases after 1.11.33.4 there is a PSOL_BINARY_URL file that tells us
|
# Releases after 1.11.33.4 there is a PSOL_BINARY_URL file that tells us
|
||||||
# where to look.
|
# where to look.
|
||||||
psol_url="$(cat PSOL_BINARY_URL)"
|
psol_url="$(scripts/format_binary_url.sh PSOL_BINARY_URL)"
|
||||||
if [[ "$psol_url" != https://* ]]; then
|
if [[ "$psol_url" != https://* ]]; then
|
||||||
fail "Got bad psol binary location information: $psol_url"
|
fail "Got bad psol binary location information: $psol_url"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Executable
+24
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
echo "Usage: $(basename $0) <url_file>" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
url_file=$1
|
||||||
|
|
||||||
|
if [ ! -e "$url_file" ]; then
|
||||||
|
echo "Url file '$url_file' missing!" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The size names must match install/build_psol.sh in mod_pagespeed
|
||||||
|
if [ "$(uname -m)" = x86_64 ]; then
|
||||||
|
bit_size_name=x64
|
||||||
|
else
|
||||||
|
bit_size_name=ia32
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -e 's/$BIT_SIZE_NAME\b/'$bit_size_name'/g' $url_file
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright 2012 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.
|
|
||||||
#
|
|
||||||
# Author: jefftk@google.com (Jeff Kaufman)
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
# scripts/prepare_psol.sh /path/to/mod_pagespeed/src
|
|
||||||
#
|
|
||||||
# Creates a directory psol/ and copies headers and a few source files from a
|
|
||||||
# depot_tools (glient) checkout into psol/include. Along with creating
|
|
||||||
# binaries, this is a step in preparing psol.tar.gz for distribution.
|
|
||||||
#
|
|
||||||
|
|
||||||
set -u # check for undefined variables
|
|
||||||
set -e # exit on failed commands
|
|
||||||
|
|
||||||
if [ "$(basename "$PWD")" != "ngx_pagespeed" ] ; then
|
|
||||||
echo "$(basename $0) must be invoked from the ngx_pagespeed directory"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $# -ne 1 ] ; then
|
|
||||||
echo "Usage: $(basename $0) /path/to/mod_pagespeed/src"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
MOD_PAGESPEED_SRC="$1"
|
|
||||||
|
|
||||||
if [ "$(basename "$(dirname "$MOD_PAGESPEED_SRC")")/$( \
|
|
||||||
basename "$MOD_PAGESPEED_SRC")" != "mod_pagespeed/src" ] ; then
|
|
||||||
echo "Usage: $(basename $0) /path/to/mod_pagespeed/src"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e psol ] ; then
|
|
||||||
echo "A psol/ directory already exists. Move it somewhere else and rerun."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
mkdir psol/
|
|
||||||
# Copy over the .h files, plus a few selected .cc and .c files.
|
|
||||||
rsync -arvz "$MOD_PAGESPEED_SRC/" "psol/include/" --prune-empty-dirs \
|
|
||||||
--exclude=".svn" \
|
|
||||||
--exclude=".git" \
|
|
||||||
--include='*.h' \
|
|
||||||
--include='*/' \
|
|
||||||
--include="apr_thread_compatible_pool.cc" \
|
|
||||||
--include="serf_url_async_fetcher.cc" \
|
|
||||||
--include="apr_mem_cache.cc" \
|
|
||||||
--include="key_value_codec.cc" \
|
|
||||||
--include="apr_memcache2.c" \
|
|
||||||
--include="loopback_route_fetcher.cc" \
|
|
||||||
--include="add_headers_fetcher.cc" \
|
|
||||||
--include="console_css_out.cc" \
|
|
||||||
--include="console_out.cc" \
|
|
||||||
--include="dense_hash_map" \
|
|
||||||
--include="dense_hash_set" \
|
|
||||||
--include="sparse_hash_map" \
|
|
||||||
--include="sparse_hash_set" \
|
|
||||||
--include="sparsetable" \
|
|
||||||
--include="mod_pagespeed_console_out.cc" \
|
|
||||||
--include="mod_pagespeed_console_css_out.cc" \
|
|
||||||
--include="mod_pagespeed_console_html_out.cc" \
|
|
||||||
--exclude='*'
|
|
||||||
mkdir -p psol/lib/Debug/linux/ia32
|
|
||||||
mkdir -p psol/lib/Debug/linux/x64
|
|
||||||
mkdir -p psol/lib/Release/linux/ia32
|
|
||||||
mkdir -p psol/lib/Release/linux/x64
|
|
||||||
|
|
||||||
# Log that we did this.
|
|
||||||
SVN_REVISION="$(svn info $MOD_PAGESPEED_SRC | grep Revision | awk '{print $2}')"
|
|
||||||
SVN_TAG="$(svn info $MOD_PAGESPEED_SRC | grep URL | awk -F/ '{print $(NF-1)}')"
|
|
||||||
|
|
||||||
DATE="$(date +%F)"
|
|
||||||
echo "${DATE}: Copied from mod_pagespeed ${SVN_TAG}@r${SVN_REVISION} ($USER)" \
|
|
||||||
>> psol/include_history.txt
|
|
||||||
|
|
||||||
echo
|
|
||||||
echo "Output is in psol/include. Now put binaries in psol/lib following"
|
|
||||||
echo "https://github.com/pagespeed/ngx_pagespeed/wiki/Building-Release-Binaries"
|
|
||||||
echo "and then you can distribute PSOL."
|
|
||||||
|
|
||||||
+15
-1
@@ -84,6 +84,7 @@ extern ngx_module_t ngx_pagespeed;
|
|||||||
|
|
||||||
// Needed for SystemRewriteDriverFactory to use shared memory.
|
// Needed for SystemRewriteDriverFactory to use shared memory.
|
||||||
#define PAGESPEED_SUPPORT_POSIX_SHARED_MEM
|
#define PAGESPEED_SUPPORT_POSIX_SHARED_MEM
|
||||||
|
#define NGINX_1_13_4 1013004
|
||||||
|
|
||||||
net_instaweb::NgxRewriteDriverFactory* active_driver_factory = NULL;
|
net_instaweb::NgxRewriteDriverFactory* active_driver_factory = NULL;
|
||||||
|
|
||||||
@@ -3007,13 +3008,17 @@ ngx_int_t ps_preaccess_handler(ngx_http_request_t* r) {
|
|||||||
ph = cmcf->phase_engine.handlers;
|
ph = cmcf->phase_engine.handlers;
|
||||||
|
|
||||||
i = r->phase_handler;
|
i = r->phase_handler;
|
||||||
|
|
||||||
// move handlers before try_files && content phase
|
// 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 &&
|
while (ph[i + 1].checker != ngx_http_core_try_files_phase &&
|
||||||
ph[i + 1].checker != ngx_http_core_content_phase) {
|
ph[i + 1].checker != ngx_http_core_content_phase) {
|
||||||
ph[i] = ph[i + 1];
|
ph[i] = ph[i + 1];
|
||||||
ph[i].next--;
|
ph[i].next--;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// insert ps phase handler
|
// insert ps phase handler
|
||||||
ph[i].checker = ps_phase_handler;
|
ph[i].checker = ps_phase_handler;
|
||||||
@@ -3069,8 +3074,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_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));
|
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_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) {
|
if (h == NULL) {
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,10 @@ NgxRewriteDriverFactory::NgxRewriteDriverFactory(
|
|||||||
shut_down_(false) {
|
shut_down_(false) {
|
||||||
InitializeDefaultOptions();
|
InitializeDefaultOptions();
|
||||||
default_options()->set_beacon_url("/ngx_pagespeed_beacon");
|
default_options()->set_beacon_url("/ngx_pagespeed_beacon");
|
||||||
|
// Put in the version of the ngx-pagespeed release. We don't release mod_pagespeed
|
||||||
|
// so we cannot rely on PSOL to hand us to right version. Note that if we perform
|
||||||
|
// another release, this must be either updated or removed.
|
||||||
|
default_options()->set_x_header_value("1.12.34.3-0");
|
||||||
SystemRewriteOptions* system_options = dynamic_cast<SystemRewriteOptions*>(
|
SystemRewriteOptions* system_options = dynamic_cast<SystemRewriteOptions*>(
|
||||||
default_options());
|
default_options());
|
||||||
system_options->set_file_cache_clean_inode_limit(500000);
|
system_options->set_file_cache_clean_inode_limit(500000);
|
||||||
|
|||||||
Reference in New Issue
Block a user