If we get invalid query parameters or request options we should treat it as if
there are no request-specific options instead of producing a 50x error.
Fixes#252.
* Add tests for statistics.
* We weren't increasing resource_404_count on 404s.
* This required giving `NgxBaseFetch` a `NgxServerContext` pointer.
* /ngx_pagespeed_statistics was publically available.
* Made a pass over the readme to add a new configuration option and fixed up
serveral things that were out of date while I was there.
Fixes#248.
* Support AddOptionsToUrls
* Support tests that need top run something post cache flush
* Add `ps_determine_port` so we parse urls out of ports and fix#239
* Rejigger the tests to support how our headers for resources don't include a
Content-Length header
If we get a request for `/ngx_pagespeed_statistics` we don't create a
`ps_request_context`. We create the content properly, but then in the header
filter we assume that "ctx is NULL iff this is not a resource fetch" and so
conclude that we're not a resource fetch. Then we call `CreateRequestContext()`
with `resource_fetch=false` and so it doesn't check to see if it's statistics.
Here I fix this by pulling the check for statistics outside of the
resource-fetch-only part of `CreateRequestContext()`.
Make us live in peace with nginx's SSI module:
- Moved our module so that we we see the content that the ssi module produces as
a whole. (right before the gzip module does its work).
- Made the header and content filters bail out for subrequests, so we don't
attempt to rewrite the sub requests that the ssi module fires.
- Changed NGX_HTTP_SSI_BUFFERED to use an unused flag, so I could rule out that
the SSI module got confused by ngx_pagespeed manipulating that flag as well.
- Handled the case in ps_update() where CollectAccumulatedWrites gives us a null
cl
Squash-merge of Otto's #242.
* Add test that we handle beacons.
* Fix a segfault in handling beacons.
* This required switching NgxRequestContext to take an ngx_http_request_t
instead of a ps_request_ctx.
* Support running tests under valgrind:
USE_VALGRIND=true test/nginx_pagespeed_test.sh ...
But: we don't set a Content-Length header on our `204 No Content` response,
which makes wget wait for 60s to time it out. Compare:
wget --save-headers -O - http://localhost:8050/ngx_pagespeed_beacon
curl -D- http://localhost:8050/ngx_pagespeed_beacon
The headers we send are:
HTTP/1.1 204 No Content
Server: nginx/1.2.4
Date: Tue, 02 Apr 2013 21:07:02 GMT
Connection: keep-alive
While Apache sends:
HTTP/1.1 204 No Content
Date: Tue, 02 Apr 2013 21:07:43 GMT
Server: Apache/2.2.3 (CentOS)
Content-Length: 0
Content-Type: text/plain; charset=UTF-8
I can't get nginx to send a content length. I've tried manually doing the
opposite of ngx_http_clear_content_length but that didn't work. Asking on
nginx-devel I got:
Adding a Content-Length will be inconsistent with RFC2616:
The 204 response MUST NOT include a message-body, and thus is always
terminated by the first empty line after the header fields.
I've reported a bug to wget. For now we can just pass wget `-t 1 --timeout=1`.
* Test ShardDomain
* Improve error message when options cannot be set at location scope
** Used to say `"pagespeed" directive Option cannot be set at location
scope`, now says `"pagespeed" directive "ShardDomain" cannot be set
at location scope`.
* Marked `CustomFetchHeader`, `MapOriginDomain`, `MapProxyDomain,
`MapRewriteDomain`, and `ShardDomain` as legal to set in location
blocks. In `mod_instaweb.cc` they're listed under `All two parameter
options that are allowed in <Directory> blocks`.
* always run with a clean cache
* in the future we should structure the tests so they run twice, once with a clean cache and then again with a populated one, but for now a clean cache should catch more bugs
* stop requiring a file cache path for tests; just use
* fix exit codes to match documentation at the top of the file: 1 is a test failure, 2 is bad args
Squash-merge of my #198.
We are going to need some nginx-specific system tests, and this seemed like a
good place to start. This adds two tests, as well as some infrastructure. With
Squash-merge of my #194 and #195
Because we're a non-blocking server we need to run a scheduler thread or else
alerts we set might not fire. We need to be careful to start it after we fork.
Better long term would be to use an nginx timer and avoid the extra thread;
tracking this in #111.
Fixes#55
The pagespeed api for handling logs has changed, we need to change with it in
order to build against the latest pagespeed optimization libraries.
Separately, a new test was added to the generic system test that depends on the
property cache (insert_dns_prefetch). We've not ported the property cache yet,
so this test will fail, and I've added it to the list of failing tests.
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.
Run all responses through PSOL's rewriter in a blocking manner. While eventually we need to be using the asynchronous rewriting interface, this is a simple proof of concept. In test/expected/test.html you can see the effect of running this code on test/www/test/html