Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4aeb203468 | |||
| 30e85eff1f | |||
| b3c883d54f | |||
| f73a591738 | |||
| ced02f1821 | |||
| 24fe429a6f | |||
| 61a4b592d2 | |||
| c24e387462 | |||
| 1ca55ba5d7 | |||
| 3bb65a9055 | |||
| 449045f982 | |||
| 98d353ebf4 | |||
| 343851a930 | |||
| 2e202e5c8d | |||
| c48ca9e990 | |||
| daf1d9446c | |||
| 4f1565bb2a | |||
| e733a838c3 | |||
| ccaa714a85 | |||
| ab07fb8968 | |||
| 605e61f0a7 | |||
| 8de5d7e443 | |||
| 49006858d1 | |||
| 11f67d9bc7 | |||
| 6f94abef67 | |||
| 662c1e1c5a | |||
| a897f64ce8 | |||
| 4d9e5fcb0c | |||
| 65761a2393 | |||
| 76500396ff | |||
| ef3899515e | |||
| c67f664244 | |||
| 54847f6d1d | |||
| 5631800479 | |||
| a7d1f91dc3 | |||
| 61b949c5e5 | |||
| 5b307745ce | |||
| f78058b6c4 | |||
| 8a0b080229 | |||
| cb56136fe1 | |||
| a4ac43e4d4 | |||
| 80c4b7e97b | |||
| 0c7d64221c | |||
| 68185b8605 | |||
| 7f225e2e70 | |||
| 4d728fc081 | |||
| a399e04a00 | |||
| 247a821564 |
@@ -2,3 +2,4 @@ test/tmp
|
||||
psol/
|
||||
psol-*.tar.gz
|
||||
*.*.*.*.tar.gz
|
||||
nginx
|
||||
|
||||
+24
-36
@@ -1,42 +1,30 @@
|
||||
language: c++
|
||||
env:
|
||||
global:
|
||||
- MAKEFLAGS=-j3
|
||||
# By default travis loads submodules serially, but we can load them in parallel
|
||||
# if we install an updated git and use --jobs. Some timing numbers:
|
||||
# serial: 257s
|
||||
# jobs=4: 182s (29s to install new git, 153s to run the downloads)
|
||||
# jobs=8: 179s (29s to install new git, 150s to run the downloads)
|
||||
# We can't use --depth=1, though, because github doesn't have
|
||||
# allowReachableSHA1InWant set.
|
||||
#
|
||||
# TODO(jefftk): once we're running on a server with git 2.8 or later we can have
|
||||
# --jobs without installing a new git.
|
||||
git:
|
||||
submodules: false
|
||||
before_install:
|
||||
- sudo add-apt-repository --yes ppa:git-core/ppa
|
||||
- sudo apt-get update
|
||||
- sudo apt-get install git
|
||||
- git submodule update --init --recursive --jobs=8
|
||||
install:
|
||||
- mv $TRAVIS_BUILD_DIR ~/ngxpagespeed
|
||||
- sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip g++ python gperf make devscripts fakeroot git curl netcat-traditional gcc-mozilla clang-3.4 2>&1 > /dev/null
|
||||
- export PATH=/usr/lib/gcc-mozilla/bin:$PATH
|
||||
- sudo ln -sf /usr/lib/gcc-mozilla/lib/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.so.6
|
||||
# - sudo sh -c 'echo "image/webp webp" >> /etc/mime.types'
|
||||
# - mkdir -p ~/bin
|
||||
# - cd ~/bin
|
||||
# - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
|
||||
- mkdir ~/mod_pagespeed
|
||||
- cd ~/mod_pagespeed
|
||||
- git clone --recursive https://github.com/pagespeed/mod_pagespeed.git src
|
||||
- cd src
|
||||
- python build/gyp_chromium --depth=.
|
||||
- cd ~/mod_pagespeed/src/pagespeed/automatic
|
||||
- make BUILDTYPE=Release -C ../../pagespeed/automatic all
|
||||
- cd ~
|
||||
- git clone https://github.com/FRiCKLE/ngx_cache_purge.git
|
||||
- NGX_CACHE_PURGE=$PWD/ngx_cache_purge
|
||||
- wget https://openresty.org/download/ngx_openresty-1.9.7.2.tar.gz
|
||||
- tar xzf ngx_openresty-*.tar.gz
|
||||
- cd ngx_openresty-*/
|
||||
- ./configure --with-luajit
|
||||
- make
|
||||
- NGX_DEVEL_KIT=$(echo $HOME/ngx_openresty-*/build/ngx_devel_kit-*/)
|
||||
- SET_MISC_MODULE=$(echo $HOME/ngx_openresty-*/build/set-misc-nginx-module-*/)
|
||||
- HEADERS_MORE_MODULE=$(echo $HOME/ngx_openresty-*/build/headers-more-nginx-module-*/)
|
||||
- cd ~
|
||||
- wget https://github.com/nginx/nginx/archive/branches/default.zip
|
||||
- unzip default.zip
|
||||
- cd nginx-branches-default
|
||||
- MOD_PAGESPEED_DIR="$HOME/mod_pagespeed/src" ./auto/configure --add-module=$HOME/ngxpagespeed --add-module="$NGX_CACHE_PURGE" --add-module="$NGX_DEVEL_KIT" --add-module="$SET_MISC_MODULE" --add-module="$HEADERS_MORE_MODULE" --with-ipv6
|
||||
- make
|
||||
- sudo make install
|
||||
scripts/build_ngx_pagespeed.sh --devel --assume-yes
|
||||
script:
|
||||
- echo "build successful"
|
||||
- echo "cd ~/ngxpagespeed"
|
||||
- echo "sudo ./test/run_tests.sh $HOME/mod_pagespeed $HOME/nginx-branches-default/objs/nginx"
|
||||
test/run_tests.sh $PWD/testing-dependencies/mod_pagespeed/ \
|
||||
$PWD/nginx/sbin/nginx
|
||||
dist: trusty
|
||||
sudo: required
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
Apache ngx_pagespeed
|
||||
|
||||
Copyright 2018 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
- The Apache Software Foundation (http://www.apache.org/).
|
||||
- Google Inc.
|
||||
|
||||
Codebase originally donated by Google Inc:
|
||||
|
||||
Copyright (C) 2010-2017 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
+1
-1
@@ -1 +1 @@
|
||||
https://dl.google.com/dl/page-speed/psol/1.12.34.2-$BIT_SIZE_NAME.tar.gz
|
||||
https://dist.apache.org/repos/dist/release/incubator/pagespeed/1.14.36.1/x64/psol-1.14.36.1-apache-incubating-$BIT_SIZE_NAME.tar.gz
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
[](https://travis-ci.org/pagespeed/ngx_pagespeed)
|
||||
[](https://travis-ci.org/apache/incubator-pagespeed-ngx)
|
||||
|
||||
ngx_pagespeed speeds up your site and reduces page load time by automatically
|
||||
applying web performance best practices to pages and associated assets (CSS,
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
# Environment Variables (Optional):
|
||||
# MOD_PAGESPEED_DIR: absolute path to the mod_pagespeed/src directory
|
||||
# PSOL_BINARY: absolute path to pagespeed_automatic.a
|
||||
# PSOL_BUILDTYPE: Release or Debug
|
||||
|
||||
mod_pagespeed_dir="${MOD_PAGESPEED_DIR:-unset}"
|
||||
position_aux="${POSITION_AUX:-unset}"
|
||||
psol_buildtype="${PSOL_BUILDTYPE:-unset}"
|
||||
|
||||
if [ "$mod_pagespeed_dir" = "unset" ] ; then
|
||||
mod_pagespeed_dir="$ngx_addon_dir/psol/include"
|
||||
@@ -33,7 +35,7 @@ if [ "$mod_pagespeed_dir" = "unset" ] ; then
|
||||
This is a development branch of ngx_pagespeed, which means there is no
|
||||
precompiled PSOL library available to link against. Either build from a
|
||||
release tag, like latest-beta, or build PSOL from source:
|
||||
https://github.com/pagespeed/ngx_pagespeed/wiki/Building-PSOL-From-Source"
|
||||
https://github.com/apache/incubator-pagespeed-ngx/wiki/Building-PSOL-From-Source"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -75,12 +77,16 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$NGX_DEBUG" = "YES" ]; then
|
||||
buildtype=Debug
|
||||
# If we're using a psol tarball that doesn't contain Debug/ (which is the case
|
||||
# from 1.12 onward) then this will be overriden to buildtype=Release below.
|
||||
if [ "$psol_buildtype" = "unset" ] ; then
|
||||
if [ "$NGX_DEBUG" = "YES" ]; then
|
||||
buildtype=Debug
|
||||
# If we're using a psol tarball that doesn't contain Debug/ (which is the case
|
||||
# from 1.12 onward) then this will be overriden to buildtype=Release below.
|
||||
else
|
||||
buildtype=Release
|
||||
fi
|
||||
else
|
||||
buildtype=Release
|
||||
buildtype=$psol_buildtype
|
||||
fi
|
||||
|
||||
# If the compiler is gcc, we want to use g++ to link, if at all possible,
|
||||
@@ -198,7 +204,7 @@ pagespeed_include="\
|
||||
$mod_pagespeed_dir/url"
|
||||
ngx_feature_path="$pagespeed_include"
|
||||
|
||||
pagespeed_libs="$psol_binary $pagespeed_libs -lrt -pthread -lm"
|
||||
pagespeed_libs="$psol_binary $pagespeed_libs -lrt -pthread -lm -luuid"
|
||||
ngx_feature_libs="$pagespeed_libs"
|
||||
ngx_feature_test="
|
||||
|
||||
|
||||
+18
@@ -1,6 +1,24 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Since nginx build system doesn't normally do C++, there is no CXXFLAGS for us
|
||||
# to touch, and compilers are understandably unhappy with --std=c++11 on C
|
||||
# files. Hence, we hack the makefile to add it for just our sources.
|
||||
|
||||
for ps_src_file in $PS_NGX_SRCS; do
|
||||
ps_obj_file="$NGX_OBJS/addon/src/`basename $ps_src_file .cc`.o"
|
||||
echo "$ps_obj_file : CFLAGS += --std=c++11" >> $NGX_MAKEFILE
|
||||
|
||||
@@ -0,0 +1,187 @@
|
||||
# Supported tags and respective `Dockerfile` links
|
||||
|
||||
- [`1.13.35.2`, `stable`, `1.13.35`, `1.13`, `1.13.35.2-alpine3.8`, `1.13.35-alpine3.8`, `1.13-alpine3.8`, `stable-alpine3.8`, `1.13.35.2-alpine3.8-ngx1.14`, `1.13.35-alpine3.8-ngx1.14`, `1.13-alpine3.8-ngx1.14`, `stable-alpine3.8-ngx1.14`, `latest` (*alpine-3.8/nginx-stable/Dockerfile*)](https://github.com/apache/incubator-pagespeed-ngx/blob/master/docker/alpine-3.8/nginx-stable/Dockerfile)
|
||||
- [`1.13.35.2-edge`, `stable-edge`, `edge`, `1.13.35-edge`, `1.13-edge`, `1.13.35.2-edge-ngx1.14`, `1.13.35-edge-ngx1.14`, `1.13-edge-ngx1.14`, `stable-edge-ngx1.14` (*alpine-edge/nginx-stable/Dockerfile*)](https://github.com/apache/incubator-pagespeed-ngx/blob/master/docker/alpine-edge/nginx-stable/Dockerfile)
|
||||
- [`1.13.35.2-alpine3.8-ngx1.15`, `ngx1.15`, `1.13.35-alpine3.8-ngx1.15`, `1.13-alpine3.8-ngx1.15`, `stable-alpine3.8-ngx1.15` (*alpine-3.8/nginx-mainline/Dockerfile*)](https://github.com/apache/incubator-pagespeed-ngx/blob//master/docker/alpine-3.8/nginx-mainline/Dockerfile)
|
||||
- [`1.13.35.2-edge-ngx1.15`, `1.13.35-edge-ngx1.15`, `1.13-edge-ngx1.15`, `stable-edge-ngx1.15` (*alpine-edge/nginx-mainline/Dockerfile*)](https://github.com/apache/incubator-pagespeed-ngx/blob/master/docker/alpine-edge/nginx-mainline/Dockerfile)
|
||||
|
||||
# Quick reference
|
||||
|
||||
- **Where to get help**:
|
||||
[Read the wiki](https://github.com/apache/incubator-pagespeed-mod/wiki), [Ask a question on the mailing list](https://groups.google.com/group/ngx-pagespeed-discuss)
|
||||
|
||||
- **Docker image repository**:
|
||||
[Dockerhub](https://hub.docker.com/r/pagespeed/nginx-pagespeed)
|
||||
|
||||
- **Git Dockerfile repository**:
|
||||
[Github](https://github.com/apache/incubator-pagespeed-ngx/tree/master/docker)
|
||||
|
||||
- **Where to file issues**:
|
||||
[https://github.com/We-Amp/ngx-pagespeed-alpine/issues](https://github.com/apache/incubator-pagespeed-ngx/issues)
|
||||
|
||||
- **Docker images maintained by**:
|
||||
[Nico Berlee](mailto:nico.berlee@on2it.net)
|
||||
|
||||
- **Supported Docker versions**:
|
||||
[the latest release](https://github.com/docker/docker-ce/releases/latest) (down to 1.12 on a best-effort basis)
|
||||
|
||||
# What is pagespeed?
|
||||
|
||||
The PageSpeed Modules, [mod_pagespeed](https://github.com/apache/incubator-pagespeed-mod) and [ngx_pagespeed](https://github.com/apache/incubator-pagespeed-ngx), are open-source webserver modules that [optimize your site automatically](https://www.modpagespeed.com/doc/filters).
|
||||
|
||||
ngx_pagespeed speeds up your site and reduces page load time by automatically
|
||||
applying web performance best practices to pages and associated assets (CSS,
|
||||
JavaScript, images) without requiring you to modify your existing content or
|
||||
workflow. Features include:
|
||||
|
||||
- Image optimization: stripping meta-data, dynamic resizing, recompression
|
||||
- CSS & JavaScript minification, concatenation, inlining, and outlining
|
||||
- Small resource inlining
|
||||
- Deferring image and JavaScript loading
|
||||
- HTML rewriting
|
||||
- Cache lifetime extension
|
||||
- and [more](https://developers.google.com/speed/docs/mod_pagespeed/config_filters)
|
||||
|
||||
To see ngx_pagespeed in action, with example pages for each of the
|
||||
optimizations, see our [demonstration site](http://ngxpagespeed.com).
|
||||
|
||||

|
||||
|
||||
# What is nginx?
|
||||
|
||||
Nginx (pronounced "engine-x") is an open source reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols, as well as a load balancer, HTTP cache, and a web server (origin server). The nginx project started with a strong focus on high concurrency, high performance and low memory usage.
|
||||
> [wikipedia.org/wiki/Nginx](https://en.wikipedia.org/wiki/Nginx)
|
||||
|
||||
# What is nginx-pagespeed?
|
||||
|
||||
The nginx-pagespeed brings all the goods of nginx and pagespeed together in one single small alpine docker image. Nginx-pagespeed aims to be 100% compatible with the plain [nginx](https://hub.docker.com/_/nginx/) images. Meaning, nginx-pagespeed can be a safe drop-in replacement for any container running `nginx:alpine`.
|
||||
|
||||
Nginx-pagespeed makes it easy to start optimizing your website by reducing page load time, without requiring you to modify existing content.
|
||||
|
||||
# How to use this image
|
||||
|
||||
## Hosting some simple static content
|
||||
|
||||
```console
|
||||
$ docker run --name pagespeed-nginx -v /some/content:/usr/share/nginx/html:ro -d pagespeed/nginx-pagespeed
|
||||
```
|
||||
|
||||
Alternatively, a simple `Dockerfile` can be used to generate a new image that includes the necessary content (which is a much cleaner solution than the bind mount above):
|
||||
|
||||
```dockerfile
|
||||
FROM pagespeed/nginx-pagespeed
|
||||
COPY static-html-directory /usr/share/nginx/html
|
||||
```
|
||||
|
||||
Place this file in the same directory as your directory of content ("static-html-directory"), run `docker build -t some-content-ngxpagespeed .`, then start your container:
|
||||
|
||||
```console
|
||||
$ docker run --name my-nginx-pagespeed -d some-content-ngxpagespeed
|
||||
```
|
||||
|
||||
## Exposing external port
|
||||
|
||||
```console
|
||||
$ docker run --name my-nginx-pagespeed -d -p 8080:80 some-content-ngxpagespeed
|
||||
```
|
||||
|
||||
Then you can hit `http://localhost:8080` or `http://host-ip:8080` in your browser.
|
||||
|
||||
## Complex configuration
|
||||
|
||||
```console
|
||||
$ docker run --name my-custom-nginx-pagespeed -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d pagespeed/nginx-pagespeed
|
||||
```
|
||||
|
||||
For information on the syntax of the nginx configuration files, see [the official documentation](http://nginx.org/en/docs/) (specifically the [Beginner's Guide](http://nginx.org/en/docs/beginners_guide.html#conf_structure)). For pagespeed specific nginx config syntax, see [Beginner's guide](https://www.modpagespeed.com/doc/configuration) or a complete overview of [all pagespeed filters](https://www.ngxpagespeed.com/).
|
||||
For a quick start on pagespeed specific configuration see []
|
||||
|
||||
If you wish to adapt the default configuration, use something like the following to copy it from a running nginx-pagespeed container:
|
||||
|
||||
```console
|
||||
$ docker run --name tmp-ngxpagespeed-container -d pagespeed/nginx-pagespeed
|
||||
$ docker cp tmp-ngxpagespeed-container:/etc/nginx/nginx.conf /host/path/nginx.conf
|
||||
$ docker rm -f tmp-ngxpagespeed-container
|
||||
```
|
||||
|
||||
This can also be accomplished more cleanly using a simple `Dockerfile` (in `/host/path/`):
|
||||
|
||||
```dockerfile
|
||||
FROM pagespeed/nginx-pagespeed
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
```
|
||||
|
||||
If you add a custom `CMD` in the Dockerfile, be sure to include `-g daemon off;` in the `CMD` in order for nginx to stay in the foreground, so that Docker can track the process properly (otherwise your container will stop immediately after starting)!
|
||||
|
||||
Then build the image with `docker build -t custom-ngxpagespeed .` and run it as follows:
|
||||
|
||||
```console
|
||||
$ docker run --name my-custom-ngxpagespeed-container -d custom-ngxpagespeed
|
||||
```
|
||||
|
||||
### Using environment variables in nginx configuration
|
||||
|
||||
Out-of-the-box, nginx doesn't support environment variables inside most configuration blocks. But `envsubst` may be used as a workaround if you need to generate your nginx configuration dynamically before nginx starts.
|
||||
|
||||
Here is an example using docker-compose.yml:
|
||||
|
||||
```yaml
|
||||
web:
|
||||
image: pagespeed/nginx-pagespeed
|
||||
volumes:
|
||||
- ./mysite.template:/etc/nginx/conf.d/mysite.template
|
||||
ports:
|
||||
- "8080:80"
|
||||
environment:
|
||||
- NGINX_HOST=foobar.com
|
||||
- NGINX_PORT=80
|
||||
command: /bin/bash -c "envsubst < /etc/nginx/conf.d/mysite.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
|
||||
```
|
||||
|
||||
The `mysite.template` file may then contain variable references like this:
|
||||
|
||||
`listen ${NGINX_PORT};
|
||||
`
|
||||
|
||||
# Image Variants
|
||||
|
||||
The `pagespeed/nginx-pagespeed` images come in many flavors, each designed for a specific use case.
|
||||
|
||||
## `pagespeed/nginx-pagespeed:<version>`
|
||||
|
||||
This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.
|
||||
|
||||
## `nginx:edge`
|
||||
|
||||
This image has the most up-to-date system packages available in the [Alpine Linux project](http://alpinelinux.org). This means the latest LibreSSL and musl-libc, with the downside of having less tested system packages.
|
||||
|
||||
|
||||
## Using the Dockerfile
|
||||
### Use docker build command to build an image from dockerfile:
|
||||
docker build -t <image_tag> <dockerfile_path> .
|
||||
$ docker build -t ngxpagespeed-alpine38-ngxstable stable/3.8/nginx-stable
|
||||
Refer [this](https://docs.docker.com/engine/reference/commandline/build/) for additional options.
|
||||
|
||||
### Run this container as an independent service:
|
||||
$ docker run -d -p 80:80 <image_tag>
|
||||
Refer [this](https://docs.docker.com/engine/reference/run/) for additional options.
|
||||
|
||||
## Requirements for building:
|
||||
- > 3 GB of free diskspace
|
||||
- 2GB of memory
|
||||
- an x86_64 compatible processor
|
||||
- Docker CE > 17.3.2
|
||||
|
||||
|
||||
# Disclaimer
|
||||
Apache PageSpeed is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
|
||||
|
||||
# License
|
||||
View [PageSpeed license information](https://github.com/apache/incubator-pagespeed-ngx/blob/master/LICENSE)
|
||||
View [Nginx license information](http://nginx.org/LICENSE)
|
||||
|
||||
As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
|
||||
|
||||
Some additional license information which was able to be auto-detected might be found in [the `repo-info` repository's `nginx/` directory](https://github.com/docker-library/repo-info/tree/master/repos/nginx).
|
||||
|
||||
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
|
||||
@@ -0,0 +1,230 @@
|
||||
ARG ALPINE_VERSION=3.8
|
||||
|
||||
########################
|
||||
# Build pagespeed psol #
|
||||
########################
|
||||
FROM alpine:$ALPINE_VERSION as pagespeed
|
||||
|
||||
# Check https://github.com/apache/incubator-pagespeed-mod/tags
|
||||
ARG MOD_PAGESPEED_TAG=v1.13.35.2
|
||||
|
||||
RUN apk add --no-cache \
|
||||
apache2-dev \
|
||||
apr-dev \
|
||||
apr-util-dev \
|
||||
build-base \
|
||||
curl \
|
||||
gettext-dev \
|
||||
git \
|
||||
gperf \
|
||||
icu-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libressl-dev \
|
||||
pcre-dev \
|
||||
py-setuptools \
|
||||
zlib-dev \
|
||||
;
|
||||
|
||||
WORKDIR /usr/src
|
||||
RUN git clone -b ${MOD_PAGESPEED_TAG} \
|
||||
--recurse-submodules \
|
||||
--depth=1 \
|
||||
-c advice.detachedHead=false \
|
||||
-j`nproc` \
|
||||
https://github.com/apache/incubator-pagespeed-mod.git \
|
||||
modpagespeed \
|
||||
;
|
||||
|
||||
WORKDIR /usr/src/modpagespeed
|
||||
|
||||
COPY patches/modpagespeed/*.patch ./
|
||||
|
||||
RUN for i in *.patch; do printf "\r\nApplying patch ${i%%.*}\r\n"; patch -p1 < $i || exit 1; done
|
||||
|
||||
WORKDIR /usr/src/modpagespeed/tools/gyp
|
||||
RUN ./setup.py install
|
||||
|
||||
WORKDIR /usr/src/modpagespeed
|
||||
|
||||
RUN build/gyp_chromium --depth=. \
|
||||
-D use_system_libs=1 \
|
||||
&& \
|
||||
cd /usr/src/modpagespeed/pagespeed/automatic && \
|
||||
make psol BUILDTYPE=Release \
|
||||
CFLAGS+="-I/usr/include/apr-1" \
|
||||
CXXFLAGS+="-I/usr/include/apr-1 -DUCHAR_TYPE=uint16_t" \
|
||||
-j`nproc` \
|
||||
;
|
||||
|
||||
RUN mkdir -p /usr/src/ngxpagespeed/psol/lib/Release/linux/x64 && \
|
||||
mkdir -p /usr/src/ngxpagespeed/psol/include/out/Release && \
|
||||
cp -R out/Release/obj /usr/src/ngxpagespeed/psol/include/out/Release/ && \
|
||||
cp -R pagespeed/automatic/pagespeed_automatic.a /usr/src/ngxpagespeed/psol/lib/Release/linux/x64/ && \
|
||||
cp -R net \
|
||||
pagespeed \
|
||||
testing \
|
||||
third_party \
|
||||
url \
|
||||
/usr/src/ngxpagespeed/psol/include/ \
|
||||
;
|
||||
|
||||
|
||||
##########################################
|
||||
# Build Nginx with support for PageSpeed #
|
||||
##########################################
|
||||
FROM alpine:$ALPINE_VERSION AS nginx
|
||||
|
||||
# Check https://github.com/apache/incubator-pagespeed-ngx/tags
|
||||
ARG NGX_PAGESPEED_TAG=v1.13.35.2-stable
|
||||
|
||||
# Check http://nginx.org/en/download.html for the latest version.
|
||||
ARG NGINX_VERSION=1.15.6
|
||||
ARG NGINX_PGPKEY=520A9993A1C052F8
|
||||
ARG NGINX_BUILD_CONFIG="\
|
||||
--prefix=/etc/nginx \
|
||||
--sbin-path=/usr/sbin/nginx \
|
||||
--modules-path=/usr/lib/nginx/modules \
|
||||
--conf-path=/etc/nginx/nginx.conf \
|
||||
--error-log-path=/var/log/nginx/error.log \
|
||||
--http-log-path=/var/log/nginx/access.log \
|
||||
--pid-path=/var/run/nginx.pid \
|
||||
--lock-path=/var/run/nginx.lock \
|
||||
--http-client-body-temp-path=/var/cache/nginx/client_temp \
|
||||
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
|
||||
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
|
||||
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
|
||||
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
|
||||
--user=nginx \
|
||||
--group=nginx \
|
||||
--with-http_ssl_module \
|
||||
--with-http_realip_module \
|
||||
--with-http_addition_module \
|
||||
--with-http_sub_module \
|
||||
--with-http_dav_module \
|
||||
--with-http_flv_module \
|
||||
--with-http_mp4_module \
|
||||
--with-http_gunzip_module \
|
||||
--with-http_gzip_static_module \
|
||||
--with-http_random_index_module \
|
||||
--with-http_secure_link_module \
|
||||
--with-http_stub_status_module \
|
||||
--with-http_auth_request_module \
|
||||
--with-http_xslt_module=dynamic \
|
||||
--with-http_image_filter_module=dynamic \
|
||||
--with-http_geoip_module=dynamic \
|
||||
--with-threads \
|
||||
--with-stream \
|
||||
--with-stream_ssl_module \
|
||||
--with-stream_ssl_preread_module \
|
||||
--with-stream_realip_module \
|
||||
--with-stream_geoip_module=dynamic \
|
||||
--with-http_slice_module \
|
||||
--with-mail \
|
||||
--with-mail_ssl_module \
|
||||
--with-compat \
|
||||
--with-file-aio \
|
||||
--with-http_v2_module \
|
||||
"
|
||||
|
||||
RUN apk add --no-cache \
|
||||
apr-dev \
|
||||
apr-util-dev \
|
||||
build-base \
|
||||
ca-certificates \
|
||||
gd-dev \
|
||||
geoip-dev \
|
||||
git \
|
||||
gnupg \
|
||||
icu-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libxslt-dev \
|
||||
linux-headers \
|
||||
libressl-dev \
|
||||
pcre-dev \
|
||||
tar \
|
||||
zlib-dev \
|
||||
;
|
||||
|
||||
WORKDIR /usr/src
|
||||
RUN git clone -b ${NGX_PAGESPEED_TAG} \
|
||||
--recurse-submodules \
|
||||
--shallow-submodules \
|
||||
--depth=1 \
|
||||
-c advice.detachedHead=false \
|
||||
-j`nproc` \
|
||||
https://github.com/apache/incubator-pagespeed-ngx.git \
|
||||
ngxpagespeed \
|
||||
;
|
||||
|
||||
RUN wget https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \
|
||||
https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz.asc && \
|
||||
(gpg --keyserver ha.pool.sks-keyservers.net --keyserver-options timeout=10 --recv-keys ${NGINX_PGPKEY} || \
|
||||
gpg --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options timeout=10 --recv-keys ${NGINX_PGPKEY} || \
|
||||
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --keyserver-options timeout=10 --recv-keys $NGINX_PGPKEY} ) && \
|
||||
gpg --trusted-key ${NGINX_PGPKEY} --verify nginx-${NGINX_VERSION}.tar.gz.asc
|
||||
|
||||
COPY --from=pagespeed /usr/src/ngxpagespeed /usr/src/ngxpagespeed/
|
||||
|
||||
WORKDIR /usr/src/nginx
|
||||
|
||||
RUN tar zxf ../nginx-${NGINX_VERSION}.tar.gz --strip-components=1 -C . && \
|
||||
./configure \
|
||||
${NGINX_BUILD_CONFIG} \
|
||||
--add-module=/usr/src/ngxpagespeed \
|
||||
--with-ld-opt="-Wl,-z,relro,--start-group -lapr-1 -laprutil-1 -licudata -licuuc -lpng -lturbojpeg -ljpeg" \
|
||||
&& \
|
||||
make install -j`nproc`
|
||||
|
||||
RUN rm -rf /etc/nginx/html/ && \
|
||||
mkdir /etc/nginx/conf.d/ && \
|
||||
mkdir -p /usr/share/nginx/html/ && \
|
||||
sed -i 's|^</body>|<p><a href="https://www.ngxpagespeed.com/"><img src="pagespeed.png" title="Nginx module for rewriting web pages to reduce latency and bandwidth" /></a></p>\n</body>|' html/index.html && \
|
||||
install -m644 html/index.html /usr/share/nginx/html/ && \
|
||||
install -m644 html/50x.html /usr/share/nginx/html/ && \
|
||||
ln -s ../../usr/lib/nginx/modules /etc/nginx/modules && \
|
||||
strip /usr/sbin/nginx* \
|
||||
/usr/lib/nginx/modules/*.so \
|
||||
;
|
||||
|
||||
COPY conf/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY conf/nginx.vh.default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY pagespeed.png /usr/share/nginx/html/
|
||||
|
||||
|
||||
##########################################
|
||||
# Combine everything with minimal layers #
|
||||
##########################################
|
||||
FROM alpine:$ALPINE_VERSION
|
||||
LABEL maintainer="Nico Berlee <nico.berlee@on2it.net>" \
|
||||
version.mod-pagespeed="1.13.35.2" \
|
||||
version.nginx="1.15.6" \
|
||||
version.ngx-pagespeed="1.13.35.2"
|
||||
|
||||
COPY --from=pagespeed /usr/bin/envsubst /usr/local/bin
|
||||
COPY --from=nginx /usr/sbin/nginx /usr/sbin/nginx
|
||||
COPY --from=nginx /usr/lib/nginx/modules/ /usr/lib/nginx/modules/
|
||||
COPY --from=nginx /etc/nginx /etc/nginx
|
||||
COPY --from=nginx /usr/share/nginx/html/ /usr/share/nginx/html/
|
||||
|
||||
RUN apk --no-cache upgrade && \
|
||||
scanelf --needed --nobanner --format '%n#p' /usr/sbin/nginx /usr/lib/nginx/modules/*.so /usr/local/bin/envsubst \
|
||||
| tr ',' '\n' \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
| xargs apk add --no-cache \
|
||||
&& \
|
||||
apk add --no-cache tzdata
|
||||
|
||||
RUN addgroup -S nginx && \
|
||||
adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx && \
|
||||
install -g nginx -o nginx -d /var/cache/ngx_pagespeed && \
|
||||
mkdir -p /var/log/nginx && \
|
||||
ln -sf /dev/stdout /var/log/nginx/access.log && \
|
||||
ln -sf /dev/stderr /var/log/nginx/error.log
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
#charset koi8-r;
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# proxy_pass http://127.0.0.1;
|
||||
#}
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# root html;
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
# fastcgi_index index.php;
|
||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||
# include fastcgi_params;
|
||||
#}
|
||||
pagespeed on;
|
||||
|
||||
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
|
||||
pagespeed FileCachePath /var/cache/ngx_pagespeed;
|
||||
|
||||
# Ensure requests for pagespeed optimized resources go to the pagespeed handler
|
||||
# and no extraneous headers get set.
|
||||
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
|
||||
add_header "" "";
|
||||
}
|
||||
location ~ "^/pagespeed_static/" { }
|
||||
location ~ "^/ngx_pagespeed_beacon$" { }
|
||||
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
#location ~ /\.ht {
|
||||
# deny all;
|
||||
#}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,31 @@
|
||||
--- a/pagespeed/automatic/Makefile
|
||||
+++ b/pagespeed/automatic/Makefile
|
||||
@@ -146,8 +146,6 @@
|
||||
pagespeed/libpagespeed_thread.a \
|
||||
pagespeed/libpthread_system.a \
|
||||
pagespeed/libutil.a \
|
||||
- third_party/apr/libapr.a \
|
||||
- third_party/aprutil/libaprutil.a \
|
||||
third_party/base64/libbase64.a \
|
||||
third_party/chromium/src/base/third_party/dynamic_annotations/libdynamic_annotations.a \
|
||||
third_party/css_parser/libcss_parser.a \
|
||||
@@ -163,18 +161,11 @@
|
||||
third_party/grpc/libgrpc_core.a \
|
||||
third_party/grpc/libgrpc_cpp.a \
|
||||
third_party/hiredis/libhiredis.a \
|
||||
- third_party/icu/libicudata.a \
|
||||
- third_party/icu/libicuuc.a \
|
||||
third_party/jsoncpp/libjsoncpp.a \
|
||||
- third_party/libjpeg_turbo/libjpeg.a \
|
||||
- third_party/libjpeg_turbo/src/libjpeg_turbo.a \
|
||||
- third_party/libpng/libpng.a \
|
||||
third_party/optipng/libopngreduc.a \
|
||||
third_party/protobuf/libprotobuf_full_do_not_use.a \
|
||||
third_party/re2/libre2.a \
|
||||
- third_party/serf/libopenssl.a \
|
||||
third_party/serf/libserf.a \
|
||||
- third_party/zlib/libzlib.a \
|
||||
url/liburl_lib.a
|
||||
|
||||
# The 'gclient' build flow uses 'xcodebuild' on Mac and 'make' on Linux.
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
From 7ea8d5fc141c7067c54ffa2b9fbc552c15089ca6 Mon Sep 17 00:00:00 2001
|
||||
From: ashishk-1 <ashish.k@gdbtech.in>
|
||||
Date: Thu, 18 Jan 2018 22:14:05 +0530
|
||||
Subject: [PATCH] Upgrading libpng library to version 1.6 (#1724)
|
||||
|
||||
---
|
||||
net/instaweb/rewriter/image.cc | 8 ++++++++
|
||||
pagespeed/kernel/image/gif_reader.cc | 4 ++--
|
||||
pagespeed/kernel/image/image_converter.cc | 6 ++++++
|
||||
pagespeed/kernel/image/png_optimizer_test.cc | 6 ++++++
|
||||
third_party/libpng/libpng.gyp | 26 +++++++++++++++++++++++---
|
||||
third_party/libpng/src | 2 +-
|
||||
6 files changed, 46 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/net/instaweb/rewriter/image.cc b/net/instaweb/rewriter/image.cc
|
||||
index 4f631182a..bb67bba35 100644
|
||||
--- a/net/instaweb/rewriter/image.cc
|
||||
+++ b/net/instaweb/rewriter/image.cc
|
||||
@@ -21,6 +21,14 @@
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
|
||||
+extern "C" {
|
||||
+#ifdef USE_SYSTEM_ZLIB
|
||||
+#include "zlib.h"
|
||||
+#else
|
||||
+#include "third_party/zlib/zlib.h"
|
||||
+#endif
|
||||
+} // extern "C"
|
||||
+
|
||||
#include "base/logging.h"
|
||||
#include "net/instaweb/rewriter/cached_result.pb.h"
|
||||
#include "net/instaweb/rewriter/public/image_data_lookup.h"
|
||||
diff --git a/pagespeed/kernel/image/gif_reader.cc b/pagespeed/kernel/image/gif_reader.cc
|
||||
index 7de69b3d7..bb0bc9cfc 100644
|
||||
--- a/pagespeed/kernel/image/gif_reader.cc
|
||||
+++ b/pagespeed/kernel/image/gif_reader.cc
|
||||
@@ -411,8 +411,8 @@ bool ReadGifToPng(GifFileType* gif_file,
|
||||
png_uint_32 height = png_get_image_height(paletted_png_ptr,
|
||||
paletted_info_ptr);
|
||||
for (png_uint_32 row = 1; row < height; ++row) {
|
||||
- memcpy(paletted_info_ptr->row_pointers[row],
|
||||
- paletted_info_ptr->row_pointers[0],
|
||||
+ memcpy(row_pointers[row],
|
||||
+ row_pointers[0],
|
||||
row_size);
|
||||
}
|
||||
|
||||
diff --git a/pagespeed/kernel/image/image_converter.cc b/pagespeed/kernel/image/image_converter.cc
|
||||
index d796b5065..84b7aff74 100644
|
||||
--- a/pagespeed/kernel/image/image_converter.cc
|
||||
+++ b/pagespeed/kernel/image/image_converter.cc
|
||||
@@ -30,6 +30,12 @@ extern "C" {
|
||||
#else
|
||||
#include "third_party/libpng/src/png.h"
|
||||
#endif
|
||||
+
|
||||
+#ifdef USE_SYSTEM_ZLIB
|
||||
+#include "zlib.h"
|
||||
+#else
|
||||
+#include "third_party/zlib/zlib.h"
|
||||
+#endif
|
||||
} // extern "C"
|
||||
|
||||
#include "base/logging.h"
|
||||
diff --git a/pagespeed/kernel/image/png_optimizer_test.cc b/pagespeed/kernel/image/png_optimizer_test.cc
|
||||
index 9ad915aff..3faa526a8 100644
|
||||
--- a/pagespeed/kernel/image/png_optimizer_test.cc
|
||||
+++ b/pagespeed/kernel/image/png_optimizer_test.cc
|
||||
@@ -36,6 +36,12 @@ extern "C" {
|
||||
#else
|
||||
#include "third_party/libpng/src/png.h"
|
||||
#endif
|
||||
+
|
||||
+#ifdef USE_SYSTEM_ZLIB
|
||||
+#include "zlib.h"
|
||||
+#else
|
||||
+#include "third_party/zlib/zlib.h"
|
||||
+#endif
|
||||
}
|
||||
|
||||
namespace {
|
||||
diff --git a/third_party/libpng/libpng.gyp b/third_party/libpng/libpng.gyp
|
||||
index cfaafee00..d96a8f74c 100644
|
||||
--- a/third_party/libpng/libpng.gyp
|
||||
+++ b/third_party/libpng/libpng.gyp
|
||||
@@ -22,14 +22,29 @@
|
||||
'dependencies': [
|
||||
'../zlib/zlib.gyp:zlib',
|
||||
],
|
||||
+ 'actions': [
|
||||
+ {
|
||||
+ 'action_name': 'copy_libpngconf_prebuilt',
|
||||
+ 'inputs' : [],
|
||||
+ 'outputs': [''],
|
||||
+ 'action': [
|
||||
+ 'cp',
|
||||
+ '-f',
|
||||
+ '<(DEPTH)/third_party/libpng/src/scripts/pnglibconf.h.prebuilt',
|
||||
+ '<(DEPTH)/third_party/libpng/src/pnglibconf.h',
|
||||
+ ],
|
||||
+ },
|
||||
+ ],
|
||||
'msvs_guid': 'C564F145-9172-42C3-BFCB-6014CA97DBCD',
|
||||
'sources': [
|
||||
+ 'src/pngpriv.h',
|
||||
'src/png.c',
|
||||
'src/png.h',
|
||||
'src/pngconf.h',
|
||||
+ 'src/pngdebug.h',
|
||||
'src/pngerror.c',
|
||||
- 'src/pnggccrd.c',
|
||||
'src/pngget.c',
|
||||
+ 'src/pnginfo.h',
|
||||
'src/pngmem.c',
|
||||
'src/pngpread.c',
|
||||
'src/pngread.c',
|
||||
@@ -37,9 +52,8 @@
|
||||
'src/pngrtran.c',
|
||||
'src/pngrutil.c',
|
||||
'src/pngset.c',
|
||||
+ 'src/pngstruct.h',
|
||||
'src/pngtrans.c',
|
||||
- 'src/pngusr.h',
|
||||
- 'src/pngvcrd.c',
|
||||
'src/pngwio.c',
|
||||
'src/pngwrite.c',
|
||||
'src/pngwtran.c',
|
||||
@@ -54,6 +68,12 @@
|
||||
# doesn't like that. This define tells libpng to not
|
||||
# complain about our inclusion of setjmp.h.
|
||||
'PNG_SKIP_SETJMP_CHECK',
|
||||
+
|
||||
+ # The PNG_FREE_ME_SUPPORTED define was dropped in libpng
|
||||
+ # 1.4.0beta78, with its behavior becoming the default
|
||||
+ # behavior.
|
||||
+ # Hence, we define it ourselves for version >= 1.4.0
|
||||
+ 'PNG_FREE_ME_SUPPORTED',
|
||||
],
|
||||
},
|
||||
'export_dependent_settings': [
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/pagespeed/kernel/thread/pthread_rw_lock.cc
|
||||
+++ b/pagespeed/kernel/thread/pthread_rw_lock.cc
|
||||
@@ -31,7 +31,7 @@
|
||||
//
|
||||
// Other OS's (FreeBSD, Darwin, OpenSolaris) documentation suggests
|
||||
// that they prefer writers by default.
|
||||
-#ifdef linux
|
||||
+#if defined(linux) && defined(__GLIBC__)
|
||||
pthread_rwlockattr_setkind_np(&attr_,
|
||||
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
--- a/pagespeed/automatic/rename_c_symbols.sh
|
||||
+++ b/pagespeed/automatic/rename_c_symbols.sh
|
||||
@@ -24,8 +24,8 @@
|
||||
set -e # exit script if any command returns an error
|
||||
set -u # exit the script if any variable is uninitialized
|
||||
|
||||
-IN=$(readlink -f $1)
|
||||
-OUT=$(readlink -f $2)
|
||||
+IN=$1
|
||||
+OUT=$2
|
||||
|
||||
# Get a list of defined non-C++ symbols that are global and not weak.
|
||||
# _Z is used at start of C++-mangled symbol names.
|
||||
@@ -0,0 +1,64 @@
|
||||
--- a/third_party/chromium/src/base/debug/stack_trace_posix.cc
|
||||
+++ b/third_party/chromium/src/base/debug/stack_trace_posix.cc
|
||||
@@ -5,7 +5,9 @@
|
||||
#include "base/debug/stack_trace.h"
|
||||
|
||||
#include <errno.h>
|
||||
+#if defined(HAVE_BACKTRACE)
|
||||
#include <execinfo.h>
|
||||
+#endif
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
@@ -64,7 +66,7 @@
|
||||
// Note: code in this function is NOT async-signal safe (std::string uses
|
||||
// malloc internally).
|
||||
|
||||
-#if defined(__GLIBCXX__)
|
||||
+#if defined(__GLIBCXX__) && defined(HAVE_BACKTRACE)
|
||||
|
||||
std::string::size_type search_from = 0;
|
||||
while (search_from < text->size()) {
|
||||
@@ -145,7 +147,7 @@
|
||||
|
||||
handler->HandleOutput("\n");
|
||||
}
|
||||
-#else
|
||||
+#elif defined(HAVE_BACKTRACE)
|
||||
bool printed = false;
|
||||
|
||||
// Below part is async-signal unsafe (uses malloc), so execute it only
|
||||
@@ -469,23 +471,31 @@
|
||||
StackTrace::StackTrace() {
|
||||
// NOTE: This code MUST be async-signal safe (it's used by in-process
|
||||
// stack dumping signal handler). NO malloc or stdio is allowed here.
|
||||
-
|
||||
+#if defined(HAVE_BACKTRACE)
|
||||
// Though the backtrace API man page does not list any possible negative
|
||||
// return values, we take no chance.
|
||||
count_ = std::max(backtrace(trace_, arraysize(trace_)), 0);
|
||||
+#else
|
||||
+ count_ = 0;
|
||||
+#endif
|
||||
}
|
||||
|
||||
void StackTrace::Print() const {
|
||||
// NOTE: This code MUST be async-signal safe (it's used by in-process
|
||||
// stack dumping signal handler). NO malloc or stdio is allowed here.
|
||||
-
|
||||
+#if defined(HAVE_BACKTRACE)
|
||||
PrintBacktraceOutputHandler handler;
|
||||
ProcessBacktrace(trace_, count_, &handler);
|
||||
+#endif
|
||||
}
|
||||
|
||||
void StackTrace::OutputToStream(std::ostream* os) const {
|
||||
+#if !defined(HAVE_BACKTRACE)
|
||||
+(*os) << "(stack trace not supported)\n";
|
||||
+#else
|
||||
StreamBacktraceOutputHandler handler(os);
|
||||
ProcessBacktrace(trace_, count_, &handler);
|
||||
+#endif
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
@@ -0,0 +1,231 @@
|
||||
ARG ALPINE_VERSION=3.8
|
||||
|
||||
########################
|
||||
# Build pagespeed psol #
|
||||
########################
|
||||
FROM alpine:$ALPINE_VERSION as pagespeed
|
||||
|
||||
# Check https://github.com/apache/incubator-pagespeed-mod/tags
|
||||
ARG MOD_PAGESPEED_TAG=v1.13.35.2
|
||||
|
||||
RUN apk add --no-cache \
|
||||
apache2-dev \
|
||||
apr-dev \
|
||||
apr-util-dev \
|
||||
build-base \
|
||||
curl \
|
||||
gettext-dev \
|
||||
git \
|
||||
gperf \
|
||||
icu-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libressl-dev \
|
||||
pcre-dev \
|
||||
py-setuptools \
|
||||
zlib-dev \
|
||||
;
|
||||
|
||||
WORKDIR /usr/src
|
||||
RUN git clone -b ${MOD_PAGESPEED_TAG} \
|
||||
--recurse-submodules \
|
||||
--depth=1 \
|
||||
-c advice.detachedHead=false \
|
||||
-j`nproc` \
|
||||
https://github.com/apache/incubator-pagespeed-mod.git \
|
||||
modpagespeed \
|
||||
;
|
||||
|
||||
WORKDIR /usr/src/modpagespeed
|
||||
|
||||
COPY patches/modpagespeed/*.patch ./
|
||||
|
||||
RUN for i in *.patch; do printf "\r\nApplying patch ${i%%.*}\r\n"; patch -p1 < $i || exit 1; done
|
||||
|
||||
WORKDIR /usr/src/modpagespeed/tools/gyp
|
||||
RUN ./setup.py install
|
||||
|
||||
WORKDIR /usr/src/modpagespeed
|
||||
|
||||
RUN build/gyp_chromium --depth=. \
|
||||
-D use_system_libs=1 \
|
||||
&& \
|
||||
cd /usr/src/modpagespeed/pagespeed/automatic && \
|
||||
make psol BUILDTYPE=Release \
|
||||
CFLAGS+="-I/usr/include/apr-1" \
|
||||
CXXFLAGS+="-I/usr/include/apr-1 -DUCHAR_TYPE=uint16_t" \
|
||||
-j`nproc` \
|
||||
;
|
||||
|
||||
RUN mkdir -p /usr/src/ngxpagespeed/psol/lib/Release/linux/x64 && \
|
||||
mkdir -p /usr/src/ngxpagespeed/psol/include/out/Release && \
|
||||
cp -R out/Release/obj /usr/src/ngxpagespeed/psol/include/out/Release/ && \
|
||||
cp -R pagespeed/automatic/pagespeed_automatic.a /usr/src/ngxpagespeed/psol/lib/Release/linux/x64/ && \
|
||||
cp -R net \
|
||||
pagespeed \
|
||||
testing \
|
||||
third_party \
|
||||
url \
|
||||
/usr/src/ngxpagespeed/psol/include/ \
|
||||
;
|
||||
|
||||
|
||||
##########################################
|
||||
# Build Nginx with support for PageSpeed #
|
||||
##########################################
|
||||
FROM alpine:$ALPINE_VERSION AS nginx
|
||||
|
||||
# Check https://github.com/apache/incubator-pagespeed-ngx/tags
|
||||
ARG NGX_PAGESPEED_TAG=v1.13.35.2-stable
|
||||
|
||||
# Check http://nginx.org/en/download.html for the latest version.
|
||||
ARG NGINX_VERSION=1.14.1
|
||||
ARG NGINX_PGPKEY=520A9993A1C052F8
|
||||
ARG NGINX_BUILD_CONFIG="\
|
||||
--prefix=/etc/nginx \
|
||||
--sbin-path=/usr/sbin/nginx \
|
||||
--modules-path=/usr/lib/nginx/modules \
|
||||
--conf-path=/etc/nginx/nginx.conf \
|
||||
--error-log-path=/var/log/nginx/error.log \
|
||||
--http-log-path=/var/log/nginx/access.log \
|
||||
--pid-path=/var/run/nginx.pid \
|
||||
--lock-path=/var/run/nginx.lock \
|
||||
--http-client-body-temp-path=/var/cache/nginx/client_temp \
|
||||
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
|
||||
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
|
||||
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
|
||||
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
|
||||
--user=nginx \
|
||||
--group=nginx \
|
||||
--with-http_ssl_module \
|
||||
--with-http_realip_module \
|
||||
--with-http_addition_module \
|
||||
--with-http_sub_module \
|
||||
--with-http_dav_module \
|
||||
--with-http_flv_module \
|
||||
--with-http_mp4_module \
|
||||
--with-http_gunzip_module \
|
||||
--with-http_gzip_static_module \
|
||||
--with-http_random_index_module \
|
||||
--with-http_secure_link_module \
|
||||
--with-http_stub_status_module \
|
||||
--with-http_auth_request_module \
|
||||
--with-http_xslt_module=dynamic \
|
||||
--with-http_image_filter_module=dynamic \
|
||||
--with-http_geoip_module=dynamic \
|
||||
--with-threads \
|
||||
--with-stream \
|
||||
--with-stream_ssl_module \
|
||||
--with-stream_ssl_preread_module \
|
||||
--with-stream_realip_module \
|
||||
--with-stream_geoip_module=dynamic \
|
||||
--with-http_slice_module \
|
||||
--with-mail \
|
||||
--with-mail_ssl_module \
|
||||
--with-compat \
|
||||
--with-file-aio \
|
||||
--with-http_v2_module \
|
||||
"
|
||||
|
||||
RUN apk add --no-cache \
|
||||
apr-dev \
|
||||
apr-util-dev \
|
||||
build-base \
|
||||
ca-certificates \
|
||||
gd-dev \
|
||||
geoip-dev \
|
||||
git \
|
||||
gnupg \
|
||||
icu-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libxslt-dev \
|
||||
linux-headers \
|
||||
libressl-dev \
|
||||
pcre-dev \
|
||||
tar \
|
||||
zlib-dev \
|
||||
;
|
||||
|
||||
WORKDIR /usr/src
|
||||
RUN git clone -b ${NGX_PAGESPEED_TAG} \
|
||||
--recurse-submodules \
|
||||
--shallow-submodules \
|
||||
--depth=1 \
|
||||
-c advice.detachedHead=false \
|
||||
-j`nproc` \
|
||||
https://github.com/apache/incubator-pagespeed-ngx.git \
|
||||
ngxpagespeed \
|
||||
;
|
||||
|
||||
RUN wget https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \
|
||||
https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz.asc && \
|
||||
(gpg --keyserver ha.pool.sks-keyservers.net --keyserver-options timeout=10 --recv-keys ${NGINX_PGPKEY} || \
|
||||
gpg --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options timeout=10 --recv-keys ${NGINX_PGPKEY} || \
|
||||
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --keyserver-options timeout=10 --recv-keys $NGINX_PGPKEY} ) && \
|
||||
gpg --trusted-key ${NGINX_PGPKEY} --verify nginx-${NGINX_VERSION}.tar.gz.asc
|
||||
|
||||
COPY --from=pagespeed /usr/src/ngxpagespeed /usr/src/ngxpagespeed/
|
||||
|
||||
WORKDIR /usr/src/nginx
|
||||
|
||||
RUN tar zxf ../nginx-${NGINX_VERSION}.tar.gz --strip-components=1 -C . && \
|
||||
./configure \
|
||||
${NGINX_BUILD_CONFIG} \
|
||||
--add-module=/usr/src/ngxpagespeed \
|
||||
--with-ld-opt="-Wl,-z,relro,--start-group -lapr-1 -laprutil-1 -licudata -licuuc -lpng -lturbojpeg -ljpeg" \
|
||||
&& \
|
||||
make install -j`nproc`
|
||||
|
||||
RUN rm -rf /etc/nginx/html/ && \
|
||||
mkdir /etc/nginx/conf.d/ && \
|
||||
mkdir -p /usr/share/nginx/html/ && \
|
||||
sed -i 's|^</body>|<p><a href="https://www.ngxpagespeed.com/"><img src="pagespeed.png" title="Nginx module for rewriting web pages to reduce latency and bandwidth" /></a></p>\n</body>|' html/index.html && \
|
||||
install -m644 html/index.html /usr/share/nginx/html/ && \
|
||||
install -m644 html/50x.html /usr/share/nginx/html/ && \
|
||||
ln -s ../../usr/lib/nginx/modules /etc/nginx/modules && \
|
||||
strip /usr/sbin/nginx* \
|
||||
/usr/lib/nginx/modules/*.so \
|
||||
;
|
||||
|
||||
COPY conf/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY conf/nginx.vh.default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY pagespeed.png /usr/share/nginx/html/
|
||||
|
||||
|
||||
##########################################
|
||||
# Combine everything with minimal layers #
|
||||
##########################################
|
||||
FROM alpine:$ALPINE_VERSION
|
||||
LABEL maintainer="Nico Berlee <nico.berlee@on2it.net>" \
|
||||
version.mod-pagespeed="1.13.35.2" \
|
||||
version.nginx="1.14.1" \
|
||||
version.ngx-pagespeed="1.13.35.2"
|
||||
|
||||
COPY --from=pagespeed /usr/bin/envsubst /usr/local/bin
|
||||
COPY --from=nginx /usr/sbin/nginx /usr/sbin/nginx
|
||||
COPY --from=nginx /usr/lib/nginx/modules/ /usr/lib/nginx/modules/
|
||||
COPY --from=nginx /etc/nginx /etc/nginx
|
||||
COPY --from=nginx /usr/share/nginx/html/ /usr/share/nginx/html/
|
||||
|
||||
RUN apk --no-cache upgrade && \
|
||||
scanelf --needed --nobanner --format '%n#p' /usr/sbin/nginx /usr/lib/nginx/modules/*.so /usr/local/bin/envsubst \
|
||||
| tr ',' '\n' \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
| xargs apk add --no-cache \
|
||||
&& \
|
||||
apk add --no-cache tzdata
|
||||
|
||||
RUN addgroup -S nginx && \
|
||||
adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx && \
|
||||
install -g nginx -o nginx -d /var/cache/ngx_pagespeed && \
|
||||
mkdir -p /var/log/nginx && \
|
||||
ln -sf /dev/stdout /var/log/nginx/access.log && \
|
||||
ln -sf /dev/stderr /var/log/nginx/error.log
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
#charset koi8-r;
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# proxy_pass http://127.0.0.1;
|
||||
#}
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# root html;
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
# fastcgi_index index.php;
|
||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||
# include fastcgi_params;
|
||||
#}
|
||||
pagespeed on;
|
||||
|
||||
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
|
||||
pagespeed FileCachePath /var/cache/ngx_pagespeed;
|
||||
|
||||
# Ensure requests for pagespeed optimized resources go to the pagespeed handler
|
||||
# and no extraneous headers get set.
|
||||
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
|
||||
add_header "" "";
|
||||
}
|
||||
location ~ "^/pagespeed_static/" { }
|
||||
location ~ "^/ngx_pagespeed_beacon$" { }
|
||||
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
#location ~ /\.ht {
|
||||
# deny all;
|
||||
#}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,31 @@
|
||||
--- a/pagespeed/automatic/Makefile
|
||||
+++ b/pagespeed/automatic/Makefile
|
||||
@@ -146,8 +146,6 @@
|
||||
pagespeed/libpagespeed_thread.a \
|
||||
pagespeed/libpthread_system.a \
|
||||
pagespeed/libutil.a \
|
||||
- third_party/apr/libapr.a \
|
||||
- third_party/aprutil/libaprutil.a \
|
||||
third_party/base64/libbase64.a \
|
||||
third_party/chromium/src/base/third_party/dynamic_annotations/libdynamic_annotations.a \
|
||||
third_party/css_parser/libcss_parser.a \
|
||||
@@ -163,18 +161,11 @@
|
||||
third_party/grpc/libgrpc_core.a \
|
||||
third_party/grpc/libgrpc_cpp.a \
|
||||
third_party/hiredis/libhiredis.a \
|
||||
- third_party/icu/libicudata.a \
|
||||
- third_party/icu/libicuuc.a \
|
||||
third_party/jsoncpp/libjsoncpp.a \
|
||||
- third_party/libjpeg_turbo/libjpeg.a \
|
||||
- third_party/libjpeg_turbo/src/libjpeg_turbo.a \
|
||||
- third_party/libpng/libpng.a \
|
||||
third_party/optipng/libopngreduc.a \
|
||||
third_party/protobuf/libprotobuf_full_do_not_use.a \
|
||||
third_party/re2/libre2.a \
|
||||
- third_party/serf/libopenssl.a \
|
||||
third_party/serf/libserf.a \
|
||||
- third_party/zlib/libzlib.a \
|
||||
url/liburl_lib.a
|
||||
|
||||
# The 'gclient' build flow uses 'xcodebuild' on Mac and 'make' on Linux.
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
From 7ea8d5fc141c7067c54ffa2b9fbc552c15089ca6 Mon Sep 17 00:00:00 2001
|
||||
From: ashishk-1 <ashish.k@gdbtech.in>
|
||||
Date: Thu, 18 Jan 2018 22:14:05 +0530
|
||||
Subject: [PATCH] Upgrading libpng library to version 1.6 (#1724)
|
||||
|
||||
---
|
||||
net/instaweb/rewriter/image.cc | 8 ++++++++
|
||||
pagespeed/kernel/image/gif_reader.cc | 4 ++--
|
||||
pagespeed/kernel/image/image_converter.cc | 6 ++++++
|
||||
pagespeed/kernel/image/png_optimizer_test.cc | 6 ++++++
|
||||
third_party/libpng/libpng.gyp | 26 +++++++++++++++++++++++---
|
||||
third_party/libpng/src | 2 +-
|
||||
6 files changed, 46 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/net/instaweb/rewriter/image.cc b/net/instaweb/rewriter/image.cc
|
||||
index 4f631182a..bb67bba35 100644
|
||||
--- a/net/instaweb/rewriter/image.cc
|
||||
+++ b/net/instaweb/rewriter/image.cc
|
||||
@@ -21,6 +21,14 @@
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
|
||||
+extern "C" {
|
||||
+#ifdef USE_SYSTEM_ZLIB
|
||||
+#include "zlib.h"
|
||||
+#else
|
||||
+#include "third_party/zlib/zlib.h"
|
||||
+#endif
|
||||
+} // extern "C"
|
||||
+
|
||||
#include "base/logging.h"
|
||||
#include "net/instaweb/rewriter/cached_result.pb.h"
|
||||
#include "net/instaweb/rewriter/public/image_data_lookup.h"
|
||||
diff --git a/pagespeed/kernel/image/gif_reader.cc b/pagespeed/kernel/image/gif_reader.cc
|
||||
index 7de69b3d7..bb0bc9cfc 100644
|
||||
--- a/pagespeed/kernel/image/gif_reader.cc
|
||||
+++ b/pagespeed/kernel/image/gif_reader.cc
|
||||
@@ -411,8 +411,8 @@ bool ReadGifToPng(GifFileType* gif_file,
|
||||
png_uint_32 height = png_get_image_height(paletted_png_ptr,
|
||||
paletted_info_ptr);
|
||||
for (png_uint_32 row = 1; row < height; ++row) {
|
||||
- memcpy(paletted_info_ptr->row_pointers[row],
|
||||
- paletted_info_ptr->row_pointers[0],
|
||||
+ memcpy(row_pointers[row],
|
||||
+ row_pointers[0],
|
||||
row_size);
|
||||
}
|
||||
|
||||
diff --git a/pagespeed/kernel/image/image_converter.cc b/pagespeed/kernel/image/image_converter.cc
|
||||
index d796b5065..84b7aff74 100644
|
||||
--- a/pagespeed/kernel/image/image_converter.cc
|
||||
+++ b/pagespeed/kernel/image/image_converter.cc
|
||||
@@ -30,6 +30,12 @@ extern "C" {
|
||||
#else
|
||||
#include "third_party/libpng/src/png.h"
|
||||
#endif
|
||||
+
|
||||
+#ifdef USE_SYSTEM_ZLIB
|
||||
+#include "zlib.h"
|
||||
+#else
|
||||
+#include "third_party/zlib/zlib.h"
|
||||
+#endif
|
||||
} // extern "C"
|
||||
|
||||
#include "base/logging.h"
|
||||
diff --git a/pagespeed/kernel/image/png_optimizer_test.cc b/pagespeed/kernel/image/png_optimizer_test.cc
|
||||
index 9ad915aff..3faa526a8 100644
|
||||
--- a/pagespeed/kernel/image/png_optimizer_test.cc
|
||||
+++ b/pagespeed/kernel/image/png_optimizer_test.cc
|
||||
@@ -36,6 +36,12 @@ extern "C" {
|
||||
#else
|
||||
#include "third_party/libpng/src/png.h"
|
||||
#endif
|
||||
+
|
||||
+#ifdef USE_SYSTEM_ZLIB
|
||||
+#include "zlib.h"
|
||||
+#else
|
||||
+#include "third_party/zlib/zlib.h"
|
||||
+#endif
|
||||
}
|
||||
|
||||
namespace {
|
||||
diff --git a/third_party/libpng/libpng.gyp b/third_party/libpng/libpng.gyp
|
||||
index cfaafee00..d96a8f74c 100644
|
||||
--- a/third_party/libpng/libpng.gyp
|
||||
+++ b/third_party/libpng/libpng.gyp
|
||||
@@ -22,14 +22,29 @@
|
||||
'dependencies': [
|
||||
'../zlib/zlib.gyp:zlib',
|
||||
],
|
||||
+ 'actions': [
|
||||
+ {
|
||||
+ 'action_name': 'copy_libpngconf_prebuilt',
|
||||
+ 'inputs' : [],
|
||||
+ 'outputs': [''],
|
||||
+ 'action': [
|
||||
+ 'cp',
|
||||
+ '-f',
|
||||
+ '<(DEPTH)/third_party/libpng/src/scripts/pnglibconf.h.prebuilt',
|
||||
+ '<(DEPTH)/third_party/libpng/src/pnglibconf.h',
|
||||
+ ],
|
||||
+ },
|
||||
+ ],
|
||||
'msvs_guid': 'C564F145-9172-42C3-BFCB-6014CA97DBCD',
|
||||
'sources': [
|
||||
+ 'src/pngpriv.h',
|
||||
'src/png.c',
|
||||
'src/png.h',
|
||||
'src/pngconf.h',
|
||||
+ 'src/pngdebug.h',
|
||||
'src/pngerror.c',
|
||||
- 'src/pnggccrd.c',
|
||||
'src/pngget.c',
|
||||
+ 'src/pnginfo.h',
|
||||
'src/pngmem.c',
|
||||
'src/pngpread.c',
|
||||
'src/pngread.c',
|
||||
@@ -37,9 +52,8 @@
|
||||
'src/pngrtran.c',
|
||||
'src/pngrutil.c',
|
||||
'src/pngset.c',
|
||||
+ 'src/pngstruct.h',
|
||||
'src/pngtrans.c',
|
||||
- 'src/pngusr.h',
|
||||
- 'src/pngvcrd.c',
|
||||
'src/pngwio.c',
|
||||
'src/pngwrite.c',
|
||||
'src/pngwtran.c',
|
||||
@@ -54,6 +68,12 @@
|
||||
# doesn't like that. This define tells libpng to not
|
||||
# complain about our inclusion of setjmp.h.
|
||||
'PNG_SKIP_SETJMP_CHECK',
|
||||
+
|
||||
+ # The PNG_FREE_ME_SUPPORTED define was dropped in libpng
|
||||
+ # 1.4.0beta78, with its behavior becoming the default
|
||||
+ # behavior.
|
||||
+ # Hence, we define it ourselves for version >= 1.4.0
|
||||
+ 'PNG_FREE_ME_SUPPORTED',
|
||||
],
|
||||
},
|
||||
'export_dependent_settings': [
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/pagespeed/kernel/thread/pthread_rw_lock.cc
|
||||
+++ b/pagespeed/kernel/thread/pthread_rw_lock.cc
|
||||
@@ -31,7 +31,7 @@
|
||||
//
|
||||
// Other OS's (FreeBSD, Darwin, OpenSolaris) documentation suggests
|
||||
// that they prefer writers by default.
|
||||
-#ifdef linux
|
||||
+#if defined(linux) && defined(__GLIBC__)
|
||||
pthread_rwlockattr_setkind_np(&attr_,
|
||||
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
--- a/pagespeed/automatic/rename_c_symbols.sh
|
||||
+++ b/pagespeed/automatic/rename_c_symbols.sh
|
||||
@@ -24,8 +24,8 @@
|
||||
set -e # exit script if any command returns an error
|
||||
set -u # exit the script if any variable is uninitialized
|
||||
|
||||
-IN=$(readlink -f $1)
|
||||
-OUT=$(readlink -f $2)
|
||||
+IN=$1
|
||||
+OUT=$2
|
||||
|
||||
# Get a list of defined non-C++ symbols that are global and not weak.
|
||||
# _Z is used at start of C++-mangled symbol names.
|
||||
@@ -0,0 +1,64 @@
|
||||
--- a/third_party/chromium/src/base/debug/stack_trace_posix.cc
|
||||
+++ b/third_party/chromium/src/base/debug/stack_trace_posix.cc
|
||||
@@ -5,7 +5,9 @@
|
||||
#include "base/debug/stack_trace.h"
|
||||
|
||||
#include <errno.h>
|
||||
+#if defined(HAVE_BACKTRACE)
|
||||
#include <execinfo.h>
|
||||
+#endif
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
@@ -64,7 +66,7 @@
|
||||
// Note: code in this function is NOT async-signal safe (std::string uses
|
||||
// malloc internally).
|
||||
|
||||
-#if defined(__GLIBCXX__)
|
||||
+#if defined(__GLIBCXX__) && defined(HAVE_BACKTRACE)
|
||||
|
||||
std::string::size_type search_from = 0;
|
||||
while (search_from < text->size()) {
|
||||
@@ -145,7 +147,7 @@
|
||||
|
||||
handler->HandleOutput("\n");
|
||||
}
|
||||
-#else
|
||||
+#elif defined(HAVE_BACKTRACE)
|
||||
bool printed = false;
|
||||
|
||||
// Below part is async-signal unsafe (uses malloc), so execute it only
|
||||
@@ -469,23 +471,31 @@
|
||||
StackTrace::StackTrace() {
|
||||
// NOTE: This code MUST be async-signal safe (it's used by in-process
|
||||
// stack dumping signal handler). NO malloc or stdio is allowed here.
|
||||
-
|
||||
+#if defined(HAVE_BACKTRACE)
|
||||
// Though the backtrace API man page does not list any possible negative
|
||||
// return values, we take no chance.
|
||||
count_ = std::max(backtrace(trace_, arraysize(trace_)), 0);
|
||||
+#else
|
||||
+ count_ = 0;
|
||||
+#endif
|
||||
}
|
||||
|
||||
void StackTrace::Print() const {
|
||||
// NOTE: This code MUST be async-signal safe (it's used by in-process
|
||||
// stack dumping signal handler). NO malloc or stdio is allowed here.
|
||||
-
|
||||
+#if defined(HAVE_BACKTRACE)
|
||||
PrintBacktraceOutputHandler handler;
|
||||
ProcessBacktrace(trace_, count_, &handler);
|
||||
+#endif
|
||||
}
|
||||
|
||||
void StackTrace::OutputToStream(std::ostream* os) const {
|
||||
+#if !defined(HAVE_BACKTRACE)
|
||||
+(*os) << "(stack trace not supported)\n";
|
||||
+#else
|
||||
StreamBacktraceOutputHandler handler(os);
|
||||
ProcessBacktrace(trace_, count_, &handler);
|
||||
+#endif
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
@@ -0,0 +1,230 @@
|
||||
ARG ALPINE_VERSION=edge
|
||||
|
||||
########################
|
||||
# Build pagespeed psol #
|
||||
########################
|
||||
FROM alpine:$ALPINE_VERSION as pagespeed
|
||||
|
||||
# Check https://github.com/apache/incubator-pagespeed-mod/tags
|
||||
ARG MOD_PAGESPEED_TAG=v1.13.35.2
|
||||
|
||||
RUN apk add --no-cache \
|
||||
apache2-dev \
|
||||
apr-dev \
|
||||
apr-util-dev \
|
||||
build-base \
|
||||
curl \
|
||||
gettext-dev \
|
||||
git \
|
||||
gperf \
|
||||
icu-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libressl-dev \
|
||||
pcre-dev \
|
||||
py-setuptools \
|
||||
zlib-dev \
|
||||
;
|
||||
|
||||
WORKDIR /usr/src
|
||||
RUN git clone -b ${MOD_PAGESPEED_TAG} \
|
||||
--recurse-submodules \
|
||||
--depth=1 \
|
||||
-c advice.detachedHead=false \
|
||||
-j`nproc` \
|
||||
https://github.com/apache/incubator-pagespeed-mod.git \
|
||||
modpagespeed \
|
||||
;
|
||||
|
||||
WORKDIR /usr/src/modpagespeed
|
||||
|
||||
COPY patches/modpagespeed/*.patch ./
|
||||
|
||||
RUN for i in *.patch; do printf "\r\nApplying patch ${i%%.*}\r\n"; patch -p1 < $i || exit 1; done
|
||||
|
||||
WORKDIR /usr/src/modpagespeed/tools/gyp
|
||||
RUN ./setup.py install
|
||||
|
||||
WORKDIR /usr/src/modpagespeed
|
||||
|
||||
RUN build/gyp_chromium --depth=. \
|
||||
-D use_system_libs=1 \
|
||||
&& \
|
||||
cd /usr/src/modpagespeed/pagespeed/automatic && \
|
||||
make psol BUILDTYPE=Release \
|
||||
CFLAGS+="-I/usr/include/apr-1" \
|
||||
CXXFLAGS+="-I/usr/include/apr-1 -DUCHAR_TYPE=uint16_t" \
|
||||
-j`nproc` \
|
||||
;
|
||||
|
||||
RUN mkdir -p /usr/src/ngxpagespeed/psol/lib/Release/linux/x64 && \
|
||||
mkdir -p /usr/src/ngxpagespeed/psol/include/out/Release && \
|
||||
cp -R out/Release/obj /usr/src/ngxpagespeed/psol/include/out/Release/ && \
|
||||
cp -R pagespeed/automatic/pagespeed_automatic.a /usr/src/ngxpagespeed/psol/lib/Release/linux/x64/ && \
|
||||
cp -R net \
|
||||
pagespeed \
|
||||
testing \
|
||||
third_party \
|
||||
url \
|
||||
/usr/src/ngxpagespeed/psol/include/ \
|
||||
;
|
||||
|
||||
|
||||
##########################################
|
||||
# Build Nginx with support for PageSpeed #
|
||||
##########################################
|
||||
FROM alpine:$ALPINE_VERSION AS nginx
|
||||
|
||||
# Check https://github.com/apache/incubator-pagespeed-ngx/tags
|
||||
ARG NGX_PAGESPEED_TAG=v1.13.35.2-stable
|
||||
|
||||
# Check http://nginx.org/en/download.html for the latest version.
|
||||
ARG NGINX_VERSION=1.15.6
|
||||
ARG NGINX_PGPKEY=520A9993A1C052F8
|
||||
ARG NGINX_BUILD_CONFIG="\
|
||||
--prefix=/etc/nginx \
|
||||
--sbin-path=/usr/sbin/nginx \
|
||||
--modules-path=/usr/lib/nginx/modules \
|
||||
--conf-path=/etc/nginx/nginx.conf \
|
||||
--error-log-path=/var/log/nginx/error.log \
|
||||
--http-log-path=/var/log/nginx/access.log \
|
||||
--pid-path=/var/run/nginx.pid \
|
||||
--lock-path=/var/run/nginx.lock \
|
||||
--http-client-body-temp-path=/var/cache/nginx/client_temp \
|
||||
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
|
||||
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
|
||||
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
|
||||
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
|
||||
--user=nginx \
|
||||
--group=nginx \
|
||||
--with-http_ssl_module \
|
||||
--with-http_realip_module \
|
||||
--with-http_addition_module \
|
||||
--with-http_sub_module \
|
||||
--with-http_dav_module \
|
||||
--with-http_flv_module \
|
||||
--with-http_mp4_module \
|
||||
--with-http_gunzip_module \
|
||||
--with-http_gzip_static_module \
|
||||
--with-http_random_index_module \
|
||||
--with-http_secure_link_module \
|
||||
--with-http_stub_status_module \
|
||||
--with-http_auth_request_module \
|
||||
--with-http_xslt_module=dynamic \
|
||||
--with-http_image_filter_module=dynamic \
|
||||
--with-http_geoip_module=dynamic \
|
||||
--with-threads \
|
||||
--with-stream \
|
||||
--with-stream_ssl_module \
|
||||
--with-stream_ssl_preread_module \
|
||||
--with-stream_realip_module \
|
||||
--with-stream_geoip_module=dynamic \
|
||||
--with-http_slice_module \
|
||||
--with-mail \
|
||||
--with-mail_ssl_module \
|
||||
--with-compat \
|
||||
--with-file-aio \
|
||||
--with-http_v2_module \
|
||||
"
|
||||
|
||||
RUN apk add --no-cache \
|
||||
apr-dev \
|
||||
apr-util-dev \
|
||||
build-base \
|
||||
ca-certificates \
|
||||
gd-dev \
|
||||
geoip-dev \
|
||||
git \
|
||||
gnupg \
|
||||
icu-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libxslt-dev \
|
||||
linux-headers \
|
||||
libressl-dev \
|
||||
pcre-dev \
|
||||
tar \
|
||||
zlib-dev \
|
||||
;
|
||||
|
||||
WORKDIR /usr/src
|
||||
RUN git clone -b ${NGX_PAGESPEED_TAG} \
|
||||
--recurse-submodules \
|
||||
--shallow-submodules \
|
||||
--depth=1 \
|
||||
-c advice.detachedHead=false \
|
||||
-j`nproc` \
|
||||
https://github.com/apache/incubator-pagespeed-ngx.git \
|
||||
ngxpagespeed \
|
||||
;
|
||||
|
||||
RUN wget https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \
|
||||
https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz.asc && \
|
||||
(gpg --keyserver ha.pool.sks-keyservers.net --keyserver-options timeout=10 --recv-keys ${NGINX_PGPKEY} || \
|
||||
gpg --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options timeout=10 --recv-keys ${NGINX_PGPKEY} || \
|
||||
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --keyserver-options timeout=10 --recv-keys $NGINX_PGPKEY} ) && \
|
||||
gpg --trusted-key ${NGINX_PGPKEY} --verify nginx-${NGINX_VERSION}.tar.gz.asc
|
||||
|
||||
COPY --from=pagespeed /usr/src/ngxpagespeed /usr/src/ngxpagespeed/
|
||||
|
||||
WORKDIR /usr/src/nginx
|
||||
|
||||
RUN tar zxf ../nginx-${NGINX_VERSION}.tar.gz --strip-components=1 -C . && \
|
||||
./configure \
|
||||
${NGINX_BUILD_CONFIG} \
|
||||
--add-module=/usr/src/ngxpagespeed \
|
||||
--with-ld-opt="-Wl,-z,relro,--start-group -lapr-1 -laprutil-1 -licudata -licuuc -lpng -lturbojpeg -ljpeg" \
|
||||
&& \
|
||||
make install -j`nproc`
|
||||
|
||||
RUN rm -rf /etc/nginx/html/ && \
|
||||
mkdir /etc/nginx/conf.d/ && \
|
||||
mkdir -p /usr/share/nginx/html/ && \
|
||||
sed -i 's|^</body>|<p><a href="https://www.ngxpagespeed.com/"><img src="pagespeed.png" title="Nginx module for rewriting web pages to reduce latency and bandwidth" /></a></p>\n</body>|' html/index.html && \
|
||||
install -m644 html/index.html /usr/share/nginx/html/ && \
|
||||
install -m644 html/50x.html /usr/share/nginx/html/ && \
|
||||
ln -s ../../usr/lib/nginx/modules /etc/nginx/modules && \
|
||||
strip /usr/sbin/nginx* \
|
||||
/usr/lib/nginx/modules/*.so \
|
||||
;
|
||||
|
||||
COPY conf/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY conf/nginx.vh.default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY pagespeed.png /usr/share/nginx/html/
|
||||
|
||||
|
||||
##########################################
|
||||
# Combine everything with minimal layers #
|
||||
##########################################
|
||||
FROM alpine:$ALPINE_VERSION
|
||||
LABEL maintainer="Nico Berlee <nico.berlee@on2it.net>" \
|
||||
version.mod-pagespeed="1.13.35.2" \
|
||||
version.nginx="1.15.6" \
|
||||
version.ngx-pagespeed="1.13.35.2"
|
||||
|
||||
COPY --from=pagespeed /usr/bin/envsubst /usr/local/bin
|
||||
COPY --from=nginx /usr/sbin/nginx /usr/sbin/nginx
|
||||
COPY --from=nginx /usr/lib/nginx/modules/ /usr/lib/nginx/modules/
|
||||
COPY --from=nginx /etc/nginx /etc/nginx
|
||||
COPY --from=nginx /usr/share/nginx/html/ /usr/share/nginx/html/
|
||||
|
||||
RUN apk --no-cache upgrade && \
|
||||
scanelf --needed --nobanner --format '%n#p' /usr/sbin/nginx /usr/lib/nginx/modules/*.so /usr/local/bin/envsubst \
|
||||
| tr ',' '\n' \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
| xargs apk add --no-cache \
|
||||
&& \
|
||||
apk add --no-cache tzdata
|
||||
|
||||
RUN addgroup -S nginx && \
|
||||
adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx && \
|
||||
install -g nginx -o nginx -d /var/cache/ngx_pagespeed && \
|
||||
mkdir -p /var/log/nginx && \
|
||||
ln -sf /dev/stdout /var/log/nginx/access.log && \
|
||||
ln -sf /dev/stderr /var/log/nginx/error.log
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
#charset koi8-r;
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# proxy_pass http://127.0.0.1;
|
||||
#}
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# root html;
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
# fastcgi_index index.php;
|
||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||
# include fastcgi_params;
|
||||
#}
|
||||
pagespeed on;
|
||||
|
||||
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
|
||||
pagespeed FileCachePath /var/cache/ngx_pagespeed;
|
||||
|
||||
# Ensure requests for pagespeed optimized resources go to the pagespeed handler
|
||||
# and no extraneous headers get set.
|
||||
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
|
||||
add_header "" "";
|
||||
}
|
||||
location ~ "^/pagespeed_static/" { }
|
||||
location ~ "^/ngx_pagespeed_beacon$" { }
|
||||
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
#location ~ /\.ht {
|
||||
# deny all;
|
||||
#}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,31 @@
|
||||
--- a/pagespeed/automatic/Makefile
|
||||
+++ b/pagespeed/automatic/Makefile
|
||||
@@ -146,8 +146,6 @@
|
||||
pagespeed/libpagespeed_thread.a \
|
||||
pagespeed/libpthread_system.a \
|
||||
pagespeed/libutil.a \
|
||||
- third_party/apr/libapr.a \
|
||||
- third_party/aprutil/libaprutil.a \
|
||||
third_party/base64/libbase64.a \
|
||||
third_party/chromium/src/base/third_party/dynamic_annotations/libdynamic_annotations.a \
|
||||
third_party/css_parser/libcss_parser.a \
|
||||
@@ -163,18 +161,11 @@
|
||||
third_party/grpc/libgrpc_core.a \
|
||||
third_party/grpc/libgrpc_cpp.a \
|
||||
third_party/hiredis/libhiredis.a \
|
||||
- third_party/icu/libicudata.a \
|
||||
- third_party/icu/libicuuc.a \
|
||||
third_party/jsoncpp/libjsoncpp.a \
|
||||
- third_party/libjpeg_turbo/libjpeg.a \
|
||||
- third_party/libjpeg_turbo/src/libjpeg_turbo.a \
|
||||
- third_party/libpng/libpng.a \
|
||||
third_party/optipng/libopngreduc.a \
|
||||
third_party/protobuf/libprotobuf_full_do_not_use.a \
|
||||
third_party/re2/libre2.a \
|
||||
- third_party/serf/libopenssl.a \
|
||||
third_party/serf/libserf.a \
|
||||
- third_party/zlib/libzlib.a \
|
||||
url/liburl_lib.a
|
||||
|
||||
# The 'gclient' build flow uses 'xcodebuild' on Mac and 'make' on Linux.
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
From 7ea8d5fc141c7067c54ffa2b9fbc552c15089ca6 Mon Sep 17 00:00:00 2001
|
||||
From: ashishk-1 <ashish.k@gdbtech.in>
|
||||
Date: Thu, 18 Jan 2018 22:14:05 +0530
|
||||
Subject: [PATCH] Upgrading libpng library to version 1.6 (#1724)
|
||||
|
||||
---
|
||||
net/instaweb/rewriter/image.cc | 8 ++++++++
|
||||
pagespeed/kernel/image/gif_reader.cc | 4 ++--
|
||||
pagespeed/kernel/image/image_converter.cc | 6 ++++++
|
||||
pagespeed/kernel/image/png_optimizer_test.cc | 6 ++++++
|
||||
third_party/libpng/libpng.gyp | 26 +++++++++++++++++++++++---
|
||||
third_party/libpng/src | 2 +-
|
||||
6 files changed, 46 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/net/instaweb/rewriter/image.cc b/net/instaweb/rewriter/image.cc
|
||||
index 4f631182a..bb67bba35 100644
|
||||
--- a/net/instaweb/rewriter/image.cc
|
||||
+++ b/net/instaweb/rewriter/image.cc
|
||||
@@ -21,6 +21,14 @@
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
|
||||
+extern "C" {
|
||||
+#ifdef USE_SYSTEM_ZLIB
|
||||
+#include "zlib.h"
|
||||
+#else
|
||||
+#include "third_party/zlib/zlib.h"
|
||||
+#endif
|
||||
+} // extern "C"
|
||||
+
|
||||
#include "base/logging.h"
|
||||
#include "net/instaweb/rewriter/cached_result.pb.h"
|
||||
#include "net/instaweb/rewriter/public/image_data_lookup.h"
|
||||
diff --git a/pagespeed/kernel/image/gif_reader.cc b/pagespeed/kernel/image/gif_reader.cc
|
||||
index 7de69b3d7..bb0bc9cfc 100644
|
||||
--- a/pagespeed/kernel/image/gif_reader.cc
|
||||
+++ b/pagespeed/kernel/image/gif_reader.cc
|
||||
@@ -411,8 +411,8 @@ bool ReadGifToPng(GifFileType* gif_file,
|
||||
png_uint_32 height = png_get_image_height(paletted_png_ptr,
|
||||
paletted_info_ptr);
|
||||
for (png_uint_32 row = 1; row < height; ++row) {
|
||||
- memcpy(paletted_info_ptr->row_pointers[row],
|
||||
- paletted_info_ptr->row_pointers[0],
|
||||
+ memcpy(row_pointers[row],
|
||||
+ row_pointers[0],
|
||||
row_size);
|
||||
}
|
||||
|
||||
diff --git a/pagespeed/kernel/image/image_converter.cc b/pagespeed/kernel/image/image_converter.cc
|
||||
index d796b5065..84b7aff74 100644
|
||||
--- a/pagespeed/kernel/image/image_converter.cc
|
||||
+++ b/pagespeed/kernel/image/image_converter.cc
|
||||
@@ -30,6 +30,12 @@ extern "C" {
|
||||
#else
|
||||
#include "third_party/libpng/src/png.h"
|
||||
#endif
|
||||
+
|
||||
+#ifdef USE_SYSTEM_ZLIB
|
||||
+#include "zlib.h"
|
||||
+#else
|
||||
+#include "third_party/zlib/zlib.h"
|
||||
+#endif
|
||||
} // extern "C"
|
||||
|
||||
#include "base/logging.h"
|
||||
diff --git a/pagespeed/kernel/image/png_optimizer_test.cc b/pagespeed/kernel/image/png_optimizer_test.cc
|
||||
index 9ad915aff..3faa526a8 100644
|
||||
--- a/pagespeed/kernel/image/png_optimizer_test.cc
|
||||
+++ b/pagespeed/kernel/image/png_optimizer_test.cc
|
||||
@@ -36,6 +36,12 @@ extern "C" {
|
||||
#else
|
||||
#include "third_party/libpng/src/png.h"
|
||||
#endif
|
||||
+
|
||||
+#ifdef USE_SYSTEM_ZLIB
|
||||
+#include "zlib.h"
|
||||
+#else
|
||||
+#include "third_party/zlib/zlib.h"
|
||||
+#endif
|
||||
}
|
||||
|
||||
namespace {
|
||||
diff --git a/third_party/libpng/libpng.gyp b/third_party/libpng/libpng.gyp
|
||||
index cfaafee00..d96a8f74c 100644
|
||||
--- a/third_party/libpng/libpng.gyp
|
||||
+++ b/third_party/libpng/libpng.gyp
|
||||
@@ -22,14 +22,29 @@
|
||||
'dependencies': [
|
||||
'../zlib/zlib.gyp:zlib',
|
||||
],
|
||||
+ 'actions': [
|
||||
+ {
|
||||
+ 'action_name': 'copy_libpngconf_prebuilt',
|
||||
+ 'inputs' : [],
|
||||
+ 'outputs': [''],
|
||||
+ 'action': [
|
||||
+ 'cp',
|
||||
+ '-f',
|
||||
+ '<(DEPTH)/third_party/libpng/src/scripts/pnglibconf.h.prebuilt',
|
||||
+ '<(DEPTH)/third_party/libpng/src/pnglibconf.h',
|
||||
+ ],
|
||||
+ },
|
||||
+ ],
|
||||
'msvs_guid': 'C564F145-9172-42C3-BFCB-6014CA97DBCD',
|
||||
'sources': [
|
||||
+ 'src/pngpriv.h',
|
||||
'src/png.c',
|
||||
'src/png.h',
|
||||
'src/pngconf.h',
|
||||
+ 'src/pngdebug.h',
|
||||
'src/pngerror.c',
|
||||
- 'src/pnggccrd.c',
|
||||
'src/pngget.c',
|
||||
+ 'src/pnginfo.h',
|
||||
'src/pngmem.c',
|
||||
'src/pngpread.c',
|
||||
'src/pngread.c',
|
||||
@@ -37,9 +52,8 @@
|
||||
'src/pngrtran.c',
|
||||
'src/pngrutil.c',
|
||||
'src/pngset.c',
|
||||
+ 'src/pngstruct.h',
|
||||
'src/pngtrans.c',
|
||||
- 'src/pngusr.h',
|
||||
- 'src/pngvcrd.c',
|
||||
'src/pngwio.c',
|
||||
'src/pngwrite.c',
|
||||
'src/pngwtran.c',
|
||||
@@ -54,6 +68,12 @@
|
||||
# doesn't like that. This define tells libpng to not
|
||||
# complain about our inclusion of setjmp.h.
|
||||
'PNG_SKIP_SETJMP_CHECK',
|
||||
+
|
||||
+ # The PNG_FREE_ME_SUPPORTED define was dropped in libpng
|
||||
+ # 1.4.0beta78, with its behavior becoming the default
|
||||
+ # behavior.
|
||||
+ # Hence, we define it ourselves for version >= 1.4.0
|
||||
+ 'PNG_FREE_ME_SUPPORTED',
|
||||
],
|
||||
},
|
||||
'export_dependent_settings': [
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/pagespeed/kernel/thread/pthread_rw_lock.cc
|
||||
+++ b/pagespeed/kernel/thread/pthread_rw_lock.cc
|
||||
@@ -31,7 +31,7 @@
|
||||
//
|
||||
// Other OS's (FreeBSD, Darwin, OpenSolaris) documentation suggests
|
||||
// that they prefer writers by default.
|
||||
-#ifdef linux
|
||||
+#if defined(linux) && defined(__GLIBC__)
|
||||
pthread_rwlockattr_setkind_np(&attr_,
|
||||
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
--- a/pagespeed/automatic/rename_c_symbols.sh
|
||||
+++ b/pagespeed/automatic/rename_c_symbols.sh
|
||||
@@ -24,8 +24,8 @@
|
||||
set -e # exit script if any command returns an error
|
||||
set -u # exit the script if any variable is uninitialized
|
||||
|
||||
-IN=$(readlink -f $1)
|
||||
-OUT=$(readlink -f $2)
|
||||
+IN=$1
|
||||
+OUT=$2
|
||||
|
||||
# Get a list of defined non-C++ symbols that are global and not weak.
|
||||
# _Z is used at start of C++-mangled symbol names.
|
||||
@@ -0,0 +1,64 @@
|
||||
--- a/third_party/chromium/src/base/debug/stack_trace_posix.cc
|
||||
+++ b/third_party/chromium/src/base/debug/stack_trace_posix.cc
|
||||
@@ -5,7 +5,9 @@
|
||||
#include "base/debug/stack_trace.h"
|
||||
|
||||
#include <errno.h>
|
||||
+#if defined(HAVE_BACKTRACE)
|
||||
#include <execinfo.h>
|
||||
+#endif
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
@@ -64,7 +66,7 @@
|
||||
// Note: code in this function is NOT async-signal safe (std::string uses
|
||||
// malloc internally).
|
||||
|
||||
-#if defined(__GLIBCXX__)
|
||||
+#if defined(__GLIBCXX__) && defined(HAVE_BACKTRACE)
|
||||
|
||||
std::string::size_type search_from = 0;
|
||||
while (search_from < text->size()) {
|
||||
@@ -145,7 +147,7 @@
|
||||
|
||||
handler->HandleOutput("\n");
|
||||
}
|
||||
-#else
|
||||
+#elif defined(HAVE_BACKTRACE)
|
||||
bool printed = false;
|
||||
|
||||
// Below part is async-signal unsafe (uses malloc), so execute it only
|
||||
@@ -469,23 +471,31 @@
|
||||
StackTrace::StackTrace() {
|
||||
// NOTE: This code MUST be async-signal safe (it's used by in-process
|
||||
// stack dumping signal handler). NO malloc or stdio is allowed here.
|
||||
-
|
||||
+#if defined(HAVE_BACKTRACE)
|
||||
// Though the backtrace API man page does not list any possible negative
|
||||
// return values, we take no chance.
|
||||
count_ = std::max(backtrace(trace_, arraysize(trace_)), 0);
|
||||
+#else
|
||||
+ count_ = 0;
|
||||
+#endif
|
||||
}
|
||||
|
||||
void StackTrace::Print() const {
|
||||
// NOTE: This code MUST be async-signal safe (it's used by in-process
|
||||
// stack dumping signal handler). NO malloc or stdio is allowed here.
|
||||
-
|
||||
+#if defined(HAVE_BACKTRACE)
|
||||
PrintBacktraceOutputHandler handler;
|
||||
ProcessBacktrace(trace_, count_, &handler);
|
||||
+#endif
|
||||
}
|
||||
|
||||
void StackTrace::OutputToStream(std::ostream* os) const {
|
||||
+#if !defined(HAVE_BACKTRACE)
|
||||
+(*os) << "(stack trace not supported)\n";
|
||||
+#else
|
||||
StreamBacktraceOutputHandler handler(os);
|
||||
ProcessBacktrace(trace_, count_, &handler);
|
||||
+#endif
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
@@ -0,0 +1,235 @@
|
||||
ARG ALPINE_VERSION=edge
|
||||
|
||||
########################
|
||||
# Build pagespeed psol #
|
||||
########################
|
||||
FROM alpine:$ALPINE_VERSION as pagespeed
|
||||
|
||||
# Check https://github.com/apache/incubator-pagespeed-mod/tags
|
||||
ARG MOD_PAGESPEED_TAG=v1.13.35.2
|
||||
|
||||
RUN apk add --no-cache \
|
||||
apache2-dev \
|
||||
apr-dev \
|
||||
apr-util-dev \
|
||||
build-base \
|
||||
curl \
|
||||
gettext-dev \
|
||||
git \
|
||||
gperf \
|
||||
icu-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libressl-dev \
|
||||
pcre-dev \
|
||||
py-setuptools \
|
||||
zlib-dev \
|
||||
;
|
||||
|
||||
WORKDIR /usr/src
|
||||
RUN git clone -b ${MOD_PAGESPEED_TAG} \
|
||||
--recurse-submodules \
|
||||
--depth=1 \
|
||||
-c advice.detachedHead=false \
|
||||
-j`nproc` \
|
||||
https://github.com/apache/incubator-pagespeed-mod.git \
|
||||
modpagespeed \
|
||||
;
|
||||
|
||||
WORKDIR /usr/src/modpagespeed
|
||||
|
||||
COPY patches/modpagespeed/*.patch ./
|
||||
|
||||
RUN for i in *.patch; do printf "\r\nApplying patch ${i%%.*}\r\n"; patch -p1 < $i || exit 1; done
|
||||
|
||||
WORKDIR /usr/src/modpagespeed/tools/gyp
|
||||
RUN ./setup.py install
|
||||
|
||||
WORKDIR /usr/src/modpagespeed
|
||||
|
||||
RUN build/gyp_chromium --depth=. \
|
||||
-D use_system_libs=1 \
|
||||
&& \
|
||||
cd /usr/src/modpagespeed/pagespeed/automatic && \
|
||||
make psol BUILDTYPE=Release \
|
||||
CFLAGS+="-I/usr/include/apr-1" \
|
||||
CXXFLAGS+="-I/usr/include/apr-1 -DUCHAR_TYPE=uint16_t" \
|
||||
-j`nproc` \
|
||||
;
|
||||
|
||||
RUN mkdir -p /usr/src/ngxpagespeed/psol/lib/Release/linux/x64 && \
|
||||
mkdir -p /usr/src/ngxpagespeed/psol/include/out/Release && \
|
||||
cp -R out/Release/obj /usr/src/ngxpagespeed/psol/include/out/Release/ && \
|
||||
cp -R pagespeed/automatic/pagespeed_automatic.a /usr/src/ngxpagespeed/psol/lib/Release/linux/x64/ && \
|
||||
cp -R net \
|
||||
pagespeed \
|
||||
testing \
|
||||
third_party \
|
||||
url \
|
||||
/usr/src/ngxpagespeed/psol/include/ \
|
||||
;
|
||||
|
||||
|
||||
##########################################
|
||||
# Build Nginx with support for PageSpeed #
|
||||
##########################################
|
||||
FROM alpine:$ALPINE_VERSION AS nginx
|
||||
|
||||
# Check https://github.com/apache/incubator-pagespeed-ngx/tags
|
||||
ARG NGX_PAGESPEED_TAG=v1.13.35.2-stable
|
||||
|
||||
# Check http://nginx.org/en/download.html for the latest version.
|
||||
ARG NGINX_VERSION=1.14.1
|
||||
ARG NGINX_PGPKEY=520A9993A1C052F8
|
||||
ARG NGINX_BUILD_CONFIG="\
|
||||
--prefix=/etc/nginx \
|
||||
--sbin-path=/usr/sbin/nginx \
|
||||
--modules-path=/usr/lib/nginx/modules \
|
||||
--conf-path=/etc/nginx/nginx.conf \
|
||||
--error-log-path=/var/log/nginx/error.log \
|
||||
--http-log-path=/var/log/nginx/access.log \
|
||||
--pid-path=/var/run/nginx.pid \
|
||||
--lock-path=/var/run/nginx.lock \
|
||||
--http-client-body-temp-path=/var/cache/nginx/client_temp \
|
||||
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
|
||||
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
|
||||
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
|
||||
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
|
||||
--user=nginx \
|
||||
--group=nginx \
|
||||
--with-http_ssl_module \
|
||||
--with-http_realip_module \
|
||||
--with-http_addition_module \
|
||||
--with-http_sub_module \
|
||||
--with-http_dav_module \
|
||||
--with-http_flv_module \
|
||||
--with-http_mp4_module \
|
||||
--with-http_gunzip_module \
|
||||
--with-http_gzip_static_module \
|
||||
--with-http_random_index_module \
|
||||
--with-http_secure_link_module \
|
||||
--with-http_stub_status_module \
|
||||
--with-http_auth_request_module \
|
||||
--with-http_xslt_module=dynamic \
|
||||
--with-http_image_filter_module=dynamic \
|
||||
--with-http_geoip_module=dynamic \
|
||||
--with-threads \
|
||||
--with-stream \
|
||||
--with-stream_ssl_module \
|
||||
--with-stream_ssl_preread_module \
|
||||
--with-stream_realip_module \
|
||||
--with-stream_geoip_module=dynamic \
|
||||
--with-http_slice_module \
|
||||
--with-mail \
|
||||
--with-mail_ssl_module \
|
||||
--with-compat \
|
||||
--with-file-aio \
|
||||
--with-http_v2_module \
|
||||
"
|
||||
|
||||
RUN apk add --no-cache \
|
||||
apr-dev \
|
||||
apr-util-dev \
|
||||
build-base \
|
||||
ca-certificates \
|
||||
gd-dev \
|
||||
geoip-dev \
|
||||
git \
|
||||
gnupg \
|
||||
icu-dev \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libxslt-dev \
|
||||
linux-headers \
|
||||
libressl-dev \
|
||||
pcre-dev \
|
||||
tar \
|
||||
zlib-dev \
|
||||
;
|
||||
|
||||
WORKDIR /usr/src
|
||||
RUN git clone -b ${NGX_PAGESPEED_TAG} \
|
||||
--recurse-submodules \
|
||||
--shallow-submodules \
|
||||
--depth=1 \
|
||||
-c advice.detachedHead=false \
|
||||
-j`nproc` \
|
||||
https://github.com/apache/incubator-pagespeed-ngx.git \
|
||||
ngxpagespeed \
|
||||
;
|
||||
|
||||
RUN wget https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \
|
||||
https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz.asc && \
|
||||
(gpg --keyserver ha.pool.sks-keyservers.net --keyserver-options timeout=10 --recv-keys ${NGINX_PGPKEY} || \
|
||||
gpg --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options timeout=10 --recv-keys ${NGINX_PGPKEY} || \
|
||||
gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --keyserver-options timeout=10 --recv-keys $NGINX_PGPKEY} ) && \
|
||||
gpg --trusted-key ${NGINX_PGPKEY} --verify nginx-${NGINX_VERSION}.tar.gz.asc
|
||||
|
||||
COPY --from=pagespeed /usr/src/ngxpagespeed /usr/src/ngxpagespeed/
|
||||
|
||||
WORKDIR /usr/src/nginx
|
||||
|
||||
RUN tar zxf ../nginx-${NGINX_VERSION}.tar.gz --strip-components=1 -C .
|
||||
|
||||
COPY patches/ngx/*.patch ./
|
||||
|
||||
RUN for i in *.patch; do printf "\r\nApplying patch ${i%%.*}\r\n"; patch -p1 < $i || exit 1; done
|
||||
|
||||
RUN ./configure \
|
||||
${NGINX_BUILD_CONFIG} \
|
||||
--add-module=/usr/src/ngxpagespeed \
|
||||
--with-ld-opt="-Wl,-z,relro,--start-group -lapr-1 -laprutil-1 -licudata -licuuc -lpng -lturbojpeg -ljpeg" \
|
||||
&& \
|
||||
make install -j`nproc`
|
||||
|
||||
RUN rm -rf /etc/nginx/html/ && \
|
||||
mkdir /etc/nginx/conf.d/ && \
|
||||
mkdir -p /usr/share/nginx/html/ && \
|
||||
sed -i 's|^</body>|<p><a href="https://www.ngxpagespeed.com/"><img src="pagespeed.png" title="Nginx module for rewriting web pages to reduce latency and bandwidth" /></a></p>\n</body>|' html/index.html && \
|
||||
install -m644 html/index.html /usr/share/nginx/html/ && \
|
||||
install -m644 html/50x.html /usr/share/nginx/html/ && \
|
||||
ln -s ../../usr/lib/nginx/modules /etc/nginx/modules && \
|
||||
strip /usr/sbin/nginx* \
|
||||
/usr/lib/nginx/modules/*.so \
|
||||
;
|
||||
|
||||
COPY conf/nginx.conf /etc/nginx/nginx.conf
|
||||
COPY conf/nginx.vh.default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY pagespeed.png /usr/share/nginx/html/
|
||||
|
||||
|
||||
##########################################
|
||||
# Combine everything with minimal layers #
|
||||
##########################################
|
||||
FROM alpine:$ALPINE_VERSION
|
||||
LABEL maintainer="Nico Berlee <nico.berlee@on2it.net>" \
|
||||
version.mod-pagespeed="1.13.35.2" \
|
||||
version.nginx="1.14.1" \
|
||||
version.ngx-pagespeed="1.13.35.2"
|
||||
|
||||
COPY --from=pagespeed /usr/bin/envsubst /usr/local/bin
|
||||
COPY --from=nginx /usr/sbin/nginx /usr/sbin/nginx
|
||||
COPY --from=nginx /usr/lib/nginx/modules/ /usr/lib/nginx/modules/
|
||||
COPY --from=nginx /etc/nginx /etc/nginx
|
||||
COPY --from=nginx /usr/share/nginx/html/ /usr/share/nginx/html/
|
||||
|
||||
RUN apk --no-cache upgrade && \
|
||||
scanelf --needed --nobanner --format '%n#p' /usr/sbin/nginx /usr/lib/nginx/modules/*.so /usr/local/bin/envsubst \
|
||||
| tr ',' '\n' \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
| xargs apk add --no-cache \
|
||||
&& \
|
||||
apk add --no-cache tzdata
|
||||
|
||||
RUN addgroup -S nginx && \
|
||||
adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx nginx && \
|
||||
install -g nginx -o nginx -d /var/cache/ngx_pagespeed && \
|
||||
mkdir -p /var/log/nginx && \
|
||||
ln -sf /dev/stdout /var/log/nginx/access.log && \
|
||||
ln -sf /dev/stderr /var/log/nginx/error.log
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
#charset koi8-r;
|
||||
#access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
#error_page 404 /404.html;
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# proxy_pass http://127.0.0.1;
|
||||
#}
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# root html;
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
# fastcgi_index index.php;
|
||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||
# include fastcgi_params;
|
||||
#}
|
||||
pagespeed on;
|
||||
|
||||
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
|
||||
pagespeed FileCachePath /var/cache/ngx_pagespeed;
|
||||
|
||||
# Ensure requests for pagespeed optimized resources go to the pagespeed handler
|
||||
# and no extraneous headers get set.
|
||||
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
|
||||
add_header "" "";
|
||||
}
|
||||
location ~ "^/pagespeed_static/" { }
|
||||
location ~ "^/ngx_pagespeed_beacon$" { }
|
||||
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
#location ~ /\.ht {
|
||||
# deny all;
|
||||
#}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,31 @@
|
||||
--- a/pagespeed/automatic/Makefile
|
||||
+++ b/pagespeed/automatic/Makefile
|
||||
@@ -146,8 +146,6 @@
|
||||
pagespeed/libpagespeed_thread.a \
|
||||
pagespeed/libpthread_system.a \
|
||||
pagespeed/libutil.a \
|
||||
- third_party/apr/libapr.a \
|
||||
- third_party/aprutil/libaprutil.a \
|
||||
third_party/base64/libbase64.a \
|
||||
third_party/chromium/src/base/third_party/dynamic_annotations/libdynamic_annotations.a \
|
||||
third_party/css_parser/libcss_parser.a \
|
||||
@@ -163,18 +161,11 @@
|
||||
third_party/grpc/libgrpc_core.a \
|
||||
third_party/grpc/libgrpc_cpp.a \
|
||||
third_party/hiredis/libhiredis.a \
|
||||
- third_party/icu/libicudata.a \
|
||||
- third_party/icu/libicuuc.a \
|
||||
third_party/jsoncpp/libjsoncpp.a \
|
||||
- third_party/libjpeg_turbo/libjpeg.a \
|
||||
- third_party/libjpeg_turbo/src/libjpeg_turbo.a \
|
||||
- third_party/libpng/libpng.a \
|
||||
third_party/optipng/libopngreduc.a \
|
||||
third_party/protobuf/libprotobuf_full_do_not_use.a \
|
||||
third_party/re2/libre2.a \
|
||||
- third_party/serf/libopenssl.a \
|
||||
third_party/serf/libserf.a \
|
||||
- third_party/zlib/libzlib.a \
|
||||
url/liburl_lib.a
|
||||
|
||||
# The 'gclient' build flow uses 'xcodebuild' on Mac and 'make' on Linux.
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
From 7ea8d5fc141c7067c54ffa2b9fbc552c15089ca6 Mon Sep 17 00:00:00 2001
|
||||
From: ashishk-1 <ashish.k@gdbtech.in>
|
||||
Date: Thu, 18 Jan 2018 22:14:05 +0530
|
||||
Subject: [PATCH] Upgrading libpng library to version 1.6 (#1724)
|
||||
|
||||
---
|
||||
net/instaweb/rewriter/image.cc | 8 ++++++++
|
||||
pagespeed/kernel/image/gif_reader.cc | 4 ++--
|
||||
pagespeed/kernel/image/image_converter.cc | 6 ++++++
|
||||
pagespeed/kernel/image/png_optimizer_test.cc | 6 ++++++
|
||||
third_party/libpng/libpng.gyp | 26 +++++++++++++++++++++++---
|
||||
third_party/libpng/src | 2 +-
|
||||
6 files changed, 46 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/net/instaweb/rewriter/image.cc b/net/instaweb/rewriter/image.cc
|
||||
index 4f631182a..bb67bba35 100644
|
||||
--- a/net/instaweb/rewriter/image.cc
|
||||
+++ b/net/instaweb/rewriter/image.cc
|
||||
@@ -21,6 +21,14 @@
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
|
||||
+extern "C" {
|
||||
+#ifdef USE_SYSTEM_ZLIB
|
||||
+#include "zlib.h"
|
||||
+#else
|
||||
+#include "third_party/zlib/zlib.h"
|
||||
+#endif
|
||||
+} // extern "C"
|
||||
+
|
||||
#include "base/logging.h"
|
||||
#include "net/instaweb/rewriter/cached_result.pb.h"
|
||||
#include "net/instaweb/rewriter/public/image_data_lookup.h"
|
||||
diff --git a/pagespeed/kernel/image/gif_reader.cc b/pagespeed/kernel/image/gif_reader.cc
|
||||
index 7de69b3d7..bb0bc9cfc 100644
|
||||
--- a/pagespeed/kernel/image/gif_reader.cc
|
||||
+++ b/pagespeed/kernel/image/gif_reader.cc
|
||||
@@ -411,8 +411,8 @@ bool ReadGifToPng(GifFileType* gif_file,
|
||||
png_uint_32 height = png_get_image_height(paletted_png_ptr,
|
||||
paletted_info_ptr);
|
||||
for (png_uint_32 row = 1; row < height; ++row) {
|
||||
- memcpy(paletted_info_ptr->row_pointers[row],
|
||||
- paletted_info_ptr->row_pointers[0],
|
||||
+ memcpy(row_pointers[row],
|
||||
+ row_pointers[0],
|
||||
row_size);
|
||||
}
|
||||
|
||||
diff --git a/pagespeed/kernel/image/image_converter.cc b/pagespeed/kernel/image/image_converter.cc
|
||||
index d796b5065..84b7aff74 100644
|
||||
--- a/pagespeed/kernel/image/image_converter.cc
|
||||
+++ b/pagespeed/kernel/image/image_converter.cc
|
||||
@@ -30,6 +30,12 @@ extern "C" {
|
||||
#else
|
||||
#include "third_party/libpng/src/png.h"
|
||||
#endif
|
||||
+
|
||||
+#ifdef USE_SYSTEM_ZLIB
|
||||
+#include "zlib.h"
|
||||
+#else
|
||||
+#include "third_party/zlib/zlib.h"
|
||||
+#endif
|
||||
} // extern "C"
|
||||
|
||||
#include "base/logging.h"
|
||||
diff --git a/pagespeed/kernel/image/png_optimizer_test.cc b/pagespeed/kernel/image/png_optimizer_test.cc
|
||||
index 9ad915aff..3faa526a8 100644
|
||||
--- a/pagespeed/kernel/image/png_optimizer_test.cc
|
||||
+++ b/pagespeed/kernel/image/png_optimizer_test.cc
|
||||
@@ -36,6 +36,12 @@ extern "C" {
|
||||
#else
|
||||
#include "third_party/libpng/src/png.h"
|
||||
#endif
|
||||
+
|
||||
+#ifdef USE_SYSTEM_ZLIB
|
||||
+#include "zlib.h"
|
||||
+#else
|
||||
+#include "third_party/zlib/zlib.h"
|
||||
+#endif
|
||||
}
|
||||
|
||||
namespace {
|
||||
diff --git a/third_party/libpng/libpng.gyp b/third_party/libpng/libpng.gyp
|
||||
index cfaafee00..d96a8f74c 100644
|
||||
--- a/third_party/libpng/libpng.gyp
|
||||
+++ b/third_party/libpng/libpng.gyp
|
||||
@@ -22,14 +22,29 @@
|
||||
'dependencies': [
|
||||
'../zlib/zlib.gyp:zlib',
|
||||
],
|
||||
+ 'actions': [
|
||||
+ {
|
||||
+ 'action_name': 'copy_libpngconf_prebuilt',
|
||||
+ 'inputs' : [],
|
||||
+ 'outputs': [''],
|
||||
+ 'action': [
|
||||
+ 'cp',
|
||||
+ '-f',
|
||||
+ '<(DEPTH)/third_party/libpng/src/scripts/pnglibconf.h.prebuilt',
|
||||
+ '<(DEPTH)/third_party/libpng/src/pnglibconf.h',
|
||||
+ ],
|
||||
+ },
|
||||
+ ],
|
||||
'msvs_guid': 'C564F145-9172-42C3-BFCB-6014CA97DBCD',
|
||||
'sources': [
|
||||
+ 'src/pngpriv.h',
|
||||
'src/png.c',
|
||||
'src/png.h',
|
||||
'src/pngconf.h',
|
||||
+ 'src/pngdebug.h',
|
||||
'src/pngerror.c',
|
||||
- 'src/pnggccrd.c',
|
||||
'src/pngget.c',
|
||||
+ 'src/pnginfo.h',
|
||||
'src/pngmem.c',
|
||||
'src/pngpread.c',
|
||||
'src/pngread.c',
|
||||
@@ -37,9 +52,8 @@
|
||||
'src/pngrtran.c',
|
||||
'src/pngrutil.c',
|
||||
'src/pngset.c',
|
||||
+ 'src/pngstruct.h',
|
||||
'src/pngtrans.c',
|
||||
- 'src/pngusr.h',
|
||||
- 'src/pngvcrd.c',
|
||||
'src/pngwio.c',
|
||||
'src/pngwrite.c',
|
||||
'src/pngwtran.c',
|
||||
@@ -54,6 +68,12 @@
|
||||
# doesn't like that. This define tells libpng to not
|
||||
# complain about our inclusion of setjmp.h.
|
||||
'PNG_SKIP_SETJMP_CHECK',
|
||||
+
|
||||
+ # The PNG_FREE_ME_SUPPORTED define was dropped in libpng
|
||||
+ # 1.4.0beta78, with its behavior becoming the default
|
||||
+ # behavior.
|
||||
+ # Hence, we define it ourselves for version >= 1.4.0
|
||||
+ 'PNG_FREE_ME_SUPPORTED',
|
||||
],
|
||||
},
|
||||
'export_dependent_settings': [
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/pagespeed/kernel/thread/pthread_rw_lock.cc
|
||||
+++ b/pagespeed/kernel/thread/pthread_rw_lock.cc
|
||||
@@ -31,7 +31,7 @@
|
||||
//
|
||||
// Other OS's (FreeBSD, Darwin, OpenSolaris) documentation suggests
|
||||
// that they prefer writers by default.
|
||||
-#ifdef linux
|
||||
+#if defined(linux) && defined(__GLIBC__)
|
||||
pthread_rwlockattr_setkind_np(&attr_,
|
||||
PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||
#endif
|
||||
@@ -0,0 +1,13 @@
|
||||
--- a/pagespeed/automatic/rename_c_symbols.sh
|
||||
+++ b/pagespeed/automatic/rename_c_symbols.sh
|
||||
@@ -24,8 +24,8 @@
|
||||
set -e # exit script if any command returns an error
|
||||
set -u # exit the script if any variable is uninitialized
|
||||
|
||||
-IN=$(readlink -f $1)
|
||||
-OUT=$(readlink -f $2)
|
||||
+IN=$1
|
||||
+OUT=$2
|
||||
|
||||
# Get a list of defined non-C++ symbols that are global and not weak.
|
||||
# _Z is used at start of C++-mangled symbol names.
|
||||
@@ -0,0 +1,64 @@
|
||||
--- a/third_party/chromium/src/base/debug/stack_trace_posix.cc
|
||||
+++ b/third_party/chromium/src/base/debug/stack_trace_posix.cc
|
||||
@@ -5,7 +5,9 @@
|
||||
#include "base/debug/stack_trace.h"
|
||||
|
||||
#include <errno.h>
|
||||
+#if defined(HAVE_BACKTRACE)
|
||||
#include <execinfo.h>
|
||||
+#endif
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
@@ -64,7 +66,7 @@
|
||||
// Note: code in this function is NOT async-signal safe (std::string uses
|
||||
// malloc internally).
|
||||
|
||||
-#if defined(__GLIBCXX__)
|
||||
+#if defined(__GLIBCXX__) && defined(HAVE_BACKTRACE)
|
||||
|
||||
std::string::size_type search_from = 0;
|
||||
while (search_from < text->size()) {
|
||||
@@ -145,7 +147,7 @@
|
||||
|
||||
handler->HandleOutput("\n");
|
||||
}
|
||||
-#else
|
||||
+#elif defined(HAVE_BACKTRACE)
|
||||
bool printed = false;
|
||||
|
||||
// Below part is async-signal unsafe (uses malloc), so execute it only
|
||||
@@ -469,23 +471,31 @@
|
||||
StackTrace::StackTrace() {
|
||||
// NOTE: This code MUST be async-signal safe (it's used by in-process
|
||||
// stack dumping signal handler). NO malloc or stdio is allowed here.
|
||||
-
|
||||
+#if defined(HAVE_BACKTRACE)
|
||||
// Though the backtrace API man page does not list any possible negative
|
||||
// return values, we take no chance.
|
||||
count_ = std::max(backtrace(trace_, arraysize(trace_)), 0);
|
||||
+#else
|
||||
+ count_ = 0;
|
||||
+#endif
|
||||
}
|
||||
|
||||
void StackTrace::Print() const {
|
||||
// NOTE: This code MUST be async-signal safe (it's used by in-process
|
||||
// stack dumping signal handler). NO malloc or stdio is allowed here.
|
||||
-
|
||||
+#if defined(HAVE_BACKTRACE)
|
||||
PrintBacktraceOutputHandler handler;
|
||||
ProcessBacktrace(trace_, count_, &handler);
|
||||
+#endif
|
||||
}
|
||||
|
||||
void StackTrace::OutputToStream(std::ostream* os) const {
|
||||
+#if !defined(HAVE_BACKTRACE)
|
||||
+(*os) << "(stack trace not supported)\n";
|
||||
+#else
|
||||
StreamBacktraceOutputHandler handler(os);
|
||||
ProcessBacktrace(trace_, count_, &handler);
|
||||
+#endif
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
@@ -0,0 +1,190 @@
|
||||
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
|
||||
index bc43f53ed9..3eec1b7dd0 100644
|
||||
--- a/src/http/modules/ngx_http_fastcgi_module.c
|
||||
+++ b/src/http/modules/ngx_http_fastcgi_module.c
|
||||
@@ -3264,7 +3264,8 @@ ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf,
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
|
||||
+ copy->code = (ngx_http_script_code_pt) (void *)
|
||||
+ ngx_http_script_copy_len_code;
|
||||
copy->len = src[i].key.len;
|
||||
|
||||
copy = ngx_array_push_n(params->lengths,
|
||||
@@ -3273,7 +3274,8 @@ ngx_http_fastcgi_init_params(ngx_conf_t *cf, ngx_http_fastcgi_loc_conf_t *conf,
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
|
||||
+ copy->code = (ngx_http_script_code_pt) (void *)
|
||||
+ ngx_http_script_copy_len_code;
|
||||
copy->len = src[i].skip_empty;
|
||||
|
||||
|
||||
diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c
|
||||
index 837ad9a2ea..300d927047 100644
|
||||
--- a/src/http/modules/ngx_http_grpc_module.c
|
||||
+++ b/src/http/modules/ngx_http_grpc_module.c
|
||||
@@ -4389,7 +4389,8 @@ ngx_http_grpc_init_headers(ngx_conf_t *cf, ngx_http_grpc_loc_conf_t *conf,
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
|
||||
+ copy->code = (ngx_http_script_code_pt) (void *)
|
||||
+ ngx_http_script_copy_len_code;
|
||||
copy->len = src[i].key.len;
|
||||
|
||||
size = (sizeof(ngx_http_script_copy_code_t)
|
||||
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
|
||||
index c9ad638df9..e7f829d653 100644
|
||||
--- a/src/http/modules/ngx_http_proxy_module.c
|
||||
+++ b/src/http/modules/ngx_http_proxy_module.c
|
||||
@@ -3493,7 +3493,8 @@ ngx_http_proxy_init_headers(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *conf,
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
|
||||
+ copy->code = (ngx_http_script_code_pt) (void *)
|
||||
+ ngx_http_script_copy_len_code;
|
||||
copy->len = src[i].key.len;
|
||||
|
||||
size = (sizeof(ngx_http_script_copy_code_t)
|
||||
diff --git a/src/http/modules/ngx_http_scgi_module.c b/src/http/modules/ngx_http_scgi_module.c
|
||||
index 3fb227b28c..9bd45bd136 100644
|
||||
--- a/src/http/modules/ngx_http_scgi_module.c
|
||||
+++ b/src/http/modules/ngx_http_scgi_module.c
|
||||
@@ -1724,7 +1724,8 @@ ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf,
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
|
||||
+ copy->code = (ngx_http_script_code_pt) (void *)
|
||||
+ ngx_http_script_copy_len_code;
|
||||
copy->len = src[i].key.len + 1;
|
||||
|
||||
copy = ngx_array_push_n(params->lengths,
|
||||
@@ -1733,7 +1734,8 @@ ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf,
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
|
||||
+ copy->code = (ngx_http_script_code_pt) (void *)
|
||||
+ ngx_http_script_copy_len_code;
|
||||
copy->len = src[i].skip_empty;
|
||||
|
||||
|
||||
diff --git a/src/http/modules/ngx_http_uwsgi_module.c b/src/http/modules/ngx_http_uwsgi_module.c
|
||||
index 124da4db56..238bcf8a3b 100644
|
||||
--- a/src/http/modules/ngx_http_uwsgi_module.c
|
||||
+++ b/src/http/modules/ngx_http_uwsgi_module.c
|
||||
@@ -1987,7 +1987,8 @@ ngx_http_uwsgi_init_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf,
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
|
||||
+ copy->code = (ngx_http_script_code_pt) (void *)
|
||||
+ ngx_http_script_copy_len_code;
|
||||
copy->len = src[i].key.len;
|
||||
|
||||
copy = ngx_array_push_n(params->lengths,
|
||||
@@ -1996,7 +1997,8 @@ ngx_http_uwsgi_init_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf,
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
|
||||
+ copy->code = (ngx_http_script_code_pt) (void *)
|
||||
+ ngx_http_script_copy_len_code;
|
||||
copy->len = src[i].skip_empty;
|
||||
|
||||
|
||||
diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c
|
||||
index 96f3ec6965..1a87735617 100644
|
||||
--- a/src/http/ngx_http_script.c
|
||||
+++ b/src/http/ngx_http_script.c
|
||||
@@ -695,7 +695,8 @@ ngx_http_script_add_copy_code(ngx_http_script_compile_t *sc, ngx_str_t *value,
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- code->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code;
|
||||
+ code->code = (ngx_http_script_code_pt) (void *)
|
||||
+ ngx_http_script_copy_len_code;
|
||||
code->len = len;
|
||||
|
||||
size = (sizeof(ngx_http_script_copy_code_t) + len + sizeof(uintptr_t) - 1)
|
||||
@@ -784,7 +785,8 @@ ngx_http_script_add_var_code(ngx_http_script_compile_t *sc, ngx_str_t *name)
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- code->code = (ngx_http_script_code_pt) ngx_http_script_copy_var_len_code;
|
||||
+ code->code = (ngx_http_script_code_pt) (void *)
|
||||
+ ngx_http_script_copy_var_len_code;
|
||||
code->index = (uintptr_t) index;
|
||||
|
||||
code = ngx_http_script_add_code(*sc->values,
|
||||
@@ -1178,8 +1180,8 @@ ngx_http_script_add_capture_code(ngx_http_script_compile_t *sc, ngx_uint_t n)
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- code->code = (ngx_http_script_code_pt)
|
||||
- ngx_http_script_copy_capture_len_code;
|
||||
+ code->code = (ngx_http_script_code_pt) (void *)
|
||||
+ ngx_http_script_copy_capture_len_code;
|
||||
code->n = 2 * n;
|
||||
|
||||
|
||||
@@ -1293,7 +1295,8 @@ ngx_http_script_add_full_name_code(ngx_http_script_compile_t *sc)
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- code->code = (ngx_http_script_code_pt) ngx_http_script_full_name_len_code;
|
||||
+ code->code = (ngx_http_script_code_pt) (void *)
|
||||
+ ngx_http_script_full_name_len_code;
|
||||
code->conf_prefix = sc->conf_prefix;
|
||||
|
||||
code = ngx_http_script_add_code(*sc->values,
|
||||
diff --git a/src/stream/ngx_stream_script.c b/src/stream/ngx_stream_script.c
|
||||
index aa555ca2c1..b00e7086f7 100644
|
||||
--- a/src/stream/ngx_stream_script.c
|
||||
+++ b/src/stream/ngx_stream_script.c
|
||||
@@ -587,7 +587,8 @@ ngx_stream_script_add_copy_code(ngx_stream_script_compile_t *sc,
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- code->code = (ngx_stream_script_code_pt) ngx_stream_script_copy_len_code;
|
||||
+ code->code = (ngx_stream_script_code_pt) (void *)
|
||||
+ ngx_stream_script_copy_len_code;
|
||||
code->len = len;
|
||||
|
||||
size = (sizeof(ngx_stream_script_copy_code_t) + len + sizeof(uintptr_t) - 1)
|
||||
@@ -677,8 +678,8 @@ ngx_stream_script_add_var_code(ngx_stream_script_compile_t *sc, ngx_str_t *name)
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- code->code = (ngx_stream_script_code_pt)
|
||||
- ngx_stream_script_copy_var_len_code;
|
||||
+ code->code = (ngx_stream_script_code_pt) (void *)
|
||||
+ ngx_stream_script_copy_var_len_code;
|
||||
code->index = (uintptr_t) index;
|
||||
|
||||
code = ngx_stream_script_add_code(*sc->values,
|
||||
@@ -767,8 +768,8 @@ ngx_stream_script_add_capture_code(ngx_stream_script_compile_t *sc,
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- code->code = (ngx_stream_script_code_pt)
|
||||
- ngx_stream_script_copy_capture_len_code;
|
||||
+ code->code = (ngx_stream_script_code_pt) (void *)
|
||||
+ ngx_stream_script_copy_capture_len_code;
|
||||
code->n = 2 * n;
|
||||
|
||||
|
||||
@@ -859,7 +860,7 @@ ngx_stream_script_add_full_name_code(ngx_stream_script_compile_t *sc)
|
||||
return NGX_ERROR;
|
||||
}
|
||||
|
||||
- code->code = (ngx_stream_script_code_pt)
|
||||
+ code->code = (ngx_stream_script_code_pt) (void *)
|
||||
ngx_stream_script_full_name_len_code;
|
||||
code->conf_prefix = sc->conf_prefix;
|
||||
|
||||
+399
-109
@@ -1,11 +1,36 @@
|
||||
#!/bin/bash
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
function usage() {
|
||||
echo "
|
||||
Usage: build_ngx_pagespeed.sh [options]
|
||||
|
||||
Installs ngx_pagespeed and its dependencies. Can optionally build and install
|
||||
nginx as well.
|
||||
nginx as well. Can be run either as:
|
||||
|
||||
bash <(curl -f -L -sS https://ngxpagespeed.com/install) [options]
|
||||
|
||||
Or:
|
||||
|
||||
git clone git@github.com:pagespeed/ngx_pagespeed.git
|
||||
cd ngx_pagespeed/
|
||||
git checkout <branch>
|
||||
scripts/build_ngx_pagespeed.sh [options]
|
||||
|
||||
Options:
|
||||
-v, --ngx-pagespeed-version <ngx_pagespeed version>
|
||||
@@ -14,7 +39,11 @@ Options:
|
||||
* latest-stable
|
||||
* a version number, such as 1.11.33.4
|
||||
|
||||
If you don't specify a version, defaults to latest-stable.
|
||||
If you don't specify a version, defaults to latest-stable unless --devel
|
||||
is specified, in which case it defaults to master.
|
||||
|
||||
This option doesn't make sense if we're running within an existing
|
||||
ngx_pagespeed checkout.
|
||||
|
||||
-n, --nginx-version <nginx version>
|
||||
What version of nginx to build. If not set, this script only prepares the
|
||||
@@ -36,6 +65,30 @@ Options:
|
||||
non-deb non-rpm system, this won't work. In that case, install the
|
||||
dependencies yourself and pass --no-deps-check.
|
||||
|
||||
-s, --psol-from-source
|
||||
Build PSOL from source instead of downloading a pre-built binary module.
|
||||
|
||||
-l, --devel
|
||||
Sets up a development environment in ngx_pagespeed/nginx, building with
|
||||
testing-only dependencies. Includes --psol-from-source, conflicts with
|
||||
--nginx-version. Uses a 'git clone' checkout for ngx_pagespeed and nginx
|
||||
instead of downloading a tarball.
|
||||
|
||||
-t, --build-type
|
||||
When building PSOL from source, what to tell it for BUILD_TYPE. Defaults
|
||||
to 'Release' unless --devel is set in which case it defaults to 'Debug'.
|
||||
|
||||
-y, --assume-yes
|
||||
Assume the answer to all prompts is 'yes, please continue'. Intended for
|
||||
automated usage, such as buildbots.
|
||||
|
||||
-a, --additional-nginx-configure-arguments
|
||||
When running ./configure for nginx, you may want to specify additional
|
||||
arguments, such as --with-http_ssl_module. By default this script will
|
||||
pause and prompt you for them, but this option lets you pass them in. For
|
||||
example, you might do:
|
||||
-a '--with-http_ssl_module --with-cc-opt=\"-I /usr/local/include\"'
|
||||
|
||||
-d, --dryrun
|
||||
Don't make any changes to the system, just print what changes you
|
||||
would have made.
|
||||
@@ -44,10 +97,34 @@ Options:
|
||||
Print this message and exit."
|
||||
}
|
||||
|
||||
RED=31
|
||||
GREEN=32
|
||||
YELLOW=33
|
||||
function begin_color() {
|
||||
color="$1"
|
||||
echo -e -n "\e[${color}m"
|
||||
}
|
||||
function end_color() {
|
||||
echo -e -n "\e[0m"
|
||||
}
|
||||
|
||||
function echo_color() {
|
||||
color="$1"
|
||||
shift
|
||||
begin_color "$color"
|
||||
echo "$@"
|
||||
end_color
|
||||
}
|
||||
|
||||
function error() {
|
||||
local error_message="$@"
|
||||
echo_color "$RED" -n "Error: " >&2
|
||||
echo "$@" >&2
|
||||
}
|
||||
|
||||
# Prints an error message and exits with an error code.
|
||||
function fail() {
|
||||
local error_message="$@"
|
||||
echo "$@" >&2
|
||||
error "$@"
|
||||
|
||||
# Normally I'd use $0 in "usage" here, but since most people will be running
|
||||
# this via curl, that wouldn't actually give something useful.
|
||||
@@ -56,6 +133,11 @@ function fail() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
function status() {
|
||||
echo_color "$GREEN" "$@"
|
||||
}
|
||||
|
||||
# Intended to be called as:
|
||||
# bash <(curl dl.google.com/.../build_ngx_pagespeed.sh) <args>
|
||||
|
||||
@@ -64,12 +146,19 @@ function fail() {
|
||||
# The run function handles exit-status checking for system-changing commands.
|
||||
# Additionally, this allows us to easily have a dryrun mode where we don't
|
||||
# actually make any changes.
|
||||
INITIAL_ENV=$(printenv | sort)
|
||||
function run() {
|
||||
if "$DRYRUN"; then
|
||||
echo "would run $@"
|
||||
echo_color "$YELLOW" -n "would run"
|
||||
echo " $@"
|
||||
env_differences=$(comm -13 <(echo "$INITIAL_ENV") <(printenv | sort))
|
||||
if [ -n "$env_differences" ]; then
|
||||
echo " with the following additional environment variables:"
|
||||
echo "$env_differences" | sed 's/^/ /'
|
||||
fi
|
||||
else
|
||||
if ! "$@"; then
|
||||
echo "Failure running $@, exiting."
|
||||
error "Failure running '$@', exiting."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -155,9 +244,9 @@ function install_dependencies() {
|
||||
fi
|
||||
done
|
||||
if [ -n "$missing_dependencies" ]; then
|
||||
echo "Detected that we're missing the following depencencies:"
|
||||
status "Detected that we're missing the following depencencies:"
|
||||
echo " $missing_dependencies"
|
||||
echo "Installing them:"
|
||||
status "Installing them:"
|
||||
run sudo $install_pkg_cmd $missing_dependencies
|
||||
fi
|
||||
}
|
||||
@@ -176,8 +265,13 @@ function gcc_too_old() {
|
||||
}
|
||||
|
||||
function continue_or_exit() {
|
||||
if "$ASSUME_YES"; then
|
||||
return
|
||||
fi
|
||||
|
||||
local prompt="$1"
|
||||
read -p "$prompt [Y/n] " yn
|
||||
echo_color "$YELLOW" -n "$prompt"
|
||||
read -p " [Y/n] " yn
|
||||
if [[ "$yn" == N* || "$yn" == n* ]]; then
|
||||
echo "Cancelled."
|
||||
exit 0
|
||||
@@ -217,9 +311,10 @@ function build_ngx_pagespeed() {
|
||||
fail "Your version of getopt is too old. Exiting with no changes made."
|
||||
fi
|
||||
|
||||
opts=$(getopt -o v:n:mb:pdh \
|
||||
opts=$(getopt -o v:n:mb:pslt:ya:dh \
|
||||
--longoptions ngx-pagespeed-version:,nginx-version:,dynamic-module \
|
||||
--longoptions buildir:,no-deps-check,dryrun,help \
|
||||
--longoptions buildir:,no-deps-check,psol-from-source,devel,build-type: \
|
||||
--longoptions assume-yes,additional-nginx-configure-arguments:,dryrun,help \
|
||||
-n "$(basename "$0")" -- "$@")
|
||||
if [ $? != 0 ]; then
|
||||
usage
|
||||
@@ -227,10 +322,14 @@ function build_ngx_pagespeed() {
|
||||
fi
|
||||
eval set -- "$opts"
|
||||
|
||||
NPS_VERSION="latest-stable"
|
||||
NPS_VERSION="DEFAULT"
|
||||
NGINX_VERSION=""
|
||||
BUILDDIR="$HOME"
|
||||
DO_DEPS_CHECK=true
|
||||
PSOL_FROM_SOURCE=false
|
||||
DEVEL=false
|
||||
BUILD_TYPE=""
|
||||
ASSUME_YES=false
|
||||
DRYRUN=false
|
||||
DYNAMIC_MODULE=false
|
||||
while true; do
|
||||
@@ -253,6 +352,23 @@ function build_ngx_pagespeed() {
|
||||
-p | --no-deps-check) shift
|
||||
DO_DEPS_CHECK=false
|
||||
;;
|
||||
-s | --psol-from-source) shift
|
||||
PSOL_FROM_SOURCE=true
|
||||
;;
|
||||
-l | --devel) shift
|
||||
DEVEL=true
|
||||
;;
|
||||
-t | --build-type) shift
|
||||
BUILD_TYPE="$1"
|
||||
shift
|
||||
;;
|
||||
-y | --assume-yes) shift
|
||||
ASSUME_YES="true"
|
||||
;;
|
||||
-a | --additional-nginx-configure-arguments) shift
|
||||
ADDITIONAL_NGINX_CONFIGURE_ARGUMENTS="$1"
|
||||
shift
|
||||
;;
|
||||
-d | --dryrun) shift
|
||||
DRYRUN="true"
|
||||
;;
|
||||
@@ -271,10 +387,58 @@ function build_ngx_pagespeed() {
|
||||
esac
|
||||
done
|
||||
|
||||
USE_GIT_CHECKOUT="$DEVEL"
|
||||
ALREADY_CHECKED_OUT=false
|
||||
if [ -e PSOL_BINARY_URL ]; then
|
||||
status "Detected that we're running in an existing ngx_pagespeed checkout."
|
||||
USE_GIT_CHECKOUT=true
|
||||
ALREADY_CHECKED_OUT=true
|
||||
fi
|
||||
|
||||
if "$ALREADY_CHECKED_OUT"; then
|
||||
if [ "$NPS_VERSION" != "DEFAULT" ]; then
|
||||
fail \
|
||||
"The --ngx-pagespeed-version argument doesn't make sense when running within an existing checkout."
|
||||
fi
|
||||
elif [ "$NPS_VERSION" = "DEFAULT" ]; then
|
||||
if "$DEVEL"; then
|
||||
NPS_VERSION="master"
|
||||
else
|
||||
NPS_VERSION="latest-stable"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d "$BUILDDIR" ]; then
|
||||
fail "Told to build in $BUILDDIR, but that directory doesn't exist."
|
||||
fi
|
||||
|
||||
BUILD_NGINX=false
|
||||
if [ -n "$NGINX_VERSION" ]; then
|
||||
BUILD_NGINX=true
|
||||
fi
|
||||
|
||||
if "$DEVEL"; then
|
||||
PSOL_FROM_SOURCE=true
|
||||
BUILD_NGINX=true
|
||||
if [ -n "$NGINX_VERSION" ]; then
|
||||
fail \
|
||||
"The --devel argument conflicts with --nginx. In devel mode we use the version of nginx that's included as a submodule."
|
||||
fi
|
||||
if "$DYNAMIC_MODULE"; then
|
||||
fail "Can't currently build a dynamic module in --devel mode."
|
||||
fi
|
||||
fi
|
||||
|
||||
if "$PSOL_FROM_SOURCE" && [ -z "$BUILD_TYPE" ]; then
|
||||
if "$DEVEL"; then
|
||||
BUILD_TYPE="Debug"
|
||||
else
|
||||
BUILD_TYPE="Release"
|
||||
fi
|
||||
elif [ -n "$BUILD_TYPE" ]; then
|
||||
fail "Setting --build-type requires --psol-from-source or --devel."
|
||||
fi
|
||||
|
||||
if [ "$NGINX_VERSION" = "latest" ]; then
|
||||
# When this function fails it prints the debugging information needed first
|
||||
# to stderr.
|
||||
@@ -283,8 +447,15 @@ function build_ngx_pagespeed() {
|
||||
|
||||
if "$DYNAMIC_MODULE"; then
|
||||
# Check that ngx_pagespeed and nginx are recent enough to support dynamic
|
||||
# modules.
|
||||
if version_older_than "$NPS_VERSION" "1.10.33.5"; then
|
||||
# modules. Unfortunately NPS_VERSION might be a tag, in which case we don't
|
||||
# know. If it's not a numeric version number, then assume it's recent
|
||||
# enough and if it's not they'll get an ugly compilation error later.
|
||||
# Luckily 1.10.33.5 was a while ago now.
|
||||
#
|
||||
# I'd like to use =~ here, but they changed syntax between v3 and v4 (quotes
|
||||
# moved from mandatory to optional to prohibited).
|
||||
if [[ "${NPS_VERSION#*[^0-9.]}" = "$NPS_VERSION" ]] &&
|
||||
version_older_than "$NPS_VERSION" "1.10.33.5"; then
|
||||
fail "
|
||||
You're trying to build ngx_pagespeed $NPS_VERSION as a dynamic module, but
|
||||
ngx_pagespeed didn't add support for dynamic modules until 1.10.33.5."
|
||||
@@ -313,18 +484,24 @@ add support for dynamic modules in a way compatible with ngx_pagespeed until
|
||||
extra_flags=()
|
||||
# Now make sure our dependencies are installed.
|
||||
if "$DO_DEPS_CHECK"; then
|
||||
INSTALL_FLAGS=""
|
||||
|
||||
if "$ASSUME_YES"; then
|
||||
INSTALL_FLAGS="-y"
|
||||
fi
|
||||
|
||||
if [ -f /etc/debian_version ]; then
|
||||
echo "Detected debian-based distro."
|
||||
status "Detected debian-based distro."
|
||||
|
||||
install_dependencies "apt-get install" debian_is_installed \
|
||||
"build-essential zlib1g-dev libpcre3 libpcre3-dev unzip"
|
||||
install_dependencies "apt-get install ${INSTALL_FLAGS}" debian_is_installed \
|
||||
build-essential zlib1g-dev libpcre3 libpcre3-dev unzip wget uuid-dev
|
||||
|
||||
if gcc_too_old; then
|
||||
if [ ! -e /usr/lib/gcc-mozilla/bin/gcc ]; then
|
||||
echo "Detected that gcc is older than 4.8. Installing gcc-mozilla"
|
||||
echo "which installs gcc-4.8 into /usr/lib/gcc-mozilla/ and doesn't"
|
||||
echo "affect your global gcc installation."
|
||||
run sudo apt-get install gcc-mozilla
|
||||
status "Detected that gcc is older than 4.8. Installing gcc-mozilla"
|
||||
status "which installs gcc-4.8 into /usr/lib/gcc-mozilla/ and doesn't"
|
||||
status "affect your global gcc installation."
|
||||
run sudo apt-get install ${INSTALL_FLAGS} gcc-mozilla
|
||||
fi
|
||||
|
||||
extra_flags=("--with-cc=/usr/lib/gcc-mozilla/bin/gcc" \
|
||||
@@ -332,10 +509,10 @@ add support for dynamic modules in a way compatible with ngx_pagespeed until
|
||||
fi
|
||||
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
echo "Detected redhat-based distro."
|
||||
status "Detected redhat-based distro."
|
||||
|
||||
install_dependencies "yum install" redhat_is_installed \
|
||||
"gcc-c++ pcre-devel zlib-devel make unzip wget"
|
||||
install_dependencies "yum install ${INSTALL_FLAGS}" redhat_is_installed \
|
||||
gcc-c++ pcre-devel zlib-devel make unzip wget libuuid-devel
|
||||
if gcc_too_old; then
|
||||
if [ ! -e /opt/rh/devtoolset-2/root/usr/bin/gcc ]; then
|
||||
redhat_major_version=$(
|
||||
@@ -350,9 +527,9 @@ Unexpected major version $redhat_major_version in /etc/redhat-release:
|
||||
$(cat /etc/redhat-release) Expected 5 or 6."
|
||||
fi
|
||||
|
||||
echo "Detected that gcc is older than 4.8. Scientific Linux provides"
|
||||
echo "a gcc package that installs gcc-4.8 into /opt/ and doesn't"
|
||||
echo "affect your global gcc installation."
|
||||
status "Detected that gcc is older than 4.8. Scientific Linux"
|
||||
status "provides a gcc package that installs gcc-4.8 into /opt/ and"
|
||||
status "doesn't affect your global gcc installation."
|
||||
slc_key="https://linux.web.cern.ch/linux/scientific6/docs/repository/"
|
||||
slc_key+="cern/slc6X/i386/RPM-GPG-KEY-cern"
|
||||
slc_key_out="$TEMPDIR/RPM-GPG-KEY-cern"
|
||||
@@ -368,7 +545,7 @@ $(cat /etc/redhat-release) Expected 5 or 6."
|
||||
repo_url+="/docs/repository/cern/devtoolset/"
|
||||
repo_url+="slc${slc_version}-devtoolset.repo"
|
||||
run sudo wget -O "$repo_fname" "$repo_url"
|
||||
run sudo yum install devtoolset-2-gcc-c++ devtoolset-2-binutils
|
||||
run sudo yum install ${INSTALL_FLAGS} devtoolset-2-gcc-c++ devtoolset-2-binutils
|
||||
fi
|
||||
extra_flags=("--with-cc=/opt/rh/devtoolset-2/root/usr/bin/gcc")
|
||||
fi
|
||||
@@ -378,9 +555,9 @@ This doesn't appear to be a deb-based distro or an rpm-based one. Not going to
|
||||
be able to install dependencies. Please install dependencies manually and rerun
|
||||
with --no-deps-check."
|
||||
fi
|
||||
echo "Dependencies are all set."
|
||||
status "Operating system dependencies are all set."
|
||||
else
|
||||
echo "Not checking whether dependencies are installed."
|
||||
status "Not checking whether operating system dependencies are installed."
|
||||
fi
|
||||
|
||||
function delete_if_already_exists() {
|
||||
@@ -391,7 +568,6 @@ with --no-deps-check."
|
||||
if [ ${#directory} -lt 8 ]; then
|
||||
fail "
|
||||
Not deleting $directory; name is suspiciously short. Something is wrong."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
continue_or_exit "OK to delete $directory?"
|
||||
@@ -399,53 +575,114 @@ Not deleting $directory; name is suspiciously short. Something is wrong."
|
||||
fi
|
||||
}
|
||||
|
||||
nps_baseurl="https://github.com/pagespeed/ngx_pagespeed/archive"
|
||||
# In general, the zip github builds for tag foo unzips to ngx_pagespeed-foo,
|
||||
# but it looks like they special case vVERSION tags to ngx_pagespeed-VERSION.
|
||||
# but it looks like they special case vVERSION tags to ngx_pagespeed-VERSION
|
||||
if [[ "$NPS_VERSION" =~ ^[0-9]*[.][0-9]*[.][0-9]*[.][0-9]*$ ]]; then
|
||||
# We've been given a numeric version number. This has an associated tag in
|
||||
# the form vVERSION-beta.
|
||||
nps_url_fname="v${NPS_VERSION}-beta"
|
||||
# We've been given a numeric version number. This has an associated tag
|
||||
# in the form vVERSION-beta.
|
||||
tag_name="v${NPS_VERSION}-beta"
|
||||
nps_downloaded_fname="ngx_pagespeed-${NPS_VERSION}-beta"
|
||||
else
|
||||
# We've been given a tag name, like latest-beta. Download that directly.
|
||||
nps_url_fname="$NPS_VERSION"
|
||||
tag_name="$NPS_VERSION"
|
||||
nps_downloaded_fname="ngx_pagespeed-${NPS_VERSION}"
|
||||
fi
|
||||
|
||||
nps_downloaded="$TEMPDIR/$nps_downloaded_fname.zip"
|
||||
run wget "$nps_baseurl/$nps_url_fname.zip" -O "$nps_downloaded"
|
||||
nps_module_dir="$BUILDDIR/$nps_downloaded_fname"
|
||||
delete_if_already_exists "$nps_module_dir"
|
||||
echo "Extracting ngx_pagespeed..."
|
||||
run unzip -q "$nps_downloaded" -d "$BUILDDIR"
|
||||
run cd "$nps_module_dir"
|
||||
|
||||
# Now we need to figure out what precompiled version of PSOL to build
|
||||
# ngx_pagespeed against.
|
||||
if "$DRYRUN"; then
|
||||
psol_url="https://psol.example.com/cant-get-psol-version-in-dry-run.tar.gz"
|
||||
elif [ -e PSOL_BINARY_URL ]; then
|
||||
# Releases after 1.11.33.4 there is a PSOL_BINARY_URL file that tells us
|
||||
# where to look.
|
||||
psol_url="$(scripts/format_binary_url.sh PSOL_BINARY_URL)"
|
||||
if [[ "$psol_url" != https://* ]]; then
|
||||
fail "Got bad psol binary location information: $psol_url"
|
||||
install_dir="this-only-makes-sense-in-devel-mode"
|
||||
if "$USE_GIT_CHECKOUT"; then
|
||||
# We're either doing a --devel build, or someone is running us from an
|
||||
# existing git checkout.
|
||||
nps_module_dir="$PWD"
|
||||
install_dir="$nps_module_dir"
|
||||
if "$ALREADY_CHECKED_OUT"; then
|
||||
run cd "$nps_module_dir"
|
||||
else
|
||||
status "Checking out ngx_pagespeed..."
|
||||
run git clone "git@github.com:pagespeed/ngx_pagespeed.git" \
|
||||
"$nps_module_dir"
|
||||
run cd "$nps_module_dir"
|
||||
run git checkout "$tag_name"
|
||||
fi
|
||||
submodules_dir="$nps_module_dir/testing-dependencies"
|
||||
if "$DEVEL"; then
|
||||
status "Downloading dependencies..."
|
||||
run git submodule update --init --recursive
|
||||
if [[ "$CONTINUOUS_INTEGRATION" != true ]]; then
|
||||
status "Switching submodules over to git protocol."
|
||||
# This lets us push to github by public key.
|
||||
for config in $(find .git/ -name config) ; do
|
||||
run sed -i s~https://github.com/~git@github.com:~ $config ;
|
||||
done
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# For past releases we have to grep it from the config file. The url has
|
||||
# always looked like this, and the config file has contained it since before
|
||||
# we started tagging our ngx_pagespeed releases.
|
||||
psol_url="$(
|
||||
grep -o "https://dl.google.com/dl/page-speed/psol/[0-9.]*.tar.gz" config)"
|
||||
if [ -z "$psol_url" ]; then
|
||||
fail "Couldn't find PSOL url in $PWD/config"
|
||||
fi
|
||||
nps_baseurl="https://github.com/apache/incubator-pagespeed-ngx/archive"
|
||||
nps_downloaded="$TEMPDIR/$nps_downloaded_fname.zip"
|
||||
status "Downloading ngx_pagespeed..."
|
||||
run wget "$nps_baseurl/$tag_name.zip" -O "$nps_downloaded"
|
||||
# Read the directory name from the zip, the first line is expected to have it.
|
||||
nps_module_dir=$(unzip -qql "$nps_downloaded" | head -n1 | tr -s ' ' | cut -d' ' -f5-)
|
||||
nps_module_dir="$BUILDDIR/${nps_module_dir::-1}"
|
||||
delete_if_already_exists "$nps_module_dir"
|
||||
status "Extracting ngx_pagespeed..."
|
||||
run unzip -q "$nps_downloaded" -d "$BUILDDIR"
|
||||
run cd "$nps_module_dir"
|
||||
fi
|
||||
|
||||
run wget "$psol_url"
|
||||
echo "Extracting PSOL..."
|
||||
run tar -xzf $(basename "$psol_url") # extracts to psol/
|
||||
MOD_PAGESPEED_DIR=""
|
||||
PSOL_BINARY=""
|
||||
if "$PSOL_FROM_SOURCE"; then
|
||||
MOD_PAGESPEED_DIR="$PWD/testing-dependencies/mod_pagespeed"
|
||||
git submodule update --init --recursive -- "$MOD_PAGESPEED_DIR"
|
||||
run pushd "$MOD_PAGESPEED_DIR"
|
||||
|
||||
if "$DEVEL"; then
|
||||
if [ ! -d "$HOME/apache2" ]; then
|
||||
run install/build_development_apache.sh 2.2 prefork
|
||||
fi
|
||||
cd devel
|
||||
run make apache_debug_psol
|
||||
PSOL_BINARY="$MOD_PAGESPEED_DIR/out/$BUILD_TYPE/pagespeed_automatic.a"
|
||||
else
|
||||
if "$DO_DEPS_CHECK"; then
|
||||
skip_deps_arg=""
|
||||
else
|
||||
skip_deps_arg="--skip_deps"
|
||||
fi
|
||||
|
||||
run install/build_psol.sh --skip_tests --skip_packaging "$skip_deps_arg"
|
||||
PSOL_BINARY="$MOD_PAGESPEED_DIR/pagespeed/automatic/pagespeed_automatic.a"
|
||||
fi
|
||||
run popd
|
||||
else
|
||||
# Now we need to figure out what precompiled version of PSOL to build
|
||||
# ngx_pagespeed against.
|
||||
if "$DRYRUN"; then
|
||||
psol_url="https://psol.example.com/cant-get-psol-version-in-dry-run.tar.gz"
|
||||
elif [ -e PSOL_BINARY_URL ]; then
|
||||
# Releases after 1.11.33.4 there is a PSOL_BINARY_URL file that tells us
|
||||
# where to look.
|
||||
psol_url="$(scripts/format_binary_url.sh PSOL_BINARY_URL)"
|
||||
if [[ "$psol_url" != https://* ]]; then
|
||||
fail "Got bad psol binary location information: $psol_url"
|
||||
fi
|
||||
else
|
||||
# For past releases we have to grep it from the config file. The url has
|
||||
# always looked like this, and the config file has contained it since
|
||||
# before we started tagging our ngx_pagespeed releases.
|
||||
psol_url="$(grep -o \
|
||||
"https://dl.google.com/dl/page-speed/psol/[0-9.]*.tar.gz" config)"
|
||||
if [ -z "$psol_url" ]; then
|
||||
fail "Couldn't find PSOL url in $PWD/config"
|
||||
fi
|
||||
fi
|
||||
|
||||
status "Downloading PSOL binary..."
|
||||
run wget "$psol_url"
|
||||
|
||||
status "Extracting PSOL..."
|
||||
run tar -xzf $(basename "$psol_url") # extracts to psol/
|
||||
fi
|
||||
|
||||
if "$DYNAMIC_MODULE"; then
|
||||
add_module="--add-dynamic-module=$nps_module_dir"
|
||||
@@ -454,17 +691,37 @@ Not deleting $directory; name is suspiciously short. Something is wrong."
|
||||
fi
|
||||
configure_args=("$add_module" "${extra_flags[@]}")
|
||||
|
||||
if "$DEVEL"; then
|
||||
configure_args=("${configure_args[@]}"
|
||||
"--prefix=$install_dir/nginx"
|
||||
"--add-module=$submodules_dir/ngx_cache_purge"
|
||||
"--add-module=$submodules_dir/ngx_devel_kit"
|
||||
"--add-module=$submodules_dir/set-misc-nginx-module"
|
||||
"--add-module=$submodules_dir/headers-more-nginx-module"
|
||||
"--with-ipv6"
|
||||
"--with-http_v2_module")
|
||||
if [ "$BUILD_TYPE" = "Debug" ]; then
|
||||
configure_args=("${configure_args[@]}" "--with-debug")
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
if [ -z "$NGINX_VERSION" ]; then
|
||||
# They didn't specify an nginx version, so we're just preparing the
|
||||
# module for them to install.
|
||||
echo "ngx_pagespeed is ready to be built against nginx."
|
||||
echo "When running ./configure pass in:"
|
||||
echo " $(quote_arguments "${configure_args[@]}")"
|
||||
if ! "$BUILD_NGINX"; then
|
||||
# Just prepare the module for them to install.
|
||||
status "ngx_pagespeed is ready to be built against nginx."
|
||||
echo "When running ./configure:"
|
||||
if "$PSOL_FROM_SOURCE"; then
|
||||
echo " Set the following environment variables:"
|
||||
echo " MOD_PAGESPEED_DIR=$MOD_PAGESPEED_DIR"
|
||||
echo " PSOL_BINARY=$PSOL_BINARY"
|
||||
fi
|
||||
echo " Give ./configure the following arguments:"
|
||||
echo " $(quote_arguments "${configure_args[@]}")"
|
||||
echo
|
||||
if [ ${#extra_flags[@]} -eq 0 ]; then
|
||||
echo "If this is for integration with an already-built nginx, make sure"
|
||||
echo "to include any other arguments you originally passed to ./configure"
|
||||
echo "You can see these with 'nginx -V'."
|
||||
echo "to include any other arguments you originally passed to"
|
||||
echo "./configure. You can see these with 'nginx -V'."
|
||||
else
|
||||
echo "Note: because we need to set $(quote_arguments "${extra_flags[@]}")"
|
||||
echo "on this platform, if you want to integrate ngx_pagespeed with an"
|
||||
@@ -472,60 +729,93 @@ Not deleting $directory; name is suspiciously short. Something is wrong."
|
||||
echo "those flags set."
|
||||
fi
|
||||
else
|
||||
# Download and build nginx.
|
||||
nginx_leaf="nginx-${NGINX_VERSION}.tar.gz"
|
||||
nginx_fname="$TEMPDIR/$nginx_leaf"
|
||||
run wget "http://nginx.org/download/$nginx_leaf" -O "$nginx_fname"
|
||||
nginx_dir="$BUILDDIR/nginx-${NGINX_VERSION}/"
|
||||
delete_if_already_exists "$nginx_dir"
|
||||
echo "Extracting nginx..."
|
||||
run tar -xzf "$nginx_fname" --directory "$BUILDDIR"
|
||||
"$DRYRUN" || cd "$nginx_dir"
|
||||
if "$DEVEL"; then
|
||||
# Use the nginx we loaded as a submodule
|
||||
nginx_dir="$submodules_dir/nginx"
|
||||
configure_location="auto"
|
||||
else
|
||||
# Download and build the specified nginx version.
|
||||
nginx_leaf="nginx-${NGINX_VERSION}.tar.gz"
|
||||
nginx_fname="$TEMPDIR/$nginx_leaf"
|
||||
status "Downloading nginx..."
|
||||
run wget "http://nginx.org/download/$nginx_leaf" -O "$nginx_fname"
|
||||
nginx_dir="$BUILDDIR/nginx-${NGINX_VERSION}/"
|
||||
delete_if_already_exists "$nginx_dir"
|
||||
status "Extracting nginx..."
|
||||
run tar -xzf "$nginx_fname" --directory "$BUILDDIR"
|
||||
configure_location="."
|
||||
fi
|
||||
run cd "$nginx_dir"
|
||||
|
||||
configure=("$configure_location/configure" "${configure_args[@]}")
|
||||
additional_configure_args=""
|
||||
if [ -z "${ADDITIONAL_NGINX_CONFIGURE_ARGUMENTS+x}" ]; then
|
||||
if ! "$ASSUME_YES"; then
|
||||
echo "About to build nginx. Do you have any additional ./configure"
|
||||
echo "arguments you would like to set? For example, if you would like"
|
||||
echo "to build nginx with https support give --with-http_ssl_module"
|
||||
echo "If you don't have any, just press enter."
|
||||
read -p "> " additional_configure_args
|
||||
fi
|
||||
else
|
||||
additional_configure_args="$ADDITIONAL_NGINX_CONFIGURE_ARGUMENTS"
|
||||
fi
|
||||
|
||||
configure=("./configure" "${configure_args[@]}")
|
||||
echo "About to build nginx. Do you have any additional ./configure"
|
||||
echo "arguments you would like to set? For example, if you would like"
|
||||
echo "to build nginx with https support give --with-http_ssl_module"
|
||||
echo "If you don't have any, just press enter."
|
||||
read -p "> " additional_configure_args
|
||||
if [ -n "$additional_configure_args" ]; then
|
||||
# Split additional_configure_args respecting any internal quotation.
|
||||
# Otherwise things like --with-cc-opt='-foo -bar' won't work.
|
||||
eval additional_configure_args=("$additional_configure_args")
|
||||
configure=("${configure[@]}" "${additional_configure_args[@]}")
|
||||
fi
|
||||
|
||||
echo "About to configure nginx with:"
|
||||
echo " $(quote_arguments "${configure[@]}")"
|
||||
continue_or_exit "Does this look right?"
|
||||
run "${configure[@]}"
|
||||
MOD_PAGESPEED_DIR="$MOD_PAGESPEED_DIR" \
|
||||
PSOL_BINARY="$PSOL_BINARY" \
|
||||
run "${configure[@]}"
|
||||
|
||||
continue_or_exit "Build nginx?"
|
||||
if ! "$DEVEL"; then
|
||||
continue_or_exit "Build nginx?"
|
||||
fi
|
||||
run make
|
||||
|
||||
continue_or_exit "Install nginx?"
|
||||
run sudo make install
|
||||
if "$DEVEL"; then
|
||||
run make install
|
||||
|
||||
echo
|
||||
if "$DYNAMIC_MODULE"; then
|
||||
echo "Nginx installed with ngx_pagespeed support available as a"
|
||||
echo "loadable module."
|
||||
status "Nginx installed with ngx_pagespeed, and set up for development."
|
||||
echo "To run tests:"
|
||||
echo " cd $nps_module_dir"
|
||||
echo " test/run_tests.sh"
|
||||
echo
|
||||
echo "To load the ngx_pagespeed module, you'll need to add:"
|
||||
echo " load_module \"modules/ngx_pagespeed.so\";"
|
||||
echo "at the top of your main nginx configuration file."
|
||||
echo "To rebuild after changes:"
|
||||
echo " scripts/rebuild.sh"
|
||||
else
|
||||
echo "Nginx installed with ngx_pagespeed support compiled-in."
|
||||
continue_or_exit "Install nginx?"
|
||||
run sudo make install
|
||||
|
||||
echo
|
||||
if "$DYNAMIC_MODULE"; then
|
||||
echo "Nginx installed with ngx_pagespeed support available as a"
|
||||
echo "loadable module."
|
||||
echo
|
||||
echo "To load the ngx_pagespeed module, you'll need to add:"
|
||||
echo " load_module \"modules/ngx_pagespeed.so\";"
|
||||
echo "at the top of your main nginx configuration file."
|
||||
else
|
||||
echo "Nginx installed with ngx_pagespeed support compiled-in."
|
||||
fi
|
||||
echo
|
||||
echo "If this is a new installation you probably need an init script to"
|
||||
echo "manage starting and stopping the nginx service. See:"
|
||||
echo " http://wiki.nginx.org/InitScripts"
|
||||
echo
|
||||
echo "You'll also need to configure ngx_pagespeed if you haven't yet:"
|
||||
echo " https://developers.google.com/speed/pagespeed/module/configuration"
|
||||
fi
|
||||
echo
|
||||
echo "If this is a new installation you probably need an init script to"
|
||||
echo "manage starting and stopping the nginx service. See:"
|
||||
echo " http://wiki.nginx.org/InitScripts"
|
||||
echo
|
||||
echo "You'll also need to configure ngx_pagespeed if you haven't yet:"
|
||||
echo " https://developers.google.com/speed/pagespeed/module/configuration"
|
||||
fi
|
||||
if "$DRYRUN"; then
|
||||
echo "[this was a dry run; your system is unchanged]"
|
||||
echo_color "$YELLOW" "[this was a dry run; your system is unchanged]"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
#!/bin/bash
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
set -e
|
||||
set -u
|
||||
@@ -21,4 +37,4 @@ else
|
||||
bit_size_name=ia32
|
||||
fi
|
||||
|
||||
sed -e 's/$BIT_SIZE_NAME\b/'$bit_size_name'/g' $url_file
|
||||
sed -e 's/$BIT_SIZE_NAME/'$bit_size_name'/g' $url_file
|
||||
|
||||
@@ -1,19 +1,32 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Converts pagespeed_libraries.conf from Apache-format to Nginx-format,
|
||||
# supporting the canonicalize_javascript_libraries filter.
|
||||
# Inspired by https://github.com/pagespeed/ngx_pagespeed/issues/532
|
||||
# Inspired by https://github.com/apache/incubator-pagespeed-ngx/issues/532
|
||||
#
|
||||
# Usage:
|
||||
# scripts/pagespeed_libraries_generator.sh > pagespeed_libraries.conf
|
||||
#
|
||||
# Then have nginx include that configuration file and enable the filter
|
||||
# canonicalize_javascript_libraries.
|
||||
#
|
||||
# Author: vid@zippykid.com (Vid Luther)
|
||||
# jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
URL="https://github.com/pagespeed/mod_pagespeed/raw/master/"
|
||||
URL="https://github.com/apache/incubator-pagespeed-mod/raw/master/"
|
||||
URL+="net/instaweb/genfiles/conf/pagespeed_libraries.conf"
|
||||
curl -L -s -S "$URL" \
|
||||
| grep ModPagespeedLibrary \
|
||||
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Usage: scripts/rebuild.sh
|
||||
#
|
||||
# After building with "scripts/build_ngx_pagespeed.sh --devel", if you make
|
||||
# changes to ngx_pagespeed you'll need to rebuild it. The underlying commands
|
||||
# aren't complicated, but it's faster to work if it's automated.
|
||||
|
||||
set -e # exit script if any command returns an error
|
||||
set -u # exit the script if any variable is uninitialized
|
||||
|
||||
this_dir="$(dirname $0)"
|
||||
cd "$this_dir/.."
|
||||
nps_dir="$PWD"
|
||||
|
||||
cd "$nps_dir/testing-dependencies/mod_pagespeed/devel"
|
||||
make apache_debug_psol
|
||||
|
||||
cd "$nps_dir/testing-dependencies/nginx/"
|
||||
make
|
||||
make install
|
||||
+20
-17
@@ -1,20 +1,23 @@
|
||||
// Copyright 2010 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Author: jmarantz@google.com (Joshua Marantz)
|
||||
// Author: sligocki@google.com (Shawn Ligocki)
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// TODO(jefftk): share more of this code with apache's log_message_handler
|
||||
|
||||
|
||||
+20
-17
@@ -1,20 +1,23 @@
|
||||
// Copyright 2010 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Author: jmarantz@google.com (Joshua Marantz)
|
||||
// Author: sligocki@google.com (Shawn Ligocki)
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef LOG_MESSAGE_HANDLER_H_
|
||||
#define LOG_MESSAGE_HANDLER_H_
|
||||
|
||||
+19
-17
@@ -1,21 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: jefftk@google.com (Jeff Kaufman)
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "ngx_pagespeed.h" // Must come first, see comments in CollectHeaders.
|
||||
|
||||
#include <unistd.h> //for usleep
|
||||
@@ -89,7 +91,7 @@ void NgxBaseFetch::Terminate() {
|
||||
NgxBaseFetch::active_base_fetches);
|
||||
|
||||
// Try to continue processing and get the active base fetch count to 0
|
||||
// untill the timeout expires.
|
||||
// until the timeout expires.
|
||||
// TODO(oschaaf): This needs more work.
|
||||
while (NgxBaseFetch::active_base_fetches > 0 && end_us > timer.NowUs()) {
|
||||
event_connection->Drain();
|
||||
@@ -152,7 +154,7 @@ void NgxBaseFetch::ReadCallback(const ps_event_data& data) {
|
||||
ps_request_ctx_t* ctx = ps_get_request_context(r);
|
||||
|
||||
// If our request context was zeroed, skip this event.
|
||||
// See https://github.com/pagespeed/ngx_pagespeed/issues/1081
|
||||
// See https://github.com/apache/incubator-pagespeed-ngx/issues/1081
|
||||
if (ctx == NULL) {
|
||||
// Should not happen normally, when it does this message will cause our
|
||||
// system tests to fail.
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
//
|
||||
// Collects output from pagespeed and buffers it until nginx asks for it.
|
||||
// Notifies nginx via NgxEventConnection to call ReadCallback() when
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
|
||||
#include "ngx_caching_headers.h"
|
||||
#include "ngx_list_iterator.h"
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
|
||||
#ifndef NGX_CACHING_HEADERS_H_
|
||||
#define NGX_CACHING_HEADERS_H_
|
||||
|
||||
+25
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: oschaaf@we-amp.com (Otto van der Schaaf)
|
||||
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -52,6 +55,14 @@ bool NgxEventConnection::Init(ngx_cycle_t* cycle) {
|
||||
} else {
|
||||
pipe_read_fd_ = file_descriptors[0];
|
||||
pipe_write_fd_ = file_descriptors[1];
|
||||
// Attempt to bump the pipe capacity, because running out of buffer space
|
||||
// can potentially lead up to writes spinning on EAGAIN.
|
||||
// See https://github.com/apache/incubator-pagespeed-ngx/issues/1380
|
||||
// TODO(oschaaf): Consider implementing a queueing mechanism for retrying
|
||||
// failed writes.
|
||||
#ifdef F_SETPIPE_SZ
|
||||
fcntl(pipe_write_fd_, F_SETPIPE_SZ, 200*1024 /* minimal amount of bytes */);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
close(file_descriptors[0]);
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: oschaaf@we-amp.com (Otto van der Schaaf)
|
||||
|
||||
//
|
||||
// NgxEventConnection implements a means to send events from other threads to
|
||||
// nginx's event loop, and is implemented by a named pipe under the hood.
|
||||
|
||||
+18
-15
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: x.dinic@gmail.com (Junmin Xiong)
|
||||
|
||||
//
|
||||
// - The fetch is started by the main thread.
|
||||
// - Resolver event was hooked when a NgxFetch starting. It could
|
||||
@@ -30,7 +33,7 @@
|
||||
// TODO(oschaaf): style: reindent namespace according to google C++ style guide
|
||||
// TODO(oschaaf): Retry mechanism for failures on a re-used k-a connection.
|
||||
// Currently we don't think it's going to be an issue, see the comments at
|
||||
// https://github.com/pagespeed/ngx_pagespeed/pull/781.
|
||||
// https://github.com/apache/incubator-pagespeed-ngx/pull/781.
|
||||
|
||||
extern "C" {
|
||||
#include <nginx.h>
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: x.dinic@gmail.com (Junmin Xiong)
|
||||
|
||||
//
|
||||
// PageSpeed needs some way to talk to the internet and request resources. For
|
||||
// example, if it's optimizing www.example.com/index.html and it sees html with
|
||||
|
||||
+27
-24
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: kspoelstra@we-amp.com (Kees Spoelstra)
|
||||
|
||||
|
||||
#include "ngx_gzip_setter.h"
|
||||
|
||||
@@ -105,10 +108,10 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) {
|
||||
#if (NGX_HTTP_GZIP)
|
||||
bool gzip_signature_mismatch = false;
|
||||
bool other_signature_mismatch = false;
|
||||
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++) {
|
||||
ngx_command_t* current_command =& ngx_modules[m]->commands[c];
|
||||
for (int m = 0; cf->cycle->modules[m] != NULL; m++) {
|
||||
if (cf->cycle->modules[m]->commands != NULL) {
|
||||
for (int c = 0; cf->cycle->modules[m]->commands[c].name.len; c++) {
|
||||
ngx_command_t* current_command =& cf->cycle->modules[m]->commands[c];
|
||||
|
||||
// We look for the gzip command, and the exact signature we trust
|
||||
// this means configured as an config location offset
|
||||
@@ -121,7 +124,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) {
|
||||
if (IsNgxFlagCommand(current_command)) {
|
||||
current_command->set = ngx_gzip_redirect_conf_set_flag_slot;
|
||||
gzip_command_.command_ = current_command;
|
||||
gzip_command_.module_ = ngx_modules[m];
|
||||
gzip_command_.module_ = cf->cycle->modules[m];
|
||||
enabled_ = 1;
|
||||
} else {
|
||||
ngx_conf_log_error(
|
||||
@@ -136,7 +139,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) {
|
||||
if (IsNgxEnumCommand(current_command)) {
|
||||
current_command->set = ngx_gzip_redirect_conf_set_enum_slot;
|
||||
gzip_http_version_command_.command_ = current_command;
|
||||
gzip_http_version_command_.module_ = ngx_modules[m];
|
||||
gzip_http_version_command_.module_ = cf->cycle->modules[m];
|
||||
} else {
|
||||
ngx_conf_log_error(
|
||||
NGX_LOG_WARN, cf, 0,
|
||||
@@ -150,7 +153,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) {
|
||||
if (IsNgxBitmaskCommand(current_command)) {
|
||||
current_command->set = ngx_gzip_redirect_conf_set_bitmask_slot;
|
||||
gzip_proxied_command_.command_ = current_command;
|
||||
gzip_proxied_command_.module_ = ngx_modules[m];
|
||||
gzip_proxied_command_.module_ = cf->cycle->modules[m];
|
||||
} else {
|
||||
ngx_conf_log_error(
|
||||
NGX_LOG_WARN, cf, 0,
|
||||
@@ -164,7 +167,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) {
|
||||
if (IsNgxHttpTypesCommand(current_command)) {
|
||||
current_command->set = ngx_gzip_redirect_http_types_slot;
|
||||
gzip_http_types_command_.command_ = current_command;
|
||||
gzip_http_types_command_.module_ = ngx_modules[m];
|
||||
gzip_http_types_command_.module_ = cf->cycle->modules[m];
|
||||
} else {
|
||||
ngx_conf_log_error(
|
||||
NGX_LOG_WARN, cf, 0,
|
||||
@@ -178,7 +181,7 @@ void NgxGZipSetter::Init(ngx_conf_t* cf) {
|
||||
if (IsNgxFlagCommand(current_command)) {
|
||||
current_command->set = ngx_gzip_redirect_conf_set_flag_slot;
|
||||
gzip_vary_command_.command_ = current_command;
|
||||
gzip_vary_command_.module_ = ngx_modules[m];
|
||||
gzip_vary_command_.module_ = cf->cycle->modules[m];
|
||||
} else {
|
||||
ngx_conf_log_error(
|
||||
NGX_LOG_WARN, cf, 0,
|
||||
@@ -310,7 +313,7 @@ void NgxGZipSetter::EnableGZipForLocation(ngx_conf_t* cf) {
|
||||
}
|
||||
if (gzip_proxied_command_.command_) {
|
||||
SetNgxConfBitmask(
|
||||
cf, &gzip_http_version_command_, NGX_HTTP_GZIP_PROXIED_ANY);
|
||||
cf, &gzip_proxied_command_, NGX_HTTP_GZIP_PROXIED_ANY);
|
||||
}
|
||||
|
||||
// This is actually the most prone to future API changes, because gzip_types
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: kspoelstra@we-amp.com (Kees Spoelstra)
|
||||
|
||||
|
||||
/*
|
||||
* NgxGZipSetter sets up gzip for pagespeed
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
|
||||
#include "ngx_list_iterator.h"
|
||||
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2013 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
//
|
||||
// Simplifies iteration over nginx lists.
|
||||
//
|
||||
|
||||
+20
-14
@@ -1,18 +1,24 @@
|
||||
// Copyright 2013 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// Author: oschaaf@gmail.com (Otto van der Schaaf)
|
||||
|
||||
#include "ngx_message_handler.h"
|
||||
|
||||
|
||||
+20
-14
@@ -1,18 +1,24 @@
|
||||
// Copyright 2013 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// Author: oschaaf@gmail.com (Otto van der Schaaf)
|
||||
|
||||
#ifndef NGX_MESSAGE_HANDLER_H_
|
||||
#define NGX_MESSAGE_HANDLER_H_
|
||||
|
||||
+52
-38
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
|
||||
/*
|
||||
* Usage:
|
||||
@@ -240,6 +243,9 @@ ngx_http_output_body_filter_pt ngx_http_next_body_filter;
|
||||
ngx_int_t ps_base_fetch_filter(ngx_http_request_t* r, ngx_chain_t* in) {
|
||||
ps_request_ctx_t* ctx = ps_get_request_context(r);
|
||||
|
||||
if (r->header_only) {
|
||||
return NGX_OK;
|
||||
}
|
||||
if (ctx == NULL || ctx->base_fetch == NULL) {
|
||||
return ngx_http_next_body_filter(r, in);
|
||||
}
|
||||
@@ -715,7 +721,7 @@ 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);
|
||||
|
||||
// We want NGX_CONF_MULTI for some very old versions:
|
||||
// https://github.com/pagespeed/ngx_pagespeed/commit/66f1b9aa
|
||||
// https://github.com/apache/incubator-pagespeed-ngx/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
|
||||
@@ -750,6 +756,11 @@ ngx_command_t ps_commands[] = {
|
||||
ngx_null_command
|
||||
};
|
||||
|
||||
bool ps_disabled(ps_srv_conf_t* cfg_s) {
|
||||
return cfg_s->server_context == NULL ||
|
||||
cfg_s->server_context->config()->unplugged();
|
||||
}
|
||||
|
||||
void ps_ignore_sigpipe() {
|
||||
struct sigaction act;
|
||||
ngx_memzero(&act, sizeof(act));
|
||||
@@ -882,8 +893,7 @@ char* ps_configure(ngx_conf_t* cf,
|
||||
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
||||
ngx_http_cycle_get_module_main_conf(cf->cycle, ngx_pagespeed));
|
||||
if (*options == NULL) {
|
||||
*options = new NgxRewriteOptions(
|
||||
cfg_m->driver_factory->thread_system());
|
||||
*options = new NgxRewriteOptions(cfg_m->driver_factory->thread_system());
|
||||
}
|
||||
|
||||
ProcessScriptVariablesMode script_mode =
|
||||
@@ -1149,13 +1159,17 @@ char* ps_merge_srv_conf(ngx_conf_t* cf, void* parent, void* child) {
|
||||
delete cfg_s->options;
|
||||
cfg_s->options = NULL;
|
||||
|
||||
if (cfg_s->server_context->global_options()->enabled()) {
|
||||
if (!cfg_s->server_context->global_options()->unplugged()) {
|
||||
// Validate FileCachePath
|
||||
GoogleMessageHandler handler;
|
||||
const char* file_cache_path =
|
||||
cfg_s->server_context->config()->file_cache_path().c_str();
|
||||
if (file_cache_path[0] == '\0') {
|
||||
return const_cast<char*>("FileCachePath must be set");
|
||||
if (!cfg_s->server_context->global_options()->standby()) {
|
||||
return const_cast<char*>("FileCachePath must be set, even for standby");
|
||||
} else {
|
||||
return const_cast<char*>("FileCachePath must be set");
|
||||
}
|
||||
} else if (!cfg_m->driver_factory->file_system()->IsDir(
|
||||
file_cache_path, &handler).is_true()) {
|
||||
return const_cast<char*>(
|
||||
@@ -1192,7 +1206,7 @@ char* ps_merge_loc_conf(ngx_conf_t* cf, void* parent, void* child) {
|
||||
ps_srv_conf_t* cfg_s = static_cast<ps_srv_conf_t*>(
|
||||
ngx_http_conf_get_module_srv_conf(cf, ngx_pagespeed));
|
||||
|
||||
if (cfg_s->server_context == NULL) {
|
||||
if (ps_disabled(cfg_s)) {
|
||||
// Pagespeed options cannot be defined only in location blocks. There must
|
||||
// be at least a single "pagespeed off" in the main block or a server
|
||||
// block.
|
||||
@@ -1699,7 +1713,7 @@ void ps_release_request_context(void* data) {
|
||||
RequestRouting::Response ps_route_request(ngx_http_request_t* r) {
|
||||
ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
|
||||
|
||||
if (!cfg_s->server_context->global_options()->enabled()) {
|
||||
if (ps_disabled(cfg_s)) {
|
||||
// Not enabled for this server block.
|
||||
return RequestRouting::kPagespeedDisabled;
|
||||
}
|
||||
@@ -1841,11 +1855,6 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
||||
options = cfg_s->server_context->global_options();
|
||||
}
|
||||
|
||||
if (!options->enabled()) {
|
||||
// Disabled via query params or request headers.
|
||||
return NGX_DECLINED;
|
||||
}
|
||||
|
||||
request_context->set_options(options->ComputeHttpOptions());
|
||||
|
||||
// ps_determine_options modified url, removing any ModPagespeedFoo=Bar query
|
||||
@@ -1872,6 +1881,14 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
||||
response_category == RequestRouting::kGlobalAdmin ||
|
||||
response_category == RequestRouting::kCachePurge;
|
||||
|
||||
// Normally if we're disabled we won't handle any requests, but if we're in
|
||||
// standby mode we do want to handle requests for .pagespeed. resources.
|
||||
if (options->unplugged() ||
|
||||
(!options->enabled() && !pagespeed_resource)) {
|
||||
// Disabled via query params or request headers.
|
||||
return NGX_DECLINED;
|
||||
}
|
||||
|
||||
if (!html_rewrite) {
|
||||
// create request ctx
|
||||
CHECK(ctx == NULL);
|
||||
@@ -2051,8 +2068,8 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
|
||||
if (options->in_place_rewriting_enabled() &&
|
||||
options->enabled() &&
|
||||
options->IsAllowed(url.Spec())) {
|
||||
ps_create_base_fetch(url.Spec(), ctx, request_context, request_headers.release(),
|
||||
kIproLookup, options);
|
||||
ps_create_base_fetch(url.Spec(), ctx, request_context,
|
||||
request_headers.release(), kIproLookup, options);
|
||||
|
||||
// Do not store driver in request_context, it's not safe.
|
||||
RewriteDriver* driver;
|
||||
@@ -2278,8 +2295,7 @@ ngx_http_output_body_filter_pt ngx_http_next_body_filter;
|
||||
// nginx so it can send them out to the browser.
|
||||
ngx_int_t ps_html_rewrite_header_filter(ngx_http_request_t* r) {
|
||||
ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
|
||||
if (cfg_s->server_context == NULL) {
|
||||
// Pagespeed is on for some server block but not this one.
|
||||
if (ps_disabled(cfg_s)) {
|
||||
return ngx_http_next_header_filter(r);
|
||||
}
|
||||
|
||||
@@ -2350,7 +2366,7 @@ ngx_int_t ps_html_rewrite_header_filter(ngx_http_request_t* r) {
|
||||
}
|
||||
|
||||
ps_strip_html_headers(r);
|
||||
// See https://github.com/pagespeed/ngx_pagespeed/issues/819
|
||||
// See https://github.com/apache/incubator-pagespeed-ngx/issues/819
|
||||
ctx->location_field_set = r->headers_out.location != NULL;
|
||||
|
||||
// TODO(jefftk): is this thread safe?
|
||||
@@ -2363,8 +2379,7 @@ ngx_int_t ps_html_rewrite_header_filter(ngx_http_request_t* r) {
|
||||
|
||||
ngx_int_t ps_html_rewrite_body_filter(ngx_http_request_t* r, ngx_chain_t* in) {
|
||||
ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
|
||||
if (cfg_s->server_context == NULL) {
|
||||
// Pagespeed is on for some server block but not this one.
|
||||
if (ps_disabled(cfg_s)) {
|
||||
return ngx_http_next_body_filter(r, in);
|
||||
}
|
||||
|
||||
@@ -2692,8 +2707,7 @@ ngx_int_t ps_simple_handler(ngx_http_request_t* r,
|
||||
}
|
||||
}
|
||||
|
||||
send_out_headers_and_body(r, response_headers, output);
|
||||
return NGX_OK;
|
||||
return send_out_headers_and_body(r, response_headers, output);
|
||||
}
|
||||
|
||||
void ps_beacon_handler_helper(ngx_http_request_t* r,
|
||||
@@ -2888,8 +2902,8 @@ ngx_int_t ps_beacon_handler(ngx_http_request_t* r) {
|
||||
// supply it to the user.
|
||||
ngx_int_t ps_content_handler(ngx_http_request_t* r) {
|
||||
ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
|
||||
if (cfg_s->server_context == NULL) {
|
||||
// Pagespeed is on for some server block but not this one.
|
||||
if (ps_disabled(cfg_s)) {
|
||||
// Pagespeed is not on for this server block.
|
||||
return NGX_DECLINED;
|
||||
}
|
||||
|
||||
@@ -3124,7 +3138,7 @@ ngx_int_t ps_init_module(ngx_cycle_t* cycle) {
|
||||
ps_main_conf_t* cfg_m = static_cast<ps_main_conf_t*>(
|
||||
ngx_http_cycle_get_module_main_conf(cycle, ngx_pagespeed));
|
||||
|
||||
// See https://github.com/pagespeed/ngx_pagespeed/issues/1220
|
||||
// See https://github.com/apache/incubator-pagespeed-ngx/issues/1220
|
||||
if (cfg_m == NULL) {
|
||||
return NGX_OK;
|
||||
}
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
|
||||
#ifndef NGX_PAGESPEED_H_
|
||||
#define NGX_PAGESPEED_H_
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
|
||||
#include "ngx_rewrite_driver_factory.h"
|
||||
|
||||
@@ -87,10 +90,6 @@ NgxRewriteDriverFactory::NgxRewriteDriverFactory(
|
||||
shut_down_(false) {
|
||||
InitializeDefaultOptions();
|
||||
default_options()->set_beacon_url("/ngx_pagespeed_beacon");
|
||||
// Put in the version of the ngx-pagespeed release. We don't release mod_pagespeed
|
||||
// so we cannot rely on PSOL to hand us to right version. Note that if we perform
|
||||
// another release, this must be either updated or removed.
|
||||
default_options()->set_x_header_value("1.12.34.3-0");
|
||||
SystemRewriteOptions* system_options = dynamic_cast<SystemRewriteOptions*>(
|
||||
default_options());
|
||||
system_options->set_file_cache_clean_inode_limit(500000);
|
||||
@@ -155,7 +154,7 @@ RewriteOptions* NgxRewriteDriverFactory::NewRewriteOptions() {
|
||||
// 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
|
||||
// See: https://github.com/apache/incubator-pagespeed-ngx/issues/1190
|
||||
options->SetRewriteLevel(RewriteOptions::kCoreFilters);
|
||||
return options;
|
||||
}
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
|
||||
#ifndef NGX_REWRITE_DRIVER_FACTORY_H_
|
||||
#define NGX_REWRITE_DRIVER_FACTORY_H_
|
||||
|
||||
+27
-21
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
|
||||
#include "ngx_rewrite_options.h"
|
||||
|
||||
@@ -192,15 +195,18 @@ RewriteOptions::OptionScope NgxRewriteOptions::GetOptionScope(
|
||||
|
||||
RewriteOptions::OptionSettingResult NgxRewriteOptions::ParseAndSetOptions0(
|
||||
StringPiece directive, GoogleString* msg, MessageHandler* handler) {
|
||||
if (IsDirective(directive, "on")) {
|
||||
set_enabled(RewriteOptions::kEnabledOn);
|
||||
} else if (IsDirective(directive, "off")) {
|
||||
set_enabled(RewriteOptions::kEnabledOff);
|
||||
} else if (IsDirective(directive, "unplugged")) {
|
||||
set_enabled(RewriteOptions::kEnabledUnplugged);
|
||||
} else {
|
||||
EnabledEnum enabled;
|
||||
if (!ParseFromString(directive, &enabled)) {
|
||||
return RewriteOptions::kOptionNameUnknown;
|
||||
}
|
||||
if (enabled == RewriteOptions::kEnabledOff) {
|
||||
// In ngx_pagespeed, for historical reasons, we treat "off" as "unplugged".
|
||||
// Also, "off" is deprecated and people should be using "standby" or
|
||||
// "unplugged" now depending on which sense they want. See comment on
|
||||
// RewriteOptions::EnabledEnum.
|
||||
enabled = RewriteOptions::kEnabledUnplugged;
|
||||
}
|
||||
set_enabled(enabled);
|
||||
return RewriteOptions::kOptionOk;
|
||||
}
|
||||
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
|
||||
// Manage configuration for pagespeed. Compare to ApacheConfig.
|
||||
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
|
||||
#include "ngx_server_context.h"
|
||||
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: jefftk@google.com (Jeff Kaufman)
|
||||
|
||||
|
||||
// Manage pagespeed state across requests. Compare to ApacheResourceManager.
|
||||
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: x.dinic@gmail.com (Junmin Xiong)
|
||||
|
||||
|
||||
extern "C" {
|
||||
#include <ngx_http.h>
|
||||
|
||||
+17
-14
@@ -1,20 +1,23 @@
|
||||
/*
|
||||
* Copyright 2012 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// Author: x.dinic@gmail.com(Junmin Xiong)
|
||||
|
||||
//
|
||||
// Fetch the resources asynchronously in Nginx. The fetcher is called in
|
||||
// the rewrite thread.
|
||||
|
||||
+31
-21
@@ -1,22 +1,21 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2012 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Author: jefftk@google.com (Jeff Kaufman)
|
||||
#
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Runs pagespeed's generic system test and nginx-specific system tests. Not
|
||||
# intended to be run on it's own; use run_tests.sh instead.
|
||||
#
|
||||
@@ -49,7 +48,11 @@ rm -rf "$TEST_TMP"
|
||||
mkdir -p "$TEST_TMP"
|
||||
echo TEST_TMP=$TEST_TMP
|
||||
|
||||
APACHE_DOC_SRC="$MOD_PAGESPEED_DIR/src/install/"
|
||||
if [ -d "$MOD_PAGESPEED_DIR/src" ]; then
|
||||
MOD_PAGESPEED_DIR+="/src"
|
||||
fi
|
||||
|
||||
APACHE_DOC_SRC="$MOD_PAGESPEED_DIR/install/"
|
||||
SERVER_ROOT="$TEST_TMP/root"
|
||||
echo SERVER_ROOT=$SERVER_ROOT
|
||||
rm -rf "$SERVER_ROOT"
|
||||
@@ -311,7 +314,7 @@ SERVER_NAME=nginx
|
||||
RUN_CONTROLLER_TEST=${RUN_CONTROLLER_TEST:-off}
|
||||
|
||||
# run generic system tests
|
||||
PAGESPEED_DIR="$MOD_PAGESPEED_DIR/src/pagespeed"
|
||||
PAGESPEED_DIR="$MOD_PAGESPEED_DIR/pagespeed"
|
||||
SYSTEM_TEST_FILE="$PAGESPEED_DIR/system/system_test.sh"
|
||||
REMOTE_CONFIG_TEST_FILE="$PAGESPEED_DIR/system/remote_config_test.sh"
|
||||
|
||||
@@ -365,6 +368,13 @@ fi
|
||||
# wants different ones than we want, so we need to reset our positional args.
|
||||
set -- "$PRIMARY_HOSTNAME"
|
||||
source $SYSTEM_TEST_FILE
|
||||
|
||||
# If we were only asked to run a single test, it ran in SYSTEM_TEST_FILE, so
|
||||
# we're done now and should exit.
|
||||
if [ -n ${TEST_TO_RUN+x} ]; then
|
||||
check_failures_and_exit
|
||||
fi
|
||||
|
||||
source $REMOTE_CONFIG_TEST_FILE
|
||||
|
||||
# nginx-specific system tests
|
||||
@@ -1420,7 +1430,7 @@ OUT=$(cat "$ERROR_LOG" \
|
||||
| grep -v "\\[error\\].*forbidden.example.com*" \
|
||||
| grep -v "\\[error\\].*custom-paths.example.com*" \
|
||||
| grep -v "\\[error\\].*bogus_format*" \
|
||||
| grep -v "\\[error\\].*src/install/foo*" \
|
||||
| grep -v "\\[error\\].*/install/foo*" \
|
||||
| grep -v "\\[error\\].*recv() failed*" \
|
||||
| grep -v "\\[error\\].*send() failed*" \
|
||||
| grep -v "\\[error\\].*Invalid url requested: js_defer.js.*" \
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# nginx_system_test.sh makes a few substitutions to pagespeed_test.conf.template
|
||||
# file to generate @@TEST_TMP@@/pagespeed_test.conf
|
||||
|
||||
@@ -88,6 +105,16 @@ http {
|
||||
# Expanded to CentralControllerPort directive when RUN_CONTROLLER_TEST=on
|
||||
@@CONTROLLER@@
|
||||
|
||||
server {
|
||||
# This is the default vhost for @@SECONDARY_PORT@@
|
||||
# Your request will land here when you pass in an unknown host.
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name default.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed RewriteLevel CoreFilters;
|
||||
}
|
||||
|
||||
server {
|
||||
# Sets up a logical home-page server on
|
||||
# max-cacheable-content-length.example.com. This server is only used to
|
||||
@@ -132,6 +159,42 @@ http {
|
||||
"@@SERVER_ROOT@@/mod_pagespeed_example/styles/";
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name pagespeed-off.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed off;
|
||||
pagespeed EnableFilters collapse_whitespace;
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name pagespeed-on.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed on;
|
||||
pagespeed EnableFilters collapse_whitespace;
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name pagespeed-standby.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed standby;
|
||||
pagespeed EnableFilters collapse_whitespace;
|
||||
}
|
||||
|
||||
server {
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name pagespeed-unplugged.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed unplugged;
|
||||
pagespeed EnableFilters collapse_whitespace;
|
||||
}
|
||||
|
||||
pagespeed UseNativeFetcher "@@NATIVE_FETCHER@@";
|
||||
@@RESOLVER@@
|
||||
|
||||
@@ -1749,6 +1812,25 @@ http {
|
||||
pagespeed DisableFilters add_instrumentation;
|
||||
pagespeed CriticalImagesBeaconEnabled false;
|
||||
}
|
||||
server {
|
||||
pagespeed on;
|
||||
listen @@SECONDARY_PORT@@;
|
||||
listen [::]:@@SECONDARY_PORT@@;
|
||||
server_name image-rewrite-with-flush.example.com;
|
||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||
pagespeed RewriteLevel PassThrough;
|
||||
pagespeed UrlValuedAttribute li data-thumb image;
|
||||
pagespeed EnableFilters core;
|
||||
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 @@PRIMARY_PORT@@;
|
||||
listen [::]:@@PRIMARY_PORT@@;
|
||||
@@ -2002,7 +2084,7 @@ http {
|
||||
# or made equivalent to ModPagespeedInPlaceRewriteDeadlineMs -1, which waits
|
||||
# forever. Otherwise ModPagespeedInPlaceRewriteDeadlineMs should just have
|
||||
# the specified deadline.
|
||||
# # See https://github.com/pagespeed/mod_pagespeed/issues/1171 for more
|
||||
# # See https://github.com/apache/incubator-pagespeed-mod/issues/1171 for more
|
||||
# detailed discussion.
|
||||
pagespeed InPlaceWaitForOptimized on;
|
||||
}
|
||||
|
||||
+34
-22
@@ -1,21 +1,21 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2013 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Author: jefftk@google.com (Jeff Kaufman)
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Runs ngx_pagespeed system tests.
|
||||
#
|
||||
# Exits with status 0 if all tests pass.
|
||||
@@ -23,8 +23,15 @@
|
||||
# Exits with status 2 if command line args are wrong.
|
||||
#
|
||||
# Usage:
|
||||
# ./run_tests.sh
|
||||
# Or:
|
||||
# ./run_tests.sh /path/to/mod_pagespeed /path/to/nginx/binary
|
||||
#
|
||||
# If you built ngx_pagespeed with "scripts/build_ngx_pagespeed.sh --devel" then
|
||||
# you don't need to pass any arguments to run_tests.sh. Otherwise, you'll need
|
||||
# to tell it where to find a mod_pagespeed checkout (for example html files etc)
|
||||
# and the nginx binary to test.
|
||||
#
|
||||
# By default the test script uses several ports. If you have a port conflict
|
||||
# and need to override one you can do that by setting the relevant environment
|
||||
# variable. For example:
|
||||
@@ -45,23 +52,28 @@ RUN_TESTS=${RUN_TESTS:-true}
|
||||
# true.
|
||||
USE_VALGRIND=${USE_VALGRIND:-false}
|
||||
|
||||
if [ "$#" -ne 2 ] ; then
|
||||
echo "Usage: $0 mod_pagespeed_dir nginx_executable"
|
||||
if [ "$#" -eq 0 ]; then
|
||||
MOD_PAGESPEED_DIR="testing-dependencies/mod_pagespeed/"
|
||||
NGINX_EXECUTABLE="nginx/sbin/nginx"
|
||||
elif [ "$#" -eq 2 ]; then
|
||||
MOD_PAGESPEED_DIR="$1"
|
||||
NGINX_EXECUTABLE="$2"
|
||||
else
|
||||
echo "Usage: $0 [mod_pagespeed_dir nginx_executable]"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
MOD_PAGESPEED_DIR="$1"
|
||||
NGINX_EXECUTABLE="$2"
|
||||
|
||||
: ${PRIMARY_PORT:=8050}
|
||||
: ${SECONDARY_PORT:=8051}
|
||||
: ${CONTROLLER_PORT:=8053}
|
||||
: ${RCPORT:=9991}
|
||||
: ${PAGESPEED_TEST_HOST:=selfsigned.modpagespeed.com}
|
||||
: ${PHP_PORT:=9000}
|
||||
|
||||
this_dir="$( cd $(dirname "$0") && pwd)"
|
||||
|
||||
function run_test_checking_failure() {
|
||||
"$MOD_PAGESPEED_DIR/install/start_php.sh" "$PHP_PORT"
|
||||
USE_VALGRIND="$USE_VALGRIND" \
|
||||
PRIMARY_PORT="$PRIMARY_PORT" \
|
||||
SECONDARY_PORT="$SECONDARY_PORT" \
|
||||
|
||||
+17
-17
@@ -1,19 +1,19 @@
|
||||
# Copyright 2013 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Author: oschaaf@we-amp.com (Otto van der Schaaf)
|
||||
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License
|
||||
|
||||
# The first few suppressions can be found in other modules
|
||||
# and easily found when searched for, and seem false positives.
|
||||
@@ -101,7 +101,7 @@
|
||||
fun:ngx_process_events_and_timers
|
||||
fun:ngx_worker_process_cycle
|
||||
}
|
||||
# Mentioned in https://github.com/pagespeed/ngx_pagespeed/issues/103
|
||||
# Mentioned in https://github.com/apache/incubator-pagespeed-ngx/issues/103
|
||||
# Assuming a false postives as the issue is closed.
|
||||
{
|
||||
<nginx false positive>
|
||||
|
||||
Reference in New Issue
Block a user