Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a7bef40eac | |||
| af5c568a92 | |||
| 5cc1ffb352 | |||
| d01093ba9b | |||
| a578057e2f | |||
| 5bd43dce9a | |||
| 19ebf69bad | |||
| 4df7460d62 | |||
| c5c443f256 | |||
| b9ca5d865d | |||
| 0cf3f1c6d7 | |||
| 7857bab7fb | |||
| b11ab687c1 | |||
| a81cc997a9 | |||
| 4c9298446c | |||
| 7355f2e207 | |||
| 9da85bb9d5 | |||
| 90ac91fe9e | |||
| da466c1487 | |||
| 2a409777dc | |||
| c3f41512cf | |||
| 0980633dd2 | |||
| c1c83aa69b | |||
| b037cc2b3e | |||
| 4885d44f69 | |||
| 7b84f92adf | |||
| a403e62074 | |||
| 14822570c4 |
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
test/tmp
|
test/tmp
|
||||||
psol/
|
psol/
|
||||||
psol-*.tar.gz
|
psol-*.tar.gz
|
||||||
|
*.*.*.*.tar.gz
|
||||||
|
|||||||
@@ -27,8 +27,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.9.32.2.tar.gz"
|
echo " $ wget https://dl.google.com/dl/page-speed/psol/1.9.32.4.tar.gz"
|
||||||
echo " $ tar -xzvf 1.9.32.2.tar.gz # expands to psol/"
|
echo " $ tar -xzvf 1.9.32.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"
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
# Author: vid@zippykid.com (Vid Luther)
|
# Author: vid@zippykid.com (Vid Luther)
|
||||||
# jefftk@google.com (Jeff Kaufman)
|
# jefftk@google.com (Jeff Kaufman)
|
||||||
|
|
||||||
URL="https://modpagespeed.googlecode.com/svn/trunk/src/"
|
URL="https://github.com/pagespeed/mod_pagespeed/raw/master/"
|
||||||
URL+="net/instaweb/genfiles/conf/pagespeed_libraries.conf"
|
URL+="net/instaweb/genfiles/conf/pagespeed_libraries.conf"
|
||||||
curl -s "$URL" \
|
curl -L -s -S "$URL" \
|
||||||
| grep ModPagespeedLibrary \
|
| grep ModPagespeedLibrary \
|
||||||
| while read library size hash url ; do
|
| while read library size hash url ; do
|
||||||
echo " pagespeed Library $size $hash $url;"
|
echo " pagespeed Library $size $hash $url;"
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ void NgxBaseFetch::HandleHeadersComplete() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For the IPRO lookup, supress notification of the nginx side here.
|
// For the IPRO lookup, suppress notification of the nginx side here.
|
||||||
// If we send both this event and the one from done, nasty stuff will happen
|
// If we send both this event and the one from done, nasty stuff will happen
|
||||||
// if we loose the race with with the nginx side destructing this base fetch
|
// if we loose the race with with the nginx side destructing this base fetch
|
||||||
// instance (and thereby clearing the byte and its pending extraneous event.
|
// instance (and thereby clearing the byte and its pending extraneous event.
|
||||||
|
|||||||
+12
-4
@@ -42,6 +42,7 @@ extern "C" {
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <typeinfo>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "net/instaweb/util/public/scoped_ptr.h"
|
#include "net/instaweb/util/public/scoped_ptr.h"
|
||||||
@@ -255,7 +256,6 @@ void NgxConnection::IdleWriteHandler(ngx_event_t* ev) {
|
|||||||
if (n == NGX_AGAIN) {
|
if (n == NGX_AGAIN) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DCHECK(false) << "NgxFetch: Unexpected write event" << n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NgxConnection::IdleReadHandler(ngx_event_t* ev) {
|
void NgxConnection::IdleReadHandler(ngx_event_t* ev) {
|
||||||
@@ -447,7 +447,7 @@ const char* NgxFetch::str_url() {
|
|||||||
return str_url_.c_str();
|
return str_url_.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function should be called only once. The only argument is sucess or
|
// This function should be called only once. The only argument is success or
|
||||||
// not.
|
// not.
|
||||||
void NgxFetch::CallbackDone(bool success) {
|
void NgxFetch::CallbackDone(bool success) {
|
||||||
ngx_log_error(NGX_LOG_DEBUG, log_, 0, "NgxFetch %p: CallbackDone: %s\n",
|
ngx_log_error(NGX_LOG_DEBUG, log_, 0, "NgxFetch %p: CallbackDone: %s\n",
|
||||||
@@ -570,8 +570,16 @@ void NgxFetch::ResolveDoneHandler(ngx_resolver_ctx_t* resolver_ctx) {
|
|||||||
ngx_uint_t i;
|
ngx_uint_t i;
|
||||||
// Find the first ipv4 address. We don't support ipv6 yet.
|
// Find the first ipv4 address. We don't support ipv6 yet.
|
||||||
for (i = 0; i < resolver_ctx->naddrs; i++) {
|
for (i = 0; i < resolver_ctx->naddrs; i++) {
|
||||||
if (reinterpret_cast<struct sockaddr_in*>(
|
// Old versions of nginx and tengine have a different definition of addrs,
|
||||||
resolver_ctx->addrs[i].sockaddr)->sin_family == AF_INET) {
|
// work around to make sure we are using the right type (ngx_addr_t*).
|
||||||
|
ngx_addr_t* ngx_addrs = reinterpret_cast<ngx_addr_t*>(resolver_ctx->addrs);
|
||||||
|
if (typeid(*ngx_addrs) == typeid(*resolver_ctx->addrs)) {
|
||||||
|
if (reinterpret_cast<struct sockaddr_in*>(ngx_addrs[i].sockaddr)
|
||||||
|
->sin_family == AF_INET) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// We're using an old version that uses in_addr_t* for addrs.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-4
@@ -70,7 +70,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NgxGZipSetter::NgxGZipSetter() : enabled_(0) { }
|
NgxGZipSetter::NgxGZipSetter() : enabled_(false), initialized_(false) { }
|
||||||
NgxGZipSetter::~NgxGZipSetter() { }
|
NgxGZipSetter::~NgxGZipSetter() { }
|
||||||
|
|
||||||
// Helper functions to determine signature.
|
// Helper functions to determine signature.
|
||||||
@@ -95,7 +95,7 @@ bool IsNgxBitmaskCommand(ngx_command_t* command) {
|
|||||||
HasLocalConfig(command));
|
HasLocalConfig(command));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the NgxGzipSetter.
|
// Initialize the NgxGZipSetter.
|
||||||
// Find the gzip, gzip_vary, gzip_http_version and gzip_types commands in the
|
// Find the gzip, gzip_vary, gzip_http_version and gzip_types commands in the
|
||||||
// gzip module. Enable if the signature of the zip command matches with what we
|
// gzip module. Enable if the signature of the zip command matches with what we
|
||||||
// trust. Also sets up redirects for the configurations. These redirect handle
|
// trust. Also sets up redirects for the configurations. These redirect handle
|
||||||
@@ -105,6 +105,16 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) {
|
|||||||
#if (NGX_HTTP_GZIP)
|
#if (NGX_HTTP_GZIP)
|
||||||
bool gzip_signature_mismatch = false;
|
bool gzip_signature_mismatch = false;
|
||||||
bool other_signature_mismatch = false;
|
bool other_signature_mismatch = false;
|
||||||
|
// If we initialized already we don't have to scan again.
|
||||||
|
if (initialized_) {
|
||||||
|
// Config might have changed, so re-enable if we have gzip.
|
||||||
|
if (gzip_command_.command_ != NULL) {
|
||||||
|
enabled_ = true;
|
||||||
|
} else {
|
||||||
|
enabled_ = false;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (int m = 0; ngx_modules[m] != NULL; m++) {
|
for (int m = 0; ngx_modules[m] != NULL; m++) {
|
||||||
if (ngx_modules[m]->commands != NULL) {
|
if (ngx_modules[m]->commands != NULL) {
|
||||||
for (int c = 0; ngx_modules[m]->commands[c].name.len; c++) {
|
for (int c = 0; ngx_modules[m]->commands[c].name.len; c++) {
|
||||||
@@ -122,7 +132,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) {
|
|||||||
current_command->set = ngx_gzip_redirect_conf_set_flag_slot;
|
current_command->set = ngx_gzip_redirect_conf_set_flag_slot;
|
||||||
gzip_command_.command_ = current_command;
|
gzip_command_.command_ = current_command;
|
||||||
gzip_command_.module_ = ngx_modules[m];
|
gzip_command_.module_ = ngx_modules[m];
|
||||||
enabled_ = 1;
|
enabled_ = true;
|
||||||
} else {
|
} else {
|
||||||
ngx_conf_log_error(
|
ngx_conf_log_error(
|
||||||
NGX_LOG_WARN, cf, 0,
|
NGX_LOG_WARN, cf, 0,
|
||||||
@@ -189,6 +199,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
initialized_ = true;
|
||||||
if (gzip_signature_mismatch) {
|
if (gzip_signature_mismatch) {
|
||||||
return; // Already logged error.
|
return; // Already logged error.
|
||||||
} else if (!enabled_) {
|
} else if (!enabled_) {
|
||||||
@@ -381,7 +392,7 @@ void NgxGZipSetter::AddGZipHTTPTypes(ngx_conf_t* cf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NgxGZipSetter::RollBackAndDisable(ngx_conf_t* cf) {
|
void NgxGZipSetter::RollBackAndDisable(ngx_conf_t* cf) {
|
||||||
ngx_conf_log_error(NGX_LOG_INFO, cf, 0,
|
ngx_conf_log_error(NGX_LOG_DEBUG, cf, 0,
|
||||||
"pagespeed: rollback gzip, explicit configuration");
|
"pagespeed: rollback gzip, explicit configuration");
|
||||||
for (std::vector<ngx_flag_t*>::iterator i = ngx_flags_set_.begin();
|
for (std::vector<ngx_flag_t*>::iterator i = ngx_flags_set_.begin();
|
||||||
i != ngx_flags_set_.end(); ++i) {
|
i != ngx_flags_set_.end(); ++i) {
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ class NgxGZipSetter {
|
|||||||
ngx_command_ctx gzip_vary_command_;
|
ngx_command_ctx gzip_vary_command_;
|
||||||
ngx_command_ctx gzip_http_version_command_;
|
ngx_command_ctx gzip_http_version_command_;
|
||||||
bool enabled_;
|
bool enabled_;
|
||||||
|
bool initialized_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NgxGZipSetter();
|
NgxGZipSetter();
|
||||||
|
|||||||
@@ -18,6 +18,10 @@
|
|||||||
#define NGX_MESSAGE_HANDLER_H_
|
#define NGX_MESSAGE_HANDLER_H_
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#include <ngx_auto_config.h>
|
||||||
|
#if (NGX_THREADS)
|
||||||
|
#include <ngx_thread.h>
|
||||||
|
#endif
|
||||||
#include <ngx_core.h>
|
#include <ngx_core.h>
|
||||||
#include <ngx_log.h>
|
#include <ngx_log.h>
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-29
@@ -295,7 +295,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()?
|
||||||
@@ -342,10 +343,17 @@ ngx_int_t copy_response_headers_to_ngx(
|
|||||||
|
|
||||||
ngx_str_t name, value;
|
ngx_str_t name, value;
|
||||||
|
|
||||||
|
// If the gzip module is not configured, we must not rename the header,
|
||||||
|
// because we will fail to inject the header filter that will rename the
|
||||||
|
// header back.
|
||||||
|
bool gzip_enabled = false;
|
||||||
|
#if (NGX_HTTP_GZIP)
|
||||||
|
gzip_enabled = true;
|
||||||
|
#endif
|
||||||
// To prevent the gzip module from clearing weak etags, we output them
|
// To prevent the gzip module from clearing weak etags, we output them
|
||||||
// using a different name here. The etag header filter module runs behind
|
// using a different name here. The etag header filter module runs behind
|
||||||
// the gzip compressors header filter, and will rename it to 'ETag'
|
// the gzip compressors header filter, and will rename it to 'ETag'
|
||||||
if (StringCaseEqual(name_gs, "etag")
|
if (gzip_enabled && StringCaseEqual(name_gs, "etag")
|
||||||
&& StringCaseStartsWith(value_gs, "W/")) {
|
&& StringCaseStartsWith(value_gs, "W/")) {
|
||||||
name.len = strlen(kInternalEtagName);
|
name.len = strlen(kInternalEtagName);
|
||||||
name.data = reinterpret_cast<u_char*>(
|
name.data = reinterpret_cast<u_char*>(
|
||||||
@@ -354,6 +362,7 @@ ngx_int_t copy_response_headers_to_ngx(
|
|||||||
name.len = name_gs.length();
|
name.len = name_gs.length();
|
||||||
name.data = reinterpret_cast<u_char*>(const_cast<char*>(name_gs.data()));
|
name.data = reinterpret_cast<u_char*>(const_cast<char*>(name_gs.data()));
|
||||||
}
|
}
|
||||||
|
|
||||||
value.len = value_gs.length();
|
value.len = value_gs.length();
|
||||||
value.data = reinterpret_cast<u_char*>(const_cast<char*>(value_gs.data()));
|
value.data = reinterpret_cast<u_char*>(const_cast<char*>(value_gs.data()));
|
||||||
|
|
||||||
@@ -1630,7 +1639,8 @@ void ps_release_base_fetch(ps_request_ctx_t* ctx) {
|
|||||||
|
|
||||||
// TODO(chaizhenhua): merge into NgxBaseFetch ctor
|
// TODO(chaizhenhua): merge into NgxBaseFetch ctor
|
||||||
ngx_int_t ps_create_base_fetch(ps_request_ctx_t* ctx,
|
ngx_int_t ps_create_base_fetch(ps_request_ctx_t* ctx,
|
||||||
RequestContextPtr request_context) {
|
RequestContextPtr request_context,
|
||||||
|
RequestHeaders* request_headers) {
|
||||||
ngx_http_request_t* r = ctx->r;
|
ngx_http_request_t* r = ctx->r;
|
||||||
ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
|
ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
|
||||||
int file_descriptors[2];
|
int file_descriptors[2];
|
||||||
@@ -1673,6 +1683,7 @@ ngx_int_t ps_create_base_fetch(ps_request_ctx_t* ctx,
|
|||||||
ctx->base_fetch = new NgxBaseFetch(
|
ctx->base_fetch = new NgxBaseFetch(
|
||||||
r, file_descriptors[1], cfg_s->server_context,
|
r, file_descriptors[1], cfg_s->server_context,
|
||||||
request_context, ctx->preserve_caching_headers);
|
request_context, ctx->preserve_caching_headers);
|
||||||
|
ctx->base_fetch->SetRequestHeadersTakingOwnership(request_headers);
|
||||||
|
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
@@ -1808,7 +1819,10 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
|||||||
GoogleString url_string = ps_determine_url(r);
|
GoogleString url_string = ps_determine_url(r);
|
||||||
GoogleUrl url(url_string);
|
GoogleUrl url(url_string);
|
||||||
|
|
||||||
CHECK(url.IsWebValid());
|
if (!url.IsWebValid()) {
|
||||||
|
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "invalid url");
|
||||||
|
return NGX_DECLINED;
|
||||||
|
}
|
||||||
|
|
||||||
scoped_ptr<RequestHeaders> request_headers(new RequestHeaders);
|
scoped_ptr<RequestHeaders> request_headers(new RequestHeaders);
|
||||||
scoped_ptr<ResponseHeaders> response_headers(new ResponseHeaders);
|
scoped_ptr<ResponseHeaders> response_headers(new ResponseHeaders);
|
||||||
@@ -1923,35 +1937,17 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
|||||||
ngx_http_set_ctx(r, ctx, ngx_pagespeed);
|
ngx_http_set_ctx(r, ctx, ngx_pagespeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps_create_base_fetch(ctx, request_context) != NGX_OK) {
|
|
||||||
// Do not need to release request context 'ctx'.
|
|
||||||
// http_pool_cleanup will call ps_release_request_context
|
|
||||||
return NGX_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx->base_fetch->SetRequestHeadersTakingOwnership(request_headers.release());
|
|
||||||
|
|
||||||
bool page_callback_added = false;
|
|
||||||
scoped_ptr<ProxyFetchPropertyCallbackCollector>
|
|
||||||
property_callback(
|
|
||||||
ProxyFetchFactory::InitiatePropertyCacheLookup(
|
|
||||||
!html_rewrite /* is_resource_fetch */,
|
|
||||||
url,
|
|
||||||
cfg_s->server_context,
|
|
||||||
options,
|
|
||||||
ctx->base_fetch,
|
|
||||||
false /* requires_blink_cohort (no longer unused) */,
|
|
||||||
&page_callback_added));
|
|
||||||
|
|
||||||
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());
|
||||||
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());
|
||||||
QueryParams query_params;
|
QueryParams query_params;
|
||||||
query_params.ParseFromUrl(url);
|
query_params.ParseFromUrl(url);
|
||||||
|
|
||||||
@@ -1995,6 +1991,7 @@ 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());
|
||||||
// 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;
|
||||||
|
|
||||||
@@ -2021,12 +2018,22 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
|||||||
driver->set_pagespeed_option_cookies(pagespeed_option_cookies);
|
driver->set_pagespeed_option_cookies(pagespeed_option_cookies);
|
||||||
|
|
||||||
// TODO(jefftk): FlushEarlyFlow would go here.
|
// TODO(jefftk): FlushEarlyFlow would go here.
|
||||||
|
bool page_callback_added = false;
|
||||||
|
ProxyFetchPropertyCallbackCollector* property_callback =
|
||||||
|
ProxyFetchFactory::InitiatePropertyCacheLookup(
|
||||||
|
!html_rewrite /* is_resource_fetch */,
|
||||||
|
url,
|
||||||
|
cfg_s->server_context,
|
||||||
|
options,
|
||||||
|
ctx->base_fetch,
|
||||||
|
false /* requires_blink_cohort (no longer unused) */,
|
||||||
|
&page_callback_added);
|
||||||
|
|
||||||
// Will call StartParse etc. The rewrite driver will take care of deleting
|
// Will call StartParse etc. The rewrite driver will take care of deleting
|
||||||
// itself if necessary.
|
// itself if necessary.
|
||||||
ctx->proxy_fetch = cfg_s->proxy_fetch_factory->CreateNewProxyFetch(
|
ctx->proxy_fetch = cfg_s->proxy_fetch_factory->CreateNewProxyFetch(
|
||||||
url_string, ctx->base_fetch, driver,
|
url_string, ctx->base_fetch, driver,
|
||||||
property_callback.release(),
|
property_callback,
|
||||||
NULL /* original_content_fetch */);
|
NULL /* original_content_fetch */);
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
@@ -2034,6 +2041,7 @@ 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());
|
||||||
// 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;
|
||||||
if (custom_options.get() == NULL) {
|
if (custom_options.get() == NULL) {
|
||||||
@@ -2073,8 +2081,7 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
|||||||
"Passing on content handling for non-pagespeed resource '%s'",
|
"Passing on content handling for non-pagespeed resource '%s'",
|
||||||
url_string.c_str());
|
url_string.c_str());
|
||||||
|
|
||||||
ctx->base_fetch->Done(false);
|
CHECK(ctx->base_fetch == NULL);
|
||||||
ps_release_base_fetch(ctx);
|
|
||||||
// set html_rewrite flag.
|
// set html_rewrite flag.
|
||||||
ctx->html_rewrite = true;
|
ctx->html_rewrite = true;
|
||||||
return NGX_DECLINED;
|
return NGX_DECLINED;
|
||||||
@@ -2279,14 +2286,13 @@ ngx_int_t ps_html_rewrite_header_filter(ngx_http_request_t* r) {
|
|||||||
if (!ps_has_stacked_content_encoding(r)) {
|
if (!ps_has_stacked_content_encoding(r)) {
|
||||||
StringPiece content_encoding =
|
StringPiece content_encoding =
|
||||||
str_to_string_piece(r->headers_out.content_encoding->value);
|
str_to_string_piece(r->headers_out.content_encoding->value);
|
||||||
GzipInflater::InflateType inflate_type;
|
GzipInflater::InflateType inflate_type = GzipInflater::kGzip;
|
||||||
bool is_encoded = false;
|
bool is_encoded = false;
|
||||||
if (StringCaseEqual(content_encoding, "deflate")) {
|
if (StringCaseEqual(content_encoding, "deflate")) {
|
||||||
is_encoded = true;
|
is_encoded = true;
|
||||||
inflate_type = GzipInflater::kDeflate;
|
inflate_type = GzipInflater::kDeflate;
|
||||||
} else if (StringCaseEqual(content_encoding, "gzip")) {
|
} else if (StringCaseEqual(content_encoding, "gzip")) {
|
||||||
is_encoded = true;
|
is_encoded = true;
|
||||||
inflate_type = GzipInflater::kGzip;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_encoded) {
|
if (is_encoded) {
|
||||||
|
|||||||
@@ -20,6 +20,10 @@
|
|||||||
#define NGX_REWRITE_DRIVER_FACTORY_H_
|
#define NGX_REWRITE_DRIVER_FACTORY_H_
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
#include <ngx_auto_config.h>
|
||||||
|
#if (NGX_THREADS)
|
||||||
|
#include <ngx_thread.h>
|
||||||
|
#endif
|
||||||
#include <ngx_core.h>
|
#include <ngx_core.h>
|
||||||
#include <ngx_http.h>
|
#include <ngx_http.h>
|
||||||
#include <ngx_config.h>
|
#include <ngx_config.h>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ SystemRequestContext* NgxServerContext::NewRequestContext(
|
|||||||
ngx_http_request_t* r) {
|
ngx_http_request_t* r) {
|
||||||
// Based on ngx_http_variable_server_port.
|
// Based on ngx_http_variable_server_port.
|
||||||
bool port_set = false;
|
bool port_set = false;
|
||||||
int local_port;
|
int local_port = 0;
|
||||||
#if (NGX_HAVE_INET6)
|
#if (NGX_HAVE_INET6)
|
||||||
if (r->connection->local_sockaddr->sa_family == AF_INET6) {
|
if (r->connection->local_sockaddr->sa_family == AF_INET6) {
|
||||||
local_port = ntohs(reinterpret_cast<struct sockaddr_in6*>(
|
local_port = ntohs(reinterpret_cast<struct sockaddr_in6*>(
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class NgxUrlAsyncFetcher : public UrlAsyncFetcher {
|
|||||||
~NgxUrlAsyncFetcher();
|
~NgxUrlAsyncFetcher();
|
||||||
|
|
||||||
// It should be called in the module init_process callback function. Do some
|
// It should be called in the module init_process callback function. Do some
|
||||||
// intializations which can't be done in the master process
|
// initializations which can't be done in the master process
|
||||||
bool Init();
|
bool Init();
|
||||||
|
|
||||||
// shutdown all the fetches.
|
// shutdown all the fetches.
|
||||||
|
|||||||
Reference in New Issue
Block a user