Commit Graph

544 Commits

Author SHA1 Message Date
Maks Orlovich 3f8b6cc3c8 Disable CSS (really font CSS in practice) inlining on AMP. (#1499)
* Disable CSS (really font CSS in practice) inlining on AMP.

Ref: https://github.com/pagespeed/ngx_pagespeed/issues/1382

* Try to deflake the font inlining test some
2017-03-08 12:21:11 -05:00
Otto van der Schaaf 1e1d7a31ea Clean the response headers when sending kNotInCache (#1497)
When we send out a 501 in the IPRO path for a http cache
hit, clear the response headers so we do not leave
behind stray headers.

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1496
2017-02-21 17:09:09 +01:00
Maks Orlovich 0cb8dad051 Basic CSP parsing and representation. (#1493) 2017-02-13 12:10:58 -05:00
Jeff Kaufman a41cdab05e standby: add standby mode (#1482)
* standby: add standby mode

In standby mode PageSpeed is off, except it serves .pagespeed. resources and
PageSpeed query parameters are interpreted.  This is equivalent to "off" in
mod_pagespeed.

With this change, "off" in mod_pagespeed is deprecated, and people should use
"standby" instead.

* add test file

* rewrite doc

* get tests to pass under memcached

* doc: minor display tweak
2017-01-25 13:22:59 -05:00
Jeff Kaufman 4a05c62329 doc: move doc references to modpagespeed.com (#1469) 2017-01-06 15:14:24 -05:00
Jeff Kaufman d55c2d7a2c licensing: correct license comments (#1447)
* many files had no license comments at all
* some files had license comments suggesting that they weren't open source
  (like a terse "all rights reserved") when they actually are open source.
* all our files are licensed under apache and should be marked as such
2016-12-12 10:16:54 -05:00
hillsp f5922ee4bc Minor bugfixes observed when cutting the release (#1445) 2016-12-09 11:01:06 -05:00
Steve Hill 3f4df27025 Update libraries 2016-11-30 14:41:35 -05:00
Joshua Marantz 69a40de884 Rename the non-const version of output_partition(i) to
mutable_output_partition(i) and change call-sites as needed.

Add an AtomicBool used for checking that we should not be modifying
the CachedResult in a RewriteContext after it is serialized to the
cache, and a new private method RewriteContext::CheckNotFrozen() to
check it.
2016-11-29 16:52:23 -05:00
Maks Orlovich d5ba802b7a Fix some typos caught by lintian 2016-11-29 11:00:44 -05:00
hillsp 208c440fd1 Delete old mobilize genfiles (#1439) 2016-11-28 14:55:16 -05:00
Maks Orlovich 22126c8c98 More logical/consistent timeout application at shutdown:
Apply it globally, not per vhost. With this, increase timeout to 5 seconds.
2016-11-21 09:37:10 -05:00
Maks Orlovich 4972505947 Fix race that could sometimes cause us to not dispatch some background fetches:
1) RateController::Fetch would try IncrementIfCanTriggerFetch, and fail since there were too many outstanding background fetches for the host. Note that "too many" is 1 in case of prefork.
2) A previous fetch would finish, notice there is nothing queued, so do nothing else.
3) RateController::Fetch would EnqueueFetchIfWithinThreshold, but there is no long and outstanding fetch for the host to push it out of the queue on completion.

The change just locks the HostFetchInfo for the duration, and adds a bunch of lock annotation for that. (This does mean we hold two locks now).

(This was probably more visible in loadtests since this is per-host and that has lots
 of hosts).

Also fix an occasional DCHECK about current_global_fetch_queue_size_, where we could end up dequeing the entry and decrementing it before the increment due to another race --- thanks to Josh for pointing it out.
2016-11-17 10:01:34 -05:00
Joshua Marantz c6f01f2d42 Don't run add-head or any of the filters that depend on it in ajax request, which
we can usually detect via request-headers x-requested-with:xml-http-request.

Preserve URLs for ajax requests as well.

Re-establish 'disallow */wp-admin/*' in default set, as a back-stop against the
wp-admin being visited from a browser that does not send that header.

Did a couple of minor cleanups found in the vicinity of the changes reuqired in
rewrite_options.cc: don't statically construct a std::vector (which we totally
did not need in the first place).  Use C++11 loops over static arrays.

Fixes:
  https://github.com/pagespeed/mod_pagespeed/issues/1405
  https://github.com/pagespeed/mod_pagespeed/issues/891
  https://github.com/pagespeed/mod_pagespeed/issues/419
  http://serverfault.com/questions/408057/mod-pagespeed-with-zend-framework-gives-404

Associated ngx_pagespeed pull: https://github.com/pagespeed/ngx_pagespeed/pull/1320
2016-11-14 09:10:07 -05:00
Steve Hill 573071ae3a NULL StringPiece is deprecated 2016-11-10 13:50:33 -05:00
Steve Hill 2a7b39d6c9 Update compiled JS from Closure update 2016-11-09 15:22:38 -05:00
Jeff Kaufman 6b8a04ed72 doc: integrate commenting systems, and export previously internal comments 2016-11-04 15:16:49 -04:00
Maks Orlovich d2550861a7 Quickly fail any pending named lock acquisitions handled by NamedLockScheduleRewriteController
on shutdown to help the process along.
2016-11-03 14:22:05 -04:00
Maks Orlovich 22588e1ed9 Export internal cleanup CL: add missing std:: 2016-11-03 14:21:44 -04:00
Maks Orlovich 98ee14e936 Avoid warnings in DownstreamCache tests about an uncleaned up rewrite_driver
by making sure that other_rewrite_driver gets cleaned up: the test sets
RewriteTestBase into managed mode, which basically means it does
rewrite_driver = NewRewriteDriver
other_rewrite_driver = NewRewriterDriver
... but then nothing actually does anything with other_rewrite_driver, making it
stick-around until factory shutdown does emergency cleanup.

(see https://github.com/pagespeed/mod_pagespeed/issues/1421)
2016-11-01 14:23:39 -04:00
Maks Orlovich 01d0ed4427 defer_js: orig_index => data-pagespeed-orig-index to not squat on browser's namespace.
Ref: https://github.com/pagespeed/mod_pagespeed/issues/1412
2016-11-01 10:09:11 -04:00
Jeff Kaufman 654230d558 Fix handling of failed AsyncFetches.
AsyncFetch::HandleDone(success=false) can't pass success=false to
HeadersComplete.  Success being false means "we've encountered an error"
but the headers may or may not have been updated to match.  For example,
if the CacheUrlAsyncFetcher doesn't find something it will set
status=false and set up 404 headers, but if SendFallbackResponse aborts
a response for having the wrong content type then it sets status=false
while leaving 200 headers.

We need to make sure that error headers are sent whenever status=false,
and the only place we can make sure of that is in AsyncFetch::Done
itself, because HandleDone is too late and HandleHeadersComplete can't
see status.

This fixes a flake in resource_content_type_html.sh with ngx_pagespeed
where when the deadline alarm was hit, which mostly happens under
valgrind, it would send out the headers for the request with no body.

I've verified the fix by making sure that the test passes if you have
set test_instant_fetch_rewrite_deadline=true, and also that while we
previously got 5 flakes in 133 runs under valgrind now we don't get any.

(I previously tried to fix this on the ngx_pagespeed end with
pagespeed/ngx_pagespeed#1307 , but that doesn't work consistently
because ngx_pagespeed races to send out headers immediately after
receiving HeadersComplete.)
2016-10-28 14:19:40 -04:00
Maks Orlovich 9c1a069abc More standards-compliant error recovery for parse problems in CSS declarations. 2016-10-28 12:23:39 -04:00
cfredric 338c379153 Make Callback's SharedString a const ref. 2016-10-27 17:56:27 -04:00
Steve Hill 8c5c1715d8 Add mising protobuf dep to fix -j builds 2016-10-20 14:29:57 -04:00
Steve Hill 663c297df6 Remove some unused RewriteOptions constants 2016-10-19 18:09:49 -04:00
Steve Hill fe0c056c83 Additional DomainLawyer testcases 2016-10-19 18:08:56 -04:00
Steve Hill 7ce64a1c49 Move closure download out of DEPS and into gypfiles. 2016-10-18 15:40:41 -04:00
Maks Orlovich 2d46c8b9d2 Remove obsolete/incomplete distributed rewrite code. 2016-10-18 10:32:24 -04:00
Maks Orlovich cdb517efa5 Remove a dangerous unused parameter in CssSummarizerBase::WillNotRenderSummary;
if it were actually used we would have a race.
2016-10-14 10:48:43 -04:00
Maks Orlovich 8803d0e833 Add a mechanism for deprecating options easily, use in Apache instead of
its adhoc approach.
2016-10-13 14:39:56 -04:00
Jeff Kaufman 10febd444e pagespeed-libraries: add jquery 3.1.1 2016-10-12 18:08:00 -04:00
Joshua Marantz 203713228f Fix three issues found with load-tests:
Don't DCHECK on computing query-options from a bad URL.  Handle
responsive_images corner-case with an escaped URL.  In particular don't
DCHECK.

Allow make_show_ads_async to run even when the <script> tag is the only
tag in the document. In particular don't DCHECK.
2016-10-12 15:54:46 -04:00
Maks Orlovich 2cea684def Reduce risk of exit crashes: don't leave the context in a stuck state
when shutting_down. That doesn't just leak it, it leaks the rewrite driver,
which we then have to try to force-shutdown which may also try to delete the
RewriteContext if it's used in fetch, potentially blowing up on stats access.
2016-10-12 15:35:48 -04:00
Maks Orlovich 1d070b6070 Don't try to access the CachedResult proto in WillNotRender,
it's unsafe, and nothing should be there anyway.
2016-10-12 15:12:46 -04:00
Steve Hill f549578a19 Replace redis cluster setup script with shared C code. 2016-10-12 15:00:22 -04:00
Maks Orlovich 326a3889e6 Export internal cleanup CL: remove extraneous passing of NULL to StringPiece ctor 2016-10-11 11:42:58 -04:00
Maks Orlovich f3be6cd7bb Fix a leak in spriter when parsing single-argument positions which are not keywords. 2016-10-11 11:41:46 -04:00
Jeff Kaufman 407534a7b4 pagespeed-libraries: add incrementaldom 0.5.1 2016-10-07 15:52:24 -04:00
Jeff Kaufman dba56f4b13 minor: remove old google code urls 2016-10-06 13:32:22 -04:00
Jeff Kaufman 833e586bdf config: remove ModPagespeedInheritVHostConfig 2016-10-05 13:35:14 -04:00
Maks Orlovich 0fb90651b2 Make hint_preload_subresources work correctly when turned on by query params, too ---
by always registering cohort, and deciding whether we need it at read time.
Also add the corresponding example page and integration test.
Fix it on nginx by adding a separate hook for post-property-cache init, as
its actually not ready in StartParse w/ProxyFetch (while it is with Apache)
Also remove some needless quoting that was pointed out in review.
2016-10-04 13:15:21 -04:00
Steve Hill bda36b208a Bump VERSION 2016-09-30 15:21:20 -04:00
Jeff Kaufman 75fb7f5a26 redis: add cluster support
Supports both MOVED and ASKING.  When receiving MOVED, pulls down the cluster mapping with CLUSTER SLOTS so that it can send queries to the right servers going forward

Most of the work by yeputons, with final cleanup, testing, and CLUSTER SLOTS support by jefftk
2016-09-26 20:39:19 -04:00
Jeff Kaufman 142ae82d03 load-from-file: don't choke on very large files
Lower the maximum size of resources we're willing to process from unlimited to
16MB, and respect that maxium in loading resources from file.

Nginx side of the change: https://github.com/pagespeed/ngx_pagespeed/pull/1268

Fixes: https://github.com/pagespeed/mod_pagespeed/issues/1386
2016-09-23 19:44:55 -04:00
Maks Orlovich 6693ed3ee5 Add hint_preload_subresources as a way of enabling preload hinting. 2016-09-23 18:20:43 -04:00
Jeff Kaufman d7effbef19 strip-subresource-hints: respect preserve with rel=preload, use href and not src
* With rel=preload the hint tells us what type of resource it is, and if
  urls have been preserved for that type we should not strip it.
* If the rel=preload type isn't image, script, or style we shouldn't
  strip it, because those are the only urls we change.
* The filter was originally written to use src= when it should have used
  href=, which meant it removed hints it shouldn't have.
* Minor cleanup: change 'type *name' to 'type* name' to match local style.
* Minor cleanup: change NULL to nullptr.

Fixes: https://github.com/pagespeed/mod_pagespeed/issues/1392
Fixes: https://github.com/pagespeed/mod_pagespeed/issues/1393

For backporting to v33 for 1.11.33.4 I instead had a minimal version without the cleanups or refactoring: https://github.com/pagespeed/mod_pagespeed/pull/1394
2016-09-23 08:44:18 -04:00
Joshua Marantz b45429d1ec When the cache is configured to be uncompressed, make sure we unzip
compressed payloads, which sometimes show up on the web even when
we don't ask for compression from an origin.
2016-09-21 14:57:04 -04:00
Steve Hill df1524a9ca Don't run RewriteDriver::Cleanup() in ServerContext::Shutdown(). Also only
wait for one timeout max, no matter how many drivers are outstanding.
2016-09-19 17:23:27 -04:00
Steve Hill ea60b6616d Increase ref while running BoundedWaitFor, which prevents the Driver from
being cleaned up while it is being waited.
2016-09-19 16:53:06 -04:00