Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f75e891b74 | |||
| 4e2eb3de85 | |||
| c56611b6f4 | |||
| 7e25a0dc13 | |||
| acbd179cb1 | |||
| 46bc8ac065 | |||
| 2af2035bbd | |||
| 61f36e0b98 | |||
| 9711b52270 | |||
| 07a6647b65 | |||
| 787239d429 | |||
| e0a3bf223a | |||
| 21f9b5c9e3 | |||
| ff8969770d | |||
| b26e174d8b | |||
| 026f86dfc2 | |||
| 0db78f6e8c | |||
| 4af79a1e2b | |||
| ed20dabf66 |
@@ -29,8 +29,8 @@ if [ "$mod_pagespeed_dir" = "unset" ] ; then
|
|||||||
echo " You need to separately download the pagespeed library:"
|
echo " You need to separately download the pagespeed library:"
|
||||||
echo ""
|
echo ""
|
||||||
echo " $ cd /path/to/ngx_pagespeed"
|
echo " $ cd /path/to/ngx_pagespeed"
|
||||||
echo " $ wget https://dl.google.com/dl/page-speed/psol/1.11.33.0.tar.gz"
|
echo " $ wget https://dl.google.com/dl/page-speed/psol/1.11.33.4.tar.gz"
|
||||||
echo " $ tar -xzvf 1.11.33.0.tar.gz # expands to psol/"
|
echo " $ tar -xzvf 1.11.33.4.tar.gz # expands to psol/"
|
||||||
echo ""
|
echo ""
|
||||||
echo " Or see the installation instructions:"
|
echo " Or see the installation instructions:"
|
||||||
echo " https://github.com/pagespeed/ngx_pagespeed#how-to-build"
|
echo " https://github.com/pagespeed/ngx_pagespeed#how-to-build"
|
||||||
@@ -80,10 +80,8 @@ ps_maybe_gpp_base=`basename $CC| sed s/gcc/g++/`
|
|||||||
ps_maybe_gpp="`dirname $CC`/$ps_maybe_gpp_base"
|
ps_maybe_gpp="`dirname $CC`/$ps_maybe_gpp_base"
|
||||||
if [ -n "$NGX_GCC_VER" -a \( -x "$ps_maybe_gpp" \) ]; then
|
if [ -n "$NGX_GCC_VER" -a \( -x "$ps_maybe_gpp" \) ]; then
|
||||||
LINK=$ps_maybe_gpp
|
LINK=$ps_maybe_gpp
|
||||||
NGX_TEST_LD_OPT="$NGX_TEST_LD_OPT -lstdc++"
|
|
||||||
else
|
|
||||||
pagespeed_libs="-lstdc++"
|
|
||||||
fi
|
fi
|
||||||
|
pagespeed_libs="-lstdc++"
|
||||||
|
|
||||||
# The compiler needs to know that __sync_add_and_fetch_4 is ok,
|
# The compiler needs to know that __sync_add_and_fetch_4 is ok,
|
||||||
# and this requires an instruction that didn't exist on i586 or i386.
|
# and this requires an instruction that didn't exist on i586 or i386.
|
||||||
@@ -159,17 +157,18 @@ pagespeed_include="\
|
|||||||
$mod_pagespeed_dir/third_party/chromium/src \
|
$mod_pagespeed_dir/third_party/chromium/src \
|
||||||
$mod_pagespeed_dir/third_party/google-sparsehash/src \
|
$mod_pagespeed_dir/third_party/google-sparsehash/src \
|
||||||
$mod_pagespeed_dir/third_party/google-sparsehash/gen/arch/$os_name/$arch_name/include \
|
$mod_pagespeed_dir/third_party/google-sparsehash/gen/arch/$os_name/$arch_name/include \
|
||||||
$mod_pagespeed_dir/third_party/protobuf/src \
|
$mod_pagespeed_dir/third_party/protobuf/src/src \
|
||||||
$mod_pagespeed_dir/third_party/re2/src \
|
$mod_pagespeed_dir/third_party/re2/src \
|
||||||
$mod_pagespeed_dir/out/$buildtype/obj/gen \
|
$mod_pagespeed_dir/out/$buildtype/obj/gen \
|
||||||
$mod_pagespeed_dir/out/$buildtype/obj/gen/protoc_out/instaweb \
|
$mod_pagespeed_dir/out/$buildtype/obj/gen/protoc_out/instaweb \
|
||||||
$mod_pagespeed_dir/third_party/apr/src/include \
|
$mod_pagespeed_dir/third_party/apr/src/include \
|
||||||
$mod_pagespeed_dir/third_party/aprutil/src/include \
|
$mod_pagespeed_dir/third_party/aprutil/src/include \
|
||||||
$mod_pagespeed_dir/third_party/apr/gen/arch/$os_name/$arch_name/include \
|
$mod_pagespeed_dir/third_party/apr/gen/arch/$os_name/$arch_name/include \
|
||||||
$mod_pagespeed_dir/third_party/aprutil/gen/arch/$os_name/$arch_name/include"
|
$mod_pagespeed_dir/third_party/aprutil/gen/arch/$os_name/$arch_name/include \
|
||||||
|
$mod_pagespeed_dir/url"
|
||||||
ngx_feature_path="$pagespeed_include"
|
ngx_feature_path="$pagespeed_include"
|
||||||
|
|
||||||
pagespeed_libs="$pagespeed_libs $psol_binary -lrt -pthread -lm"
|
pagespeed_libs="$psol_binary $pagespeed_libs -lrt -pthread -lm"
|
||||||
ngx_feature_libs="$pagespeed_libs"
|
ngx_feature_libs="$pagespeed_libs"
|
||||||
ngx_feature_test="
|
ngx_feature_test="
|
||||||
|
|
||||||
|
|||||||
+24
-3
@@ -12,9 +12,12 @@
|
|||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* Author: jefftk@google.com (Jeff Kaufman)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Author: jefftk@google.com (Jeff Kaufman)
|
#include "ngx_pagespeed.h" // Must come first, see comments in CollectHeaders.
|
||||||
|
|
||||||
#include <unistd.h> //for usleep
|
#include <unistd.h> //for usleep
|
||||||
|
|
||||||
#include "ngx_base_fetch.h"
|
#include "ngx_base_fetch.h"
|
||||||
@@ -23,6 +26,8 @@
|
|||||||
|
|
||||||
#include "ngx_pagespeed.h"
|
#include "ngx_pagespeed.h"
|
||||||
|
|
||||||
|
#include "net/instaweb/rewriter/public/rewrite_driver.h"
|
||||||
|
#include "net/instaweb/rewriter/public/rewrite_options.h"
|
||||||
#include "net/instaweb/rewriter/public/rewrite_stats.h"
|
#include "net/instaweb/rewriter/public/rewrite_stats.h"
|
||||||
#include "pagespeed/kernel/base/google_message_handler.h"
|
#include "pagespeed/kernel/base/google_message_handler.h"
|
||||||
#include "pagespeed/kernel/base/message_handler.h"
|
#include "pagespeed/kernel/base/message_handler.h"
|
||||||
@@ -38,14 +43,18 @@ const char kDone = 'D';
|
|||||||
NgxEventConnection* NgxBaseFetch::event_connection = NULL;
|
NgxEventConnection* NgxBaseFetch::event_connection = NULL;
|
||||||
int NgxBaseFetch::active_base_fetches = 0;
|
int NgxBaseFetch::active_base_fetches = 0;
|
||||||
|
|
||||||
NgxBaseFetch::NgxBaseFetch(ngx_http_request_t* r,
|
NgxBaseFetch::NgxBaseFetch(StringPiece url,
|
||||||
|
ngx_http_request_t* r,
|
||||||
NgxServerContext* server_context,
|
NgxServerContext* server_context,
|
||||||
const RequestContextPtr& request_ctx,
|
const RequestContextPtr& request_ctx,
|
||||||
PreserveCachingHeaders preserve_caching_headers,
|
PreserveCachingHeaders preserve_caching_headers,
|
||||||
NgxBaseFetchType base_fetch_type)
|
NgxBaseFetchType base_fetch_type,
|
||||||
|
const RewriteOptions* options)
|
||||||
: AsyncFetch(request_ctx),
|
: AsyncFetch(request_ctx),
|
||||||
|
url_(url.data(), url.size()),
|
||||||
request_(r),
|
request_(r),
|
||||||
server_context_(server_context),
|
server_context_(server_context),
|
||||||
|
options_(options),
|
||||||
done_called_(false),
|
done_called_(false),
|
||||||
last_buf_sent_(false),
|
last_buf_sent_(false),
|
||||||
references_(2),
|
references_(2),
|
||||||
@@ -249,6 +258,13 @@ ngx_int_t NgxBaseFetch::CollectAccumulatedWrites(ngx_chain_t** link_ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngx_int_t NgxBaseFetch::CollectHeaders(ngx_http_headers_out_t* headers_out) {
|
ngx_int_t NgxBaseFetch::CollectHeaders(ngx_http_headers_out_t* headers_out) {
|
||||||
|
// nginx defines _FILE_OFFSET_BITS to 64, which changes the size of off_t.
|
||||||
|
// If a standard header is accidentally included before the nginx header,
|
||||||
|
// on a 32-bit system off_t will be 4 bytes and we don't assign all the
|
||||||
|
// bits of content_length_n. Sanity check that did not happen.
|
||||||
|
// This could use static_assert, but this file is not built with --std=c++11.
|
||||||
|
bool sanity_check_off_t[sizeof(off_t) == 8 ? 1 : -1] __attribute__ ((unused));
|
||||||
|
|
||||||
const ResponseHeaders* pagespeed_headers = response_headers();
|
const ResponseHeaders* pagespeed_headers = response_headers();
|
||||||
|
|
||||||
if (content_length_known()) {
|
if (content_length_known()) {
|
||||||
@@ -331,4 +347,9 @@ void NgxBaseFetch::HandleDone(bool success) {
|
|||||||
DecrefAndDeleteIfUnreferenced();
|
DecrefAndDeleteIfUnreferenced();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NgxBaseFetch::IsCachedResultValid(const ResponseHeaders& headers) {
|
||||||
|
return OptionsAwareHTTPCacheCallback::IsCacheValid(
|
||||||
|
url_, *options_, request_context(), headers);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace net_instaweb
|
} // namespace net_instaweb
|
||||||
|
|||||||
+12
-2
@@ -43,6 +43,9 @@
|
|||||||
// events it handles.
|
// events it handles.
|
||||||
//
|
//
|
||||||
// When the last reference is dropped, this class will delete itself.
|
// When the last reference is dropped, this class will delete itself.
|
||||||
|
//
|
||||||
|
// TODO(jmarantz): consider sharing the cache-invalidation infrastructure
|
||||||
|
// with ApacheFetch, using a common base class.
|
||||||
|
|
||||||
#ifndef NGX_BASE_FETCH_H_
|
#ifndef NGX_BASE_FETCH_H_
|
||||||
#define NGX_BASE_FETCH_H_
|
#define NGX_BASE_FETCH_H_
|
||||||
@@ -59,6 +62,7 @@ extern "C" {
|
|||||||
#include "ngx_server_context.h"
|
#include "ngx_server_context.h"
|
||||||
|
|
||||||
#include "net/instaweb/http/public/async_fetch.h"
|
#include "net/instaweb/http/public/async_fetch.h"
|
||||||
|
#include "net/instaweb/rewriter/public/rewrite_options.h"
|
||||||
#include "pagespeed/kernel/base/string.h"
|
#include "pagespeed/kernel/base/string.h"
|
||||||
#include "pagespeed/kernel/http/headers.h"
|
#include "pagespeed/kernel/http/headers.h"
|
||||||
|
|
||||||
@@ -74,10 +78,12 @@ enum NgxBaseFetchType {
|
|||||||
|
|
||||||
class NgxBaseFetch : public AsyncFetch {
|
class NgxBaseFetch : public AsyncFetch {
|
||||||
public:
|
public:
|
||||||
NgxBaseFetch(ngx_http_request_t* r, NgxServerContext* server_context,
|
NgxBaseFetch(StringPiece url, ngx_http_request_t* r,
|
||||||
|
NgxServerContext* server_context,
|
||||||
const RequestContextPtr& request_ctx,
|
const RequestContextPtr& request_ctx,
|
||||||
PreserveCachingHeaders preserve_caching_headers,
|
PreserveCachingHeaders preserve_caching_headers,
|
||||||
NgxBaseFetchType base_fetch_type);
|
NgxBaseFetchType base_fetch_type,
|
||||||
|
const RewriteOptions* options);
|
||||||
virtual ~NgxBaseFetch();
|
virtual ~NgxBaseFetch();
|
||||||
|
|
||||||
// Statically initializes event_connection, require for PSOL and nginx to
|
// Statically initializes event_connection, require for PSOL and nginx to
|
||||||
@@ -125,6 +131,8 @@ class NgxBaseFetch : public AsyncFetch {
|
|||||||
ngx_http_request_t* request() { return request_; }
|
ngx_http_request_t* request() { return request_; }
|
||||||
NgxBaseFetchType base_fetch_type() { return base_fetch_type_; }
|
NgxBaseFetchType base_fetch_type() { return base_fetch_type_; }
|
||||||
|
|
||||||
|
virtual bool IsCachedResultValid(const ResponseHeaders& headers);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool HandleWrite(const StringPiece& sp, MessageHandler* handler);
|
virtual bool HandleWrite(const StringPiece& sp, MessageHandler* handler);
|
||||||
virtual bool HandleFlush(MessageHandler* handler);
|
virtual bool HandleFlush(MessageHandler* handler);
|
||||||
@@ -156,9 +164,11 @@ class NgxBaseFetch : public AsyncFetch {
|
|||||||
// Live count of NgxBaseFetch instances that are currently in use.
|
// Live count of NgxBaseFetch instances that are currently in use.
|
||||||
static int active_base_fetches;
|
static int active_base_fetches;
|
||||||
|
|
||||||
|
GoogleString url_;
|
||||||
ngx_http_request_t* request_;
|
ngx_http_request_t* request_;
|
||||||
GoogleString buffer_;
|
GoogleString buffer_;
|
||||||
NgxServerContext* server_context_;
|
NgxServerContext* server_context_;
|
||||||
|
const RewriteOptions* options_;
|
||||||
bool done_called_;
|
bool done_called_;
|
||||||
bool last_buf_sent_;
|
bool last_buf_sent_;
|
||||||
// How many active references there are to this fetch. Starts at two,
|
// How many active references there are to this fetch. Starts at two,
|
||||||
|
|||||||
+2
-2
@@ -940,8 +940,8 @@ void NgxFetch::FixUserAgent() {
|
|||||||
user_agent += "NgxNativeFetcher";
|
user_agent += "NgxNativeFetcher";
|
||||||
}
|
}
|
||||||
GoogleString version = StrCat(
|
GoogleString version = StrCat(
|
||||||
" ", kModPagespeedSubrequestUserAgent,
|
" (", kModPagespeedSubrequestUserAgent,
|
||||||
"/" MOD_PAGESPEED_VERSION_STRING "-" LASTCHANGE_STRING);
|
"/" MOD_PAGESPEED_VERSION_STRING "-" LASTCHANGE_STRING ")");
|
||||||
if (!StringPiece(user_agent).ends_with(version)) {
|
if (!StringPiece(user_agent).ends_with(version)) {
|
||||||
user_agent += version;
|
user_agent += version;
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-22
@@ -466,7 +466,8 @@ void copy_response_headers_from_ngx(const ngx_http_request_t* r,
|
|||||||
|
|
||||||
// When we don't have a date header, set one with the current time.
|
// When we don't have a date header, set one with the current time.
|
||||||
if (headers->Lookup1(HttpAttributes::kDate) == NULL) {
|
if (headers->Lookup1(HttpAttributes::kDate) == NULL) {
|
||||||
headers->SetDate(ngx_current_msec);
|
PosixTimer timer;
|
||||||
|
headers->SetDate(timer.NowMs());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(oschaaf): ComputeCaching should be called in setupforhtml()?
|
// TODO(oschaaf): ComputeCaching should be called in setupforhtml()?
|
||||||
@@ -682,6 +683,13 @@ char* ps_main_configure(ngx_conf_t* cf, ngx_command_t* cmd, void* conf);
|
|||||||
char* ps_srv_configure(ngx_conf_t* cf, ngx_command_t* cmd, void* conf);
|
char* ps_srv_configure(ngx_conf_t* cf, ngx_command_t* cmd, void* conf);
|
||||||
char* ps_loc_configure(ngx_conf_t* cf, ngx_command_t* cmd, void* conf);
|
char* ps_loc_configure(ngx_conf_t* cf, ngx_command_t* cmd, void* conf);
|
||||||
|
|
||||||
|
// We want NGX_CONF_MULTI for some very old versions:
|
||||||
|
// https://github.com/pagespeed/ngx_pagespeed/commit/66f1b9aa
|
||||||
|
// but it's gone in recent revisions, so provide a compat #define if needed
|
||||||
|
#ifndef NGX_CONF_MULTI
|
||||||
|
#define NGX_CONF_MULTI 0
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO(jud): Verify that all the offsets should be NGX_HTTP_SRV_CONF_OFFSET and
|
// TODO(jud): Verify that all the offsets should be NGX_HTTP_SRV_CONF_OFFSET and
|
||||||
// not NGX_HTTP_LOC_CONF_OFFSET or NGX_HTTP_MAIN_CONF_OFFSET.
|
// not NGX_HTTP_LOC_CONF_OFFSET or NGX_HTTP_MAIN_CONF_OFFSET.
|
||||||
ngx_command_t ps_commands[] = {
|
ngx_command_t ps_commands[] = {
|
||||||
@@ -1086,7 +1094,7 @@ char* ps_merge_srv_conf(ngx_conf_t* cf, void* parent, void* child) {
|
|||||||
|
|
||||||
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
||||||
ngx_http_conf_get_module_main_conf(cf, ngx_pagespeed));
|
ngx_http_conf_get_module_main_conf(cf, ngx_pagespeed));
|
||||||
cfg_m->driver_factory->set_main_conf(parent_cfg_s->options);
|
cfg_m->driver_factory->SetMainConf(parent_cfg_s->options);
|
||||||
cfg_s->server_context = cfg_m->driver_factory->MakeNgxServerContext(
|
cfg_s->server_context = cfg_m->driver_factory->MakeNgxServerContext(
|
||||||
"dummy_hostname", dummy_port);
|
"dummy_hostname", dummy_port);
|
||||||
// The server context sets some options when we call global_options(). So
|
// The server context sets some options when we call global_options(). So
|
||||||
@@ -1581,10 +1589,12 @@ void ps_release_base_fetch(ps_request_ctx_t* ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO(chaizhenhua): merge into NgxBaseFetch ctor
|
// TODO(chaizhenhua): merge into NgxBaseFetch ctor
|
||||||
void ps_create_base_fetch(ps_request_ctx_t* ctx,
|
void ps_create_base_fetch(StringPiece url,
|
||||||
RequestContextPtr request_context,
|
ps_request_ctx_t* ctx,
|
||||||
RequestHeaders* request_headers,
|
RequestContextPtr request_context,
|
||||||
NgxBaseFetchType type) {
|
RequestHeaders* request_headers,
|
||||||
|
NgxBaseFetchType type,
|
||||||
|
const RewriteOptions* options) {
|
||||||
CHECK(ctx->base_fetch == NULL) << "Pre-existing base fetch!";
|
CHECK(ctx->base_fetch == NULL) << "Pre-existing base fetch!";
|
||||||
|
|
||||||
ngx_http_request_t* r = ctx->r;
|
ngx_http_request_t* r = ctx->r;
|
||||||
@@ -1594,9 +1604,9 @@ void ps_create_base_fetch(ps_request_ctx_t* ctx,
|
|||||||
// it, and call Done() on the associated parent (Proxy or Resource) fetch. If
|
// it, and call Done() on the associated parent (Proxy or Resource) fetch. If
|
||||||
// we fail before creating the associated fetch then we need to call Done() on
|
// we fail before creating the associated fetch then we need to call Done() on
|
||||||
// the BaseFetch ourselves.
|
// the BaseFetch ourselves.
|
||||||
ctx->base_fetch = new NgxBaseFetch(r, cfg_s->server_context,
|
ctx->base_fetch = new NgxBaseFetch(url, r, cfg_s->server_context, request_context,
|
||||||
request_context,
|
ctx->preserve_caching_headers, type,
|
||||||
ctx->preserve_caching_headers, type);
|
options);
|
||||||
ctx->base_fetch->SetRequestHeadersTakingOwnership(request_headers);
|
ctx->base_fetch->SetRequestHeadersTakingOwnership(request_headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1861,16 +1871,17 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
|||||||
if (pagespeed_resource) {
|
if (pagespeed_resource) {
|
||||||
// TODO(jefftk): Set using_spdy appropriately. See
|
// TODO(jefftk): Set using_spdy appropriately. See
|
||||||
// ProxyInterface::ProxyRequestCallback
|
// ProxyInterface::ProxyRequestCallback
|
||||||
ps_create_base_fetch(ctx, request_context, request_headers.release(),
|
ps_create_base_fetch(url.Spec(), ctx, request_context,
|
||||||
kPageSpeedResource);
|
request_headers.release(), kPageSpeedResource,
|
||||||
|
options);
|
||||||
ResourceFetch::Start(
|
ResourceFetch::Start(
|
||||||
url,
|
url,
|
||||||
custom_options.release() /* null if there aren't custom options */,
|
custom_options.release() /* null if there aren't custom options */,
|
||||||
false /* using_spdy */, cfg_s->server_context, ctx->base_fetch);
|
false /* using_spdy */, cfg_s->server_context, ctx->base_fetch);
|
||||||
return ps_async_wait_response(r);
|
return ps_async_wait_response(r);
|
||||||
} else if (is_an_admin_handler) {
|
} else if (is_an_admin_handler) {
|
||||||
ps_create_base_fetch(ctx, request_context, request_headers.release(),
|
ps_create_base_fetch(url.Spec(), ctx, request_context,
|
||||||
kAdminPage);
|
request_headers.release(), kAdminPage, options);
|
||||||
QueryParams query_params;
|
QueryParams query_params;
|
||||||
query_params.ParseFromUrl(url);
|
query_params.ParseFromUrl(url);
|
||||||
|
|
||||||
@@ -1918,8 +1929,8 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
|||||||
|
|
||||||
if (options->domain_lawyer()->MapOriginUrl(
|
if (options->domain_lawyer()->MapOriginUrl(
|
||||||
url, &mapped_url, &host_header, &is_proxy) && is_proxy) {
|
url, &mapped_url, &host_header, &is_proxy) && is_proxy) {
|
||||||
ps_create_base_fetch(ctx, request_context, request_headers.release(),
|
ps_create_base_fetch(url.Spec(), ctx, request_context,
|
||||||
kPageSpeedProxy);
|
request_headers.release(), kPageSpeedProxy, options);
|
||||||
|
|
||||||
RewriteDriver* driver;
|
RewriteDriver* driver;
|
||||||
if (custom_options.get() == NULL) {
|
if (custom_options.get() == NULL) {
|
||||||
@@ -1943,8 +1954,8 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (html_rewrite) {
|
if (html_rewrite) {
|
||||||
ps_create_base_fetch(ctx, request_context, request_headers.release(),
|
ps_create_base_fetch(url.Spec(), ctx, request_context,
|
||||||
kHtmlTransform);
|
request_headers.release(), kHtmlTransform, options);
|
||||||
// Do not store driver in request_context, it's not safe.
|
// Do not store driver in request_context, it's not safe.
|
||||||
RewriteDriver* driver;
|
RewriteDriver* driver;
|
||||||
|
|
||||||
@@ -1988,8 +1999,8 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
|||||||
if (options->in_place_rewriting_enabled() &&
|
if (options->in_place_rewriting_enabled() &&
|
||||||
options->enabled() &&
|
options->enabled() &&
|
||||||
options->IsAllowed(url.Spec())) {
|
options->IsAllowed(url.Spec())) {
|
||||||
ps_create_base_fetch(ctx, request_context, request_headers.release(),
|
ps_create_base_fetch(url.Spec(), ctx, request_context, request_headers.release(),
|
||||||
kIproLookup);
|
kIproLookup, options);
|
||||||
|
|
||||||
// Do not store driver in request_context, it's not safe.
|
// Do not store driver in request_context, it's not safe.
|
||||||
RewriteDriver* driver;
|
RewriteDriver* driver;
|
||||||
@@ -2931,7 +2942,7 @@ ngx_int_t ps_preaccess_handler(ngx_http_request_t* r) {
|
|||||||
ngx_int_t ps_etag_filter_init(ngx_conf_t* cf) {
|
ngx_int_t ps_etag_filter_init(ngx_conf_t* cf) {
|
||||||
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
||||||
ngx_http_conf_get_module_main_conf(cf, ngx_pagespeed));
|
ngx_http_conf_get_module_main_conf(cf, ngx_pagespeed));
|
||||||
if (cfg_m->driver_factory != NULL) {
|
if (cfg_m != NULL && cfg_m->driver_factory != NULL) {
|
||||||
ngx_http_ef_next_header_filter = ngx_http_top_header_filter;
|
ngx_http_ef_next_header_filter = ngx_http_top_header_filter;
|
||||||
ngx_http_top_header_filter = ps_etag_header_filter;
|
ngx_http_top_header_filter = ps_etag_header_filter;
|
||||||
}
|
}
|
||||||
@@ -3013,6 +3024,11 @@ ngx_int_t ps_init_module(ngx_cycle_t* cycle) {
|
|||||||
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
||||||
ngx_http_cycle_get_module_main_conf(cycle, ngx_pagespeed));
|
ngx_http_cycle_get_module_main_conf(cycle, ngx_pagespeed));
|
||||||
|
|
||||||
|
// See https://github.com/pagespeed/ngx_pagespeed/issues/1220
|
||||||
|
if (cfg_m == NULL) {
|
||||||
|
return NGX_OK;
|
||||||
|
}
|
||||||
|
|
||||||
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_cycle_get_module_main_conf(cycle, ngx_http_core_module));
|
ngx_http_cycle_get_module_main_conf(cycle, ngx_http_core_module));
|
||||||
ngx_http_core_srv_conf_t** cscfp = static_cast<ngx_http_core_srv_conf_t**>(
|
ngx_http_core_srv_conf_t** cscfp = static_cast<ngx_http_core_srv_conf_t**>(
|
||||||
@@ -3080,7 +3096,7 @@ void ps_exit_child_process(ngx_cycle_t* cycle) {
|
|||||||
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
||||||
ngx_http_cycle_get_module_main_conf(cycle, ngx_pagespeed));
|
ngx_http_cycle_get_module_main_conf(cycle, ngx_pagespeed));
|
||||||
NgxBaseFetch::Terminate();
|
NgxBaseFetch::Terminate();
|
||||||
if (cfg_m->driver_factory != NULL) {
|
if (cfg_m != NULL && cfg_m->driver_factory != NULL) {
|
||||||
cfg_m->driver_factory->ShutDown();
|
cfg_m->driver_factory->ShutDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3090,7 +3106,7 @@ void ps_exit_child_process(ngx_cycle_t* cycle) {
|
|||||||
ngx_int_t ps_init_child_process(ngx_cycle_t* cycle) {
|
ngx_int_t ps_init_child_process(ngx_cycle_t* cycle) {
|
||||||
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
||||||
ngx_http_cycle_get_module_main_conf(cycle, ngx_pagespeed));
|
ngx_http_cycle_get_module_main_conf(cycle, ngx_pagespeed));
|
||||||
if (cfg_m->driver_factory == NULL) {
|
if (cfg_m == NULL || cfg_m->driver_factory == NULL) {
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ NgxRewriteDriverFactory::NgxRewriteDriverFactory(
|
|||||||
SystemThreadSystem* system_thread_system, StringPiece hostname, int port)
|
SystemThreadSystem* system_thread_system, StringPiece hostname, int port)
|
||||||
: SystemRewriteDriverFactory(process_context, system_thread_system,
|
: SystemRewriteDriverFactory(process_context, system_thread_system,
|
||||||
NULL /* default shared memory runtime */, hostname, port),
|
NULL /* default shared memory runtime */, hostname, port),
|
||||||
main_conf_(NULL),
|
|
||||||
threads_started_(false),
|
threads_started_(false),
|
||||||
ngx_message_handler_(
|
ngx_message_handler_(
|
||||||
new NgxMessageHandler(timer(), thread_system()->NewMutex())),
|
new NgxMessageHandler(timer(), thread_system()->NewMutex())),
|
||||||
@@ -148,10 +147,19 @@ NamedLockManager* NgxRewriteDriverFactory::DefaultLockManager() {
|
|||||||
|
|
||||||
RewriteOptions* NgxRewriteDriverFactory::NewRewriteOptions() {
|
RewriteOptions* NgxRewriteDriverFactory::NewRewriteOptions() {
|
||||||
NgxRewriteOptions* options = new NgxRewriteOptions(thread_system());
|
NgxRewriteOptions* options = new NgxRewriteOptions(thread_system());
|
||||||
|
// TODO(jefftk): figure out why using SetDefaultRewriteLevel like
|
||||||
|
// mod_pagespeed does in mod_instaweb.cc:create_dir_config() isn't enough here
|
||||||
|
// -- if you use that instead then ngx_pagespeed doesn't actually end up
|
||||||
|
// defaulting CoreFilters.
|
||||||
|
// See: https://github.com/pagespeed/ngx_pagespeed/issues/1190
|
||||||
options->SetRewriteLevel(RewriteOptions::kCoreFilters);
|
options->SetRewriteLevel(RewriteOptions::kCoreFilters);
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RewriteOptions* NgxRewriteDriverFactory::NewRewriteOptionsForQuery() {
|
||||||
|
return new NgxRewriteOptions(thread_system());
|
||||||
|
}
|
||||||
|
|
||||||
bool NgxRewriteDriverFactory::CheckResolver() {
|
bool NgxRewriteDriverFactory::CheckResolver() {
|
||||||
if (use_native_fetcher_ && resolver_ == NULL) {
|
if (use_native_fetcher_ && resolver_ == NULL) {
|
||||||
return false;
|
return false;
|
||||||
@@ -208,6 +216,14 @@ void NgxRewriteDriverFactory::StartThreads() {
|
|||||||
threads_started_ = true;
|
threads_started_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NgxRewriteDriverFactory::SetMainConf(NgxRewriteOptions* main_options) {
|
||||||
|
// Propagate process-scope options from the copy we had during nginx option
|
||||||
|
// parsing to our own.
|
||||||
|
if (main_options != NULL) {
|
||||||
|
default_options()->MergeOnlyProcessScopeOptions(*main_options);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NgxRewriteDriverFactory::LoggingInit(
|
void NgxRewriteDriverFactory::LoggingInit(
|
||||||
ngx_log_t* log, bool may_install_crash_handler) {
|
ngx_log_t* log, bool may_install_crash_handler) {
|
||||||
log_ = log;
|
log_ = log;
|
||||||
|
|||||||
@@ -63,8 +63,9 @@ class NgxRewriteDriverFactory : public SystemRewriteDriverFactory {
|
|||||||
virtual Timer* DefaultTimer();
|
virtual Timer* DefaultTimer();
|
||||||
virtual NamedLockManager* DefaultLockManager();
|
virtual NamedLockManager* DefaultLockManager();
|
||||||
// Create a new RewriteOptions. In this implementation it will be an
|
// Create a new RewriteOptions. In this implementation it will be an
|
||||||
// NgxRewriteOptions.
|
// NgxRewriteOptions, and it will have CoreFilters explicitly set.
|
||||||
virtual RewriteOptions* NewRewriteOptions();
|
virtual RewriteOptions* NewRewriteOptions();
|
||||||
|
virtual RewriteOptions* NewRewriteOptionsForQuery();
|
||||||
virtual ServerContext* NewDecodingServerContext();
|
virtual ServerContext* NewDecodingServerContext();
|
||||||
// Check resolver configured or not.
|
// Check resolver configured or not.
|
||||||
bool CheckResolver();
|
bool CheckResolver();
|
||||||
@@ -90,7 +91,7 @@ class NgxRewriteDriverFactory : public SystemRewriteDriverFactory {
|
|||||||
InitStats(statistics);
|
InitStats(statistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_main_conf(NgxRewriteOptions* main_conf) { main_conf_ = main_conf; }
|
void SetMainConf(NgxRewriteOptions* main_conf);
|
||||||
|
|
||||||
void set_resolver(ngx_resolver_t* resolver) {
|
void set_resolver(ngx_resolver_t* resolver) {
|
||||||
resolver_ = resolver;
|
resolver_ = resolver;
|
||||||
@@ -133,10 +134,6 @@ class NgxRewriteDriverFactory : public SystemRewriteDriverFactory {
|
|||||||
private:
|
private:
|
||||||
Timer* timer_;
|
Timer* timer_;
|
||||||
|
|
||||||
// main_conf will have only options set in the main block. It may be NULL,
|
|
||||||
// and we do not take ownership.
|
|
||||||
NgxRewriteOptions* main_conf_;
|
|
||||||
|
|
||||||
bool threads_started_;
|
bool threads_started_;
|
||||||
NgxMessageHandler* ngx_message_handler_;
|
NgxMessageHandler* ngx_message_handler_;
|
||||||
NgxMessageHandler* ngx_html_parse_message_handler_;
|
NgxMessageHandler* ngx_html_parse_message_handler_;
|
||||||
|
|||||||
@@ -46,7 +46,23 @@ POSITION_AUX="${POSITION_AUX:-unset}"
|
|||||||
PRIMARY_HOSTNAME="localhost:$PRIMARY_PORT"
|
PRIMARY_HOSTNAME="localhost:$PRIMARY_PORT"
|
||||||
SECONDARY_HOSTNAME="localhost:$SECONDARY_PORT"
|
SECONDARY_HOSTNAME="localhost:$SECONDARY_PORT"
|
||||||
|
|
||||||
SERVER_ROOT="$MOD_PAGESPEED_DIR/src/install/"
|
this_dir="$( cd $(dirname "$0") && pwd)"
|
||||||
|
echo this_dir=$this_dir
|
||||||
|
TEST_TMP="$this_dir/tmp"
|
||||||
|
rm -rf "$TEST_TMP"
|
||||||
|
mkdir -p "$TEST_TMP"
|
||||||
|
echo TEST_TMP=$TEST_TMP
|
||||||
|
|
||||||
|
APACHE_DOC_SRC="$MOD_PAGESPEED_DIR/src/install/"
|
||||||
|
SERVER_ROOT="$TEST_TMP/root"
|
||||||
|
echo SERVER_ROOT=$SERVER_ROOT
|
||||||
|
rm -rf "$SERVER_ROOT"
|
||||||
|
mkdir -p "$SERVER_ROOT"
|
||||||
|
export APACHE_DOC_ROOT="$SERVER_ROOT"
|
||||||
|
|
||||||
|
mkdir -p "$APACHE_DOC_ROOT"
|
||||||
|
make -f "$APACHE_DOC_SRC/Makefile.tests" setup_doc_root \
|
||||||
|
INSTALL_DATA_DIR="$APACHE_DOC_SRC"
|
||||||
|
|
||||||
# We need check and check_not before we source SYSTEM_TEST_FILE that provides
|
# We need check and check_not before we source SYSTEM_TEST_FILE that provides
|
||||||
# them.
|
# them.
|
||||||
@@ -136,8 +152,6 @@ function fire_ab_load() {
|
|||||||
sleep 2
|
sleep 2
|
||||||
}
|
}
|
||||||
|
|
||||||
this_dir="$( cd $(dirname "$0") && pwd)"
|
|
||||||
|
|
||||||
# stop nginx/valgrind
|
# stop nginx/valgrind
|
||||||
killall -s KILL nginx
|
killall -s KILL nginx
|
||||||
# TODO(oschaaf): Fix waiting for valgrind on 32 bits systems.
|
# TODO(oschaaf): Fix waiting for valgrind on 32 bits systems.
|
||||||
@@ -145,8 +159,6 @@ killall -s KILL memcheck-amd64-
|
|||||||
while pgrep nginx > /dev/null; do sleep 1; done
|
while pgrep nginx > /dev/null; do sleep 1; done
|
||||||
while pgrep memcheck > /dev/null; do sleep 1; done
|
while pgrep memcheck > /dev/null; do sleep 1; done
|
||||||
|
|
||||||
TEST_TMP="$this_dir/tmp"
|
|
||||||
rm -r "$TEST_TMP"
|
|
||||||
check_simple mkdir -p "$TEST_TMP"
|
check_simple mkdir -p "$TEST_TMP"
|
||||||
PROXY_CACHE="$TEST_TMP/proxycache"
|
PROXY_CACHE="$TEST_TMP/proxycache"
|
||||||
TMP_PROXY_CACHE="$TEST_TMP/tmpproxycache"
|
TMP_PROXY_CACHE="$TEST_TMP/tmpproxycache"
|
||||||
@@ -646,14 +658,14 @@ check touch "$SECONDARY_CACHE/cache.flush"
|
|||||||
check touch "$IPRO_CACHE/cache.flush"
|
check touch "$IPRO_CACHE/cache.flush"
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
CACHE_TESTING_DIR="$SERVER_ROOT/mod_pagespeed_test/cache_flush/"
|
CACHE_TESTING_DIR="$SERVER_ROOT/cache_flush/"
|
||||||
CACHE_TESTING_TMPDIR="$CACHE_TESTING_DIR/$$"
|
CACHE_TESTING_TMPDIR="$CACHE_TESTING_DIR/$$"
|
||||||
mkdir "$CACHE_TESTING_TMPDIR"
|
mkdir "$CACHE_TESTING_TMPDIR"
|
||||||
cp "$CACHE_TESTING_DIR/cache_flush_test.html" "$CACHE_TESTING_TMPDIR/"
|
cp "$CACHE_TESTING_DIR/cache_flush_test.html" "$CACHE_TESTING_TMPDIR/"
|
||||||
CSS_FILE="$CACHE_TESTING_TMPDIR/update.css"
|
CSS_FILE="$CACHE_TESTING_TMPDIR/update.css"
|
||||||
echo ".class myclass { color: $COLOR0; }" > "$CSS_FILE"
|
echo ".class myclass { color: $COLOR0; }" > "$CSS_FILE"
|
||||||
|
|
||||||
URL_PATH="mod_pagespeed_test/cache_flush/$$/cache_flush_test.html"
|
URL_PATH="cache_flush/$$/cache_flush_test.html"
|
||||||
|
|
||||||
URL="$SECONDARY_HOSTNAME/$URL_PATH"
|
URL="$SECONDARY_HOSTNAME/$URL_PATH"
|
||||||
CACHE_A="--header=Host:cache_a.example.com"
|
CACHE_A="--header=Host:cache_a.example.com"
|
||||||
|
|||||||
@@ -564,6 +564,10 @@ http {
|
|||||||
pagespeed UrlValuedAttribute img alt-src Image;
|
pagespeed UrlValuedAttribute img alt-src Image;
|
||||||
pagespeed UrlValuedAttribute video alt-a Image;
|
pagespeed UrlValuedAttribute video alt-a Image;
|
||||||
pagespeed UrlValuedAttribute video alt-b Image;
|
pagespeed UrlValuedAttribute video alt-b Image;
|
||||||
|
pagespeed UrlValuedAttribute link data-stylesheet Stylesheet;
|
||||||
|
pagespeed UrlValuedAttribute span data-stylesheet-a Stylesheet;
|
||||||
|
pagespeed UrlValuedAttribute span data-stylesheet-b Stylesheet;
|
||||||
|
pagespeed UrlValuedAttribute span data-stylesheet-c Stylesheet;
|
||||||
|
|
||||||
# Also test that we can redefine spec-defined attributes.
|
# Also test that we can redefine spec-defined attributes.
|
||||||
pagespeed UrlValuedAttribute blockquote cite Image;
|
pagespeed UrlValuedAttribute blockquote cite Image;
|
||||||
@@ -808,7 +812,7 @@ http {
|
|||||||
server_name www.example.com;
|
server_name www.example.com;
|
||||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
|
|
||||||
pagespeed LoadFromFile http://cdn.example.com @@SERVER_ROOT@@;
|
pagespeed LoadFromFile http://cdn.example.com @@SERVER_ROOT@@/;
|
||||||
pagespeed MapRewriteDomain cdn.example.com origin.example.com;
|
pagespeed MapRewriteDomain cdn.example.com origin.example.com;
|
||||||
pagespeed RewriteLevel PassThrough;
|
pagespeed RewriteLevel PassThrough;
|
||||||
pagespeed EnableFilters rewrite_css,rewrite_images;
|
pagespeed EnableFilters rewrite_css,rewrite_images;
|
||||||
@@ -822,7 +826,7 @@ http {
|
|||||||
server_name origin.example.com;
|
server_name origin.example.com;
|
||||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
|
|
||||||
pagespeed LoadFromFile http://cdn.example.com @@SERVER_ROOT@@;
|
pagespeed LoadFromFile http://cdn.example.com @@SERVER_ROOT@@/;
|
||||||
pagespeed MapRewriteDomain cdn.example.com origin.example.com;
|
pagespeed MapRewriteDomain cdn.example.com origin.example.com;
|
||||||
pagespeed RewriteLevel PassThrough;
|
pagespeed RewriteLevel PassThrough;
|
||||||
pagespeed EnableFilters rewrite_css,rewrite_images;
|
pagespeed EnableFilters rewrite_css,rewrite_images;
|
||||||
@@ -836,7 +840,7 @@ http {
|
|||||||
server_name cdn.example.com;
|
server_name cdn.example.com;
|
||||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
|
|
||||||
pagespeed LoadFromFile http://cdn.example.com @@SERVER_ROOT@@;
|
pagespeed LoadFromFile http://cdn.example.com @@SERVER_ROOT@@/;
|
||||||
pagespeed MapRewriteDomain cdn.example.com origin.example.com;
|
pagespeed MapRewriteDomain cdn.example.com origin.example.com;
|
||||||
pagespeed RewriteLevel PassThrough;
|
pagespeed RewriteLevel PassThrough;
|
||||||
pagespeed EnableFilters rewrite_css,rewrite_images;
|
pagespeed EnableFilters rewrite_css,rewrite_images;
|
||||||
@@ -1266,6 +1270,44 @@ http {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen @@SECONDARY_PORT@@;
|
||||||
|
listen [::]:@@SECONDARY_PORT@@;
|
||||||
|
server_name compressedcache.example.com;
|
||||||
|
pagespeed on;
|
||||||
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
|
pagespeed EnableFilters rewrite_css;
|
||||||
|
pagespeed HttpCacheCompressionLevel 9;
|
||||||
|
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 @@SECONDARY_PORT@@;
|
||||||
|
listen [::]:@@SECONDARY_PORT@@;
|
||||||
|
server_name uncompressedcache.example.com;
|
||||||
|
pagespeed on;
|
||||||
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
|
pagespeed EnableFilters rewrite_css;
|
||||||
|
pagespeed HttpCacheCompressionLevel 0;
|
||||||
|
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 {
|
server {
|
||||||
listen @@SECONDARY_PORT@@;
|
listen @@SECONDARY_PORT@@;
|
||||||
listen [::]:@@SECONDARY_PORT@@;
|
listen [::]:@@SECONDARY_PORT@@;
|
||||||
@@ -1328,7 +1370,7 @@ http {
|
|||||||
listen [::]:@@SECONDARY_PORT@@;
|
listen [::]:@@SECONDARY_PORT@@;
|
||||||
server_name proxy-post-origin.example.com;
|
server_name proxy-post-origin.example.com;
|
||||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
root "@@SERVER_ROOT@@";
|
root "@@SERVER_ROOT@@/";
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
@@ -1346,7 +1388,7 @@ http {
|
|||||||
listen [::]:@@SECONDARY_PORT@@;
|
listen [::]:@@SECONDARY_PORT@@;
|
||||||
server_name script-filters.example.com;
|
server_name script-filters.example.com;
|
||||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
root "@@SERVER_ROOT@@";
|
root "@@SERVER_ROOT@@/";
|
||||||
set $filters "";
|
set $filters "";
|
||||||
set $domain_shards "cdn1.example.com,cdn2.example.com";
|
set $domain_shards "cdn1.example.com,cdn2.example.com";
|
||||||
if ($http_X_Script) {
|
if ($http_X_Script) {
|
||||||
@@ -1368,7 +1410,7 @@ http {
|
|||||||
pagespeed EnableCachePurge on;
|
pagespeed EnableCachePurge on;
|
||||||
|
|
||||||
pagespeed PurgeMethod PURGE;
|
pagespeed PurgeMethod PURGE;
|
||||||
root "@@SERVER_ROOT@@/mod_pagespeed_test/purge";
|
root "@@SERVER_ROOT@@/purge";
|
||||||
pagespeed FileCachePath "@@FILE_CACHE@@_purge";
|
pagespeed FileCachePath "@@FILE_CACHE@@_purge";
|
||||||
pagespeed DisableFilters add_instrumentation;
|
pagespeed DisableFilters add_instrumentation;
|
||||||
pagespeed RewriteLevel PassThrough;
|
pagespeed RewriteLevel PassThrough;
|
||||||
@@ -1384,7 +1426,7 @@ http {
|
|||||||
pagespeed EnableCachePurge on;
|
pagespeed EnableCachePurge on;
|
||||||
|
|
||||||
pagespeed PurgeMethod PURGE;
|
pagespeed PurgeMethod PURGE;
|
||||||
root "@@SERVER_ROOT@@/mod_pagespeed_test/purge";
|
root "@@SERVER_ROOT@@/purge";
|
||||||
pagespeed FileCachePath "@@FILE_CACHE@@_dir_on";
|
pagespeed FileCachePath "@@FILE_CACHE@@_dir_on";
|
||||||
pagespeed DisableFilters add_instrumentation;
|
pagespeed DisableFilters add_instrumentation;
|
||||||
pagespeed RewriteLevel PassThrough;
|
pagespeed RewriteLevel PassThrough;
|
||||||
@@ -1402,7 +1444,7 @@ http {
|
|||||||
pagespeed InPlaceResourceOptimization off;
|
pagespeed InPlaceResourceOptimization off;
|
||||||
pagespeed off;
|
pagespeed off;
|
||||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
root "@@SERVER_ROOT@@";
|
root "@@SERVER_ROOT@@/";
|
||||||
location /mod_pagespeed_test/nostore {
|
location /mod_pagespeed_test/nostore {
|
||||||
add_header "Cache-Control" "max-age=12345";
|
add_header "Cache-Control" "max-age=12345";
|
||||||
add_header "Cache-Control" "public, no-store";
|
add_header "Cache-Control" "public, no-store";
|
||||||
@@ -1417,7 +1459,7 @@ http {
|
|||||||
pagespeed InPlaceResourceOptimization off;
|
pagespeed InPlaceResourceOptimization off;
|
||||||
pagespeed off;
|
pagespeed off;
|
||||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
root "@@SERVER_ROOT@@";
|
root "@@SERVER_ROOT@@/";
|
||||||
location / {
|
location / {
|
||||||
add_header "PageSpeedFilters" "add_instrumentation";
|
add_header "PageSpeedFilters" "add_instrumentation";
|
||||||
}
|
}
|
||||||
@@ -1430,7 +1472,7 @@ http {
|
|||||||
pagespeed InPlaceResourceOptimization off;
|
pagespeed InPlaceResourceOptimization off;
|
||||||
pagespeed off;
|
pagespeed off;
|
||||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
root "@@SERVER_ROOT@@";
|
root "@@SERVER_ROOT@@/";
|
||||||
location / {
|
location / {
|
||||||
add_header "PageSpeed" "off";
|
add_header "PageSpeed" "off";
|
||||||
}
|
}
|
||||||
@@ -1517,6 +1559,15 @@ http {
|
|||||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
pagespeed on;
|
||||||
|
listen @@SECONDARY_PORT@@;
|
||||||
|
listen [::]:@@SECONDARY_PORT@@;
|
||||||
|
server_name debug-filters.example.com;
|
||||||
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
|
pagespeed RewriteLevel PassThrough;
|
||||||
|
pagespeed EnableFilters debug;
|
||||||
|
}
|
||||||
server {
|
server {
|
||||||
listen @@PRIMARY_PORT@@;
|
listen @@PRIMARY_PORT@@;
|
||||||
listen [::]:@@PRIMARY_PORT@@;
|
listen [::]:@@PRIMARY_PORT@@;
|
||||||
@@ -1755,7 +1806,7 @@ http {
|
|||||||
# optimized.
|
# optimized.
|
||||||
location /mod_pagespeed_test/auth/ {
|
location /mod_pagespeed_test/auth/ {
|
||||||
auth_basic "Restricted";
|
auth_basic "Restricted";
|
||||||
auth_basic_user_file "@@SERVER_ROOT@@mod_pagespeed_test/auth/passwd.conf";
|
auth_basic_user_file "@@SERVER_ROOT@@/mod_pagespeed_test/auth/passwd.conf";
|
||||||
}
|
}
|
||||||
|
|
||||||
location /mod_pagespeed_test/ipro/cookie/ {
|
location /mod_pagespeed_test/ipro/cookie/ {
|
||||||
@@ -1827,6 +1878,11 @@ http {
|
|||||||
"http://$host:@@PRIMARY_PORT@@/mod_pagespeed_test/ipro/instant/"
|
"http://$host:@@PRIMARY_PORT@@/mod_pagespeed_test/ipro/instant/"
|
||||||
"@@SERVER_ROOT@@/mod_pagespeed_test/ipro/instant/";
|
"@@SERVER_ROOT@@/mod_pagespeed_test/ipro/instant/";
|
||||||
|
|
||||||
|
location /mod_pagespeed_test/public/ {
|
||||||
|
add_header "Cache-Control" "public, max-age=600";
|
||||||
|
pagespeed PreserveUrlRelativity off;
|
||||||
|
}
|
||||||
|
|
||||||
pagespeed EnableFilters remove_comments;
|
pagespeed EnableFilters remove_comments;
|
||||||
|
|
||||||
# Test LoadFromFile mapping by mapping one dir to another.
|
# Test LoadFromFile mapping by mapping one dir to another.
|
||||||
|
|||||||
+4
-2
@@ -23,9 +23,11 @@
|
|||||||
# Exits with status 2 if command line args are wrong.
|
# Exits with status 2 if command line args are wrong.
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# ./run_tests.sh primary_port secondary_port mod_pagespeed_dir pagespeed_test_host
|
# ./run_tests.sh primary_port secondary_port mod_pagespeed_dir ngx_binary
|
||||||
|
# pagespeed_test_host
|
||||||
# Example:
|
# Example:
|
||||||
# ./run_tests.sh 8050 8051 /path/to/mod_pagespeed www.modpagespeed.com
|
# ./run_tests.sh 8050 8051 /path/to/mod_pagespeed /path/to/nginx/binary
|
||||||
|
# selfsigned.modpagespeed.com
|
||||||
#
|
#
|
||||||
|
|
||||||
# Normally we test only with the native fetcher off. Set
|
# Normally we test only with the native fetcher off. Set
|
||||||
|
|||||||
Reference in New Issue
Block a user