We were sometimes failing to set last_buf when we should, but being protected
from the consequences by another bug that made us usually send additional extra
buffers with last_buf set.
See discussion in #78, pull request was #94.
Within the anonymous namespace in ngx_pagespeed.css we don't really need to be
using the long `ngx_http_pagespeed_` prefix. Switching to just `ps_` should be
safe. For symbols that need to be visible outside this file, though, we need to
keep the long prefix.
Fixes#85.
Nginx allows configuration at three levels:
- main
- server
- location
Previously we did everything at the server level, which made for a few problems:
- we didn't support options in location blocks
- we created an NgxRewriteDriverFactory for every server block, which when
combined with the Serf fetcher meant we had separate fetch pools for every
server. If someone had nginx configured with a lot of server blocks, we
could attempt far too many simultaneous loopback fetches and DOS ourself.
Now we store things at several levels:
- main
- rewrite driver factory
- server
- most things
- location
- directory specific options
When returning NGX_ERROR in the header filter, apperently nginx already
finalizes the http request for us. This fixes#79
It also puts a check in place for a switch label that should be impossible to
reach.
(Merged from oschaaf-issue-79.)
Link against the debug versions of the mod_pagespeed libraries when nginx is
configured with --with-debug.
Requires that said libraries have been pre-built with BUILDTYPE=Debug.
If we get an invalid filename in a request for static pagespeed content, we
should return NGX_DECLINED from the handler so that nginx can 404 for us.
Fixes issue #67.
Requests to:
/ngx_pagespeed_static/...
can be handled synchronously by pagespeed. They're used for support files for
optimizations, like js_defer.js.
This also includes a couple refactors:
- I pulled most of NgxBaseFetch::CopyBufferToNginx() out into
ngx_http_pagespeed_string_piece_to_buffer_chain().
- ngx_http_pagespeed_create_request_context() now returns a
CreateRequestContext::Response which gives callers more detailed information
about the request.
- I also pulled ngx_http_pagespeed_set_cache_control() out of
ngx_http_pagespeed_header_filter().
Fixes issue #62.
Set up the background code for connecting pagespeed configuration structures
(RewriteOptions) to the companion nginx ones. Passes all the actual work
through to NgxRewriteOptions::ParseAndSetOptions which isn't written yet.
(All it does so far is interpret "pagespeed on/off".)
Adding nginx subclasses of RewriteOptions and ServerContext are a bit overkill
for this change, but we're going to need them a lot.
Once configuration is complete, any mod_pagespeed configuration directive should
work in ngx_pagespeed:
mod_pagespeed.conf:
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedRunExperiment on
ModPagespeedExperimentSpec id=3;percent=50;default
ModPagespeedExperimentSpec id=4;percent=50
ngx_pagespeed.conf:
pagespeed ModPagespeedEnableFilters collapse_whitespace
pagespeed ModPagespeedRunExperiment on;
pagespeed ModPagespeedExperimentSpec "id=3;percent=50;default";
pagespeed ModPagespeedExperimentSpec "id=4;percent=50";
The `ModPagespeed` is optional, and discouraged:
ngx_pagespeed.conf:
pagespeed EnableFilters collapse_whitespace
pagespeed RunExperiment on;
pagespeed ExperimentSpec "id=3;percent=50;default";
pagespeed ExperimentSpec "id=4;percent=50";
Pagespeed puts headers in ngx_base_fetch->response_headers() and nginx calls
NgxBaseFetch::CollectHeaders to get them out, which wasn't implemented before.
Other minor changes in this commit:
- whitespace fixes
- ordering of includes
- ngx_http_pagespeed_str_to_string_piece now takes its argument by value
If custom_options were set by GetQueryOptions(), don't run the experiment
framework. We don't want experiments to be contaminated with unexpected
settings.