Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 70038bc64a | |||
| 815fa29985 | |||
| c82bb2c7a4 | |||
| e9eaa23356 | |||
| a7969a6382 | |||
| 243d4e1931 | |||
| 8246c03fda | |||
| 99ac026f00 | |||
| 90e4c40d86 | |||
| 0de4e20be1 |
@@ -37,11 +37,11 @@ recompiling Tengine](https://github.com/pagespeed/ngx_pagespeed/wiki/Using-ngx_p
|
||||
|
||||
```bash
|
||||
$ cd ~
|
||||
$ wget https://github.com/pagespeed/ngx_pagespeed/archive/v1.7.30.4-beta.zip
|
||||
$ unzip v1.7.30.4-beta.zip # or unzip v1.7.30.4-beta
|
||||
$ cd ngx_pagespeed-1.7.30.4-beta/
|
||||
$ wget https://dl.google.com/dl/page-speed/psol/1.7.30.4.tar.gz
|
||||
$ tar -xzvf 1.7.30.4.tar.gz # expands to psol/
|
||||
$ wget https://github.com/pagespeed/ngx_pagespeed/archive/v1.8.31.3-beta.zip
|
||||
$ unzip v1.8.31.3-beta.zip # or unzip v1.8.31.3-beta
|
||||
$ cd ngx_pagespeed-1.8.31.3-beta/
|
||||
$ wget https://dl.google.com/dl/page-speed/psol/1.8.31.3.tar.gz
|
||||
$ tar -xzvf 1.8.31.3.tar.gz # expands to psol/
|
||||
```
|
||||
|
||||
3. Download and build nginx:
|
||||
@@ -52,7 +52,7 @@ recompiling Tengine](https://github.com/pagespeed/ngx_pagespeed/wiki/Using-ngx_p
|
||||
$ wget http://nginx.org/download/nginx-1.6.0.tar.gz
|
||||
$ tar -xvzf nginx-1.6.0.tar.gz
|
||||
$ cd nginx-1.6.0/
|
||||
$ ./configure --add-module=$HOME/ngx_pagespeed-1.7.30.4-beta
|
||||
$ ./configure --add-module=$HOME/ngx_pagespeed-1.8.31.3-beta
|
||||
$ make
|
||||
$ sudo make install
|
||||
```
|
||||
@@ -95,7 +95,7 @@ To confirm that the module is loaded, fetch a page and check that you see the
|
||||
|
||||
```bash
|
||||
$ curl -I 'http://localhost:8050/some_page/' | grep X-Page-Speed
|
||||
X-Page-Speed: 1.7.30.4-...
|
||||
X-Page-Speed: 1.8.31.3-...
|
||||
```
|
||||
|
||||
Looking at the source of a few pages you should see various changes, such as
|
||||
|
||||
@@ -27,8 +27,8 @@ if [ "$mod_pagespeed_dir" = "unset" ] ; then
|
||||
echo " You need to separately download the pagespeed library:"
|
||||
echo ""
|
||||
echo " $ cd /path/to/ngx_pagespeed"
|
||||
echo " $ wget https://dl.google.com/dl/page-speed/psol/1.7.30.4.tar.gz"
|
||||
echo " $ tar -xzvf 1.7.30.4.tar.gz # expands to psol/"
|
||||
echo " $ wget https://dl.google.com/dl/page-speed/psol/1.8.31.3.tar.gz"
|
||||
echo " $ tar -xzvf 1.8.31.3.tar.gz # expands to psol/"
|
||||
echo ""
|
||||
echo " Or see the installation instructions:"
|
||||
echo " https://github.com/pagespeed/ngx_pagespeed#how-to-build"
|
||||
@@ -173,8 +173,7 @@ if [ $ngx_found = yes ]; then
|
||||
$ps_src/ngx_rewrite_driver_factory.h \
|
||||
$ps_src/ngx_rewrite_options.h \
|
||||
$ps_src/ngx_server_context.h \
|
||||
$ps_src/ngx_url_async_fetcher.h \
|
||||
$psol_library_binaries"
|
||||
$ps_src/ngx_url_async_fetcher.h"
|
||||
NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
|
||||
$ps_src/log_message_handler.cc \
|
||||
$ps_src/ngx_base_fetch.cc \
|
||||
|
||||
@@ -1277,16 +1277,17 @@ ps_loc_conf_t* ps_get_loc_config(ngx_http_request_t* r) {
|
||||
// Wrapper around GetQueryOptions()
|
||||
RewriteOptions* ps_determine_request_options(
|
||||
ngx_http_request_t* r,
|
||||
const RewriteOptions* domain_options, /* may be null */
|
||||
RequestHeaders* request_headers,
|
||||
ResponseHeaders* response_headers,
|
||||
ps_srv_conf_t* cfg_s,
|
||||
GoogleUrl* url) {
|
||||
// Stripping ModPagespeed query params before the property cache lookup to
|
||||
// make cache key consistent for both lookup and storing in cache.
|
||||
//
|
||||
// Sets option from request headers and url.
|
||||
RewriteQuery rewrite_query;
|
||||
if (!cfg_s->server_context->GetQueryOptions(
|
||||
domain_options, url, request_headers, response_headers,
|
||||
&rewrite_query)) {
|
||||
url, request_headers, response_headers, &rewrite_query)) {
|
||||
// Failed to parse query params or request headers. Treat this as if there
|
||||
// were no query params given.
|
||||
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
||||
@@ -1374,7 +1375,7 @@ bool ps_determine_options(ngx_http_request_t* r,
|
||||
// Request-specific options, nearly always null. If set they need to be
|
||||
// rebased on the directory options or the global options.
|
||||
RewriteOptions* request_options = ps_determine_request_options(
|
||||
r, directory_options, request_headers, response_headers, cfg_s, url);
|
||||
r, request_headers, response_headers, cfg_s, url);
|
||||
bool have_request_options = request_options != NULL;
|
||||
|
||||
// Because the caller takes ownership of any options we return, the only
|
||||
@@ -1797,7 +1798,7 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
||||
return ps_async_wait_response(r);
|
||||
} else if (is_an_admin_handler) {
|
||||
QueryParams query_params;
|
||||
query_params.ParseFromUrl(url);
|
||||
query_params.Parse(url.Query());
|
||||
|
||||
PosixTimer timer;
|
||||
int64 now_ms = timer.NowMs();
|
||||
@@ -2394,7 +2395,7 @@ ngx_int_t ps_simple_handler(ngx_http_request_t* r,
|
||||
GoogleUrl url(url_string);
|
||||
QueryParams query_params;
|
||||
if (url.IsWebValid()) {
|
||||
query_params.ParseFromUrl(url);
|
||||
query_params.Parse(url.Query());
|
||||
}
|
||||
|
||||
GoogleString output;
|
||||
|
||||
@@ -46,9 +46,10 @@ const char kGlobalAdminPath[] = "GlobalAdminPath";
|
||||
|
||||
// These options are copied from mod_instaweb.cc, where APACHE_CONFIG_OPTIONX
|
||||
// indicates that they can not be set at the directory/location level. They set
|
||||
// options in the RewriteDriverFactory, so they do not appear in RewriteOptions.
|
||||
// They are not alphabetized on purpose, but rather left in the same order as in
|
||||
// mod_instaweb.cc in case we end up needing to compare.
|
||||
// options in the RewriteDriverFactory, so they're entirely global and do not
|
||||
// appear in RewriteOptions. They are not alphabetized on purpose, but rather
|
||||
// left in the same order as in mod_instaweb.cc in case we end up needing to
|
||||
// compare.
|
||||
// TODO(oschaaf): this duplication is a short term solution.
|
||||
const char* const server_only_options[] = {
|
||||
"FetcherTimeoutMs",
|
||||
@@ -61,6 +62,7 @@ const char* const server_only_options[] = {
|
||||
"MessageBufferSize",
|
||||
"NumRewriteThreads",
|
||||
"NumExpensiveRewriteThreads",
|
||||
"StaticAssetPrefix",
|
||||
"TrackOriginalContentLength",
|
||||
"UsePerVHostStatistics", // TODO(anupama): What to do about "No longer used"
|
||||
"BlockingRewriteRefererUrls",
|
||||
@@ -102,20 +104,20 @@ void NgxRewriteOptions::AddProperties() {
|
||||
// Nginx-specific options.
|
||||
add_ngx_option(
|
||||
"", &NgxRewriteOptions::statistics_path_, "nsp", kStatisticsPath,
|
||||
kProcessScope, "Set the statistics path. Ex: /ngx_pagespeed_statistics");
|
||||
kServerScope, "Set the statistics path. Ex: /ngx_pagespeed_statistics");
|
||||
add_ngx_option(
|
||||
"", &NgxRewriteOptions::global_statistics_path_, "ngsp",
|
||||
kGlobalStatisticsPath, kProcessScope,
|
||||
"Set the global statistics path. Ex: /ngx_pagespeed_global_statistics");
|
||||
add_ngx_option(
|
||||
"", &NgxRewriteOptions::console_path_, "ncp", kConsolePath, kProcessScope,
|
||||
"", &NgxRewriteOptions::console_path_, "ncp", kConsolePath, kServerScope,
|
||||
"Set the console path. Ex: /pagespeed_console");
|
||||
add_ngx_option(
|
||||
"", &NgxRewriteOptions::messages_path_, "nmp", kMessagesPath,
|
||||
kProcessScope, "Set the messages path. Ex: /ngx_pagespeed_message");
|
||||
kServerScope, "Set the messages path. Ex: /ngx_pagespeed_message");
|
||||
add_ngx_option(
|
||||
"", &NgxRewriteOptions::admin_path_, "nap", kAdminPath,
|
||||
kProcessScope, "Set the admin path. Ex: /pagespeed_admin");
|
||||
kServerScope, "Set the admin path. Ex: /pagespeed_admin");
|
||||
add_ngx_option(
|
||||
"", &NgxRewriteOptions::global_admin_path_, "ngap", kGlobalAdminPath,
|
||||
kProcessScope, "Set the global admin path. Ex: /pagespeed_global_admin");
|
||||
@@ -309,8 +311,11 @@ const char* NgxRewriteOptions::ParseAndSetOptions(
|
||||
result = ParseAndSetOptionHelper<SystemRewriteDriverFactory>(
|
||||
arg, driver_factory,
|
||||
&SystemRewriteDriverFactory::set_track_original_content_length);
|
||||
} else if (IsDirective(directive, "StaticAssetPrefix")) {
|
||||
driver_factory->set_static_asset_prefix(arg);
|
||||
result = RewriteOptions::kOptionOk;
|
||||
} else {
|
||||
result = ParseAndSetOptionFromName1(directive, args[1], &msg, handler);
|
||||
result = ParseAndSetOptionFromName1(directive, arg, &msg, handler);
|
||||
}
|
||||
} else if (n_args == 3) {
|
||||
// Short-term special handling, until this moves to common code.
|
||||
|
||||
+74
-96
@@ -259,7 +259,7 @@ if [ ! -e "$SYSTEM_TEST_FILE" ] ; then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
PSA_JS_LIBRARY_URL_PREFIX="pagespeed_static"
|
||||
PSA_JS_LIBRARY_URL_PREFIX="pagespeed_custom_static"
|
||||
|
||||
# An expected failure can be indicated like: "~In-place resource optimization~"
|
||||
PAGESPEED_EXPECTED_FAILURES="
|
||||
@@ -522,6 +522,60 @@ if [ "$HOSTNAME" = "localhost:$PRIMARY_PORT" ] ; then
|
||||
AUTH=""
|
||||
fi
|
||||
|
||||
start_test "Custom statistics paths in server block"
|
||||
|
||||
# Served on normal paths by default.
|
||||
URL="inherit-paths.example.com/ngx_pagespeed_statistics"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_from "$OUT" grep cache_time_us
|
||||
|
||||
URL="inherit-paths.example.com/ngx_pagespeed_message"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_from "$OUT" grep Info
|
||||
|
||||
URL="inherit-paths.example.com/pagespeed_console"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_from "$OUT" grep console_div
|
||||
|
||||
URL="inherit-paths.example.com/pagespeed_admin/"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_from "$OUT" grep Admin
|
||||
|
||||
# Not served on normal paths when overriden.
|
||||
URL="custom-paths.example.com/ngx_pagespeed_statistics"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_not_from "$OUT" grep cache_time_us
|
||||
|
||||
URL="custom-paths.example.com/ngx_pagespeed_message"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_not_from "$OUT" grep Info
|
||||
|
||||
URL="custom-paths.example.com/pagespeed_console"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_not_from "$OUT" grep console_div
|
||||
|
||||
URL="custom-paths.example.com/pagespeed_admin/"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_not_from "$OUT" grep Admin
|
||||
|
||||
# Served on custom paths when overriden
|
||||
URL="custom-paths.example.com/custom_pagespeed_statistics"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_from "$OUT" grep cache_time_us
|
||||
|
||||
URL="custom-paths.example.com/custom_pagespeed_message"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_from "$OUT" grep Info
|
||||
|
||||
URL="custom-paths.example.com/custom_pagespeed_console"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_from "$OUT" grep console_div
|
||||
|
||||
URL="custom-paths.example.com/custom_pagespeed_admin/"
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_from "$OUT" grep Admin
|
||||
|
||||
|
||||
WGET_ARGS=""
|
||||
function gunzip_grep_0ff() {
|
||||
gunzip - | fgrep -q "color:#00f"
|
||||
@@ -1324,10 +1378,10 @@ check touch "$SECONDARY_CACHE/cache.flush"
|
||||
check touch "$IPRO_CACHE/cache.flush"
|
||||
sleep 1
|
||||
|
||||
CSS_FILE="$SERVER_ROOT/mod_pagespeed_test/cache_flush/update.css"
|
||||
CSS_FILE="$SERVER_ROOT/mod_pagespeed_test/update.css"
|
||||
echo ".class myclass { color: $COLOR0; }" > "$CSS_FILE"
|
||||
|
||||
URL_PATH="mod_pagespeed_test/cache_flush/cache_flush_test.html"
|
||||
URL_PATH="mod_pagespeed_test/cache_flush_test.html"
|
||||
|
||||
URL="$SECONDARY_HOSTNAME/$URL_PATH"
|
||||
CACHE_A="--header=Host:cache_a.example.com"
|
||||
@@ -1997,13 +2051,13 @@ OUT1=$(http_proxy=$SECONDARY_HOSTNAME \
|
||||
$WGET_DUMP --header 'X-PSA-Blocking-Rewrite: psatest' $URL)
|
||||
check_not_from "$OUT1" egrep -q 'pagespeed\.criticalCssBeaconInit'
|
||||
check_from "$OUT1" grep -q "Cache-Control: private, max-age=3000"
|
||||
|
||||
# 2. We get an instrumented page if the correct key is present.
|
||||
http_proxy=$SECONDARY_HOSTNAME \
|
||||
fetch_until -save $URL 'grep -c criticalCssBeaconInit' 2 \
|
||||
"--header=PS-ShouldBeacon:random_rebeaconing_key --save-headers"
|
||||
check grep -q "Cache-Control: max-age=0, no-cache" $FETCH_UNTIL_OUTFILE
|
||||
|
||||
OUT2=$(http_proxy=$SECONDARY_HOSTNAME \
|
||||
$WGET_DUMP $WGET_ARGS \
|
||||
--header 'X-PSA-Blocking-Rewrite: psatest'\
|
||||
--header="PS-ShouldBeacon: random_rebeaconing_key" $URL)
|
||||
check_from "$OUT2" grep -q "Cache-Control: max-age=0, no-cache"
|
||||
check_from "$OUT2" egrep -q "pagespeed\.criticalCssBeaconInit"
|
||||
# 3. We do not get an instrumented page if the wrong key is present.
|
||||
WGET_ARGS="--header=\"PS-ShouldBeacon: wrong_rebeaconing_key\""
|
||||
OUT3=$(http_proxy=$SECONDARY_HOSTNAME \
|
||||
@@ -2150,7 +2204,7 @@ keepalive_test "keepalive-beacon-post.example.com" "/ngx_pagespeed_beacon"\
|
||||
|
||||
start_test keepalive with static resources
|
||||
keepalive_test "keepalive-static.example.com"\
|
||||
"/pagespeed_static/js_defer.0.js" ""
|
||||
"/pagespeed_custom_static/js_defer.0.js" ""
|
||||
|
||||
# Test for MaxCombinedCssBytes. The html used in the test, 'combine_css.html',
|
||||
# has 4 CSS files in the following order.
|
||||
@@ -2185,7 +2239,7 @@ CONNECTION=$(extract_headers $FETCH_UNTIL_OUTFILE | fgrep "Connection:")
|
||||
check_not_from "$CONNECTION" fgrep -qi "Keep-Alive, Keep-Alive"
|
||||
check_from "$CONNECTION" fgrep -qi "Keep-Alive"
|
||||
|
||||
start_test pagespeed_static defer js served with correct headers.
|
||||
start_test pagespeed_custom_static defer js served with correct headers.
|
||||
# First, determine which hash js_defer is served with. We need a correct hash
|
||||
# to get it served up with an Etag, which is one of the things we want to test.
|
||||
URL="$HOSTNAME/mod_pagespeed_example/defer_javascript.html?PageSpeed=on&PageSpeedFilters=defer_javascript"
|
||||
@@ -2342,78 +2396,9 @@ test_decent_browsers "New Opera" \
|
||||
WGETRC=$OLD_WGETRC
|
||||
WGET_ARGS=""
|
||||
|
||||
test_filter collapse_whitespace
|
||||
start_test Cookie options on: by default comments not removed, whitespace is
|
||||
HOST_NAME="http://options-by-cookies-enabled.example.com"
|
||||
URL="$HOST_NAME/mod_pagespeed_test/forbidden.html"
|
||||
echo wget $URL
|
||||
OUT="$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)"
|
||||
check_from "$OUT" grep -q '<!--'
|
||||
check_not_from "$OUT" grep -q ' '
|
||||
start_test Cookie options on: set option by cookie takes effect
|
||||
echo wget --header=Cookie:PageSpeedFilters=+remove_comments $URL
|
||||
OUT="$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --no-cookies \
|
||||
--header=Cookie:PageSpeedFilters=+remove_comments $URL)"
|
||||
check_not_from "$OUT" grep -q '<!--'
|
||||
check_not_from "$OUT" grep -q ' '
|
||||
start_test Cookie options off: by default comments nor whitespace removed
|
||||
HOST_NAME="http://options-by-cookies-disabled.example.com"
|
||||
URL="$HOST_NAME/mod_pagespeed_test/forbidden.html"
|
||||
echo wget $URL
|
||||
OUT="$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)"
|
||||
check_from "$OUT" grep -q '<!--'
|
||||
check_from "$OUT" grep -q ' '
|
||||
start_test Cookie options off: set option by cookie has no effect
|
||||
echo wget --header=Cookie:PageSpeedFilters=+remove_comments $URL
|
||||
OUT="$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP --no-cookies \
|
||||
--header=Cookie:PageSpeedFilters=+remove_comments $URL)"
|
||||
check_from "$OUT" grep -q '<!--'
|
||||
check_from "$OUT" grep -q ' '
|
||||
WGET_ARGS=""
|
||||
|
||||
start_test Request Option Override : Correct values are passed
|
||||
HOST_NAME="http://request-option-override.example.com"
|
||||
OPTS="?ModPagespeed=on"
|
||||
OPTS+="&ModPagespeedFilters=+collapse_whitespace,+remove_comments"
|
||||
OPTS+="&PageSpeedRequestOptionOverride=abc"
|
||||
URL="$HOST_NAME/mod_pagespeed_test/forbidden.html$OPTS"
|
||||
OUT="$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)"
|
||||
echo wget $URL
|
||||
check_not_from "$OUT" grep -q '<!--'
|
||||
|
||||
start_test Request Option Override : Incorrect values are passed
|
||||
HOST_NAME="http://request-option-override.example.com"
|
||||
OPTS="?ModPagespeed=on"
|
||||
OPTS+="&ModPagespeedFilters=+collapse_whitespace,+remove_comments"
|
||||
OPTS+="&PageSpeedRequestOptionOverride=notabc"
|
||||
URL="$HOST_NAME/mod_pagespeed_test/forbidden.html$OPTS"
|
||||
OUT="$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)"
|
||||
echo wget $URL
|
||||
check_from "$OUT" grep -q '<!--'
|
||||
|
||||
start_test Request Option Override : Correct values are passed as headers
|
||||
HOST_NAME="http://request-option-override.example.com"
|
||||
OPTS="--header=ModPagespeed:on"
|
||||
OPTS+=" --header=ModPagespeedFilters:+collapse_whitespace,+remove_comments"
|
||||
OPTS+=" --header=PageSpeedRequestOptionOverride:abc"
|
||||
URL="$HOST_NAME/mod_pagespeed_test/forbidden.html"
|
||||
echo wget $OPTS $URL
|
||||
OUT="$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $OPTS $URL)"
|
||||
check_not_from "$OUT" grep -q '<!--'
|
||||
|
||||
start_test Request Option Override : Incorrect values are passed as headers
|
||||
HOST_NAME="http://request-option-override.example.com"
|
||||
OPTS="--header=ModPagespeed:on"
|
||||
OPTS+=" --header=ModPagespeedFilters:+collapse_whitespace,+remove_comments"
|
||||
OPTS+=" --header=PageSpeedRequestOptionOverride:notabc"
|
||||
URL="$HOST_NAME/mod_pagespeed_test/forbidden.html"
|
||||
echo wget $OPTS $URL
|
||||
OUT="$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $OPTS $URL)"
|
||||
check_from "$OUT" grep -q '<!--'
|
||||
|
||||
start_test JS gzip headers
|
||||
|
||||
JS_URL="$HOSTNAME/pagespeed_static/js_defer.$HASH.js"
|
||||
JS_URL="$HOSTNAME/pagespeed_custom_static/js_defer.$HASH.js"
|
||||
JS_HEADERS=$($WGET -O /dev/null -q -S --header='Accept-Encoding: gzip' \
|
||||
$JS_URL 2>&1)
|
||||
check_from "$JS_HEADERS" egrep -qi 'HTTP/1[.]. 200 OK'
|
||||
@@ -2607,12 +2592,15 @@ OUTFILE=$OUTDIR/etags
|
||||
$WGET -o $OUTFILE -O /dev/null --header "If-None-Match: $ETAG" $URL
|
||||
check fgrep -q "awaiting response... 304" $OUTFILE
|
||||
|
||||
start_test PageSpeed resources should have a content length.
|
||||
start_test PageSpeed CSS loaded in fallback mode is always chunked
|
||||
# This is because the domains in urls may be rewritten, changing content
|
||||
# length from what's in the cache.
|
||||
URL="$EXAMPLE_ROOT/styles/W.rewrite_css_images.css.pagespeed.cf.Hash.css"
|
||||
OUT=$($WGET_DUMP --save-headers $URL)
|
||||
check_from "$OUT" egrep -q $'^Content-Length: ([0-9])*\r$'
|
||||
check_not_from "$OUT" egrep -iq $'^Transfer-Encoding: chunked\r$'
|
||||
check_not_from "$OUT" egrep -iq $'^Connection: close\r$'
|
||||
fetch_until -save $URL "egrep -c Transfer-Encoding:" 1 "--save-headers"
|
||||
OUT=$(cat $FETCH_UNTIL_OUTFILE)
|
||||
check_from "$OUT" egrep -iq $'^Transfer-Encoding: chunked\r$'
|
||||
check_not_from "$OUT" egrep -iq '^Content-Length:'
|
||||
check_not_from "$OUT" egrep -iq '^Connection: close'
|
||||
|
||||
start_test Downstream cache integration caching headers.
|
||||
URL="http://downstreamcacheresource.example.com/mod_pagespeed_example/images/"
|
||||
@@ -2622,16 +2610,6 @@ check_from "$OUT" egrep -iq $'^Cache-Control: .*\r$'
|
||||
check_from "$OUT" egrep -iq $'^Expires: .*\r$'
|
||||
check_from "$OUT" egrep -iq $'^Last-Modified: .*\r$'
|
||||
|
||||
# Verify that we can control pagespeed settings via a response
|
||||
# header passed from an origin to a reverse proxy.
|
||||
start_test Honor response header direcives from origin
|
||||
URL="http://rproxy.rmcomments.example.com/"
|
||||
URL+="mod_pagespeed_example/remove_comments.html"
|
||||
echo http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL ...
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $URL)
|
||||
check_from "$OUT" fgrep -q "remove_comments example"
|
||||
check_not_from "$OUT" fgrep -q "This comment will be removed"
|
||||
|
||||
# Test handling of large HTML files. We first test with a cold cache, and verify
|
||||
# that we bail out of parsing and insert a script redirecting to
|
||||
# ?PageSpeed=off. This should also insert an entry into the property cache so
|
||||
|
||||
@@ -34,6 +34,8 @@ http {
|
||||
pagespeed AdminPath /pagespeed_admin;
|
||||
pagespeed GlobalAdminPath /pagespeed_global_admin;
|
||||
|
||||
pagespeed StaticAssetPrefix /pagespeed_custom_static/;
|
||||
|
||||
root "@@SERVER_ROOT@@";
|
||||
|
||||
# Block 5a: Decide on Cache-Control header value to use for outgoing
|
||||
@@ -351,29 +353,6 @@ http {
|
||||
pagespeed DownstreamCachePurgeLocationPrefix "http://localhost:@@SECONDARY_PORT@@/purge";
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
server_name origin.rmcomments.example.com;
|
||||
pagespeed off;
|
||||
add_header PageSpeedFilters remove_comments;
|
||||
}
|
||||
server {
|
||||
# Set up a reverse proxy (rproxy.) and origin (origin.) as vhosts for
|
||||
# showing that we can configure PageSpeed via response headers.
|
||||
listen @@SECONDARY_PORT@@;
|
||||
server_name rproxy.rmcomments.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed RewriteLevel PassThrough;
|
||||
pagespeed DisableFilters add_instrumentation,remove_comments;
|
||||
# Note that we don't enable remove_comments here; that setting
|
||||
# comes from the response headers from origin.rmcomments.example.com
|
||||
location / {
|
||||
proxy_pass http://localhost:@@SECONDARY_PORT@@;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Host origin.rmcomments.example.com;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
server_name renderedimagebeacon.example.com;
|
||||
@@ -647,18 +626,6 @@ http {
|
||||
pagespeed CacheFlushPollIntervalSec 1;
|
||||
pagespeed RewriteLevel PassThrough;
|
||||
pagespeed EnableFilters inline_css;
|
||||
|
||||
# Make a non-empty subdirectory config to make sure that
|
||||
# cache.flush updates get transmitted to nested configurations.
|
||||
#
|
||||
# TODO(jmarantz): This test currently fails on ngx_pagespeed, meaning we
|
||||
# don't handle cache flushing correctly here. Uncomment the config below to
|
||||
# expose the error.
|
||||
#location /mod_pagespeed_test/cache_flush/ {
|
||||
# pagespeed RewriteLevel PassThrough;
|
||||
# pagespeed EnableFilters inline_css;
|
||||
# pagespeed DisableFilters add_instrumentation;
|
||||
#}
|
||||
}
|
||||
|
||||
server {
|
||||
@@ -746,6 +713,23 @@ http {
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
server_name custom-paths.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
|
||||
pagespeed StatisticsPath /custom_pagespeed_statistics;
|
||||
pagespeed ConsolePath /custom_pagespeed_console;
|
||||
pagespeed MessagesPath /custom_pagespeed_message;
|
||||
pagespeed AdminPath /custom_pagespeed_admin;
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
server_name inherit-paths.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
server_name notransform.example.com;
|
||||
@@ -897,34 +881,6 @@ http {
|
||||
add_header "Date" "Date: Fri, 16 Oct 2009 23:05:07 GMT";
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
server_name options-by-cookies-enabled.example.com;
|
||||
pagespeed FileCachePath "@@SECONDARY_CACHE@@_optionsbycookieson";
|
||||
pagespeed AllowOptionsToBeSetByCookies true;
|
||||
pagespeed RewriteLevel PassThrough;
|
||||
pagespeed EnableFilters collapse_whitespace;
|
||||
pagespeed DisableFilters remove_comments,add_instrumentation;
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
server_name options-by-cookies-disabled.example.com;
|
||||
pagespeed FileCachePath "@@SECONDARY_CACHE@@_optionsbycookiesoff";
|
||||
pagespeed AllowOptionsToBeSetByCookies false;
|
||||
pagespeed DisableFilters add_instrumentation;
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
server_name request-option-override.example.com;
|
||||
pagespeed FileCachePath "@@SECONDARY_CACHE@@";
|
||||
pagespeed RequestOptionOverride abc;
|
||||
pagespeed RewriteLevel Passthrough;
|
||||
pagespeed EnableFilters collapse_whitespace;
|
||||
pagespeed DisableFilters remove_comments,add_instrumentation;
|
||||
}
|
||||
|
||||
# Proxy + IPRO a gzip'd file for testing Issue 896.
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
|
||||
Reference in New Issue
Block a user