Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b371c0af1 | |||
| fcbce7acc2 | |||
| ad74f4412b | |||
| 79f98b197e | |||
| 4103004cee | |||
| 0f3f268b36 | |||
| 30fdd02d0c | |||
| 0572a5bebf | |||
| 4bd5b7c663 | |||
| a9c292d8dc | |||
| 907c57a217 |
@@ -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.9.32.4.tar.gz"
|
||||
echo " $ tar -xzvf 1.9.32.4.tar.gz # expands to psol/"
|
||||
echo " $ wget https://dl.google.com/dl/page-speed/psol/1.9.32.14.tar.gz"
|
||||
echo " $ tar -xzvf 1.9.32.14.tar.gz # expands to psol/"
|
||||
echo ""
|
||||
echo " Or see the installation instructions:"
|
||||
echo " https://github.com/pagespeed/ngx_pagespeed#how-to-build"
|
||||
|
||||
@@ -410,8 +410,6 @@ ngx_int_t copy_response_headers_to_ngx(
|
||||
continue;
|
||||
} else if (STR_EQ_LITERAL(name, "Transfer-Encoding")) {
|
||||
continue;
|
||||
} else if (STR_EQ_LITERAL(name, "Server")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
u_char* name_s = ngx_pstrdup(r->pool, &name);
|
||||
@@ -1711,8 +1709,8 @@ void ps_release_request_context(void* data) {
|
||||
}
|
||||
|
||||
if (ctx->recorder != NULL) {
|
||||
ctx->recorder->Fail();
|
||||
ctx->recorder->DoneAndSetHeaders(NULL); // Deletes recorder.
|
||||
// Deletes recorder.
|
||||
ctx->recorder->DoneAndSetHeaders(NULL, false /* incomplete response */);
|
||||
ctx->recorder = NULL;
|
||||
}
|
||||
|
||||
@@ -2508,7 +2506,9 @@ ngx_int_t ps_in_place_body_filter(ngx_http_request_t* r, ngx_chain_t* in) {
|
||||
if (cl->buf->last_buf || recorder->failed()) {
|
||||
ResponseHeaders response_headers;
|
||||
copy_response_headers_from_ngx(r, &response_headers);
|
||||
ctx->recorder->DoneAndSetHeaders(&response_headers);
|
||||
ctx->recorder->DoneAndSetHeaders(
|
||||
&response_headers,
|
||||
cl->buf->last_buf /* response is complete if last_buf is set */);
|
||||
ctx->recorder = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -269,6 +269,8 @@ PSA_JS_LIBRARY_URL_PREFIX="pagespeed_custom_static"
|
||||
|
||||
# An expected failure can be indicated like: "~In-place resource optimization~"
|
||||
PAGESPEED_EXPECTED_FAILURES="
|
||||
~Override server header in resource flow.~
|
||||
~Override server header in IPRO flow.~
|
||||
"
|
||||
|
||||
# Some tests are flakey under valgrind. For now, add them to the expected failures
|
||||
@@ -655,7 +657,7 @@ fetch_until "$URL" "fgrep -c .pagespeed." 1 --header=Host:www.google.com
|
||||
|
||||
# If this accepts the Host header and fetches from google.com it will fail with
|
||||
# a 404. Instead it should use a loopback fetch and succeed.
|
||||
URL="$HOSTNAME/mod_pagespeed_example/.pagespeed.ce.8CfGBvwDhH.css"
|
||||
URL="$HOSTNAME/mod_pagespeed_example/styles/big.pagespeed.ce.8CfGBvwDhH.css"
|
||||
check wget -O /dev/null --header=Host:www.google.com "$URL"
|
||||
|
||||
test_filter combine_css combines 4 CSS files into 1.
|
||||
@@ -2748,6 +2750,46 @@ start_test Base config has purging disabled. Check error message syntax.
|
||||
OUT=$($WGET_DUMP "$HOSTNAME/pagespeed_admin/cache?purge=*")
|
||||
check_from "$OUT" fgrep -q "pagespeed EnableCachePurge on;"
|
||||
|
||||
start_test Default server header in html flow.
|
||||
URL=http://headers.example.com/mod_pagespeed_example/
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP -O /dev/null -S $URL 2>&1)
|
||||
# '|| true' in the line below supresses the exit code from grep when there is no
|
||||
# match in its input (1).
|
||||
MATCHES=$(echo "$OUT" | grep -c "Server: nginx/") || true
|
||||
check [ $MATCHES -eq 1 ]
|
||||
|
||||
start_test Default server header in resource flow.
|
||||
URL=http://headers.example.com/mod_pagespeed_example/
|
||||
URL+=combine_javascript2.js+combine_javascript1.js.pagespeed.jc.0.js
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP -O /dev/null -S $URL 2>&1)
|
||||
MATCHES=$(echo "$OUT" | grep -c "Server: nginx/") || true
|
||||
check [ $MATCHES -eq 1 ]
|
||||
|
||||
start_test Default server header in IPRO flow.
|
||||
URL=http://headers.example.com//mod_pagespeed_example/combine_javascript2.js
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP -O /dev/null -S $URL 2>&1)
|
||||
MATCHES=$(echo "$OUT" | grep -c "Server: nginx/") || true
|
||||
check [ $MATCHES -eq 1 ]
|
||||
|
||||
start_test Override server header in html flow.
|
||||
URL=http://headers.example.com/mod_pagespeed_test/whitespace.html
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP -O /dev/null -S $URL 2>&1)
|
||||
MATCHES=$(echo "$OUT" | grep -c "Server: override") || true
|
||||
check [ $MATCHES -eq 1 ]
|
||||
|
||||
start_test Override server header in resource flow.
|
||||
URL=http://headers.example.com/mod_pagespeed_test/
|
||||
URL+=A.proxy_pass.css.pagespeed.cf.0.css
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP -O /dev/null -S $URL 2>&1)
|
||||
MATCHES=$(echo "$OUT" | grep -c "Server: override") || true
|
||||
check [ $MATCHES -eq 1 ]
|
||||
|
||||
start_test Override server header in IPRO flow.
|
||||
URL=http://headers.example.com/mod_pagespeed_test/proxy_pass.css
|
||||
OUT=$(http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP -O /dev/null -S $URL 2>&1)
|
||||
MATCHES=$(echo "$OUT" | grep -c "Server: override") || true
|
||||
check [ $MATCHES -eq 1 ]
|
||||
|
||||
if $USE_VALGRIND; then
|
||||
# It is possible that there are still ProxyFetches outstanding
|
||||
# at this point in time. Give them a few extra seconds to allow
|
||||
|
||||
@@ -1044,6 +1044,31 @@ http {
|
||||
pagespeed DisableFilters remove_comments,add_instrumentation;
|
||||
}
|
||||
|
||||
# Test that pagespeed is disabled when sendfile headers are present.
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name uses-sendfile.example.com;
|
||||
pagespeed FileCachePath "@@SECONDARY_CACHE@@";
|
||||
pagespeed EnableFilters inline_javascript,rewrite_javascript;
|
||||
add_header 'X-Sendfile' 'blablabla';
|
||||
}
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name doesnt-sendfile.example.com;
|
||||
pagespeed FileCachePath "@@SECONDARY_CACHE@@";
|
||||
pagespeed EnableFilters inline_javascript,rewrite_javascript;
|
||||
}
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name uses-xaccelredirect.example.com;
|
||||
pagespeed FileCachePath "@@SECONDARY_CACHE@@";
|
||||
pagespeed EnableFilters inline_javascript,rewrite_javascript;
|
||||
add_header 'X-Accel-Redirect' 'blablabla';
|
||||
}
|
||||
|
||||
# Proxy + IPRO a gzip'd file for testing Issue 896.
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
@@ -1152,6 +1177,22 @@ http {
|
||||
pagespeed EnableFilters rewrite_css;
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name headers.example.com;
|
||||
root "@@SERVER_ROOT@@";
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@_purge";
|
||||
pagespeed RewriteLevel CoreFilters;
|
||||
|
||||
pagespeed InPlaceRewriteDeadlineMs -1;
|
||||
pagespeed LoadFromFile "http://headers.example.com/"
|
||||
"@@SERVER_ROOT@@/";
|
||||
location /mod_pagespeed_test/ {
|
||||
more_set_headers "Server: overriden";
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@PRIMARY_PORT@@;
|
||||
listen [::]:@@PRIMARY_PORT@@;
|
||||
|
||||
Reference in New Issue
Block a user