Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d01093ba9b | |||
| da466c1487 | |||
| 2a409777dc | |||
| c3f41512cf | |||
| 0980633dd2 | |||
| c1c83aa69b | |||
| 4885d44f69 | |||
| 7b84f92adf | |||
| a403e62074 | |||
| 14822570c4 |
@@ -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.2.tar.gz"
|
||||
echo " $ tar -xzvf 1.9.32.2.tar.gz # expands to psol/"
|
||||
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 ""
|
||||
echo " Or see the installation instructions:"
|
||||
echo " https://github.com/pagespeed/ngx_pagespeed#how-to-build"
|
||||
|
||||
@@ -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 loose the race with with the nginx side destructing this base fetch
|
||||
// instance (and thereby clearing the byte and its pending extraneous event.
|
||||
|
||||
+12
-4
@@ -42,6 +42,7 @@ extern "C" {
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <typeinfo>
|
||||
#include <vector>
|
||||
|
||||
#include "net/instaweb/util/public/scoped_ptr.h"
|
||||
@@ -255,7 +256,6 @@ void NgxConnection::IdleWriteHandler(ngx_event_t* ev) {
|
||||
if (n == NGX_AGAIN) {
|
||||
return;
|
||||
}
|
||||
DCHECK(false) << "NgxFetch: Unexpected write event" << n;
|
||||
}
|
||||
|
||||
void NgxConnection::IdleReadHandler(ngx_event_t* ev) {
|
||||
@@ -447,7 +447,7 @@ const char* NgxFetch::str_url() {
|
||||
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.
|
||||
void NgxFetch::CallbackDone(bool success) {
|
||||
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;
|
||||
// Find the first ipv4 address. We don't support ipv6 yet.
|
||||
for (i = 0; i < resolver_ctx->naddrs; i++) {
|
||||
if (reinterpret_cast<struct sockaddr_in*>(
|
||||
resolver_ctx->addrs[i].sockaddr)->sin_family == AF_INET) {
|
||||
// Old versions of nginx and tengine have a different definition of addrs,
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
+15
-4
@@ -70,7 +70,7 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
NgxGZipSetter::NgxGZipSetter() : enabled_(0) { }
|
||||
NgxGZipSetter::NgxGZipSetter() : enabled_(false), initialized_(false) { }
|
||||
NgxGZipSetter::~NgxGZipSetter() { }
|
||||
|
||||
// Helper functions to determine signature.
|
||||
@@ -95,7 +95,7 @@ bool IsNgxBitmaskCommand(ngx_command_t* command) {
|
||||
HasLocalConfig(command));
|
||||
}
|
||||
|
||||
// Initialize the NgxGzipSetter.
|
||||
// Initialize the NgxGZipSetter.
|
||||
// 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
|
||||
// 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)
|
||||
bool gzip_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++) {
|
||||
if (ngx_modules[m]->commands != NULL) {
|
||||
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;
|
||||
gzip_command_.command_ = current_command;
|
||||
gzip_command_.module_ = ngx_modules[m];
|
||||
enabled_ = 1;
|
||||
enabled_ = true;
|
||||
} else {
|
||||
ngx_conf_log_error(
|
||||
NGX_LOG_WARN, cf, 0,
|
||||
@@ -189,6 +199,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) {
|
||||
}
|
||||
}
|
||||
}
|
||||
initialized_ = true;
|
||||
if (gzip_signature_mismatch) {
|
||||
return; // Already logged error.
|
||||
} else if (!enabled_) {
|
||||
@@ -381,7 +392,7 @@ void NgxGZipSetter::AddGZipHTTPTypes(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");
|
||||
for (std::vector<ngx_flag_t*>::iterator i = ngx_flags_set_.begin();
|
||||
i != ngx_flags_set_.end(); ++i) {
|
||||
|
||||
@@ -91,6 +91,7 @@ class NgxGZipSetter {
|
||||
ngx_command_ctx gzip_vary_command_;
|
||||
ngx_command_ctx gzip_http_version_command_;
|
||||
bool enabled_;
|
||||
bool initialized_;
|
||||
|
||||
public:
|
||||
NgxGZipSetter();
|
||||
|
||||
@@ -59,7 +59,7 @@ class NgxUrlAsyncFetcher : public UrlAsyncFetcher {
|
||||
~NgxUrlAsyncFetcher();
|
||||
|
||||
// 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();
|
||||
|
||||
// shutdown all the fetches.
|
||||
|
||||
Reference in New Issue
Block a user