* 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
* 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
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.
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.
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)
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.)
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.
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.
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.
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
* 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