Commit Graph

295 Commits

Author SHA1 Message Date
Jeff Kaufman 492ea96424 options: accept bad query parameters and request options
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.
2013-04-12 16:52:36 -04:00
Jeff Kaufman ecfcfc04d4 system-test: test connection refused in fetching 2013-04-12 16:50:56 -04:00
Jeff Kaufman 43b4b0768b statistics: check cache flushing 2013-04-12 16:48:51 -04:00
Jeff Kaufman 335282f334 readme: better php documentation 2013-04-12 11:13:17 -04:00
Jeff Kaufman f510a94214 statistics: check that statistics work and are not extrnally accessible
* 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.
2013-04-11 13:03:30 -04:00
Jeff Kaufman 6b8ea5856c options: support options in urls via pagespeed AddOptionsToUrls
* 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
2013-04-11 10:50:25 -04:00
Jeff Kaufman 41edcb97cd statistics: fix statistics and add a test so we don't break it again
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()`.
2013-04-10 12:53:01 -04:00
Jeff Kaufman f3cc1a432e ssi: fix handling of server side includes
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.
2013-04-10 12:36:14 -04:00
Jeff Kaufman 255c2421f4 beacons: test beacons, stop segfaulting on beacons, also support valgrind
* 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`.
2013-04-08 17:25:34 -04:00
Jeff Kaufman a5e4f46217 system-test: MapProxyDomain 2013-04-08 15:39:39 -04:00
Jeff Kaufman 2263dee2d7 system-test: proxy_pass with pagespeed disabled 2013-04-05 16:58:54 -04:00
Jeff Kaufman adcfac1570 system-test: check whether we work with php 2013-04-05 11:02:17 -04:00
Jeff Kaufman d41574edb5 system-test: respect custom options on resources 2013-04-05 11:00:57 -04:00
Jeff Kaufman c939112a9b system-test: check cache_partial_html and flush_subresources do nothing 2013-04-05 10:59:16 -04:00
Jeff Kaufman 001882a57e system-test: check for valid xhtml in add_instrumentation js insertion 2013-04-05 10:57:47 -04:00
Jeff Kaufman c14cd3f4f4 system-test: avoid renaming introspective javascript 2013-04-05 10:56:31 -04:00
Jeff Kaufman 615e7651e2 system-test: check that combine_js works with long urls 2013-04-05 10:54:56 -04:00
Jeff Kaufman 0f0c1cb162 caching-headers: respect 'ModifyCachingHeaders off' 2013-04-05 10:53:44 -04:00
Jeff Kaufman 957ef3b2c1 system-test: check LoadFromFile works 2013-04-05 10:51:45 -04:00
Jeff Kaufman 443384797d system-test: shard domain
* 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`.
2013-04-05 10:49:52 -04:00
Jeff Kaufman ee6f44ee67 system-test: check that we respect the Vary: User-Agent 2013-04-05 10:47:29 -04:00
Jeff Kaufman 465594c5a6 system-test: check jpeg and webp rewriting quality 2013-04-05 10:41:07 -04:00
Jeff Kaufman 70c74813c0 system-test: check rewriting images works 2013-04-04 10:57:02 -04:00
Jeff Kaufman 88b3713c15 system-test: check that we respect no-transform 2013-04-04 10:47:29 -04:00
Jeff Kaufman bd38510760 system-test: PreserveURLs 2013-04-04 10:26:54 -04:00
Jeff Kaufman 3ff62faf98 Merge pull request #215 from pagespeed/jefftk-retain-comment
system-test: test RetainComment
2013-04-04 07:25:24 -07:00
Jeff Kaufman f3636bc5ba system-test: test RetainComment 2013-04-03 17:36:27 -04:00
Jeff Kaufman 08891eb3b3 try-files: add a server block for testing 2013-04-03 14:56:27 -04:00
Jeff Kaufman 800bbd0409 trunk-tracking: use System and support cache flushing
Use SystemRewriteDriverFactory.
Use SystemServerContext.
Wire up FlushCacheIfNecessary().
Port cache flushing tests.
2013-04-03 10:51:58 -04:00
Jeff Kaufman 2d0996210e request-headers: support X-Forwarded-Proto 2013-04-03 10:25:36 -04:00
Jeff Kaufman 4e2a7c5bcf system-test: port simple tests, all are exact copies from apache 2013-04-02 18:14:01 -04:00
Jeff Kaufman d91dc8b2e8 system-test: check loopback fetcher works with vhosts on alternate ips 2013-04-02 17:14:33 -04:00
Jeff Kaufman 06a85d5ce5 options: default to core filters 2013-04-02 10:41:06 -04:00
Jeff Kaufman 768ba6a64f system-test: clear cache; simpler init
* 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.
2013-03-29 11:37:17 -04:00
Jeff Kaufman cb00b0a0e8 system-test: support blocking rewrites (fixes #199) 2013-03-28 16:02:58 -04:00
Jeff Kaufman 51ebf51b4e system-test: infrastructure, host validation
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
2013-03-28 13:39:03 -04:00
Jeff Kaufman 7152e5498c trunk-sync: we also fail ipro testing because its not ported 2013-01-23 14:37:08 -05:00
Jeff Kaufman 51bc7e73df trunk-sync: system_test_trailer renamed to check_failures_and_exit 2013-01-23 14:36:30 -05:00
Jeff Kaufman 814e0c18f2 rewrite driver factory: start a scheduler thread
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
2012-12-19 10:59:04 -05:00
Jeff Kaufman 9cd5f3b19c request context: deal with changes in pagespeed's api
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.
2012-12-17 10:57:18 -05:00
Jeff Kaufman 14c7fb1c8d system test: use PAGESPEED_EXPECTED_FAILURES for known bad tests 2012-11-30 17:12:13 -05:00
Jeff Kaufman 72b1b98bb9 content handler: support static javascript requests
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.
2012-11-19 16:29:25 -05:00
Jeff Kaufman eda3a913f9 Add script to run system test, remove temporary test files 2012-11-05 10:03:38 -05:00
Jeff Kaufman b9fff21986 Rewrite pages asynchronously (branch jefftk-async-rewrite, pull request 11). 2012-11-01 10:31:12 -04:00
Jeff Kaufman 1766acbffb Support Blocking Rewrite Flow
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
2012-10-18 10:18:05 -04:00