Compare commits

..

4792 Commits

Author SHA1 Message Date
Huibao Lin c591621b2e Expose the option of try_best_compression_for_png 2017-03-08 16:23:13 -05:00
Maks Orlovich 5300d22fa1 Log errors if serf error rate seems too high. (#1507) 2017-03-08 13:22:06 -05:00
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
Maks Orlovich 8488f6db18 - Update libpng to 1.2.57 (#1509)
- Update RE2 to newest version, mostly to pick up a gcc 6.0/6.1 compatibility
  fix (reported in our issue #1504
2017-03-07 10:26:48 -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
Otto van der Schaaf 9394a38c7d Add an anchor for "Configuring SSL Certificates" (#1495) 2017-02-16 19:20:57 +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
Maks Orlovich 478fb85224 A simple script to collect slurp dumps for loadtest, (#1473)
* A simple script to collect slurp dumps for loadtest,
with help of PhantomJs
2017-01-20 16:16:54 -05:00
Jeff Kaufman c50a93f2e8 Update our copy of the public suffix list (#1477)
Update our domain-registry-provider dependency to pull in an updated copy of the public suffix list.  This imports https://github.com/pagespeed/domain-registry-provider/pull/6

The steps for doing this in the future are documented at https://github.com/pagespeed/mod_pagespeed/wiki/Updating-the-Public-Suffix-List
2017-01-17 07:40:59 -05:00
Jeff Kaufman bd64bde554 doc: use HTTPS for LazyloadImagesBlankUrl (#1476)
Fixes https://github.com/pagespeed/ngx_pagespeed/issues/1358
2017-01-17 07:38:24 -05:00
Jeff Kaufman 7427b368e9 doc: move doc to html/doc in preparation for landing page work (#1478) 2017-01-13 10:16:30 -05:00
Jeff Kaufman b8576200b4 release: open source extract_so_from_deb (#1475) 2017-01-11 15:49:18 -05:00
Jeff Kaufman 6a15917500 build release tarball: open source it (#1474)
* build release tarball: open source it

* change it from being given a branch to working on the current checkout
* change it to work with create_distro_tarball, which was already opensourced
* make it build openssl 1.0.2 if needed

* doc ubuntu 14 dep
2017-01-11 15:19:44 -05:00
Jeff Kaufman 58c175ca32 memory profiling: export lots_of_vhosts.sh (#1472) 2017-01-10 10:53:59 -05:00
Jeff Kaufman 4a05c62329 doc: move doc references to modpagespeed.com (#1469) 2017-01-06 15:14:24 -05:00
Jeff Kaufman 41513b3131 Check in modpagespeed.com:/var/www/scripts/install_examples.sh (#1471) 2017-01-06 15:07:01 -05:00
huibaolin 3f8624a29a Add images for blogpost. These images won't be optimized by PageSpeed (#1470) 2017-01-06 14:22:41 -05:00
Jeff Kaufman 790a7c434e doc: allow doc content to be wider if there's room (#1468) 2017-01-05 15:31:31 -05:00
Jeff Kaufman 6f37179e9f doc: open source docs (#1464) (#1465) (#1459)
* open source docs
* remove old templating system
* format docs
2017-01-05 11:00:35 -05:00
Maks Orlovich a41abdce24 Release various benchmarks scripts using 'siege' (#1454)
(I didn't try to integrate compiling 3.0.8 here since it looked a bit too
 complex to include in this CL).
2016-12-20 15:53:09 -05:00
Maks Orlovich 7639b3d9ba Update the BoringSSL instructions to match current paths, (#1457)
submodule update directions (thanks to Steve to help with that!)
2016-12-20 15:52:51 -05:00
Maks Orlovich 6d12e0bc1a Incorporate review feedback 2016-12-20 15:51:32 -05:00
Maks Orlovich cb68849324 Adjust file list for 34/master. 2016-12-20 15:51:32 -05:00
Maks Orlovich 7dd0a4ccd9 Import the script used to prepare tarball for experimental packages (#1449)
Import the script used to make release tarballs,
with a few fixed and an additional mode used for the experimental packages for Debian.
2016-12-20 15:51:32 -05:00
hillsp 22ec60e9f0 Explicitly checkout the build branch (#1456) 2016-12-20 15:23:00 -05:00
Jeff Kaufman 7b58623ca2 travis: send emails to new pagespeed-ci group instead of individual devs (#1452) 2016-12-19 13:44:14 -05:00
Jeff Kaufman f61c3a5c4e devel: fix flakes in build_development_apache (#1451)
build_development_apache.sh flakes about 21% of the time, due to the apr
makefile not handling parallelism properly when running the install target.
Explicitly set -j1 when installing apr.

Fixes pagespeed/ngx_pagespeed#1338
2016-12-19 10:46:13 -05:00
Jeff Kaufman 5e6fbf5108 travis: add -luuid so we can build with devel on travis (#1448)
This should fix the ngx_pagespeed build on travis, because the ngx_pagespeed build is using devel.

(This is actually something I had originally done as part of 91662d08a, but because part of that change involved removing our exporting tools I hand-exported the change and missed this file.)
2016-12-19 10:45:50 -05:00
Jeff Kaufman e02a3f6a35 Rewrite check_tests_are_run.sh to be simpler. 2016-12-15 09:14:52 -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
Jeff Kaufman 96f16f32cc ngxpagespeed.com configuration: fix /install (#1444)
ngxpagespeed.com/install serves a redirect to build_ngx_pagespeed.sh on github.  Now that we develop on master and trunk-tracking is gone, fix it to point at master.

Already fixed (manually) on the live site.
2016-12-08 14:07:43 -05:00
hillsp ac71cb763f Update README.md 2016-12-08 10:52:34 -05:00
Jeff Kaufman 91662d08ae devel: open source google's mod_pagespeed development tools
These are the scripts and Makefiles we've been using to develop mod_pagespeed.  These were in a google-internal repo instead of being open sourced for complicated internal reasons, but now mod_pagespeed developers inside and outside google can use the same tools and flow.

This change adds a bunch of make targets.  To see them, look at the big comment at the top of devel/Makefile.  To run them, cd to devel/ and run make:

   cd devel/
   make apache_debug_smoke_test

This change also adds 'checkin' tests, which are a way to run all our tests together, so we can be confident a change doesn't break any of them.  To run checkin tests:

   cd devel/
   ./checkin

They're pretty slow: about 2hr on my machine.  Definitely don't bother runnning checkin tests until unit tests and system tests have passed first.
2016-12-06 09:18:26 -05:00
Maks Orlovich a99ea36b31 Provide a custom allocation wrapper for libpng, that mostly just uses
malloc, but makes sure that padding bytes at very end are deterministically
zero.
Reason: Testing on native builds on Debian Sid suggested that *something* in
our compression stack was apparently letting some of the padding bytes
influence the output. (Noticeable on PngOptimizerTest.ValidPngs).
This works around the issue.
2016-12-05 12:33:54 -05:00
Maks Orlovich 06fb3c1604 libpng1.6 compat: don't call png_read_update_info twice.
(From libpng docs on changes in 1.6.x:
 "The library now issues an error if the application attempts to set a
 transform after it calls png_read_update_info() or if it attempts to call
 both png_read_update_info() and png_start_read_image() or to call either
 of them more than once.")
2016-12-02 13:31:08 -05:00
hillsp 1956099022 Switch travis.yml to new build system, clean it up (#1440) 2016-12-01 12:04:40 -05:00
hillsp bc2234bd85 Whoops, fix jenkins link not just badge URL 2016-12-01 11:12:31 -05:00
Steve Hill 76ef77d36f Allow debug release builds, plus some other build cleanups. 2016-11-30 15:54:01 -05:00
Chris Fredrickson 4e3ead31cf Fix a data race in CacheBatcherTest. 2016-11-30 14:43:19 -05:00
Steve Hill 3f4df27025 Update libraries 2016-11-30 14:41:35 -05:00
Steve Hill aebb4f6931 Mark CentralController as Experimental 2016-11-30 14:41:15 -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
Steve Hill 325a4b6b89 Add build_on_vm.sh 2016-11-29 16:06:25 -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
hillsp f305bc2f2f Update README.md for new Jenkins IP 2016-11-28 13:45:47 -05:00
Steve Hill 636ecc4e76 Remove explicit copy ctor/copy assign operator from UnicodeText::const_iterator 2016-11-28 10:42:55 -05:00
Steve Hill aaa7400ebc Fix --verbose flag for build_release. Allow 32-bit builds in travis. 2016-11-28 10:40:08 -05:00
Maks Orlovich 2fcfa08ce1 Stop using private libpng data, but rather the public API.
This is needed to build on Debian sid against system libpng, which is always 1.6.
Also stop using png_sizeof, it's the same as sizeof in practice,
and is gone in 1.6.
2016-11-23 15:47:13 -05:00
Steve Hill 7385dfc100 Fix build_release to work on Ubuntu 14 2016-11-23 14:45:52 -05:00
Joshua Marantz ceea713cb0 Only run broken_fetch test on memcached/redis, where:
a) we can easily & selectively purge the HTTP cache by deleting a directory
b) doing this doesn't also clear the metadata cache, which needs to remain fresh to repro the bug.
2016-11-22 11:31:53 -05:00
Steve Hill f5ac855454 Fix install_required_packages when src_pacakges is empty. 2016-11-21 17:58:42 -05:00
Joshua Marantz a6fe5f6d0e Capture a testcase for when a cache-flush induces 404s for .pagespeed. resources
optimized using an ipro-recorded fetch.  This is
for https://github.com/pagespeed/mod_pagespeed/issues/1145
and https://github.com/pagespeed/ngx_pagespeed/issues/1319 .

Associated nginx commit:
https://github.com/pagespeed/ngx_pagespeed/commit/617f0e6beedb6496925e0f0145c2c09d9a5fa481
2016-11-21 14:36:58 -05:00
hillsp fe326271dc Stop using build_release.sh in travis until I can debug it. 2016-11-21 10:16:30 -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
hillsp 152e17a4b0 build_release.sh is broken without --stable for the moment 2016-11-18 17:58:49 -05:00
Steve Hill 74656a3f3d Add --verbose to test_package.sh and hook it up to build_release.sh.
This prevents Travis from timing out during the system tests.
2016-11-18 17:41:56 -05:00
Steve Hill 5ba3b7498d Add --verbose to build_release.sh so that Travis doesn't timeout. 2016-11-18 15:54:14 -05:00
Maks Orlovich c2f183703a Forgot to include file in c13af19f0e 2016-11-18 15:52:42 -05:00
hillsp 1aaa61faf0 Switch travis.yml to new build system 2016-11-18 14:34:51 -05:00
Steve Hill de65f5a4bb Delete obsolete files from old build system 2016-11-18 14:26:03 -05:00
Steve Hill 66c1c43b31 Replace build_release_platform with build_release 2016-11-18 14:24:22 -05:00
Maks Orlovich c13af19f0e Fix leak when we see an html page with nonsense Content-Encoding. 2016-11-18 14:01:20 -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
Steve Hill b216e348ad On head, test_package.sh needs build_env.sh to find redis-server. 2016-11-16 10:28:02 -05:00
hillsp 4ac1e6ac72 Erp, don't cd into install first 2016-11-15 16:55:04 -05:00
hillsp 0b320d31c9 Fix travis.yml for deleted ubuntu.sh 2016-11-15 16:53:49 -05:00
Steve Hill 2b23e61ead Fix ignores and add per-OS make_vars 2016-11-15 16:10:06 -05:00
Steve Hill 4ba690b8c9 Add test_package.sh for running system tests. 2016-11-15 15:57:28 -05:00
Jeff Kaufman c75a5da266 Add build_development_apache.sh 2016-11-15 07:42:58 -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
Jeff Kaufman e070e55aed Update mod_fcgid to a version with apache 2.2 compatibility (#1430) 2016-11-11 17:45:46 -05:00
Steve Hill 408ea00873 Add install_required_packages.sh 2016-11-11 16:59:22 -05:00
hillsp 4b844abf3b Remove more gclient from travis.yml, cleanup. 2016-11-11 12:05:28 -05:00
hillsp 93223446ed Remove gclient from travis.yml 2016-11-11 12:03:00 -05:00
Steve Hill 993754c479 Stop depending on gclient. 2016-11-10 16:43:55 -05:00
Jeff Kaufman 36d4a38005 Linux installer: Fix APT_SOURCES and APT_SOURCESDIR paths
In prior versions of Ubuntu/Debian the Dir::Etc apt-config variable contained a
trailing slash by default. The cronjob at /etc/cron.daily/google-chrome was
concatenating that variable into a path, assuming the trailing slash. But in
Ubuntu 16.10, the trailing slash is gone. That breaks the path to the list file,
and the cronjob fails to fix it.

Patch from https://chromium.googlesource.com/chromium/src.git/+/389af6af989c5ba5384988b55fc28a3f231a1479%5E%21/#F0

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1428
2016-11-10 15:20:05 -05:00
Steve Hill e472a0f702 Add missing std:: 2016-11-10 13:53:23 -05:00
Steve Hill 573071ae3a NULL StringPiece is deprecated 2016-11-10 13:50:33 -05:00
Steve Hill 8b8658bd72 Add scripts to setup 32-bit chroots for building. 2016-11-10 11:54:08 -05:00
Jeff Kaufman 176da99558 Add dependencies for building a dev apache (#1426)
* Add nghttp2 as a submodule
* Add mod_fcgid as a submodule
2016-11-10 07:46:22 -05:00
Steve Hill 385578da16 start_php.sh should wait for php-cgi to die. 2016-11-09 17:18:35 -05:00
Steve Hill 2a7b39d6c9 Update compiled JS from Closure update 2016-11-09 15:22:38 -05:00
hillsp 8642cfbb40 Update to Closure 20161024 (#1427) 2016-11-09 14:53:10 -05:00
Maks Orlovich 2264ea8017 Typo fix 2016-11-08 09:12:50 -05:00
Maks Orlovich 9a76ce6172 Some small fixes for when we are accessing ourselves as [[::1]:12345 in tests. 2016-11-07 14:47:42 -05:00
hillsp 3f66cd36f7 linux_package_deb_stable not linux_package_deb_releae 2016-11-04 19:55:07 -04:00
Steve Hill 46c78191cd Add install/build_mps.sh for building mod_pagespeed. 2016-11-04 18:46:06 -04:00
Steve Hill 5b9af6e606 Fix system tests on CentOS 6:
- Work-around various SELinux permission type stuff.
 - Force .js to have the correct MIME type.
 - os_redirector.sh should load build_env as well as shell_utils.
2016-11-04 17:40:38 -04:00
hillsp 02d809531b Update travis.yml for new gyp deb target 2016-11-04 17:36:58 -04:00
Steve Hill 4fdf0f75e0 Remove gyp variables chromium_revision and channel.
linux_package_deb now becomes linux_package_deb_(beta|release). Likewise rpm.
2016-11-04 16:29:12 -04: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
Steve Hill b15de12be9 Make invalid_host_header.sh work when HOSTNAME has no port. 2016-11-03 13:11:35 -04:00
Jeff Kaufman becd5769d3 StringPiece: compatibility changes for std::string_view
StringPiece is eventually going to be replaced with std::string_view,
which has a somewhat different API.  Adjust our use of StringPiece to
avoid some things that are going away.
2016-11-03 07:09:18 -04:00
Jeff Kaufman 71d99059a3 test: use better names for remote config testing
rcport1  ->  standard
rcport2  ->  partly-invalid
rcport3  ->  invalid
rcport4  ->  out-of-scope
rcport5  ->  fail-future
rcport6  ->  timeout
rcport7  ->  experiment
rcport8  ->  slightly-slow
rcport9  ->  slow-expired
rcport10 ->  forbidden
rcport11 ->  forbidden-once
2016-11-03 07:07:22 -04:00
Steve Hill 0fbb9b451a Fix invalid_host_header to work correctly and not depend on netcat. 2016-11-02 18:59:57 -04:00
Steve Hill b8aa8896b8 os_redirector and make some things symlinks 2016-11-02 17:58:06 -04:00
Steve Hill 98e130b2cc Add install/build_psol.sh ti replace build_psol_tarball.sh. 2016-11-01 16:13:29 -04:00
Jeff Kaufman 34f53de6b0 Follow-up to 13c12ce19 to add a missing file and unbreak the build 2016-11-01 15:23:56 -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
Jeff Kaufman 13c12ce191 remote-config: switch tests away from netcat
The remote-config tests used to abuse netcat as a kind of server.  They
would run one netcat for each possible response we wanted to test, each
on its own port since we couldn't have netcat read the request line to
make a custom response, which meant we needed a lot of ports.
Additionally they depended on a flag that is only available in the
debian distribution of netcat, so testing on other platforms meant
copying in debian's patch.

This change replaces the hacky fragile use of netcat with a server
written in python as a relatively simple wrapper around select.select().

Also, this adds four more tests for verifying that remote config does
the right thing when the remote config server becomes
available (rcport8), when we have a stale copy of the config (rcport9,
which fails), when the config 403s (rcport10), and when the config
initially 403s but then 200s (rcport11).

* In a followup I'll rename the numbered ports to better names, but I
  think it's less confusing if I keep them the same here.
* "pathological_server" probably isn't the best name, since most of what
  it's doing isn't actually that bad.  On the other hand, having full
  control over what we send out allows us to be as pathological as we
  want to if we want to use this to test anything else.

nginx side of the change: https://github.com/pagespeed/ngx_pagespeed/pull/1293
2016-11-01 13:28:54 -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
Maks Orlovich 2c061cc308 Sync with BoringSSL stable update, to make it work again. 2016-10-31 14:03:19 -04:00
Steve Hill 1dd7753351 Revert "travis: Fetch submodules when we clone"
We don't need to fetch submodules for gclient!

This reverts commit 8992d535fe.
2016-10-31 10:08:30 -04:00
hillsp 8992d535fe travis: Fetch submodules when we clone 2016-10-28 17:55:36 -04:00
hillsp c6ff02ea03 Add submodules for our DEPS (#1423)
Replace gclient deps management with git submodules.
Does not remove gclient entirely (yet).
2016-10-28 16:47:22 -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
cfredric 42098f8ed9 Coalesce cache fetches of the same key. 2016-10-28 14:13:26 -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
cfredric d5b02c3527 Merge branch 'master' of github.com:pagespeed/mod_pagespeed 2016-10-27 17:19:29 -04:00
cfredric 1407b08ccb Refactor DelayCache to control when ValidateCandidate is called. 2016-10-27 17:16:33 -04:00
Steve Hill 50cd55f8f7 APACHE_DOC_ROOT is /var/www/html on newer CentOSes, set it in the Makefile 2016-10-27 17:13:52 -04:00
Steve Hill d25ee2ee4f Allow selinux to fail if it's not configured. 2016-10-27 15:06:27 -04:00
Steve Hill 2912f3bda3 Make system tests work when SELinux is enabled. 2016-10-26 18:16:01 -04:00
Steve Hill 0d69a97e4b Add missing HTML5 <picture> tag to css_parser stuff 2016-10-25 11:12:32 -04:00
Steve Hill fcac38eebe Fix gflags overlapping directories. 2016-10-24 13:20:32 -04:00
Jeff Kaufman c10c586b87 add hooks timestamp file to gitignore 2016-10-21 16:36:45 -04:00
Jeff Kaufman ddb38b8563 build: stop computing lastchange every time, it's slow and unnecessary 2016-10-21 16:33:54 -04:00
Steve Hill 8c5c1715d8 Add mising protobuf dep to fix -j builds 2016-10-20 14:29:57 -04:00
Steve Hill 3bc70722fb Fix psol builds after DEPS cleanup 2016-10-20 11:31:40 -04:00
Jeff Kaufman 7fa614f266 system-tests: split the system tests in apache/ into multiple files
Split apache/system_test.sh into apache/system_tests/*, the same way
automatic/ and system/ are divided.

I haven't done any reordering or cleanups: I want to first get it split, then
come back and make it tidy, or else keeping this outstanding CL synced without
merge conflicts will be a huge pain.

The main advantage of splitting the tests is that it allows us to run a single
test with TEST_TO_RUN=filename when debugging, but it also makes future
refactors simpler.
2016-10-19 19:20:40 -04:00
Steve Hill 1e7558617e Add --depth=. to gyp call, allowing checkout to not be named src. 2016-10-19 18:38:34 -04:00
hillsp 945335d0f2 Cleanup gitignore for DEPS cleanup (#1419) 2016-10-19 18:15:59 -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 368b3e1ed8 Cleanup DEPS so they don't overlap with git file.
Required for submodules.
Copies in the gyp files for gtest and gmock from chromium.
2016-10-19 18:07:30 -04:00
Jeff Kaufman 83a30c0d96 system-tests: add CONTINUE_AFTER_FAILURE mode
intended for (a) checkin tests and (b) finding flakes masked by other flakes
2016-10-19 15:59:28 -04:00
hillsp 22a079fdac Fix ignore for google-sparsehash 2016-10-18 15:43:14 -04:00
Steve Hill 7ce64a1c49 Move closure download out of DEPS and into gypfiles. 2016-10-18 15:40:41 -04:00
Jeff Kaufman 8f17bb07a2 testing: make check_not and check_not_from actually work
A change about two years ago broke check_not and check_not_from so that they didn't actually
exit on error anymore, because their failing exit status was swallowed by
the subshell.  Luckily there aren't any tests that have gone stale in the mean time!
2016-10-18 14:16:41 -04:00
hillsp cf75b30ca2 Cleanup .gitignore; Sort, de-dup, remove *s (#1415) 2016-10-18 10:41:18 -04:00
Maks Orlovich 2d46c8b9d2 Remove obsolete/incomplete distributed rewrite code. 2016-10-18 10:32:24 -04:00
Jeff Kaufman 6630969369 system tests: remove running tests in the background
This was added, found to be too flaky, and has been disabled for over a year.  It probably doesn't work anymore, and if we want to revive it we'll probably do it a different way.

(Also, I want to make changes to this part of the test script, and having stale code around makes it hard to make sure I haven't broken the stale code.)
2016-10-18 07:37:44 -04:00
Steve Hill f48c13fde0 Change GTestSrcDir to not require our directory be called 'src'. 2016-10-17 18:07:20 -04:00
Steve Hill 142f7d5d63 Fix tests on CentOS:
* Switch blocking rewrite_test to use the larger Beach.jpeg. On my VM the other
  image was completing too quickly.
* Make process_scope test fetch a directory that has an index.html, not
  a 403.
2016-10-17 16:06:27 -04:00
Jeff Kaufman c174e3a417 system-tests: split the system tests in system/ into multiple files
Split system/system_test.sh into system/system_tests/*, the same way
automatic/system_test.sh is divided.

I haven't done any reordering or cleanups: I want to first get it split, then
come back and make it tidy, or else keeping this outstanding CL synced without
merge conflicts will be a huge pain.

The main advantage of splitting the tests is that it allows us to run a single
test with TEST_TO_RUN=filename when debugging, but it also makes future
refactors simpler.
2016-10-17 15:36:17 -04:00
Joshua Marantz 4536a5ff77 Skip writing the cache when ipro-recording a non-optimizable content
type, such as html, pdf, or something we can't parse.

This has a very slight negative effect on performance for low-entry URLs
in siege tests (very close to the noise level), and a fairly significant
on high-entropy URLs, such as HTML with random query params.  The idea
is to avoid filling the cache with them.
2016-10-14 16:17:14 -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 b98ae97e1f Export internal cleanup CL: remove extraneous passing of NULL to StringPiece ctor 2016-10-13 14:40:39 -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
Steve Hill d25b613ab8 Switch DEPS to be 100% git 2016-10-13 14:18:05 -04:00
Jeff Kaufman 95ee32c9f3 testing: Add TEST_TO_RUN to allow faster iteration when debugging.
People can set TEST_TO_RUN=test-name to run only a specific test.

This only works for tests that are set up to use run_test, which is currently
only the ones under automatic/, but I'm planning to convert system/ etc in a
followup.
2016-10-13 09:09:29 -04:00
Steve Hill b42cb5e0f5 Add missing redis_cache_cluster_setup_main.cc 2016-10-12 19:39:58 -04:00
Jeff Kaufman 04c7e6b2ff tests: unbreak tests with nginx
I didn't test 7ecf90cff properly , and it was broken in three ways:
* It didn't pass in REDIRECT_STATUS, so php wouldn't start
  * When you start php-cgi from the command line this isn't
    needed, but when php-cgi detects it's being run
    non-interactively it refuses to start without it.
* A test that was expecting to talk to flush.example.com in one
  case and noflush.example.com was always getting
  noflush.example.com.
* The 'check if php is working' command worked, but it was using
  an endpoint with a 2s sleep when it didn't need that, which
  slowed down the tests.
2016-10-12 18:09:43 -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
hillsp c95dc3cbe9 Cleanup broken submodules for DEPS (#1414)
* Delete broken, accidental submodules
* Add some missing ignores to gitignore
2016-10-12 14:47:03 -04:00
Maks Orlovich 3191ebfd39 Cleanup a few more loose ends from mod_spdy integration. 2016-10-12 12:22:34 -04:00
Joshua Marantz c488f9c9d2 Provide an env-var mechanism to skip starting external caches. 2016-10-11 15:04:09 -04:00
Maks Orlovich 006b7b2bc0 Remove accidentally added test file 2016-10-11 14:27:23 -04:00
Steve Hill e64b491183 Don't CHECK cluster size in ResetClusterConfiguration for Redis 2016-10-11 13:50:12 -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 7ecf90cff3 tests: make php tests less flaky with nginx
* Add install/start_php.sh that starts a php server on the specified port,
  killing an existing one if need be.
* Change the follow-flushes test to first check that the page can be fetched.
* Refactor the arguments to check_flushing to reduce duplication.

nginx side of the change is: https://github.com/pagespeed/ngx_pagespeed/pull/1288
2016-10-07 15:51:15 -04:00
Steve Hill 69c1b39953 Wait for CLUSTER MEET to propagate before trying to CLUSTER REPLICATE. 2016-10-06 17:52:22 -04:00
hillsp 9ecb3ac159 Correct travis.yml for updated DEPS file 2016-10-06 15:43:54 -04:00
Steve Hill 8be7be6c11 Move gclient so it's relative to mps root, not the directory above. 2016-10-06 13:49:00 -04:00
Jeff Kaufman dba56f4b13 minor: remove old google code urls 2016-10-06 13:32:22 -04:00
hillsp 89c46bebe6 Add gclient stuff to gitignore 2016-10-05 18:01:34 -04:00
Maks Orlovich 325feb6a7f Remove some unused constants. 2016-10-05 14:59:03 -04:00
Steve Hill d178cd2d3a Fix messed-up line wraps in build_release_platform.sh 2016-10-05 14:26:23 -04:00
Jeff Kaufman 833e586bdf config: remove ModPagespeedInheritVHostConfig 2016-10-05 13:35:14 -04:00
Steve Hill 11a6223a63 Various fixes to release process. 2016-10-04 18:46:22 -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
Joshua Marantz f0ce01f740 Add clean_slate_for_tests to Makefile.tests 2016-10-04 11:20:07 -04:00
Steve Hill 58de613c85 Re-sync permissions again 2016-10-04 11:19:13 -04:00
hillsp dc64b379b1 Mark all scripts as executable (#1410) 2016-10-03 17:19:48 -04:00
Steve Hill 9303c10c07 Definitely warn about ModPagespeedInheritVHostConfig if it's off. 2016-10-03 11:42:15 -04:00
Joshua Marantz 02832c403c Change uses of StringPiece::starts_with to strings::StartsWith, and
StringPiece::starts_with to StringPiece::EndsWith
2016-10-03 09:37:52 -04:00
Steve Hill bda36b208a Bump VERSION 2016-09-30 15:21:20 -04:00
Steve Hill 292a8ac09c Allow LoadClusterConfiguration to fail in RedisCacheClusterTest::SetUpTestCase 2016-09-30 13:09:18 -04:00
Steve Hill 4c30b08ad9 Deprecate ModPagespeedInheritVHostConfig. 2016-09-29 15:12:39 -04:00
Steve Hill f6bc6c5472 Redis cluster setup should not treat 'OK' as failure 2016-09-28 22:26:33 -04:00
Joshua Marantz 94008d4205 Bail early in ipro-recording if the content-type is known in the
kPreliminaryHeaders to be something we cannot optimize.
2016-09-28 17:40:55 -04:00
Jeff Kaufman 74059559a1 redis-cluster: report stats for all connected cluster nodes 2016-09-28 16:28:18 -04:00
Jeff Kaufman da1cdeec3f redis-cluster testing: set up the cluster just once at the beginning 2016-09-28 16:08:43 -04:00
Steve Hill c2c99a4b79 Only run ResetClusterConfiguration when Redis tests are enabled. 2016-09-28 15:09:28 -04:00
Jeff Kaufman 8803d28f44 redis: parse only a single server, not a comma separated list 2016-09-28 13:29:02 -04:00
Steve Hill b488ad9531 Break CLUSTER ADDSLOTS into batches to fix Travis. 2016-09-27 21:58:29 -04:00
Steve Hill 3c08b611e1 Remove reduntant test in redis cluster verification 2016-09-27 17:58:49 -04:00
Steve Hill 0701c4ea3c Sort cluster_mappings_ and use std::lower_bound to search it. 2016-09-27 16:37:06 -04:00
hillsp 0f429a1b1b Travis: Don't run pagespeed_automatic_test if mod_pagespeed_test fails 2016-09-27 11:16:50 -04:00
Joshua Marantz b6c29c5dcc Update git commit ID for the EINTR fix. 2016-09-27 08:42:01 -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 4e14d1fc85 debian-install: put pagespeed-libraries.conf where it will be loaded
The way you used to install apache2 configuration on Debian-based systems
was to put it in /etc/apache2/conf.d/, but starting with Ubuntu 14 LTS
there's a new system where you install it to /etc/apache2/conf-available/ and
then run a2enconf to symlink it to /etc/apache2/conf-enabled.  On these
systems we weren't installing pagespeed-libraries.conf in a way that made
it usable, because when we put it in conf.d it just was never loaded.

Switch to installing to /etc/apache2/conf-available/, and then use a2enconf
if it's available.  If a2enconf isn't available, manually symlink to conf.d.

Fixes: https://github.com/pagespeed/mod_pagespeed/issues/1389
2016-09-26 18:58:57 -04:00
Steve Hill 1d1e02585f Replace one StringPiece::starts_with with strings::StartsWith. 2016-09-26 13:53:25 -04:00
Steve Hill ece4aed17e Hook up controller tests. 2016-09-26 13:52:42 -04:00
Joshua Marantz a3e5f2d6e6 Fix path used to find clean_slate script for production builds. 2016-09-26 07:07:37 -04:00
Joshua Marantz 25e0928eac Fix a ~5% flake in AprMemCacheTest when run at Google. It might
be due to signals being sent & caught, and a slightly-too-tight
timeout.

The root cause of the interrupt problem was lack of EINTR handling in
apr_memcache2.c.  In general in Apache there is no signal handling so
this does not affect any kind of production use (at least when not
shutting down), but affects our unit tests in some enviornments.  As far
as I can tell there was only one point where the EINTR handling needed
to be added, but I left behind more debug printing, via
fprintf(stderr...), which came through in unit tests.  No
message-handlers are available from inside apr_memcache2.c.

Backs out the change to send an ascii reset sequence to the memcache.
It's totally unnecessary, exposes the ascii protocol of memcached at
the wrong layer of abstraction, and adds further risk to the test.
2016-09-23 23:54:29 -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
Jeff Kaufman 1fee1305c3 tests: improve cache cleaning
The current cache-cleaning is broken because it only deletes the main
cache, and not any alternate caches.  Also cache-cleaning can be quite
slow, so be a little noisier while doing it, factor it out into a
script.

(Change by jmarantz@)
2016-09-23 19:42:48 -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 2a599ee97c Rename "ExperimentalRedisServer" to "RedisServer". 2016-09-23 16:17:04 -04:00
Steve Hill 5733f5fb2d Add stall detection to CentralControllerRpcClient. 2016-09-23 16:14:53 -04:00
Joshua Marantz fb3ef57e90 Add a temporary dummy header file to make an internal refactoring
process go more smoothly.
2016-09-23 11:15:55 -04:00
Jeff Kaufman 6bbc3f22ba Rename the ExperimentalRedisServer option to RedisServer, since load tests and stress tests were ok. 2016-09-23 09:32:17 -04:00
Jeff Kaufman a458199863 Add redirect for /install 2016-09-23 09:00:29 -04:00
Jeff Kaufman 45a295ed45 verify that PSOL_BINARY_URL is set properly on release branches 2016-09-23 08:44:54 -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 3607c98d20 Start migrating off of StringPiece::ends_with/starts_with and using our
new standard functions strings::StartsWith and strings::EndsWith.
2016-09-22 10:27:31 -04:00
Joshua Marantz 453df76095 'install' doesn't exist as an 'apachectl' command... use 'stop' instead. 2016-09-21 19:14:29 -04:00
Joshua Marantz 848b516c3b Put a target 'apache_debug_test' where travis can see it. 2016-09-21 15:02:10 -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 2a014ad881 Make QueuedExpensiveOperationController re-entrant with callbacks. 2016-09-21 12:22:20 -04:00
Steve Hill 7fa8e2c7c6 Hook up the client side part of the CentralController. This will actually
cause gRPC stuff to happen if the CentralControllerPort is set.

There is a currently a known deadlock with the controller, which will be
fixed in a subsequence change.
2016-09-21 09:52:19 -04:00
Joshua Marantz 57509076c4 Factor out a separate round of tests for the controller, which should
not be enabled during most of our tests, which should instead match the
configuration used by default for our userbase.

Requires https://github.com/pagespeed/ngx_pagespeed/pull/1278 to be
checked in concurrently.
2016-09-20 15:42:11 -04:00
Steve Hill 95af68692f Adding new items to ContextRegistry fails cleanly if shutdown.
This gives it an atomic "obtain lock or fail" semantic.
2016-09-20 12:57:37 -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
Joshua Marantz d76bc188e6 Refactor test methods to avoid extra passing around of &message_handler_
everywhere.
2016-09-16 19:17:53 -04:00
Maks Orlovich 0030eb9916 Remove dead methods and field. 2016-09-16 17:10:24 -04:00
Egor Suvorov 1520e7dc68 Make AprMemCache use ExternalClusterSpec for configuration parsing.
Note that this change breaks backward compatibility, because now specs like `::host:::port` are incorrect, while previously all "empty" pieces of spec between colons were ignored.
2016-09-16 15:20:39 -04:00
Steve Hill 486620a3bf Add ContextRegistry, which will be used to track gRPC Contexts. 2016-09-16 13:35:04 -04:00
Jeff Kaufman 761ac4c44f build-release-platform: make it work on the buildbots
These are the changes I needed to make to get build-release-platform
to work on the buildbots:

* fcgid is not vailable on centos5, so do not require it
* httpd on centos5 is in /usr/sbin, which is not in PATH
* httpd -M on centos5 prints its output to stderr
* we have set -x so you cannot do foo ; if [ $? != 0 ] ...
* we now depend on having a c compiler newer than gcc 4.1,
  so mess with the PATH to get us the one from scientific
  linux
  * but devtoolset includes a version of sudo that does not
    support -E, so rename that so it is not used
* do not delete release/ for one architecture when you
  start building the next one
  * remove the scp to centos-buildbot since we keep
    everything now
* git pull --ff-only only makes sense on a branch, not
  when you are re at a tag
* put a linebreak in EOF) so we do not screw up syntax
  highlighting in emacs
2016-09-16 13:13:49 -04:00
Jeff Kaufman c10259b866 pagespeed-libraries: add angular-material 1.1.1 and incremental-dom 0.5.0 2016-09-16 13:11:10 -04:00
Maks Orlovich dfb46b933a Make the link headers we generate nopush 2016-09-16 11:08:35 -04:00
Egor Suvorov 1f644fe601 Add tests for Redis Cluster (disabled until Redis Cluster is supported)
This change creates infrastructure for Redis Cluster tests and few simple smoke tests. More tests will come in future changes, when Redis Cluster is actually implement
2016-09-15 17:38:36 -04:00
Egor Suvorov 4bc7455e93 Refactor connection handling in RedisCache
This refactoring is necessary because in Redis Cluster we should be able to keep several connections to Redis at once and switch between them.
* Move connection-handling functions in RedisCache to RedisCache::Connection
* Create RedisCache::RedisCommand() which issues command, handles locks and validates response instead of the caller, thus simplifying the code.
2016-09-15 15:49:32 -04:00
Steve Hill e7dbc66f56 Suppress "Adding function to sequence after shutdown" message on release
builds.

I noticed this when testing the controller which can wake up a bunch of
blocked rewrites as part of the shutdown process. However, in general these
messages are generally useless/worrying for end users, plus we DTRT by
canceling the Function cleanly anyway. The gRPC specific issue will be
discussed when that code lands.
2016-09-15 14:51:59 -04:00
Steve Hill 1422358a25 Support UNIX sockets (unix:/foo) in ControllerPort option. 2016-09-15 14:38:05 -04:00
Egor Suvorov c274e370e0 Introduce ExternalServerSpec struct for uniformed management of Redis/Memcached server lists.
* Add system_specs.cc which aggregates structs for holding information about external cache servers (host, port) and corresponding parsing methods.
* Update SystemRewriteOptions and SystemCaches so that they use new structs instead of RedisServerSpec (which is removed)
* Parsing of server spec is done differently than in AprMemCache: it does not accept things like `:host:port` or `host:::port`.

This change aims to make further integration of Redis Cluster configuration easier.
2016-09-15 14:11:11 -04:00
Maks Orlovich f67ac592b1 Validate dependencies before preload hinting,
so we don't hint .pagespeed. resources which page won't actually have.
2016-09-15 13:49:29 -04:00
Maks Orlovich 89e35673ea Remove some unused, blink-specific methods from UserAgentMatcher. 2016-09-15 12:34:12 -04:00
Steve Hill 91c7e8eb7e Move GrpcServerTest implementation into the .cc. 2016-09-15 10:29:03 -04:00
Egor Suvorov 408b2d9f1b Fix race condition in RedisCacheTest.ShutDownDuringConnection
It was not waiting until RedisNotRespondingServerThread actually receives connection, which resulted in TcpServerThreadForTesting failure. Other tests do not need to explicitly wait on that because they rely on what server thread answers to the client.
2016-09-14 12:29:46 -04:00
Maks Orlovich e755e27b56 Remove now-obsolete notion of prefetch mechanism:
It didn't cover the one way that actually works, and
of the mechanisms it reported only one was used, and
only if enabled by an option that's not documented for
MPS/NPS, and only for Safari and obsolete Chrome, and
was using a mechanism that's likely to cause trouble.
2016-09-13 16:29:18 -04:00
Joshua Marantz 2c1c5aafe5 Remove experimental mobilization flags. 2016-09-13 16:22:53 -04:00
hillsp 28c9c63106 Work-around with before_install not before_script 2016-09-13 11:17:03 -04:00
hillsp 8e6d3d6fd1 Remove jcrowell from travis notifications 2016-09-13 11:07:18 -04:00
hillsp 61ad086eae Work-around broken GCE Ubuntu repo 2016-09-13 11:06:44 -04:00
Egor Suvorov 57ee946ca4 Add TcpConnectionForTesting class and utilize it in AprMemCacheTest for flushing Memcached between tests. 2016-09-13 10:51:23 -04:00
Maks Orlovich 4ca0483fc4 Remove some dead methods. 2016-09-13 10:42:29 -04:00
Egor Suvorov 61b3b95261 Fix some IWYU warnings 2016-09-12 16:50:36 -04:00
Maks Orlovich f1740e336b Match boringssl chromium-stable update 2016-09-12 15:16:18 -04:00
Steve Hill 1c68e89fc1 Allow IPRO requests to use the Central Controller. 2016-09-12 15:01:00 -04:00
Maks Orlovich 166712eb60 Remove flush early flow.
It never worked in mod_pagespeed/ngx_pagespeed, and adds a lot of complexity due to how it's structure all over the place. More immediately, much of older code dealing with prefetching is used only by it.

(There are some lose ends this still keeps wrt to RewriteOptions::kFlushSubresources, and
 perhaps something else that I missed, but this should be the bulk of it...)
2016-09-12 12:50:58 -04:00
Joshua Marantz dbdf8a9a56 Make a possible race less likely under valgrind by increasing the
timeout during Serf tests.
2016-09-09 22:08:57 -04:00
Steve Hill 02fa852a4b Let gRPC pick the port instead of rolling random. 2016-09-09 18:21:20 -04:00
Steve Hill c633ec01a6 Test WorkBoundExpensiveOperationController treats -1 as unlimited. 2016-09-09 15:53:47 -04:00
Steve Hill d9027813a8 RpcHandlerTest.ClientAbortAfterWrite must wait for test completion. 2016-09-09 15:53:19 -04:00
Egor Suvorov 075cdb328e Improve RedisCache thread safety mechanisms.
* IsHealthy() is guaranteed to not lock for a long time.
* If one thread is currently connecting to Redis, other threads will fast-fail instead of blocking until connection succeeds/fails.
* Similarly, if connection is dropped at some point, only one thread will start re-connecting, others will fast-fail.
* RedisCache() ctor now needs ThreadSystem instead of single AbstractMutex.
2016-09-09 14:47:49 -04:00
Egor Suvorov 181aa66b65 Remove extra empty line from redis_cache_test.cc 2016-09-09 13:30:37 -04:00
Joshua Marantz 435c134451 Remove mobilize JS from the code base
Changes:
- Remove JS code from pagespeed/opt/mobilize
- Remove iframe_fetcher and mobilize_rewrite_filter
2016-09-08 14:50:55 -04:00
Maks Orlovich 8d585f7508 Preload hinting: order nested stylesheets after their parent,
before later resources.
2016-09-08 12:28:54 -04:00
Steve Hill 1a0eb2217c Replace various kStatisticsGroups with Statistics::kDefaultGroup 2016-09-08 11:19:47 -04:00
Joshua Marantz 37bd8ff493 Clear the stats structure to avoid valgrind errors. 2016-09-08 09:36:18 -04:00
Joshua Marantz e04f768d2c Get build_release_platform.sh to work on our workstations.
Install FastCGI & libphp into root server if not already there.

Add -clean switch to optionally clean up /var/www/html prior to trying
to install over those directories.

Rename 'apache_system_test' to 'apache_root_test' to (hopefully) reduce
confusion.  Sadly this test is not working yet.

Make all the ports disjoint for root_test/build_release_platform, so
don't get into a situation where a failed build_release_platform leaves
root apache2 owning a port required by our checkin tests.
2016-09-08 08:01:50 -04:00
Huibao Lin e42c631de6 Update libwebp to 0.5.1 2016-09-07 15:05:13 -04:00
Steve Hill 8899891a28 Add statistic counting permitted expensive operations. 2016-09-07 13:26:36 -04:00
Jeff Kaufman b5517f68fe nginx: add example files used on ngxpagespeed.com
* nginx.service: systemd configuration file
* ngxpagespeed-com.conf: nginx configuration file
* prepare_ngx_pagespeed_examples.sh: script to build /usr/local/nginx/html
2016-09-07 09:44:38 -04:00
Jeff Kaufman 0d2017f1b5 logos: update pagespeed and google logos to new versions 2016-09-07 09:42:27 -04:00
Jeff Kaufman 78171b260b caching: make documentation match code for checkpointing 2016-09-07 09:38:36 -04:00
Jeff Kaufman a50a541423 pagespeed-libraries: add angular_material 1.1.1 2016-09-07 09:37:44 -04:00
Joshua Marantz 13f46f71c1 Move the remote_config tests out to a separate test outside the smoke
tests, simplifying debugging httpd with a default configuration by
reducing the amount of unexpected requests flying around.
2016-09-07 09:00:42 -04:00
Joshua Marantz 9920e286c5 send a content-type header with .webp in case that is not installed on
the server echo the curl command used in resource_content_type_html.sh
fix some inconsistent indentation in VirtualHost declarations
2016-09-06 22:52:20 -04:00
Egor Suvorov 3dc0dff6ea Refactor RedisCacheTest for centralized management of custom servers.
* Now all custom servers (e.g. RedisGetRespondingServerThread) are started via RedisCacheTest::StartCustomServer<>, ports are also booked by RedisCacheTest.
* Get rid of cache_.reset() lines in tests in favor of several custom methods in the fixture.
* Make kTimeoutUs checked by static_assert, not CHECK
2016-09-06 17:16:38 -04:00
Steve Hill 7a8d0cfe20 Fix QueuedWorkerPool::Sequence::ShutDown not shutting down the sequence
in a thread-safe way. Adds annotalysis and a couple of other minor
locking fixes.
2016-09-06 17:12:32 -04:00
Egor Suvorov 08ed3dc95a Make start_background_server.sh faster and refactor shell utils.
* Get rid of explicit `sleep 2` with following check for server availability, make it check availability every 0.1s until 2s pass. It gives significant speedup in practice as memcached/redis typically start up instantly.
* Move shell_utils.sh to open source.
* Implement wait_cmd_with_timeout for use in check_for_leaks and start_background_server - it uses $SECONDS instead of counting iterations so commands used can take arbitrary amount of time to run.
2016-09-06 15:48:54 -04:00
Steve Hill 76ed6ef9bc Use check_stat_op in apache_debug_gzip_test.
This prevents a break in ModPagespeedFetchWithGzip if prior tests run.
2016-09-02 18:49:38 -04:00
Maks Orlovich 36c62c91fe Add missing include dir for PSOL build. 2016-09-02 15:39:39 -04:00
Maks Orlovich a64dbda708 Simplify this to only support current revision, based on feedback. 2016-09-02 15:15:25 -04:00
Joshua Marantz 7181f0c8b9 Factor out tests that require deprecated vhost-inheritance of
process-scope options, and thus generate warnings, into separate scripts
with quaranteened config.

Also (because this bit me during testing of this change): increase the
serf timeout when running under valgrind, and also change the
unconditional long timeout in mod_pagespeed_test/ipro/instant/wait to
only do so under valgrind.  This was made much easier by an earlier
refactor of the way configuration options get plumbed through our
makesfiles.
2016-09-02 14:35:58 -04:00
Maks Orlovich c78a18bc0e Pull out the InputInfo validation functions into a separate
file, so I can call them for determining what to preload.
(including file system metadata cache helpers)
2016-09-02 13:40:13 -04:00
Maks Orlovich 1188016590 Update to using Chromium from git (since there is no more SVN)
Mechanically/high-volume-wise this required duplicating some of the build/
and yasm/ build bits, since they're in the main Chrome repo.
More messy is the url/ situation: there is a version available, but not completely
up-to-date one, in fact one that's older than our base and what we were using from svn,
so we need to do weird compatibility massaging.
(I've also picked up newest RE2, which required some sync up changes).
2016-09-02 11:15:12 -04:00
Steve Hill 5d3bede980 If a controller denies an operation, don't report failure. 2016-09-01 15:59:12 -04:00
Jeff Kaufman 5daea16958 string-piece: replace usages of clear(); string_view doesn't have that 2016-09-01 15:06:50 -04:00
Jeff Kaufman dc431423bd combine-css: add wildcard to let people combine stylesheets with ids
Nginx side of the change: https://github.com/pagespeed/ngx_pagespeed/pull/1259

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1384
2016-09-01 15:03:48 -04:00
Egor Suvorov 94d185ffa2 Clean up RedisCache.
* Change order of declarations and definitions for better grouping.
* Move comment regarding reconnection strategy to header's beginning.
* Better comment formatting.
2016-08-31 14:07:29 -04:00
Joshua Marantz 7de75011b6 Remove calls to StringPiece::clear() by instead assigning from an
empty-constructed SP.
2016-08-30 15:39:26 -04:00
Joshua Marantz 4ae804df08 In apache_install_conf, recursively call make by sending in the
$(OPTIONS) rather than passing down OPTIONS="$(OPTIONS)".
2016-08-30 15:38:39 -04:00
Joshua Marantz fc35237330 Collect all the options to be used when generating config files into
Makefile variable OPTIONS, rather than having a separate Makefile
variable for each option.
2016-08-30 09:33:45 -04:00
Maks Orlovich c511dae590 Collect validity information on dependencies we collect.
(Will be used to verify preload hint URLs, but isn't yet)
2016-08-29 16:10:28 -04:00
Jeff Kaufman 7f44c27b6b pagespeed-libraries: add jqueryui 1.12.0 2016-08-29 11:46:18 -04:00
Jeff Kaufman c60c641b60 locking cleanup: convert SharedMemCache to use ScopedMutex 2016-08-29 11:45:51 -04:00
Egor Suvorov 6ab400cfc9 Add configurable timeout for all RedisCache operations. 2016-08-29 11:23:25 -04:00
Steve Hill 6d17fedfed Make InstawebHandler cleanup its driver by default. 2016-08-29 10:49:24 -04:00
Maks Orlovich 5805a9b88b Fix inflating fetch keeping the compressed(!) content-length
after it gunzip'd its input. Suspect this is the root cause for
travis flakiness.
2016-08-26 16:10:08 -04:00
Steve Hill bc316c2689 Change CreateCentralController to return a managed pointer 2016-08-26 13:31:22 -04:00
Joshua Marantz 224f364f47 Refactor the way the sed replacements are constructed for hacking
debug.conf.template into pagespeed.conf, using gmake functions.  Add an
ending delimiter to all the sed-patterns for customizing the
configuration templates.

The refactoring reduces slightly the number of times we must repeat
stanzas involving OPT_* et al in our makefiles.  More reductions are
needed.

The ending delimeter (\b) solves a problem where the pattern "#REDIS"
was a substring of "#REDIS_LOADTEST", and sed would break the template.
To work around this problem I used "#RED_LOADTEST" but now you don't
find that variable with a csearch for "REDIS".
2016-08-25 18:55:55 -04:00
Steve Hill fba6fb2915 Add missing gyp changes for gRPC 1.0/protobuf 3.0 2016-08-25 17:14:47 -04:00
Steve Hill e6b0b62669 Use CURL for non-local stats test.
Hopefully will improve error messages with flakes.
2016-08-25 16:29:37 -04:00
Egor Suvorov 3b434065f0 Hook up statistics for RedisCache.
* Add RedisCache::GetStatus() which prints result of INFO command.
* Add test for GetStatus().
* Make GetStatus() and statistics from CacheStats wrappers around RedisCache available from admin panel.
All Redis-statistics-related stuff should be done in this change.
2016-08-25 16:05:22 -04:00
Jeff Kaufman dfda93522d caching: don't respect vary when cache-extending either
By default we don't respect Vary headers we find on resources.  People who do want us to respect them can set 'RespectVary on' in their configuration.  The cache-extender was not considering the value of the RespectVary option in deciding whether things were cachable, and was instead assuming RespectVary=true.

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1373
2016-08-25 16:04:30 -04:00
Steve Hill 4f222b3946 Upgrade protobuf & gRPC to release versions. 2016-08-25 16:02:03 -04:00
Joshua Marantz f63cc12e9a Allow some more slop in image_rewrite stats checks. There is something
racy about how we are capturing stats in system tests.
2016-08-25 15:30:55 -04:00
Egor Suvorov ac859adc4e Make SystemMessageHandler store FileMessage()s to buffer as well.
* Make AddMessageToBuffer() non-virtual, as nobody ever overrides it.
* Add version of AddMessageToBuffer() which accepts file:line arguments and adds them to the log line stored.
* Use the latter in ApacheMessageHandler.
Nginx side of this change: https://github.com/pagespeed/ngx_pagespeed/pull/1255 .
Related to 3e31b0c5d6.
2016-08-25 14:22:50 -04:00
Steve Hill b029922629 Switch CentralControllerRpcServer to MessageHandler.
LOG() macros don't appear to work.
2016-08-25 13:31:02 -04:00
Jeffrey Crowell fd4fda305d allow gzipped data to be passed back to the user in psx proxy mode
fixup the logic for accepting gzip
2016-08-25 11:12:51 -04:00
Egor Suvorov 3e31b0c5d6 Make log entries by MockMessageHandler::FileMessage() available to MockMessageHandler::Dump().
* Add tests for FileMessage() and Dump().
* Make FileMessage() behave similarly to Message().
2016-08-25 10:13:34 -04:00
Steve Hill 23fb7074ae Add ScheduleRewriteRpcContext. 2016-08-24 15:06:30 -04:00
Egor Suvorov ac79f1fb81 Specify max memory and eviction policy for Redis server in run_program_with_redis.sh 2016-08-24 11:31:28 -04:00
Egor Suvorov 9b5aa2a5cb Add parenthesis inside PS_LOG_* macros definitions. 2016-08-23 18:54:57 -04:00
Steve Hill 7790a7d480 Add ExpensiveOperationRpcContext, the first client side gRPC piece. 2016-08-23 17:08:25 -04:00
Joshua Marantz 784816de4f Add configuration file support for load-testing redis. 2016-08-23 00:48:15 -04:00
Egor Suvorov dc43eed4c3 Introduce TcpServerThreadForTesting::ShutDown(), which serves as destructor.
This method is to be called in subclass' destructor. The goal is to avoid race
condition on vptr between the server thread and destructors who change vptr.
That also guarantees that all member fields of subclass are destructed after
server thread finishes.
2016-08-22 18:22:25 -04:00
Jeff Kaufman a91139ead4 cache: checkpoint the shm cache to disk
Snapshot the SHM cache to disk about every five minutes, and restore on restart.  Stop writing changes to the shm metadata cache through to the file cache.

Nginx side of the change, which includes a system test: https://github.com/pagespeed/ngx_pagespeed/pull/930

(No system test for Apache because what we're testing is completely shared between the two of them and we don't already have restart tests for Apache.)
2016-08-22 14:44:04 -04:00
Jeff Kaufman a01eda70b5 pagespeed-libraries: add angular_material/1.1.0 2016-08-22 14:30:24 -04:00
Egor Suvorov 1b8af53912 Add extra checks for Thread::Join()'s invariants.
* If joinable thread was started, Join() should be called before destructor.
* Join() should not be called more than once.
2016-08-20 20:55:48 -04:00
Maks Orlovich 1bfbb9ffa2 Switch to using EqualsProto in this test, since I want to test even
more fields (which I am about to actually set), and this feels like it
would scale better (and would be annoying to review in main CL).
2016-08-19 15:40:24 -04:00
Egor Suvorov acac4a8bc1 Make TcpServerThreadForTesting emit error messages instead of hanging.
Previously it hanged in destructor if no client has connected.
2016-08-19 10:41:53 -04:00
Maks Orlovich 96938f395e CollectDependenciesFilter: Implement handling of media= at top-level 2016-08-19 10:31:40 -04:00
Egor Suvorov 9ff2d6d012 Make Travis run unit tests for external cache servers as well (#1378) 2016-08-18 16:24:35 -04:00
Egor Suvorov cf06873a88 Refactor SystemRewriteOptionsTest for easier testing of single-integer options. 2016-08-18 13:51:43 -04:00
Egor Suvorov 4a29a19812 Improve install/run_program_with_*.sh scripts.
* Add install/run_program_with_ext_caches.sh script.
* Make install/start_background_server.sh not override SERVER_CMD if one of sanity checks fails, that way it does not break anything if accidentally run after another start_background_server.sh.
* Fix outdated comments in install/start_background_server.sh.
2016-08-18 13:34:38 -04:00
Maks Orlovich a6583c0114 Don't include bogus last_modified = 0 in InputInfo when the resource didn't
have a last-modified header.
(Noticed when storing these in dependencies tables).
2016-08-18 12:40:42 -04:00
Maks Orlovich 0efccd536b Fix crash with !loaded() resources in CSS dependency collection Josh noticed in loadtest. 2016-08-18 10:15:11 -04:00
Maks Orlovich 8fc3a55b19 Change by jefftk:
Add example page for OptimizeForBandwidth mode

See it live at http://modpagespeed.com/optimize_for_bandwidth.html
2016-08-16 17:54:41 -04:00
Maks Orlovich f4d468895c Recombile JS files 2016-08-16 17:53:40 -04:00
Maks Orlovich 0df83712e5 Do CSS indirect dependency collection in CollectDependenciesFilter, not CssFilter.
This is cleaner code-wise, and makes it easier to do additional things like properly order dependencies, have different domain policy for preload hints, etc.
(It's also not as expensive computationally as I first thought, since the CSS parser has code for just parsing imports)
Testcase for this is TEST_F(PushPreloadFilterTest, IndirectCollected)
2016-08-16 17:53:25 -04:00
Egor Suvorov bf4754060d Add RedisReconectionDelay config option.
Previously it was fixed: 1 second.
2016-08-16 17:37:09 -04:00
Jeffrey Crowell ed737aaf69 Update README.md 2016-08-16 14:28:05 -04:00
Egor Suvorov e53bc946e1 Integrate RedisCache into settings and system tests.
Should be done in this commit:
* New configuration variable for enabling single Redis server as cache backend. It should work everywhere where we have Memcache as an option.
* All system and leak tests should run under both Redis and Memcache.
* Unit tests for configuration of Redis (system_caches_test.cc).
* All other hook-ups of existing Redis adapter functionality which are not listed under "will be done in follow-ups" below.

Will be done in follow-ups:
* Full hook-up of statistics for Redis cache, including graphs on admin site (if any).
* Configurable reconnection timeout.
* Load stress tests.
* HTML documentation updates and update of pagespeed.conf.template.
* Features of Redis adapter: support for Redis Cluster, configurable timeouts for operations, MultiGet support, etc.
* Possibly: parse Memcached configuration in the same way, e.g. check correctness during config load, not actual cache start.
2016-08-15 17:25:07 -04:00
Steve Hill 996dcbebaf RpcHandler for ExpensiveOperationController. 2016-08-12 14:00:05 -04:00
Steve Hill 9c95920a9a Merge Otto's comment from https://github.com/pagespeed/mod_pagespeed/pull/1374 2016-08-12 13:56:11 -04:00
Steve Hill ebb8308c6d Add DomainLawyer test for origin URL suffixes 2016-08-12 13:54:37 -04:00
Egor Suvorov 40d9ea8f09 Remove CACHE_STATISTICS preprocessor macro, assuming it's always 1.
It was added in 2012 and we decided that it's not required anymore.
2016-08-11 18:49:43 -04:00
Egor Suvorov 54b2f9fa85 Add auto-reconnection to RedisCache and fix TcpServerThreadForTesting::PickListenPortOnce
* Connect() is not available, use newly introduced StartUp().
* StartUp() tries to connect and enables reconnections until ShutDown().
* Reconnection is done inside Get/Put/Delete - either instantly after communication failure, or after some delay if last reconnection attempt did not succeed.
* IsHealthy() returns true when reconnection becomes possible to make the caller call Get/Put/Delete and initiation reconnection.
* TcpServerThreadForTesting::PickListenPortOnce now picks a specific port.
2016-08-11 12:23:38 -04:00
Egor Suvorov f9c8b87073 Move SystemCachesTest.HangingMultigetTest to AprMemCacheTest
This test does not really test anything from SystemCaches. Also done:
* Refactor out BlockingCallback from SystemCachesTest to a separate file so
it can be used both in system_caches_test and  apr_mem_cache_test.
2016-08-11 11:56:30 -04:00
Otto van der Schaaf 3db287fdd4 Remark we should use RewriteOptions::AddProperty for future options. (#1374)
Discussed via https://github.com/pagespeed/ngx_pagespeed/pull/1239/files/e51aeefab261f755018ea4325cf27068d72b1785#r74164403

Associated to https://github.com/pagespeed/ngx_pagespeed/pull/1239
2016-08-10 20:44:54 +02:00
Jeffrey Crowell 6c504ea742 Update .travis.yml 2016-08-09 17:44:32 -04:00
Jeffrey Crowell 5683c210e6 update travis-ci to send emails groups don't work 2016-08-09 17:44:20 -04:00
Jeffrey Crowell c562415255 sync genfiles 2016-08-09 15:03:06 -04:00
Jeffrey Crowell 68d21a1f8c update boringssl to sync with chrome 52 2016-08-09 15:03:06 -04:00
Egor Suvorov f56fb2cec1 Pin boringssl version, because @chromium-stable moved and builds broke. 2016-08-08 16:25:01 -04:00
Egor Suvorov 3f89fe2111 Check that thread was not started before in ThreadSystem::Thread::Start. 2016-08-08 13:18:15 -04:00
Steve Hill 888d2e6643 Add RpcHandler for ScheduleRewriteController. 2016-08-08 11:23:09 -04:00
Steve Hill 626c985567 Move grpc/alarm.h into grpc_server_test.h
Fixes https://github.com/pagespeed/ngx_pagespeed/issues/1237
2016-08-08 10:47:59 -04:00
Steve Hill 4aa8e3d267 Create a .cc file for GrpcServerTest::listen_port_ 2016-08-05 14:35:23 -04:00
Egor Suvorov 7a8d8ff452 Refactor system_caches_test.cc so it'll be easier to add Redis tests
* Introduce a SystemCachesExternalCacheTestBase fixture which holds tests (in a
  form of tests helpers) that are common for memcached and Redis. It also holds
  virtual functions which configure either server.
* All non-memcached specific tests are moved to that fixture with cut-paste.
* Implement SystemCachesMemCacheTest so that all old tests are run with memcached.
2016-08-05 12:03:01 -04:00
Maks Orlovich 244ea2561e Make dedup_image_filter work in cases where we generate IDs:
don't produce duplicate IDs for all the duplicates.


Should address
https://github.com/pagespeed/mod_pagespeed/issues/1369
2016-08-04 16:12:12 -04:00
Jeff Kaufman 7fd66dc92c rewrite-options: don't turn on CoreFilters just because of query params
Fixes an nginx-only bug: https://github.com/pagespeed/ngx_pagespeed/issues/1190

ngx_pagespeed side of the change:
  https://github.com/pagespeed/ngx_pagespeed/pull/1228
2016-08-04 11:25:15 -04:00
Jeffrey Crowell a715c52783 Only strip the content-encoding headers in ipro recorder if it is safe
to
ignore them (eg. don't drop Content-Encoding: gzip if the content is
actually
gzipped).

fixes #1371

add two small checks to ipro recording gzipped content tests
2016-08-03 16:45:29 -04:00
Jeffrey Crowell fe60deb209 upgrade brotli library 2016-08-03 16:45:29 -04:00
Jeff Kaufman 922b7e757f rewrite-domains: apply to static assets
ngx_pagespeed side of the change: https://github.com/pagespeed/ngx_pagespeed/pull/1223

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1350
2016-08-02 15:51:40 -04:00
Jeff Kaufman 6a3fed6641 caching: remove min_cache_ttl_ms option
We added an experimental option to extend the cache lifetime of
resources that explicitly set a TTL below our minimum.  It looks to me like this
can be retired now that the experiment is done.

The option was never exposed in open source, so it's safe to fully remove it.
2016-07-28 06:38:04 -04:00
Jeff Kaufman 06323ab4f9 insert-dns-prefetch: test against gstatic 2016-07-28 06:33:18 -04:00
Jeff Kaufman 8d4d798a9a compiled-javascript: updated to closure compiler v20160713 2016-07-27 09:52:58 -04:00
Jeff Kaufman eb6f7cf1eb closure-compiler: unbreak builds
In 89efe99ad we changed the way we downloaded the closure compiler to switch
to using a tagged release, but the JAR file you get with a release has a
different filename.  Update closure/download.sh to expect the new filename
format.
2016-07-27 09:50:27 -04:00
Steve Hill 89efe99ad5 Update closure to v20160713. 2016-07-26 14:38:18 -04:00
Steve Hill 3088e26a63 Add RpcHandler for dealing with gRPC clients. 2016-07-26 14:31:27 -04:00
Jeff Kaufman 6707ec8cfd pagespeed-libraries: added angularjs 1.2.30 and 1.5.8 2016-07-26 08:40:58 -04:00
Egor Suvorov aa85223f2e Make RedisCache thread-safe. 2016-07-25 15:17:58 -04:00
Maks Orlovich 0535204985 Support srcset in CacheExtender as well. 2016-07-25 13:45:10 -04:00
Maks Orlovich e005e5cfb6 Rollback CSS parser changes, as other clients need to be updated to them. 2016-07-25 11:44:33 -04:00
Maks Orlovich c9c48bb542 Update of JS to some API changes and regen'd.
(Export of change from a colleague involved in this stuff)
2016-07-25 11:44:03 -04:00
Jud Porter 31c4141c49 Prepare for goog.dom.TagName type change. 2016-07-25 09:25:53 -04:00
Egor Suvorov 7f6b088fb6 Fix #1351: Make AprMemCacheTest and RedisCacheTest tests independent from each other
* Add FlushAll() public method to RedisCache and call it right after connecting to server in RedisCacheTest
* Add CacheKeyPrepender wrapper for CacheInterface
* Make AprMemCache add prefixes to all keys added to Memcached. Prefix right now is simply a test case + test name. Flushing Memcached requires us to further modify our apr_memcached fork, which we decided to avoid.
2016-07-22 15:08:54 -04:00
Jeff Kaufman c15bc21fcd system-tests: give more information when fetch-until fails
When debugging system test flakes that manifest as fetch_until timeouts it's
helpful to have the failed input to fetch_until available in the failure
message, because that's what people put in bug reports (and is all that's
available on blaze).  This change makes fetch_until print:

  Fetched file: 681 bytes (
  ... contents of fetch file ...
  )

on timeouts.  If the fetched file is binary we just dump the first 256 characters, as hex, along with how big it is and its guessed mime type:

  Fetched file: 98051 bytes, image/jpeg; charset=binary (
  00000000: ffd8 ffe0 0010 4a46 4946 0001 0100 0001  ......JFIF......
  00000010: 0001 0000 ffdb 0043 0005 0304 0404 0305  .......C........
  00000020: 0404 0405 0505 0607 0c08 0707 0707 0f0b  ................
  [snip]
  000001f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  ...
  )

Inspired by https://github.com/pagespeed/mod_pagespeed/issues/1359
2016-07-22 09:09:07 -04:00
Egor Suvorov 3b99f98008 Add more tests and improve logging in RedisCache
* Logging is now performed with MessageHandler
* Log errors in Put and Delete as well
* Refactor some common errors handling patterns in shared method
2016-07-21 19:34:46 -04:00
Egor Suvorov 675c24d2f4 Add InMemoryCache implementation and tests (partially in 74e2f95)
InMemoryCache is a maximally simple implementation of cacheInterface,
for debugging and faking purposes.

This changelist is more for me (Egor) to get feedback than to actually submit the
code into Piper, because I doubt there are any direct applications. The goal is to ensure that I understand what it's going on in caches and that I haven't missed anything important.
2016-07-21 16:03:06 -04:00
Egor Suvorov 2e44c630db Refactor run_program_with_memcached.sh and run_program_with_redis.sh
* Shared code now lives as a helper script named run_program_with_server.sh.
* No special `-multi` mode anymore: all arguments are passed directly to `eval` and invoked as if they were typed inside the script. Essentially it enables `-multi` by default. We were not using it anywhere except abandoned experimental branch anyway, so it's ok to break backwards compatibility.
2016-07-21 15:47:26 -04:00
Jeff Kaufman 2c4aad05fe system-test: fix 'url-valued stylesheet attributes' flake
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1356
2016-07-21 15:20:58 -04:00
Jeff Kaufman 74e2f9554c cache-cleaner: run only one copy of the cache cleaner at once
Without this CL, if the cache cleaner runs for more than the interval
at which we start cache cleaning, the second run would see the first's
lock as stale and begin another run.  This CL makes the cleaner touch
its lock file every N (=1000) operations so that a cleaner that's still
making progress won't have its lock broken.

Because a big chunk of cache cleaning is one call to GetDirInfo that
does a huge recursive search, I had to extend GetDirInfo's API to
so you can pass in a callback for between FS operations.

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1337
2016-07-21 14:42:45 -04:00
Maks Orlovich 45243747e6 Implement parsing of CSS3 pseudo-classes with arguments. 2016-07-19 10:35:37 -04:00
Jeff Kaufman 2c6d3c60a5 json: stop changing the content type on ipro'd json files
nginx side of the change: https://github.com/pagespeed/ngx_pagespeed/pull/1224

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1321
2016-07-18 11:15:19 -04:00
Jeff Kaufman ecfdcc8d94 pagespeed-libraries: added dojo 1.8.9, 1.7.10, 1.8.11, 1.8.12, 1.9.8, 1.9.9, 1.10.5, 1.10.6, 1.11.1, 1.11.2 2016-07-18 11:14:04 -04:00
Steve Hill 087f0ed7bb Add MatchesProto testing predicate. 2016-07-15 12:32:03 -04:00
Jeff Kaufman b8aa5b4efa cache-cleaning: allow people to turn it off
Support 'FileCacheCleanIntervalMs -1' to turn off cache cleaning.

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1343
2016-07-14 13:13:37 -04:00
Maks Orlovich 6ff9ecd394 Make sure not to call PthreadSharedMem::Terminate() --- and other "we're done,
delete all the statics" --- code earlier than ~ApacheRewriteDriverFactory,
which includes ShutDown and code calling PthreadSharedMem::DestroySegment,
as otherwise it will spam logs with warnings about "Attempt to destroy unknown
SHM segment"
(ref https://github.com/pagespeed/mod_pagespeed/issues/1349)
2016-07-13 13:37:22 -04:00
Steve Hill 87a01b9e92 Replace DummyController with CentralControllerRpcServer.
Currently this starts a gRPC server but doesn't actually handle any events yet.
2016-07-12 17:01:11 -04:00
Jeff Kaufman 099329f561 beacons: allow people to choose how long beacons are valid for
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1311
2016-07-12 16:30:16 -04:00
Jeff Kaufman a0c46bd44d pagespeed-libraries: add jquery 3.1.0 2016-07-12 16:29:15 -04:00
Jeffrey Crowell ee4764715b add jenkins badge to README.md 2016-07-12 16:09:34 -04:00
Maks Orlovich c7e641b828 Fix flattening with @font-face.
(Reported in https://github.com/pagespeed/ngx_pagespeed/issues/1222)
2016-07-12 16:05:22 -04:00
Egor Suvorov 28a6a81341 Add redis-server to .travis.yml install section 2016-07-12 14:44:00 -04:00
Egor Suvorov 0b7fb5e12a Add first naive implementation of Redis implementation of CacheInterface
* Add hiredis to dependencies and write .gyp for it
* Add run_program_with_redis.sh (copied from run_program_with_memcache.sh)
* Add RedisCache and one simple unit test for it

Things to do:
* Add more tests
* Add configuration variables for Redis cache so it can be enabled
* Understand purpose of memcache-related flags and variables in test Makefiles
  and ensure Redis has same, if needed
2016-07-12 14:40:44 -04:00
Jeffrey Crowell 7502b5856c rm unused generate_grpc_gyp script 2016-07-12 14:17:38 -04:00
Jeffrey Crowell 3be157c6b9 add grpc.gyp so that grpc will actually build 2016-07-12 14:17:04 -04:00
Jeffrey Crowell c7d0c2ea9e update grpc to 0.15
0.15 supports the MANYLINUX and will build on centos5
2016-07-12 14:15:28 -04:00
Maks Orlovich 02de03e825 Merge straightforward forwarding of flushes in ProxyFetch from Otto's
https://github.com/pagespeed/mod_pagespeed/pull/1336
The tests are tweaked slightly to work with fcgid on Apache and some additional
test environments.
2016-07-12 12:15:49 -04:00
Jeff Kaufman 8184c8f99f dns-prefetch: whitelist Safari 6+
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1348
2016-07-11 13:21:32 -04:00
Jan-Willem Maessen caafe1c175 Fix FastWildcardGroup bug. We insert all-wildcard patterns in *reverse* order,
and should match them forwards as a result.  Add a couple of tests beyond
Steve's initial repro.

https://github.com/pagespeed/mod_pagespeed/issues/1294
2016-07-08 14:28:41 -04:00
Maks Orlovich ef83c507c9 Provide URL information in image filter debug messages. 2016-07-08 12:54:49 -04:00
Egor Suvorov 727d5f75ce Test that LRU cache works as expected when marked "unhealthy" 2016-07-07 16:21:51 -04:00
Maks Orlovich 83aec21bf9 Teach CssFilter to report dependencies on @import'ed stylesheets. 2016-07-07 15:45:44 -04:00
Jeff Kaufman d33c56075f insert-ga: accept dc.js as a synonym for ga.js
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1338
2016-07-07 11:11:37 -04:00
Jeff Kaufman 703060b318 inliners: don't inline gzipped text
If what we're going to inline into CSS or JS starts with the gzip magic
bytes (file signature) then it's very likely to be gzipped and very
unlikely to be valid CSS or JS, so we should abort the inlining.

Fixes the amount of https://github.com/pagespeed/mod_pagespeed/issues/1307
that I could repro.  If we later see mangling files in-place (or combining)
then we can extend this.
2016-07-06 10:08:28 -04:00
Maks Orlovich a2eb16e363 Improve how srcset locations are described in text.
(These show up in debug logs --- I was expecting them to show up
 in debug comments as well, and while that didn't work out, no reason
 not to keep this).
2016-07-01 14:00:50 -04:00
Jeffrey Crowell afa1852e37 add fortify source to the cflags and cxxflags
closes https://github.com/pagespeed/mod_pagespeed/issues/1301
closes #1301
2016-06-30 12:20:13 -04:00
Maks Orlovich 428b7e044e Basic support for rewriting <img srcset> 2016-06-29 17:48:59 -04:00
Jeff Kaufman 8ab12c589a system_test: reorder tests to keep simple ones first 2016-06-28 12:57:44 -04:00
Steve Hill 08e7b80360 SerfUrlAsyncFetcher should not spin on EAGAIN from read and generally
correctly handle errors.
2016-06-27 17:01:09 -04:00
Maks Orlovich d43f40b3c7 Merge hop-by-hop handling improvements by Otto van der Schaaf:
* Adds Connection: to the list of headers that contain fields separated by ","
* Marks Alt-Svc and Alternate-Protocol as hop-by-hop, so we will treat them as such.
* Adds sanitization of headers marked as hop-by-hop in Connection: headers as per rfc.
* Moves initialization of 'AtExitManager' out of the css filter to the more central ProcessContext as this change adds another dependancy on it -- and we must initialize it exactly once.
* Changes the header definitions to be lazy initialized to avoid extra allocations when manipulating headers, while avoiding static initialization.
(From https://github.com/pagespeed/mod_pagespeed/pull/1195)
2016-06-27 14:40:18 -04:00
Jeff Kaufman 490e4cf480 preloading: switch defer_js to rel=preload
defer_js was using Image objects to preload scripts for WebKit in a way that is
harmful in modern browsers.  Currently this isn't actually needed in Chrome,
since the preload scanner already finds our deferred scripts, but Chrome is
thinking of removing that [1].  This change switches us to the new standard,
rel=preload, which we will need once Chrome updates its scanner not to preload
things with invalid type attributes.

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1054

[1] https://bugs.chromium.org/p/chromium/issues/detail?id=623109
2016-06-27 14:21:25 -04:00
Jeff Kaufman 68cbc68c91 preload: strip existing rel=preload hints
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1327
2016-06-27 14:20:31 -04:00
Huibao Lin 31fd972a4e Add tests for the size of rewritten PNG/JPEG images 2016-06-27 11:20:44 -04:00
Joshua Marantz 50d3e18f9d sync for internal tweaks 2016-06-27 09:29:40 -04:00
Joshua Marantz 4f3957d698 Loosen up some of the size threshold comparisons to be slightly less
brittle to changes in webp's compressor.
2016-06-27 09:00:06 -04:00
Jeff Kaufman 3d10186215 url-valued-attributes: support css
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1324
2016-06-27 08:17:07 -04:00
Joshua Marantz c8dc73fec4 Also add 'public' to non-private cache-control if request has
via:*google*.

Completes the fix to
https://github.com/pagespeed/ngx_pagespeed/issues/1149

A challenge here is to make sure we test all the egress points, e.g.
  - pagespeed resources: cached and reconstructed on demand
  - fallbacks of various sorts
  - ipro resources: cached and reconstructed on demand
  - loaded from LoadFromFile
also we must make sure we don't cache the 'public' based on the request
headers.
2016-06-26 23:41:26 -04:00
Steve Hill dfdd05ad64 Add test that verifies SerfUrlAsyncFetcher spams read on a hanging
socket.
2016-06-24 14:10:08 -04:00
Jeff Kaufman 65ba39467c image-inline: add missing test file
followup to 95f7f4dc
2016-06-23 13:43:59 -04:00
Jeff Kaufman 95f7f4dcca image-inline: don't inline shortcut images
Because shortcut images don't block page rendering and generally aren't that important the tradeoffs are different for them, and we shouldn't inline them.

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1022
2016-06-23 07:10:01 -04:00
Jeff Kaufman edf58c5114 pagespeed_libraries: added angular 1.4.12 2016-06-23 07:02:29 -04:00
Huibao Lin 34dc740acf Enforce "must_reduce_bytes" options in image optimization 2016-06-22 15:01:16 -04:00
Jud Porter 4f1c8cdda8 Add three dot help button. 2016-06-22 13:47:23 -04:00
Maks Orlovich 6f403aa6c5 Hopefully fix the flake in SimpleBufferedApacheFetchTest.Success flake jcrowell noticed
on Travis. "Hopefully" since I can't reproduce it, so while I understand the logic of events,
I can't exclude dumb typos.
(https://github.com/pagespeed/mod_pagespeed/issues/1322).
2016-06-22 10:59:32 -04:00
Huibao Lin 991c09faca Merge branch 'master' of github.com:pagespeed/mod_pagespeed 2016-06-21 16:59:13 -04:00
Huibao Lin aaaa00bb67 Reformat code 2016-06-21 16:57:30 -04:00
Joshua Marantz 35ce47fed9 Add a method to add 'public' to response-headers if via:*google is
present in request-headers.
2016-06-21 16:45:41 -04:00
huibao@google.com 52e9b34abe Regold image size 2016-06-21 14:27:36 -04:00
Steve Hill 66d8196524 Create TcpServerThreadForTesting and re-factor FakeMemcacheServerThread to use it. 2016-06-21 14:24:35 -04:00
Jeffrey Crowell eafbee00d6 add dependencies for php-cgi to .travis.yml 2016-06-17 17:20:58 -04:00
Jeffrey Crowell 4b7e84a84e add gce_public_cache.sh system test 2016-06-17 16:31:02 -04:00
Jeffrey Crowell c1e4d1eba4 sync genfiles 2016-06-17 14:24:16 -04:00
Jeffrey Crowell 5409b6df33 update brotli to 0.5.0 2016-06-17 14:23:25 -04:00
Steve Hill 9d76d90828 Add thread-safety annotations to SerfUrlAsyncFetcher. 2016-06-17 14:00:24 -04:00
Joshua Marantz 6d81e8054f Propagate 'cache-control:public' from inputs to outputs.
Partially fixes https://github.com/pagespeed/ngx_pagespeed/issues/1149

General strategy:
 - adjust general mechanism for computing output response header from input response headers
   to incorporate 'public' on input.

A challenge here is to make sure we test all the egress points, e.g.
  - pagespeed resources: cached and reconstructed on demand
  - fallbacks of various sorts
  - ipro resources: cached and reconstructed on demand
  - loaded from LoadFromFile
2016-06-16 09:55:51 -04:00
Joshua Marantz 8f6e4d4b4b Tweak google-maps URL slightly. Library update. 2016-06-15 21:54:08 -04:00
Joshua Marantz d67bc4f4ce Generalize the expected results to allow error message variation
depending on implementation rev.
2016-06-15 21:52:37 -04:00
Joshua Marantz f602d42ebd peleyal : Fixes a CSS bug found during testing:
.article__header .article__header
{ {
max-width: 82vw; ===> << NOTHING, IT WAS REMOVED >>
} }
2016-06-15 21:50:49 -04:00
Huibao Lin 33b5b25ad8 Regold size of the rewritten WebP images 2016-06-15 09:54:56 -04:00
Maks Orlovich 5f6ff53690 Fix flattening when something imported as @import "foo" all;
is included in something w/o explicitly restricted media.
Key thing to note here: empty media_ means everything, and we're doing
intersection, so there is a room for confusion between nothing and
everything.
2016-06-10 16:26:56 -04:00
Steve Hill 36c29fd768 Re-factor ControllerManager to accept an interface that specifies behavior. 2016-06-10 14:54:17 -04:00
Steve Hill 4510f84822 Allow error writer to actually be set for collecting css minify errors. 2016-06-10 13:52:40 -04:00
Huibao Lin 757be8dd83 Regold data for image_optimizer_test 2016-06-09 14:40:10 -04:00
Joshua Marantz 6b0cd0c3aa Finish checking in system-test changes for htaccess overrides of disallow. 2016-06-02 10:11:49 -04:00
Joshua Marantz 44a09a745f Merge branch 'master' of github.com:pagespeed/mod_pagespeed 2016-06-02 09:56:01 -04:00
Joshua Marantz 4d3acd9cd3 Add testing for htaccess overrides with Disallow/Allow. 2016-06-02 09:55:14 -04:00
Maks Orlovich e3c7bc9161 Don't require URLs to be on proxy domain when using an input-only proxy extent
UrlNamer. Should fix some CHECK failures I saw in measurement mode, due to us
being unable to fetch our own OutputResources.
2016-06-02 09:46:50 -04:00
Maks Orlovich 5c48690979 Fix build with -O2 on gcc-4.8; it was complaining about potentially
unitialized image_format.
2016-06-01 15:26:29 -04:00
Jeffrey Crowell 467bb4cc80 sync genfiles 2016-06-01 14:31:57 -04:00
Jeffrey Crowell b85b60d79d update boringssl gypi and asm routines from latest chromium stable.
fixes build.
2016-06-01 14:31:16 -04:00
Joshua Marantz 0a938a174e Don't print out info messages about the size not changing. 2016-06-01 11:08:16 -04:00
Huibao Lin 1d2efe0b05 Add ImageOptimizer which applies all optimizations to all image formats 2016-05-31 16:26:55 -04:00
Maks Orlovich f4562ad914 Rename kProcessScope -> kLegacyProcessScope to make it less likely it
would be used by mistake in new code. (Also needs nginx to be updated..)
2016-05-30 12:51:41 -04:00
Jeffrey Crowell ca56590649 pull depot_tools from chromium git instead of svn 2016-05-25 11:32:27 -04:00
Jeffrey Crowell 9206b14768 build with -j3 on travis so we don't take up so much time. 2016-05-25 10:30:52 -04:00
Jeffrey Crowell 971c51256d add php to the travis tests
tests were enabled in cd2cf872db
2016-05-24 16:23:56 -04:00
Steve Hill cd2cf872db Require DISABLE_PHP_TESTS instead of auto-disabling if PHP is broken. 2016-05-24 15:35:32 -04:00
Jeffrey Crowell e1db59e69d sync pagespeed_libraries.conf
pull in latest jquery
2016-05-24 14:24:16 -04:00
Jeffrey Crowell c0c4c8e024 Update README.md 2016-05-24 14:22:07 -04:00
Jeffrey Crowell 3d38507f15 send webp to pagespeed insights.
insights can render webp, but doesn't advertise Accept: image/webp we
can send webp for benchmarking purposes though.
2016-05-24 14:18:38 -04:00
Huibao Lin 38d8a01e6b Refactor utilities for testing images 2016-05-24 11:28:57 -04:00
Huibao Lin c374f48e6f Move and refactor the method for comparing animated images 2016-05-24 09:15:29 -04:00
Maks Orlovich 53fcf10b32 Implement proper ProxyMode and IsProxyEncoded in MeasurementProxyUrlNamer;
otherwise we end up rejecting combine + rewrite CSS URLs. As part of this,
split ProxyMode semantics into two pieces: the decoding bit (which we want),
and the part that forced absolufication (which we don't want here, but other
applications do).
2016-05-23 16:48:45 -04:00
Maks Orlovich 020028e72b Remove workaround in computing of central controller port,
now we can consistently pull it out of default_options()
2016-05-20 13:25:32 -04:00
Maks Orlovich 4f657b9298 Always parse process config into RewriteDriverFactory::default_options,
and then sync it back to per-ServerContext options. Should fix the
 regression with ImageMaxRewritesAtOnce
(https://github.com/pagespeed/mod_pagespeed/issues/1305)
and give RewriteDriverFactory and all the ServerContexts a
consistent view of their value.
2016-05-19 16:58:05 -04:00
Joshua Marantz 985bb49b2b Show more detail in log on brotli errors (eustas) 2016-05-18 08:47:14 -04:00
Maks Orlovich faaf624ff9 Give the measurement proxy option proper scope; it's not for
<Directory> use (doesn't do anything there anyway).
2016-05-17 12:21:49 -04:00
Maks Orlovich 6f90e5988e Rollback removal of config info from MeasurementProxyUrlNamer.
Turns out I need it to properly implement IsProxyEncoded.
2016-05-17 11:23:55 -04:00
Joshua Marantz 2e8eb00efb Undo previous errant commit of a stale file. 2016-05-16 17:31:02 -04:00
Joshua Marantz 6ccb1a06d3 Library updates. 2016-05-16 14:00:29 -04:00
Joshua Marantz 246ad99d82 More Makefile.tests changes that didn't make it into the last git commit. 2016-05-16 13:59:11 -04:00
Joshua Marantz e7de969108 setup the doc root before running vm_system_tests. (#1310) 2016-05-16 13:32:29 -04:00
Steve Hill 501967bd03 Fix verify_nginx_release.sh to work on our 32-bit buildbot. 2016-05-13 13:02:41 -04:00
Jeffrey Crowell 651a2503f8 move the gyp dependency to pull from chromium git. 2016-05-13 11:32:20 -04:00
Joshua Marantz a72248c760 Use full paths in ln -s and in cp -r, rather than using the cd-command-chain. (#1309) 2016-05-13 09:34:38 -04:00
Joshua Marantz 2bfd7fb24b Test purging of ipro-rewritten resources. This previously worked in (#1306)
Apache, but only today was fixed in ngx_pagespeed on 5/11/16, in
https://github.com/pagespeed/ngx_pagespeed/pull/1193

To test a fix to this bug, I need to alter files in the htdocs
directory during the test.  This is source-controlled.  We were doing
this before with mod_pagespeed_test/cache_flush but somehow getting
away with it (or just getting lucky with timing).  But this is really
a bad practice.

So in this pull-request I also change the infrastructure to simply copy
the cache_flush/ and purge/ subdirectories to htdocs/.  The rest of the
directories get symlinked.

This must be committed alongside https://github.com/pagespeed/ngx_pagespeed/pull/1197
2016-05-13 08:44:20 -04:00
Maks Orlovich ae3b2254a6 Wire through one of the install dirs, so our test scripts
works with non-standard install dirs.
2016-05-11 09:38:25 -04:00
Maks Orlovich 8309390c8d Prevent controller/babysitter from running twice by explicitly
dropping our fd reference to it when the ApacheRewriteDriverFactory[1] is
destroyed, so it doesn't hang around between the runs.
This also ensures that we exit if we get cleaned up, even if there are
some httpd children hanging around for some reason keeping the fd alive ---
seems to happen with leftover php-cgi processes for me when doing smoke tests
with 2.4, which ends up wedging as we loop waiting for the processes to exit

[1]  We don't want to do it like that for SystemRewriteDriverFactory, since
that can get hot-destroyed when reloading config, as tests verify.
2016-05-10 15:55:02 -04:00
Maks Orlovich e5184f1e92 Change by eustas: added a TODO note. 2016-05-10 12:05:13 -04:00
Maks Orlovich 9cf8d32b81 Update font inlining test for changes in the service: looks like it requires newer Chrome
version for woff2 support now.
2016-05-10 12:04:23 -04:00
Maks Orlovich 0e25c27eb0 Cleanup some unused state from MeasurementProxyUrlNamer now it's clear the
responsibility that would need it will be in MeasurementProxyRewriteOptionsManager.
2016-05-09 10:45:51 -04:00
Maks Orlovich 5ad68c28b0 Initial integration of measurement proxy mode. 2016-05-05 13:22:58 -04:00
Steve Hill 5ff19f7103 Add stub grpc-enabled proto file. 2016-05-04 18:01:35 -04:00
Jeffrey Crowell b11df43b7f change from @morlovich Add streaming to SimpleBufferedApacheFetch. Also make it
possible to turn on proper flushing for FullProxy mode to make this
actually useful.
2016-05-04 17:19:55 -04:00
Jeffrey Crowell 2311fc5d38 change boirngssl to track from chromium stable 2016-05-04 16:48:33 -04:00
Maks Orlovich a955b950da Cleanup: remove unused include (upstream merge) 2016-05-04 14:59:12 -04:00
Maks Orlovich 1a32fcee5e Config decoder for measurement proxy mode.
Also fix the decoder to actually authorize fetches of things it decoded.
2016-05-04 14:58:47 -04:00
Steve Hill 501345d634 Re-factor protoc.gypi to be less messy 2016-05-03 17:05:56 -04:00
Steve Hill 0bb891d49e Break protoc target into protoc and protoc_lib.
Removes unnecessary iOS build target which would have make this change
a lot messier.
2016-05-02 16:56:11 -04:00
Jeffrey Crowell 3739a09e30 Update README.md 2016-05-02 13:59:09 -04:00
Maks Orlovich 270fd8f27d Add forgotten "override" 2016-05-02 10:42:32 -04:00
Maks Orlovich f8b678c96d TSAN pointed out that detached ThreadSystem::Thread's that 'delete this' in
their Run introduce a race with Start (since that stores started_). Change
this test to just join and cleanup manually.
2016-04-29 15:00:33 -04:00
Steve Hill 12cbd6c00a Add CentralControllerPort option. 2016-04-28 15:47:33 -04:00
Maks Orlovich 85f7eb513a Basic infrastructure for a mode in which MPS acts as a proxy for all requests.
Not really intended as end-user feature at this point, mostly meant for
some measurement experiments we want to do.
2016-04-28 14:47:34 -04:00
Joshua Marantz 07c1fcc170 This is an attemped unit-test repro of
https://github.com/pagespeed/mod_pagespeed/issues/1294

The unit test works properly, so there is no code change in this commit.
The bug remains outstanding.
2016-04-27 09:13:13 -04:00
Maks Orlovich 0544579b75 Basic UrlNamer for measurement proxies.
Not connected to anything yet, but unit-tested.
2016-04-26 15:22:16 -04:00
Steve Hill 56e31dee1a Make check_ipro_s_maxage much quieter in tests. 2016-04-22 16:35:05 -04:00
Maks Orlovich e189453005 Remove essentially unused parameter from UrlNamer::Decode 2016-04-21 14:45:14 -04:00
Maks Orlovich 682dfb272e Update library index 2016-04-21 14:44:41 -04:00
Maks Orlovich 44a8eeb46a Add a stats prefix to ProxyInterface.
This is because I want to use it under an ultra-optional flag in MPS, but the default
stat names (e.g. all-requests) would be quite confusing for something that won't be
turned on by most people.
2016-04-20 16:41:34 -04:00
Maks Orlovich 9783244e9e A primitive push/preload filter. No smarts, just pushes it all! 2016-04-18 17:04:18 -04:00
Steve Hill aceda00f28 Flatten experiment variant to int for ga.js.
If experiment variant is not an int, inject JS comment with a warning.
2016-04-18 14:23:26 -04:00
Maks Orlovich a2c9b9356d Export internal unused-includes cleanup 2016-04-18 13:59:29 -04:00
Maks Orlovich 9478c5a132 Very basic filter to collect direct dependencies.
(For potential push/preload use)
2016-04-18 13:59:15 -04:00
Maks Orlovich b49066f7fb Change by jcrowell: Prep for new package signing key. 2016-04-18 13:58:54 -04:00
Maks Orlovich 257a8a9ce0 Update library index 2016-04-18 13:55:18 -04:00
Maks Orlovich 5f5afd35dc Change by Huibao: Fix the description for ImageMaxRewritesAtOnce 2016-04-18 13:55:05 -04:00
Jeffrey Crowell 7e50351584 proactively kill listeners on remote config ports
prevents system flakes due to listeners that are still up from previous
runs
2016-04-12 15:42:48 -04:00
Jeffrey Crowell 3121d5edc4 sync genfiles 2016-04-12 15:42:17 -04:00
Jeffrey Crowell b43d685c72 Update README.md 2016-04-12 14:47:47 -04:00
Joshua Marantz 7d441cee06 Add missing file. 2016-04-11 22:12:07 -04:00
Joshua Marantz ffbd5a3047 Filter to add a <link rel=amphtml> tag to a page.
Motivating use-case: for Triton, we want the web page
  www.example.com/a/b
to include the tag:
  <link rel=amphtml href="https://project123.appspot.com/a/b/amp">

and
  www.example.com/a/b/
to include the tag:
  <link rel=amphtml href="https://project123.appspot.com/a/b/amp/">

This is enabled by setting the PSS options:

EnableFilter InsertAmpLinkFilter
AmpLinkPattern
"https://project123.appspot.com${path_no_trailing_slash}/amp${maybe_trailing_slash}${maybe_query}

This is from sjnickerson@google.com
2016-04-11 21:35:59 -04:00
Maks Orlovich c512a65f78 Separate out InputInfo from CachedResult, so I can have dependency
chain of CachedResult -> Dependencies -> InputInfo and can then
safely have a Dependencies in CachedResult, rather than a cycle.
This is needed for kind of dumb reasons, though: normal RewriteContext
operation forces things to go through CachedResult while I really only
want to run on the slot chain, but it doesn't seem worth a major refactor
to avoid that.

Note: resource_tag_scanner_test.cc should go with previous commit,
input_info.proto with this one.
2016-04-11 14:47:48 -04:00
Maks Orlovich ea3b78c7b6 Change by jefftk: Add support for rewriting data-src atttribute on images 2016-04-11 14:20:22 -04:00
Steve Hill b16ecaf83c Fix QueuedExpensiveOperationController to correctly support unlimited and zero
permitted operations.
2016-04-08 18:53:53 -04:00
Jeffrey Crowell 14a5532430 redirect messages on travis script to devnull
we're getting dangerously close to the 4MB log limit
2016-04-08 10:29:06 -04:00
Jeff Kaufman 689e3f1a0d Set s-maxage=10 on resources that we haven't IPRO-optimized yet.
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1220
2016-04-07 16:01:08 -04:00
Joshua Marantz 2ca9ec5360 remove unreferenced file. 2016-04-05 21:53:43 -04:00
Steve Hill c2fea9fe7e Ignore grpc.gyp 2016-04-05 14:46:02 -04:00
Maks Orlovich 81a12c144d Add locking to DependencyTracker, will need it. 2016-04-05 14:41:40 -04:00
Steve Hill 0c1dfffd36 Fix gitignore for gflags 2016-04-05 13:33:43 -04:00
Jeff Kaufman 5aa12cf256 setChosenVariant was a typo for setChosenVariation
Fixes experiment reporting for classic ga.js

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1288
2016-04-05 11:24:40 -04:00
Steve Hill 6f6ee36fc3 Add gyp bindings for grpc. For verfication purposes, inserts a somewhat
arbitrary (but likely permanent) dependency on grpc::CompletionQueue into
SystemServerContext.
2016-04-04 18:27:39 -04:00
Jud Porter 6c465391de Fix wording on mobilizer buttons. 2016-04-04 11:48:40 -04:00
Jud Porter 1b19b6974a Remove unused blink js. 2016-04-04 11:12:01 -04:00
Maks Orlovich 3196519205 Hookup DependencyTracker into RewriteDriver; add an experiment-only option for turning it (and stuff that will use it) on and off. 2016-04-04 10:41:18 -04:00
Jeffrey Crowell a2d0afab87 add image/webp to mime.types for tests on 12.04
closes #1285
2016-04-01 14:07:15 -04:00
Joshua Marantz f9fdda7d32 Add more thorough rewriting capability to static_rewriter. 2016-04-01 12:43:10 -04:00
Maks Orlovich 90bfc8f469 Remove now obsolete blink flags 2016-04-01 10:58:30 -04:00
Maks Orlovich 5e835486c5 Add dependency tracker class, which helps collect async-computed
info into pcache. Not hooked up yet.
2016-03-31 15:40:15 -04:00
Maks Orlovich d88badfd1d Reinstate 3224d86, got rolled back by accident. 2016-03-31 15:11:00 -04:00
Maks Orlovich 94342c6e43 Change by jmarantz: Add disclaimer boilerplate comment to all speed-tests. 2016-03-31 15:08:32 -04:00
Maks Orlovich 7aa5db95a4 Rgen library index. 2016-03-31 15:07:52 -04:00
Steve Hill 9d92542652 Add indirection header for apache's httpd.h, which replaces #define of OK
with APACHE_OK. This is required for gRPC compatibility.
2016-03-31 12:01:16 -04:00
Maks Orlovich e8af38db04 Remove more blink/cache html leftovers. 2016-03-30 11:02:10 -04:00
Maks Orlovich 3224d86e46 jmarantz: Don't run SupportNoscript when in AMP mode. 2016-03-29 14:58:05 -04:00
Maks Orlovich f7db08df14 Get rid of the now unused blink cohort. 2016-03-29 14:57:29 -04:00
Joshua Marantz 1d25e18b3d Add new cohort for dependencies info. Can't use the DOM cohort since
it's written too early -- we need results of rewrites. (morlovich)
2016-03-28 21:59:19 -04:00
Joshua Marantz 9ccceedb75 Deflake a system-test failure that was counting image-rewrites, which
are bounded by an advisory lock.
2016-03-28 18:50:06 -04:00
Steve Hill 2af564294d Make memcached bind only to localhost/tcp. Ensure memcached is cleaned
up, no matter how the script is terminated.
2016-03-28 16:01:05 -04:00
Jeff Kaufman 33772a9773 tests for cc62cd2e1d 2016-03-28 14:03:02 -04:00
Jeff Kaufman cc62cd2e1d fix issue with fetching and content types 2016-03-28 13:12:49 -04:00
Jeff Kaufman 75d12267af Now that we use git, use git for patching. Also, disable font inlining tests for 1.9 and 1.10 which don't have that fix. 2016-03-28 13:09:49 -04:00
Jeff Kaufman e161fa598f Make build_psol_tarball.sh handle 1.9.32.x releases, where automatic/ was in a
different place.
2016-03-28 13:08:49 -04:00
Joshua Marantz 0c09d72d09 Remove obsolete filters CacheHtml (filter & flow) and
compute_visible_text_filter_test.cc
2016-03-28 12:41:55 -04:00
Joshua Marantz 99efdd19c1 Move the contents of third_party/pagespeed/apache/speed_test.cc into
net/instaweb/rewriter/rewrite_driver_speed_test.cc, which is a proper
microbenchmark sharing the same infrastructure requirements.

apache/speed_test.cc was annoying because it was slow during unit
tests, and printed lots of error messages that slowed it further and
were distracting when running interactively.  And its output was less
useful than speed-tests using the microbenchmark system.
2016-03-23 15:59:46 -04:00
Joshua Marantz 7bf8083314 Integrate AMP rewrite filter into RewriteDriver and test a few filters
explicitly:
  1. AddInstrumentation, which needs to be completely disabled in AMP.
  2. responsive_images & rewrite_domains, which need to be partially
     disabled in AMP.

Partially addresses:
https://github.com/pagespeed/mod_pagespeed/issues/1263 . It's possible
that this commmit fully addresses that bug, but validation is needed.
2016-03-23 12:12:00 -04:00
Joshua Marantz 5676daafbe Fix test infrastructure to always use AddFilters mechanism to add
enabled filters, rather than newing Filter classes and adding them to
the filter-list manually.  This makes for more realistic tests.
2016-03-22 20:54:28 -04:00
Steve Hill e83a6404c4 Log received experiment ID 2016-03-22 12:54:43 -04:00
Jeff Kaufman d53a49bfbb Add angular 1.5.1, jquery 1.12.1, jquery 2.2.2, and spf 2.3.2. 2016-03-21 17:24:57 -04:00
Jeff Kaufman 93f3faf277 Script to check that an nginx release builds and passes tests.
This ensures that the PSOL tarball is good, and that it's compatible with the ngx_pagespeed code we intend to release.
2016-03-21 17:24:12 -04:00
Jeff Kaufman e4e48fd14f Open source the script we use to build binaries on the buildbots 2016-03-21 17:23:16 -04:00
Jeff Kaufman c47224cffa Use kFilterId more consistently. 2016-03-21 17:22:42 -04:00
Joshua Marantz ad71403117 HtmlFilter that recognizes Amp Documents, calling a callback as soon as
the AMP-ness is discovered.

Continues addressing
https://github.com/pagespeed/mod_pagespeed/issues/1263 .

See also: https://github.com/ampproject/amphtml/issues/2380
2016-03-18 23:41:29 -04:00
Joshua Marantz 186740f895 Identify filters that add scripts, and ensure that we don't miss any
script-adding features with a DCHECK.  In a later CL this bool method
will be used to disable filters that inject scripts when serving AMP
documents.
2016-03-18 10:33:35 -04:00
Steve Hill f8d7fc47cf Re-factor ExpensiveOperationContext and ScheduleRewriteContext to be
pure virtual. This will allow the contexts to have completely different
implementations for RPC or "local" access, which is a pre-req for gRPC.
This also removes some redundancy in the controller class heirarchy.
2016-03-16 18:56:40 -04:00
Steve Hill f71db40a27 Adjust ImageRewriteTest size treshold a little. 2016-03-16 18:53:49 -04:00
Joshua Marantz ab05e27254 Add capability for the HtmlParser to buffer events, preventing any from
going to filters, except for ones added as event_listeners.

Starts addressing https://github.com/pagespeed/mod_pagespeed/issues/1263
2016-03-15 18:50:56 -04:00
Maks Orlovich a7aaf15e19 Set http2 bit if indicated by mod_h2 or Via: header
Also internally treated h2 requests as http/1.1 (so we don't
risk leaking 2.0 into a plain HTTP get or such)
2016-03-10 09:05:22 -05:00
Jud Porter 620d55a060 Remove the unused menu button and nav panel classes. Also remove a bunch of outdated stuff from the mobilization css. 2016-03-09 18:06:06 -05:00
Maks Orlovich c1ed50cebf Add a special slot for rewriting things inside srcset's.
Tested, but not used by anything yet.

Step towards fixing https://github.com/pagespeed/mod_pagespeed/issues/1274
2016-03-09 15:46:01 -05:00
Huibao Lin 2c015d6b6f Remove option max_image_bytes_for_webp_in_css 2016-03-09 08:53:09 -05:00
Jud Porter cd487b2023 Fix grep statement in system test. 2016-03-08 11:45:29 -05:00
Jud Porter 495d27b51d Remove the MobilizeCachedFinder. 2016-03-07 18:34:50 -05:00
Jud Porter a0015d30f8 Remove console_start.js, and just call the required initialization routine in admin_site.cc. 2016-03-07 18:08:38 -05:00
Jud Porter 86da4fc42a Remove checks of psLabeledMode option in mobilization JS. 2016-03-07 18:05:00 -05:00
Jeff Kaufman 9bf75235c6 Add centralized process
This change adds two processes: a controller, and a babysitter. The
controller process is intended to host cheesy's controller work. The
babysitter process just waits around in case the controller dies and
restarts it if it does.

In order to exit when the host process exits, the controller watches a
pipe.  If reading from that pipe gets an EOF, then it knows the master
quit and it can quit itself. If the master wants to quit the controller
to load a new one with an updated configuration, it can write a byte to
the pipe, which the controller will see and exit.

Reviewed in https://github.com/pagespeed/mod_pagespeed/pull/1260

Companion nginx change: https://github.com/pagespeed/ngx_pagespeed/pull/1113
2016-03-07 16:06:35 -05:00
Huibao Lin e38ededfb5 Add convert_png_to_jpeg to recompress_images group 2016-03-07 15:54:14 -05:00
Maks Orlovich c84b75d3d2 Give up on cleaning up gflags on exit, it races
with some stuff in google-land.
2016-03-07 12:16:26 -05:00
Huibao Lin b92ddc14a2 Add system tests for image format, quality, and response in IPRO
Test image rewrites in IPRO for
- 3 quality levels: (1) desktop quality, (2) mobile quality, (3)
  Save-Data quality
- 3 user-agents: (1) Chrome on Android, (2) Safari on iOS, (3) Firefox
  on desktop
- 4 types of image: (1) JPEG, (2) Photographic PNG, (3)
  Non-photographic PNG, (4) animation
- 2 request headers: (1) Via, (2) Save-Data
- 3 AllowVaryOn options: (1) Auto, (2) Accept, (3) None.

Verify
- Content type (aka image type)
- Vary response header
- Content length (aka image quality)
2016-03-07 11:35:50 -05:00
Jeff Kaufman b651c7870b Style fixups and Google-specific fixess for 54983f4 2016-03-04 18:17:52 -05:00
Jeff Kaufman 54983f4ddd Merge pull request #1204 from pagespeed/keesspoelstra-strip-subresource-hints
Strip subresource hints / issue 973
2016-03-04 18:06:26 -05:00
Maks Orlovich 0e79a08a76 Relax CSS inlining charset check to always permit ASCII-only data.
Needed for fonts.g.c due to apparent recent changes (and us not
permitting inlining there was making the corresponding continuous tests
fail).
2016-03-04 14:45:37 -05:00
Steve Hill edbf39832d Add C++ standard qualifier to static_rewriter build. 2016-03-03 17:36:27 -05:00
Jeff Kaufman 8f1a4d250c release: add script for building psol tarball 2016-03-03 16:48:52 -05:00
Jeffrey Crowell 5ac13227c8 fix off-by-one read in css parser
on un-null terminated css, fix off-by-one heap read.
2016-03-02 10:24:23 -05:00
Jeff Kaufman 32d8306031 update boringssl
* updates our boringssl dependency to 6d49157 (2/17).
* expands UPDATING_BORINGSSL with more details and runnable commands
* removes now-obselete OPENSSL_IS_BORINGSSL ifdefs
2016-03-01 17:22:42 -05:00
Jud Porter fef64d315c Remove unused ghost_click_buster. 2016-02-29 19:03:43 -05:00
Joshua Marantz de580d67aa Go back to using a shared scheduler for apache ipro requests. It turns
out that we weren't running scheduler-based locks while running the
tasks on a driver's private scheduler.

Includes a new unit-test that spins forever without this change.
2016-02-29 17:06:54 -05:00
Jud Porter 4e1143bd26 Add feature_id for maps. (from jmaessen) 2016-02-29 13:53:56 -05:00
Jud Porter 391a13e5b0 Remove more mobilization code, including the decision tree code and support for unused options in mobilize_rewrite_filter like layout mode. 2016-02-29 13:53:05 -05:00
Joshua Marantz 5c0bc1ac65 switch to opaque brotli interface. 2016-02-25 14:13:35 -05:00
Jud Porter 32b5edd7f9 Remove unused mobilization code. 2016-02-24 09:50:39 -05:00
Steve Hill d2b48ffdfa Switch some deprected proto fields to reserved. 2016-02-23 16:03:06 -05:00
Steve Hill 38842d11ce Upgrade our open source protobuf compiler. 2016-02-23 15:07:15 -05:00
Jan-Willem Maessen 0812d456a9 Update generated JS library code. 2016-02-23 13:55:22 -05:00
Jan-Willem Maessen 356a845a68 Fix #include accidentally removed from CSS parser code. 2016-02-23 13:50:12 -05:00
Jan-Willem Maessen 6dfaf074e8 Add back #include that was stripped. 2016-02-23 10:35:53 -05:00
Joshua Marantz 8519eb97ef Use a barrier-increment to get the cache tests to work without
thread-sanitizer errors.
2016-02-22 16:58:55 -05:00
Steve Hill e8c03dd80a Add some explicit casts to int64 that are required with the newer proto
compiler, which uses google::protobuf::int64.
2016-02-22 13:59:57 -05:00
Huibao Lin c0b22d1cd2 Rewrite images for Save-Data mode 2016-02-19 15:53:01 -05:00
Huibao Lin 79eb6faa7a Add helper method SupportSaveData 2016-02-19 15:43:43 -05:00
Jeffrey Crowell c936eaa1bf fix off-by-one in Css::Parser::ParseEscape() 2016-02-19 14:05:28 -05:00
Steve Hill 89f54b920e Fix calls to ReleaseCreationLock so that retries work as expected. 2016-02-18 17:45:16 -05:00
Huibao Lin b98bf9a12b Rename SupportsSaveData to RequestsSaveData 2016-02-18 10:40:05 -05:00
Jud Porter 74d705a62e Remove unused critical_xpaths.js 2016-02-17 09:28:43 -05:00
Huibao Lin 6c0be2e754 Detect Save-Data and Via request headers 2016-02-17 08:31:24 -05:00
Huibao Lin 5da54d8c0a Add utilities for computing image qualities 2016-02-17 08:29:04 -05:00
Jeffrey Crowell c42eb0f2d3 update README.md, latest released versions. 2016-02-16 16:51:45 -05:00
Huibao Lin e6864494f6 Add set_allow_vary_on method 2016-02-16 14:16:05 -05:00
Jud Porter fd4e636b61 Remove the critical line finder classes, which were used by split html. 2016-02-16 11:40:01 -05:00
Jud Porter 8c44f5a1b2 Update closure compiler and library to v20160208. 2016-02-16 11:00:43 -05:00
Jud Porter c316936298 Remove split html user agent checks. 2016-02-12 23:26:57 -05:00
Jud Porter c174ea4dbc Compiled JS update. 2016-02-12 20:41:49 -05:00
Jud Porter a8a0e9a817 Fully qualify std::* names (from sbenza) 2016-02-12 20:41:35 -05:00
Joshua Marantz d647d454b3 Use AtomicBool for executing_rewrite_tasks_ to avoid a race condition
around concurrent writes of 'true'.  Note that this variable is only
used to implement a CHECK to ensure order of operations in an API.
2016-02-12 16:34:56 -05:00
Joshua Marantz 7c30b7ec44 height:0% should not be minified to height:0
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1261
2016-02-11 11:25:06 -05:00
Joshua Marantz 60f80184b3 Optionally run mod_pagespeed ipro rewrite tasks on the request thread.
Change to having ApacheFetch block using the scheduler rather than
TimedWait on its own condvar, whenever there is a RewriteDriver.  This
allows in-place deadlines to work, and eliminates the 'abandoned' state
of ApacheFetch, simplifying its code and usage.

Added a Sequence* to CacheUrlAsyncFetcher in order to synchronize the
memcached cache response with the request-thread.
2016-02-10 14:35:37 -05:00
Huibao Lin 1fef4af9fb Add 3 options for supporting Save-Data mode:
- AllowVaryOn
- JpegQualityForSaveData
- WebpQualityForSaveData
2016-02-09 13:10:51 -05:00
Maks Orlovich 6d5fbbfda8 CriticalSelectorsEnable() is now trivial, inline + remove it. 2016-02-09 13:00:47 -05:00
Maks Orlovich f7dd6c9d98 Update the diff file for Serf changes
(Accidentally left out from 4af5e6565a, apparently)
2016-02-09 10:50:30 -05:00
Maks Orlovich cef377fdbc Update libraries catalog 2016-02-09 10:49:04 -05:00
Maks Orlovich 6695cf2755 Get rid of old critical_css_filter --- replaced by critical_selector_filter.
This did require adding some annoying glue to set up the pcache in a couple of tests.
2016-02-09 10:48:47 -05:00
Joshua Marantz bce5cf3fad Factor out a test helper class for fetching with a notifier for re-use
in new code.
2016-02-05 18:03:01 -05:00
Steve Hill 002de7d218 Fix QueuedExpensiveOperationController pulling from the wrong end of the
queue.
2016-02-03 15:41:25 -05:00
Jeff Kaufman 4af5e6565a Check that certificates are valid for the domain we're trying to contact.
This depends on x509_check_host, which was added in openssl 1.0.2.  If we want
to support older versions of openssl we need to parse certs ourself, like svn
does, which is a bunch of moderately tricky security sensitive code that I'd
really rather avoid.  We normally build agaist boringssl, which has this
function, but we also prepare a tarball build that intendes to link against
system openssl.  So anyone using that build process will need to upgrade to
1.0.2.
2016-02-03 14:55:02 -05:00
Joshua Marantz 5ac28b36d4 Fixes for include-what-you-use compliance 2016-02-03 13:16:43 -05:00
Jud Porter 8bd899f2de Update compiled JS. 2016-02-03 10:20:55 -05:00
Jud Porter f60390045c Remove unused xhr.js files. 2016-02-03 10:19:46 -05:00
Jud Porter a5f09642e7 Remove unused layout.css, theme_picker.js, and xhr.js. 2016-02-03 10:04:22 -05:00
Steve Hill cd78e754d8 llow the popularity contest to shed queued retries if the queue gets
full.
2016-02-02 13:13:51 -05:00
Steve Hill 3eb70969da Expand PriorityQueue to int64 2016-02-02 11:36:43 -05:00
Jud Porter f90757c723 Update the closure library version, make the compiler version match, and update some flags for the new compiler. 2016-02-01 19:01:29 -05:00
Jud Porter 3a51ee5a78 Update compiled JS files. 2016-02-01 19:00:28 -05:00
Jud Porter 4c315bf73b Update pagespeed_libraries.conf 2016-02-01 18:59:55 -05:00
Joshua Marantz 73196a4594 Rely more consistently on accept:image/webp for webp determination. We
still rely on UA for Android 4.0, blacklisting many potential
masqueraders.
2016-02-01 12:47:21 -05:00
Steve Hill 86041eb9fe Fix using Remove() on first and last elements of PriorityQueue. 2016-01-29 13:20:09 -05:00
Joshua Marantz 308e0c47d3 Enable the responsive images unit test to run. 2016-01-29 11:03:21 -05:00
Jeff Kaufman 79aaa94790 Update libpng to 1.2.56 2016-01-28 16:41:14 -05:00
Joshua Marantz 23947d0006 Consider CriOS to be chrome-like, meaning that we need also
accept:image/webp to send webp.

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1256
2016-01-28 13:33:29 -05:00
Joshua Marantz aa4ec14ba8 Add workaround to avoid delivering webp to CriOS 48, which no longer
can handle webp.
2016-01-28 13:06:24 -05:00
Maks Orlovich 5b8253a2a7 Fix building with 3rd party OpenSSL:
don't incorrectly rely on boringssl directly from sha1 code, but rather go through our selector target (and similarly use it to find the includes) to find the ssl lib one is supposed to use.

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1139 too
2016-01-28 11:13:43 -05:00
Joshua Marantz e97fe1e495 Overlay the current image filename on the image so you can more easily tell the
resolution (jefftk)
2016-01-27 19:19:24 -05:00
Joshua Marantz bd61c0d786 That previous attempt borked the quoting. It's a pain to get the
quoting right in fetch_until, so it's better to search for a single
word and then afterward grep for the phrase you are looking for.
2016-01-27 15:34:12 -05:00
Steve Hill fda5bcdec1 Expand PriorityQueue to support removal and negative values.
#Please enter the commit message for your changes. Lines starting
2016-01-27 13:20:41 -05:00
Maks Orlovich f3639e84c0 Tweak how we mark ourselves in UA, so that fonts.g.c recognizes us proxying IE11 as IE11.
(Will also need a similar change to nginx native fetcher)
Fixes https://github.com/pagespeed/ngx_pagespeed/issues/1080
2016-01-26 18:01:25 -05:00
Joshua Marantz 9460f44b95 Implement & test a new alternative subclass SchedulerSequence which
provides a method to run pending tasks synchronized to a scheduler.
2016-01-26 13:45:22 -05:00
Steve Hill c07911ad42 Implement PopularityContestScheduleRewriteController. 2016-01-26 11:50:17 -05:00
Maks Orlovich bd14840540 Remove spdy-specific config code, except for bits needed for backwards compatibility
(which is more than one would think of at first due to it having somewhat peculiar semantics).
2016-01-25 15:32:40 -05:00
Jeffrey Crowell f0d2abe0d8 modify kFetchHost to use selfsigned.modpagespeed.com, which has a selfsigned
certificate over https, and also has an http endpoint.

this way we can use our proper cert for the
https://(www.)modpagespeed.com/
2016-01-25 15:14:12 -05:00
Jeff Kaufman c07a505dcd Adds a test page for responsive images, along with a test image.
The page is intended to be iframed from a blog post, as:

    <iframe width=500 height=500
            src="https://www.modpagespeed.com/responsive_images_iframe.html"
    ></iframe>

The test image is a 1700x1700 crop of the public domain image at
https://commons.wikimedia.org/wiki/File:Acc%C3%A8s_plage,_Sainte-Marie,_R%C3%A9_island,_august_2015.jpg
I can't use Puzzle.jpg because it's not high enough resolution.

Also brings the modpagespeed.com configuration under version control.
2016-01-21 16:50:19 -05:00
Jeff Kaufman befa49422b Move InstawebHandler initialization after validity checks.
Creating an instaweb handler will run MakeRequestUrl, which assumes that
request->unparsed_uri is non-null.  So move the creation to after where
we check that it's non-null.  To be safe, move it all the way down to
where it's first needed, in case some other validity checks end up being
relevant.

Fixes #1248
2016-01-21 16:47:09 -05:00
Maks Orlovich 07bd70ce33 Update libraries index. 2016-01-21 14:52:50 -05:00
Maks Orlovich 0195e29d8d Don't add an extra canonical header when there is one already, and test
our behavior when one exists.

Was motivated by https://github.com/pagespeed/mod_pagespeed/issues/1238, but I can't
seem to reproduce the behavior Jeff saw.

If anyone has any ideas as to what I am missing, I would appreciate it.
(Still going ahead with this since it does fix one case and adds more tests.)
2016-01-21 14:52:27 -05:00
Maks Orlovich 02e8f7e866 Make sure mod_access_compat is loaded for Apache 2.4
so that "allow from" style of ACLs in our config works.
Ref: https://github.com/pagespeed/mod_pagespeed/issues/1229
2016-01-20 11:08:12 -05:00
Joshua Marantz d3851dd382 Clear the destination HTTPValue before trying to write it. 2016-01-19 17:46:31 -05:00
Joshua Marantz 21d6c8202a Add new 'Sequence' abstraction to superclass QueuedWorkerPool::Sequence, using that
in several places.
2016-01-19 16:08:12 -05:00
Jud Porter e1af68fc6b Fix some forward declarations and a few other header issues. 2016-01-19 15:56:58 -05:00
Joshua Marantz 2f0ad892c2 attempt to converge the JS compiler changes again. 2016-01-19 15:37:08 -05:00
Joshua Marantz e6d85036fd Set x-original-content-length for optimizations, including
minification & gzip compression.

Maintain the semantic that when decompressing, if we lost all our reduction,
we remove the x-original-content-length.

If we have multiple levels of compression, we retain the largest value
of x-original-content-length.

Compute x-original-content-length across resource rewrites even if we don't
have a content-length header on the origin, but we do have the entire content
loaded.
2016-01-19 14:50:17 -05:00
Joshua Marantz 4ae1f641a6 Ignore gflags directory. 2016-01-19 14:42:43 -05:00
Joshua Marantz 6c0bd1c078 webutil html5 scanner update 2016-01-19 14:29:44 -05:00
Jeffrey Crowell 35d1b26101 Merge pull request #1245 from pagespeed/fixgflags
rm gflags because we pull this from git
2016-01-19 13:29:43 -05:00
Joshua Marantz c7272849bf Add new mechanism to clone Schedules. 2016-01-19 13:25:34 -05:00
Jeff Kaufman 514d485634 Minor followups to 28c4fc3899 2016-01-19 13:19:07 -05:00
Jeff Kaufman 28c4fc3899 Merge pull request #1200 from pagespeed/oschaaf-master-add-resource-header
New option: AddResourceHeader
2016-01-19 09:32:37 -05:00
Jeffrey Crowell 445b4d9ad0 rm gflags because we pull this from git 2016-01-14 15:02:16 -05:00
Steve Hill 1016e9e474 Library updates 2016-01-14 14:10:15 -05:00
Steve Hill 4d2b7d2150 Implement a priority queue that will be used for the popularity contest. 2016-01-14 14:08:58 -05:00
Joshua Marantz c368ef3726 Resolve flaky system test for counting image-rewrites on bursts of
requests by allowing 1 or 2 rewrites, instead of requiring 1.  Put in
comment explaining that this is due to 'best effort' locks.
2016-01-14 10:47:14 -05:00
Joshua Marantz b905d7599a library updates 2016-01-14 10:19:40 -05:00
Joshua Marantz bcf63acfd4 Fix flaw in HTTPCache::Find where the fallback value does not get
decompressed even when the cached response is compressed and the request
does not have accept-encoding.  This was found by observing flakiness in
valgrind-system tests.

Fix flaw in the version of HTTPCache::Put that takes ResponseHeaders*
and mutates it unexpectedly, by adding compression headers.

Fix a flaw in InflatingFetch that Reset didn't reset all the cached
boolean bits.  I don't think this was the cause of anything in
production becasue we only use Reset in tests (where we re-use a Fetch
object).
2016-01-14 10:11:19 -05:00
Joshua Marantz 81c64d271f gen-file updates for closure-compiler & js libraries.
various C++11 changes
2016-01-14 09:59:53 -05:00
Kees Spoelstra e61e03e05a Strip subresource hints / issue 973
Default behaviour is to strip subresource links which are in scope for pagespeed,
these are the resources that are not disallowed or are valid domains in the domain laywer.

Added can_modify_url flag to HtmlParse and CanModifyUrl function to the HtmlFilter which
indicates whether urls can be rewritten by the parser and thus should be removed.
This is tested now in the strip_subresource_hints_filter_test.cc as this is only used by the
strip subresource hints feature right now. This should be moved to the HtmlParse tests.

DetermineEnabledFilters has been rolled up into DetermineFiltersBehaviour, which also
determines can_modify_url for all the filters and possible future "behaviors".

Added new option to explicitly prevent the default behaviour:
ModPreserveSubresourceHints on/off

For ubuntu a check for the new setup /var/www/html instead of /var/www for the document root
has been added.
2016-01-13 21:12:47 +01:00
Joshua Marantz 53be049cf0 Don't create & maintain waveforms objects in Apache & Nginx since we
don't display them.

Move content-type lookup until right before it's use, which (a) is
more intuitive and (b) looks likely to be faster in terms of map setup.
2016-01-13 14:57:12 -05:00
Maks Orlovich 1ddc05c96f Make sure to correctly set the canonical header on the fallback
paths as well. Should hopefully fix flakiness of the integration
test for it.
2016-01-12 13:24:33 -05:00
Jeffrey Crowell c775f808fc fix path of brotli_inflater in kernel.gyp 2016-01-12 11:28:12 -05:00
Jeffrey Crowell c273ff8477 add missing brotli.gyp file 2016-01-11 19:47:18 -05:00
Jeffrey Crowell 24a815def7 update brotli to v0.3.0, make it so tests actually run 2016-01-11 17:45:30 -05:00
Steve Hill 297e7386ac Hookup rewrite locks to CentralController. 2016-01-08 17:06:55 -05:00
Jeffrey Crowell 7dafed0b78 add third_party/brotli to gitignore 2016-01-06 17:49:28 -05:00
Jeffrey Crowell 881d248987 sync genfiles 2016-01-06 17:48:52 -05:00
Jeffrey Crowell e2a27b84f1 sync genfiles 2016-01-06 17:48:20 -05:00
Jeffrey Crowell 29d303a5cc Add class for encoding/decoding brotli
not hooked up to anything yet.
2016-01-06 17:47:00 -05:00
Jeffrey Crowell 94a3ce1390 update depot_tools location. 2016-01-06 11:34:09 -05:00
Jeffrey Crowell d93c80f941 remove clang from travis until builds work with it
currently there is some linking error with old system gcc + clang, disable clang on travis as it is just noise for now.
2016-01-06 11:12:19 -05:00
Jan-Willem Maessen 340c0addaa Merge pull request #1235 from pagespeed/jmaessen-111325196
Fix typo in commented-out part of default .conf (#1230).
2016-01-05 17:16:35 -05:00
Joshua Marantz 17764c5122 Remove some dead test infra methods. 2016-01-05 16:09:58 -05:00
Joshua Marantz 62d24fbd88 Only rewrite an image once even if it's requested via ipro many times
concurrently.

Print elapsed time properly for subshell tests. Fix typo in SVG
reference which was causing spurious timeout warnings in nginx tests,
and then flagged by nginx system tests.

Remove nginx test flakiness by using fetch_until an image gets small
to indicate an ipro-rewrite is done, rather than testing for
image_ongoing_rewrites to be zero. The old technique might fail because
we might check that stat before the image starts being rewritten.

Note: with this change, nginx system tests no longer flake for me,
whereas previously about 10% of the time it would flake on "IPRO flow
uses cache as expected". That was also suppressed for valgrind runs,
which is no longer needed.

Even after this change, nginx system tests with valgrind tests still flake
with "Fetch timed out" log messages, which I am adding to the
suppressions, and with "Embed image configuration in rewritten image
URL.", where the recursive-wget result is not optimized. I think that
might be a real user-facing bug, and I will report it to the nginx list.
2016-01-05 12:10:27 -05:00
Jan-Willem Maessen a5f15d1d02 Fix typo in commented-out part of default .conf (#1230). 2016-01-04 14:46:03 -05:00
Huibao Lin 83c9607ebe Use a smaller animated image to speed up test 2016-01-04 13:29:33 -05:00
Huibao Lin 3cd2c8c4fe Export more files for image resizing 2016-01-04 13:25:33 -05:00
Huibao Lin 77fa0e5ba3 Add support for resizing transparent images 2016-01-04 11:32:05 -05:00
Huibao Lin 275e0cd977 Use double-precision for computing resizing grid 2016-01-04 11:29:47 -05:00
Huibao Lin 766d6351c1 Add speed test for image resizing 2016-01-04 11:23:13 -05:00
Jeffrey Crowell 09ab741015 1.10.33.2 is now latest-beta 2015-12-21 15:30:32 -05:00
Joshua Marantz 8f7da7381c Make unit-tests run with gzip-enabled cache, and do some of the fetches with
gzip.

Turn the RequestContext frozen-check into a DCHECK, and add a DCHECK to the
gzip bit as well.
2015-12-21 14:57:42 -05:00
Steve Hill 4948e410ff Add NamedLockScheduleRewriteController, a compatible implementation of
ScheduleRewriteController.
2015-12-21 12:40:32 -05:00
Steve Hill b2579cd29b Update genfiles 2015-12-21 12:39:59 -05:00
Steve Hill 8e3d203b96 Update VERSION 2015-12-21 12:37:40 -05:00
Huibao Lin ad2818b0b0 Don't add dimension to image URL unless the image has been successfully resized 2015-12-18 15:35:45 -05:00
Jud Porter a60dae643e Update for chrome 47 testing. Also remove some unused mobilization JS. 2015-12-18 10:04:11 -05:00
Jud Porter 5353b7d4bf pagespeed_libraries.conf update 2015-12-18 10:02:30 -05:00
Jeff Kaufman 2cea12ce11 convert-meta-tags: don't allow newlines when converting meta tags.
This change makes ResponseHeaders::MergeContentType reject values
containing unprintable characters.

Fixes #1083

This is Otto's work from https://github.com/pagespeed/mod_pagespeed/pull/1196
2015-12-17 17:44:21 -05:00
Jeff Kaufman b6a955af34 log: prevent 'flush' and '.' from being logged on their own.
The system_cache_path is logged on startup and on some errors.  It has
newlines in it, used as a separator.  This means you get log lines like:

  2015/12/17 13:27:00 [info] 105645#0: \
     [ngx_pagespeed 1.10.0.0-7582] Initializing shared memory for path: \
     /home/jefftk/ngx_pagespeed/test/tmp/file-cache/
  flush
  .

This change makes us use spaces instead so you get:

  2015/12/17 13:27:00 [info] 105645#0: \
     [ngx_pagespeed 1.10.0.0-7582] Initializing shared memory for path: \
     /home/jefftk/ngx_pagespeed/test/tmp/file-cache/ flush .
2015-12-17 16:51:35 -05:00
Jeff Kaufman f3edc3bb9a Remove our dependency on apr_sockaddr_ip_getbuf
The new version of serf uses apr_sockaddr_ip_getbuf to add IP addresses to log
messages, but this function is new in APR 1.3.  This means we get a runtime
error on CentOS 5, where Apache fails to start.

We didn't catch this on our buildbot because one of our dependencies needs to be
fetched over svn with svn 1.8 or higher, and installing the new svn brought
along a new apr (1.5) and everything worked.

Fixes #1224
2015-12-17 16:50:27 -05:00
Jeffrey Crowell 5e9467a248 bump clang on travis 2015-12-17 16:24:28 -05:00
Jeffrey Crowell e0a725b932 JsTokenizerPatterns is a struct, not a class
fw declare JsTokenizerPatterns as a struct to silence a compiler
warning.
2015-12-17 15:48:22 -05:00
Joshua Marantz 024eb91ed4 Repro and fix for crash in nested rewrites with accept-encoding:gzip.
Note that this removes a check-fail avoidance committed here:
https://github.com/pagespeed/mod_pagespeed/commit/03978331da3f6f8d9633a6f27e7bead675810cbf
by fixing the root cause.
2015-12-17 15:17:49 -05:00
Joshua Marantz e1b99aabd8 Remove WorkBound and fold functionality directly into the WorkBound
controller. (cheesy)
2015-12-17 15:12:33 -05:00
Jeffrey Crowell 064b11321b Merge pull request #1223 from pagespeed/travis
build with gcc 4.8 on travis
2015-12-17 12:53:14 -05:00
Jeffrey Crowell f67135037b build with gcc 4.8 on travis 2015-12-17 11:38:30 -05:00
Jeff Kaufman 61f4e964ab Don't include rel=canonical headers on IPRO resources.
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1222
2015-12-17 11:31:06 -05:00
Maks Orlovich 55e0962b1f Quickfix for URL preservation + combine_css conflict:
for now disable combine_css. Proper resolution (which will
make it win in some circumstances) will be a follow up,
but likely quite a bit more complex.
Note that combine_js isn't affected by this since it makes an entirely
new script element for combination (as well as new ones for evals), rather
than using the one from the first input.

Addresses Otto's reduction in issue #1215
2015-12-17 11:28:57 -05:00
Otto van der Schaaf dce03c75df New option: AddResourceHeader
Allows setting headers on PageSpeed resources for CORS support.

Fixes https://github.com/pagespeed/ngx_pagespeed/issues/1005
2015-12-17 07:49:02 +01:00
Maks Orlovich 5a51f25001 Don't store webp-animated and non-webp capable image opts under same cache key.
Change the non-webp cache key to avoid picking up any that we previously messed up.
Also restructure the code a bit to lower the risk of this occuring again.

Part of issue #1216
2015-12-15 13:49:41 -05:00
Jeffrey Crowell 22cff97e9d sync pagespeed_libraries.conf genfiles 2015-12-15 13:43:44 -05:00
Jeffrey Crowell 03978331da prevent crash from CHECK fail in SetAcceptsGzip()
this change prevents double writes to SetAcceptsGzip()
2015-12-15 13:43:00 -05:00
Maks Orlovich 1f2f19a8c3 Add a using_http2 bit to request_context. 2015-12-15 09:57:41 -05:00
Maks Orlovich 4881e376e8 Sync libraries index 2015-12-15 09:57:18 -05:00
Maks Orlovich 374a1bc3b4 Don't include system headers in extern "C" block, that can cause weird stuff.
(Cleanup from some of work toolchain people)
2015-12-15 09:40:44 -05:00
Maks Orlovich dd93f6055d Notice when we were passed in CXX envvar pointing at clang,
and don't complain about too old a gcc in that case.
Get rid of -Wno-unused-but-set-variable --- clang warns about the flag,
and the gcc warning it disables actually seems useful. Adjust the code
instead.
2015-12-14 14:53:40 -05:00
Jeffrey Crowell 16d1fd2b9a update README 1.10.33.0 is beta now. 2015-12-14 14:39:36 -05:00
Jeffrey Crowell bfcca778b2 Update .travis.yml 2015-12-14 13:55:50 -05:00
Maks Orlovich 1369628d8a Build as c++11, statically linking in libstdc++ and libgcc into
mod_pagespeed.so unless 'use system libs' flag is set. This cl does not
include flag tweaks for clang.
2015-12-14 13:31:12 -05:00
Jeffrey Crowell 0e8b7d05d4 Update .travis.yml 2015-12-14 10:49:06 -05:00
Steve Hill 3a81a1a912 Fix MemLock to allow deletion of the old lock during unlock/steal. 2015-12-14 10:45:29 -05:00
Steve Hill 26a1b683ea Libraries update 2015-12-14 10:44:58 -05:00
Jeff Kaufman 4a29975753 Add a second ad example to make_show_ads_async 2015-12-11 14:10:15 -05:00
Jeff Kaufman 4b6a082ad5 With automatic/ under pagespeed/ now the parent directory is one closer. 2015-12-11 13:52:01 -05:00
Joshua Marantz b7c6787b9c Libraries update 2015-12-10 17:04:07 -05:00
Joshua Marantz f941b6c504 Consider a MapProxyDomain request as handled, even if it times out of its
ApacheFetch.
2015-12-10 15:21:55 -05:00
Jeff Kaufman bc0855e08f Fix segfault with ssl errors.
When serf_bucket_response_status gets an ssl error it can close the connection
and call CallbackDone(false).  This nulls async_fetch_.

Only try to use async_fetch_ if serf_bucket_response_status returns success.
2015-12-10 15:08:37 -05:00
Joshua Marantz 6df7052bdb Finishing moving the controller to the pagespeed/ subdirectory (cheesy) 2015-12-10 13:56:09 -05:00
Jeffrey Crowell 9e106d43c6 Update README.md 2015-12-09 17:26:03 -05:00
Maks Orlovich d5cb1d2147 Remove FetchFromModSpdy support. 2015-12-09 15:32:17 -05:00
Maks Orlovich 6985c8fe7d Remove an old experimental flag that didn't do anything. 2015-12-09 15:17:49 -05:00
Steve Hill b1717dac7d Update libraries index 2015-12-08 15:23:15 -05:00
Steve Hill bbd61224c3 Factor ExpensiveOperation functionality out into ExpensiveOperationController.
This will allow plugging of different implementations into
CentralController.
2015-12-08 15:19:36 -05:00
Jeff Kaufman 94391ddf6a Always specify http:// with curl.
When running with an old version of curl (like 7.15.5 on the centos
buildbot) if you leave off the http:// on a proxied fetch curl doesn't
add it.  So it will send:

    GET messages-allowed.example.com/mod_pagespeed_message HTTP/1.1

Which Apache will reject with:

    HTTP/1.1 400 Bad Request

Not sure why this didn't turn up with the buildbots running tests.
2015-12-07 15:41:16 -05:00
Steve Hill 664d81ff76 Move all the controller stuff out of n/i/rewriter and into
pagespeed/controller.
2015-12-04 13:58:09 -05:00
Jeffrey Crowell 771ed02aa4 remove the ignoring of no-sign-compare warnings 2015-12-04 11:34:38 -05:00
Jeff Kaufman c49088cbe4 GCC 4.6.3 gives sign comparision errors building base/logging.h. This isn't our
code, and shadowing chromium base seems like overkill, so turn off checking for
sign comparison errors with gcc 4.6.
2015-12-04 11:16:17 -05:00
Maks Orlovich 193d7ddb2a Add clang_version.py, heavily based on compiler_version.py so we
can detect when we're using clang, and also its version.
2015-12-04 10:56:47 -05:00
Jeffrey Crowell 95cae3589d Explicitly disable the features layering_check and parse_headers and set
default_hdrs_check to 'loose', where they currently aren't set. These are the
current implicit defaults, so this is a no-op change in preparation to flip
those defaults.
2015-12-04 10:42:58 -05:00
Jeffrey Crowell 1129ac3d85 sync with chromium boringssl
https://chromium.googlesource.com/chromium/src.git/+/10f4f96db4f6e67316f5e5b6aa92b73947509ac5
https://boringssl.googlesource.com/boringssl/+log/fde89b43c347155798dee8b1210c2c5faabe25f8..6d9e5a74482bb832a6b4d9ae3d20d8f10f250bbd
2015-12-04 10:41:14 -05:00
Maks Orlovich 41ec7c0d20 On a user-facing resource fetch, make sure to disregard cached
load-shedding note, and actually fetch the inputs.
2015-12-04 09:43:26 -05:00
Steve Hill de7dc3d6aa Move WorkBound out of RewriteDriverFactory and into CompatibleCentralServer. 2015-12-03 17:18:51 -05:00
Jeffrey Crowell 5468deba17 remove unused HttpOptions in FetchRemoteConfig 2015-12-03 15:50:20 -05:00
Joshua Marantz 9ef0c058ea Add a test showing that ipro doesn't currently honor
InPlaceRewriteDeadlineMs because it doesn't run the scheduler.

This is related to https://github.com/pagespeed/mod_pagespeed/issues/1171
2015-12-02 17:02:28 -05:00
Steve Hill 79c375bab6 Add CentralControllerInterfaceAdapter.
This wraps CentralControllerInterface in CentralControllerCallbacks. Hook this
up to ImageRewriteFilter.
2015-12-02 16:45:34 -05:00
Joshua Marantz 9be3e68380 Remove errant %s from the error context string. This was non-fatal as the
string was just concatenated and not used for formatting.
2015-12-02 08:45:33 -05:00
Steve Hill c8f2359119 Stop tests creating random '0' file in cwd 2015-12-01 13:15:41 -05:00
Steve Hill 49665e1714 Add CentralControllerCallback 2015-11-30 14:33:38 -05:00
Maks Orlovich b9cb6e7c07 clang in C++11 mode complains about these, since they try to
stuff things >= 128 into unsigned char. Add some ugly casting
to catch avoid it (could also just disable the warning.)
2015-11-30 13:57:08 -05:00
Maks Orlovich 56b555ffa0 Update libraries index 2015-11-30 13:54:33 -05:00
Jeffrey Crowell fcfda77089 sync boringssl with latest chromium sync. 2015-11-30 13:32:17 -05:00
Joshua Marantz 56e4c8ddfa Read in file-cache entries all at once, rather than a chunk at a time.
When reading large images a chunk at a time, callgrind indicated a
significant amount of time spent appending bytes to a dynamically
expanding buffer.

Note: this adds a call to fstat so we know the size of the file before
we start to read it.

Another note: the only way I could find to implement this reading into
std::string involved using std::string::resize, which nulls the bytes we
are about to write.  That seems like a shame but it is what it is :).
2015-11-25 14:09:58 -05:00
Huibao Lin 1ad70a54c1 Add convert_to_webp_lossless to CoreFilters and rewrite_images 2015-11-25 07:51:17 -05:00
Huibao Lin ad3f3ab7d3 Add utility for detecting animated WebP 2015-11-24 21:42:14 -05:00
Steve Hill 7509ec44dc Add CompatibleCentralController which presents a CentralControllerInterface
compatible wrapper for the existing WorkBound.
2015-11-24 15:19:59 -05:00
Jud Porter 5ad569cbd3 Replace make with $(MAKE) per https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html 2015-11-24 13:41:47 -05:00
Jud Porter 2e3b6dc692 pagespeed_libraries.conf update 2015-11-24 13:40:06 -05:00
Joshua Marantz 9d0932c1e2 Stop counting lines for all files we read just to add line numbers to error
messages.  This is particularly embarrassing when reading an image from
the file cache.
2015-11-24 13:37:18 -05:00
Maks Orlovich 0cbaf3db0c Build us with -D_GLIBCXX_USE_CXX11_ABI=0, in preparation
of making ngx_pagespeed build with the same (needed for
people using recent-distro gcc >= 5.x with our PSOL), so people
who build psol from source on new gcc don't have trouble.
2015-11-24 09:10:00 -05:00
Huibao Lin 41871f9e0a Exclude Firefox from WebP lossy support list 2015-11-23 19:59:12 -05:00
Maks Orlovich 892b36c297 Make sparse_hash config compilable as C++11 2015-11-23 12:19:57 -05:00
Maks Orlovich 61c8aa9f92 Update libraries index. 2015-11-23 11:14:48 -05:00
Jeff Kaufman 7c38c9076f Extend insert_ga to handle content experiments and universal analytics. Also add a lot more testing for the case where we're modifying an existing analytics snippet. 2015-11-20 19:42:06 -05:00
Jeffrey Crowell fbca6fa138 bump http cache version due to gzip before 1.10 2015-11-20 17:07:34 -05:00
Joshua Marantz 4846786686 Break out of bucket-loop in ipro-data-recorder after we hit EOS and
delete the recorder.

This is an attempt to address the stack-trace reported in
https://github.com/pagespeed/mod_pagespeed/issues/1191
2015-11-20 16:38:47 -05:00
Jeff Kaufman 468997aefd Update serf to 1.3.8 from 1.1.0 2015-11-20 16:24:08 -05:00
Jeff Kaufman db226e9046 Move large constructor to .cc file.
(Work by jmarantz.)
2015-11-20 11:21:23 -05:00
Jeff Kaufman 48249d74eb Revert "Update serf from 1.1.0 to to 1.3.8"
This reverts commit 89b830d102.

This was a partial commit; reverting it and trying again.
2015-11-19 16:48:40 -05:00
Jeffrey Crowell d7b5e6cda5 add email notifications to travis
we should get yelled at if the build is broken ;)
2015-11-19 16:42:29 -05:00
Jeff Kaufman 05f4233e0d Fix some JS type errors.
(work by jud@)
2015-11-19 16:20:49 -05:00
Jeff Kaufman 4731b25f2e Remove unncessary RewriteDriverFactory::Init
(change by cheesy@)
2015-11-19 16:19:30 -05:00
Jeff Kaufman 89b830d102 Update serf from 1.1.0 to to 1.3.8 2015-11-19 16:17:54 -05:00
Steve Hill 1f01bcad3a Re-factor WorkBound into asynchronous interface. 2015-11-19 15:04:52 -05:00
Jan-Willem Maessen e3c9243b6a Deprecate squash_images_for_mobile_screen, which was never fully baked. 2015-11-19 11:26:28 -05:00
Joshua Marantz 267b460759 Move a large ctor body from .h to .cc. 2015-11-18 21:46:22 -05:00
Jeffrey Crowell 0ef74854ff Update .travis.yml 2015-11-17 20:35:01 -05:00
Jeffrey Crowell f3009355af lock around checking and setting accepts_gzip_
race was in flush early, with multiple threads accessing accepts_gzip_
simultaneously.
2015-11-17 19:07:45 -05:00
Joshua Marantz 596ad6e39a Add new version of pagespeed.conf for demos: demo.conf (jmarantz)
Update deprecated help-center URLs.

Keep webp "exact" to 0, and fix the test to ignore comparing RGB when
alpha is 0 (lode)
2015-11-17 12:35:32 -05:00
Joshua Marantz 11516bd84a Don't use a mock-timer & scheduler for the spammer tests. The
impendance mismatch between mock-time and real-time required for the
spammer tests doesn't work well with valgrind, and only luckily works
in non-valgrind.
2015-11-17 12:33:41 -05:00
Jeffrey Crowell b0d485e1cb update libpng to 1.2.54, move deps to github from sourceforge
Virtually all libpng versions through 1.6.18, 1.5.23, 1.4.16, 1.2.53, and
1.0.63, respectively, have a potential out-of-bounds read in
png_set_tIME()/png_convert_to_rfc1123() and an out-of-bounds write in
png_get_PLTE()/png_set_PLTE(). The former vulnerability has been assigned ID
CVE-2015-7981 and the latter CVE-2015-8126. Both are fixed in versions 1.6.19,
1.5.24, 1.4.17, 1.2.54, and 1.0.64, released on 12 November 2015.
2015-11-16 14:09:41 -05:00
Jeffrey Crowell 1e516f5a38 plug in gzip-extract to HTTPCache.
set cache default to gzip -9
2015-11-16 13:39:55 -05:00
Steve Hill 93ebae4c48 Add empty CentralControllerInterface as starting point for improved load
management.
2015-11-16 11:33:30 -05:00
Jeff Kaufman c1a5d453be External resource moved from www.google.com to cse.google.com, and we can't follow redirects in fetching. This is breaking our tests. 2015-11-11 16:13:29 -05:00
Jeffrey Crowell 68e214829b svn needs to be 1.8+ now for chromium svn
we should get rid of having to use svn soon, but that will require a chromium deps update and c++11 support for compilers.
2015-11-11 15:34:36 -05:00
Maks Orlovich 766a72debe Merge pull request #1177 from pagespeed/morlovich-107417631
Honor disallow in defer_js
See: #1173
2015-11-10 11:42:26 -05:00
Maks Orlovich 53e9fca3de Honor disallow in defer_js
See: https://github.com/pagespeed/mod_pagespeed/issues/1173
2015-11-10 11:03:17 -05:00
Jud Porter 5e45a8ad14 Make sure spacer stays inside the iframe container, so that the total size of the iframe container is the viewport height. 2015-11-10 11:02:39 -05:00
Huibao Lin a32980cdd8 Convert animated GIF to WebP 2015-11-10 09:25:42 -05:00
Joshua Marantz 834c20f14d Before rewriting metadata cache entries for on-the-fly fetches, do a
read to see if the new value is different.

This means we will do more cache reads but fewer cache writes most of
the time.

Skip optimization-locks for on-the-fly resources, which makes no sense
for cheap uncacheable optimizations.
2015-11-09 15:01:35 -05:00
Jan-Willem Maessen bb6b1d43bc Correctly handle Google Ads-specific user agents. This avoids ads policy violations. 2015-11-09 10:36:05 -05:00
Steve Hill f6b35b985c Add a limit to the number of RewriteDrivers that can be stored in a pool. 2015-11-06 16:18:40 -05:00
Maks Orlovich de0dd18aeb Merge pull request #1170 from pagespeed/morlovich-106862622
Removed declaration of not-actually-implemented method.
2015-11-06 13:17:11 -05:00
Maks Orlovich 4ceb021e17 Removed declaration of not-actually-implemented method. 2015-11-06 13:13:42 -05:00
Maks Orlovich 0541395c50 Merge pull request #1168 from pagespeed/morlovich-106862622
Add newlines when missing at ends of combined CSS files,
in order to be more robust against problems involving unmatched
quotes.

See #1165
2015-11-05 10:08:52 -05:00
Jeff Kaufman 300934332e Don't allocate multiple RewriteOptions on the stack because this will fail to compile on systems with small stack frame limits 2015-11-05 09:19:24 -05:00
Jeff Kaufman 4fb74f7b23 Allow ShardDomain to be empty to support using it with script variables in nginx 2015-11-05 09:19:07 -05:00
Maks Orlovich bf8644d96f Add newlines when missing between combined CSS files,
in order to be more robust against problems involving unmatched
quotes.

See https://github.com/pagespeed/mod_pagespeed/issues/1165
2015-11-04 14:41:55 -05:00
Jeffrey Crowell 78abd0c4b9 fix format type mismatch, closes #1167
%ld doesn't match with a size_t on 32bit
2015-11-03 16:41:28 -05:00
Jeffrey Crowell 8458f8cd73 add unzipping code to Resource 2015-11-03 10:24:31 -05:00
Jeff Kaufman d66e67b9e8 Add support for blocking access to our handlers.
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1088

Nginx side of the change: https://github.com/pagespeed/ngx_pagespeed/pull/974
2015-11-02 08:17:50 -05:00
Jeffrey Crowell 8808aacdd9 add ability to gzip-compress with GzipInflater.
GZip is "deflate" but with a header, use zlib to add the header and
magic.
2015-10-30 15:42:26 -04:00
Jeffrey Crowell b69b3c2793 rename resource::contents() to ExtractUncompressedContents
in prep for change to make contents always be the extracted contents
(ExtractUncompressedContents). refactor a ton of files to use the new
definition.
2015-10-30 15:20:06 -04:00
Joshua Marantz 96dfdae960 For 0 values in CSS, strip length suffixes, but not other units (e.g. time).
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1164
2015-10-30 13:44:24 -04:00
Jud Porter 43d0de2b85 Move the init JS into the body instead of being in the head, and cleanup the init JS a bit. 2015-10-30 13:18:37 -04:00
Jud Porter a1353572ea Don't include test.cc in re2.gyp, since that includes main. (from morlovich) 2015-10-30 12:55:55 -04:00
Jud Porter b652cc9b9d Some cleanup from pull request 1161 (from jefftk). 2015-10-30 12:55:02 -04:00
Jud Porter 35db2ce799 Use the SERF_DURATION_NOBLOCK constant, defined in serf.h, instead of its value. (from jefftk) 2015-10-30 11:44:06 -04:00
Jud Porter 4a77202018 Move inline_google_font_css above move_css_above_scripts. (from jmaessen) 2015-10-30 11:43:08 -04:00
Jud Porter 6b6f0ad021 pagespeed_libraries.conf update 2015-10-30 11:41:04 -04:00
Jud Porter a03ed3d669 Remove unused layout code from JS. 2015-10-28 16:17:49 -04:00
Jud Porter 24ca5e1ba0 pagespeed_libraries.conf update. 2015-10-28 16:17:09 -04:00
Jeff Kaufman 119f004e23 Merge pull request #1161 from pagespeed/oschaaf-master-nps-issue-1015
nps-1015: IPRO+MPD support in ngx_pagespeed
2015-10-28 13:30:24 -04:00
Jeffrey Crowell ed739359fd 1.9.32.10 is stable 2015-10-27 13:19:26 -04:00
Jeffrey Crowell 349d87980b remove 'foo' file doesn't belong in the repo 2015-10-27 13:18:45 -04:00
Otto van der Schaaf becc2f6d6f nps-1015: IPRO+MPD support in ngx_pagespeed
- Move the Apache tests for IPRO + MPD to system/system_test.sh
- Add a flag 'trusted_input_' in ProxyFetch to allow ngx_pagespeed
  to transform html but not proxy external html fetched via MPD.

MPS-side of the fix for:
https://github.com/pagespeed/ngx_pagespeed/issues/1015
2015-10-27 18:16:36 +01:00
Maks Orlovich dda7ea7d40 Don't include test.cc in re2.gyp, since that includes main(!) 2015-10-27 09:16:36 -04:00
Jud Porter 67a8ec04f8 Merge pull request #1159 from pagespeed/jud-gitignore
Add third_party/libpng/src to gitignore.
2015-10-26 14:38:28 -04:00
Jud Porter 927e42e22e Add third_party/libpng/src to gitignore. 2015-10-26 14:35:30 -04:00
Jud Porter b1e8516b51 Hide the header bar when a minimum font size is set in the browser. 2015-10-26 14:28:21 -04:00
Jud Porter 67e408ea49 Update pagespeed_libraries.conf 2015-10-26 14:27:49 -04:00
Maks Orlovich e8d6a04a53 Remove duplication of input files: those removed from instaweb_apr.gyp were
already listed in instaweb.gyp:instaweb_system, and resource_tag_scanner.cc is
also in instaweb_rewriter.
(Having the dupes is a problem when one tries to link things together properly).
2015-10-26 12:05:30 -04:00
Joshua Marantz 750d1d1ecc Clear the request-properties from RewriteDrier::SetRequestHeaders even if there
is no user-agent.
2015-10-26 08:18:10 -04:00
Maks Orlovich cfab993ec0 Merge pull request #1157 from pagespeed/morlovich-106148422
Switch to getting libpng from its git, and update to 1.2.52
2015-10-23 13:19:38 -04:00
Maks Orlovich 48dd4d1bb7 Switch to getting libpng from its git, and update to 1.2.52
(Which tweaks one of its headers to be C++-11 compilable)
2015-10-23 12:45:23 -04:00
Joshua Marantz b94d6124c5 Test infrastructure change to reflect production code: remove
RewriteDriver::SetUserAgent in favor of the setting the user-agent in
request headers, which the RewriteDriver reads.
2015-10-22 16:42:13 -04:00
Joshua Marantz 2f5741fc51 A few aggregated changes. 2015-10-22 13:52:10 -04:00
Joshua Marantz cdcfebd660 Be more defensive about examining protobuf fields that might not be initialized. 2015-10-22 13:30:32 -04:00
Steve Hill 9a82930af9 Remove ServerContext::MakeInputLock which is a duplicate of
AsyncFetchWithLock::MakeInputLock, used only for testing.
2015-10-21 17:13:45 -04:00
Jud Porter ca8d91e85e Detect user agents which support animated WebP. (from huibao) 2015-10-20 10:10:34 -04:00
Jud Porter 3104a9bf67 Add meta tag containing phone number to mobilized page. (from jmaessen) 2015-10-20 10:09:48 -04:00
Jud Porter 9e5955b7b9 Fix iframe scrolling attribute for iOS. 2015-10-20 10:08:09 -04:00
Jud Porter a78f01e1e1 Refactor JS for better testing. 2015-10-20 10:07:25 -04:00
Jud Porter 22fe1df260 genfile update. 2015-10-20 10:05:42 -04:00
Jud Porter 5a2e149ab3 Library detection update. 2015-10-20 10:05:11 -04:00
Jeff Kaufman c5d13af625 Compute whether flattening_succeeded_, to fix https://github.com/pagespeed/mod_pagespeed/issues/1092
This is Otto's change from https://github.com/pagespeed/mod_pagespeed/pull/1151
2015-10-15 11:37:21 -04:00
Jan-Willem Maessen 4cc960a011 Add meta tag containing phone number to mobilized page. 2015-10-13 11:57:38 -04:00
Jeffrey Crowell 6ac8d70dca 1.9.32.4 is current stable, not 1.9.32.6 2015-10-09 00:33:43 -04:00
Joshua Marantz 52f0d468e3 Allow IPRO transcoding to work with MapProxyDomain, addressing
https://github.com/pagespeed/mod_pagespeed/issues/1149

Note that IPRO+MPD was working (and optimizing) in MPS; it just wasn't
getting the right UA/Accept-header bits propagated into the
request_properties, so webp transcoding didn't happen.
2015-10-08 21:59:38 -04:00
Joshua Marantz b8017dc00f Fix iframe contents overflowing the iframe on iOS, causing the desktop
site to be displayed when a width=device-width viewport tag is set. (jud)
2015-10-08 21:45:41 -04:00
Joshua Marantz 47487f230c Add a new query-parameter "Noop" which is used for busting browser
caches, which makes it easier to write a demo showing ipro image
rewriting.
2015-10-08 21:41:46 -04:00
Jeffrey Crowell edd89e950a mark 1.9.32.10 as stable 2015-10-08 17:49:43 -04:00
Jeffrey Crowell 4cbc932034 fix build of boringssl with newer compilers (gcc5)
getaddrinfo is a POSIX extension.

newer compilers (gcc5?) require additional cflags to use getaddrinfo and
friends.
2015-10-07 11:03:07 -04:00
Jeffrey Crowell 4b3fc6d5a1 fix msan error in system_caches_test 2015-10-02 11:26:39 -04:00
Jeffrey Crowell f1bb2f6d24 sync genfiles 2015-10-01 10:24:32 -04:00
Jeffrey Crowell 19b09fe694 fix apr_memcache multiget to prevent spinning
fixes #1048

in the case where
           if (strncmp(MS_VALUE, conn->buffer, MS_VALUE_LEN) == 0) {
and
           else if (strncmp(MS_END, conn->buffer, MS_END_LEN) == 0) {

both fail, it was possible for queries_sent to never decrement.
This patch sets rv to APR_EGENERAL in this case, decrements the queries_sent,
and closes the connection.

According to the trace from betabrand this is where the hang is.

Patch applied from apr dev mailing list
(http://www.mail-archive.com/dev%40apr.apache.org/msg26265.html)

Also adds a test for this path. The test is dependent on a new print to
stderr in apr_memcache2, but the real test is that we don't hang in this
situation.
2015-10-01 10:23:05 -04:00
Jud Porter d81c24cd5d Compiled JS and library detection config update. 2015-09-29 10:10:50 -04:00
Jan-Willem Maessen 6730bf4dd3 Fresh compiles of js code. 2015-09-28 11:42:26 -04:00
Jan-Willem Maessen 2dcfad6999 Google Hosted libraries now include incrementaldom. 2015-09-28 11:33:10 -04:00
Jud Porter 6e4b083106 Fix mob JS namespaces. 2015-09-24 10:28:50 -04:00
Maks Orlovich 0ea2124fcd Add canonical URL info to http headers when rewriting images and PDFs. 2015-09-18 12:34:30 -04:00
Jeff Kaufman a626324357 serf fetch: add unit testing 2015-09-18 07:28:38 -04:00
Jeff Kaufman b0055802aa unicode: following upstream, pull header-only functions out of unilib.h into unilib_utf8_utils.h 2015-09-18 07:28:04 -04:00
Jeff Kaufman 814a348d75 generated js: churn 2015-09-18 07:26:31 -04:00
Jeff Kaufman 7baee59ae7 pagespeed libraries: Add angular 1.3.19, 1.4.6, 1.5.0-beta. Add mootools 1.5.2. 2015-09-18 07:24:31 -04:00
Jeffrey Crowell f04981248c Merge pull request #1141 from pagespeed/jcrowell-102755858
serf's new home is on apache svn
2015-09-17 14:07:33 -04:00
Jeffrey Crowell 7e54f9d21e stop using deprecated syntax for addition
use $(()) instead of $[ ] for addition in shell scripts
2015-09-17 11:22:19 -04:00
Jud Porter b37177a347 Extern for extension js. 2015-09-16 09:42:12 -04:00
Jud Porter 6d600bb8b3 Fixes to make theme detection work when the window is in the extension var. 2015-09-16 09:41:39 -04:00
Jud Porter c02518b5cf Use em for drop shadow intead of px. 2015-09-16 09:40:32 -04:00
Jud Porter c112a45673 Fix bug in HtmlColor. When set to an undefined value, and then setting it back to a valid one using SetValueFromHsl, the undefined bit was still set. (from phatt) 2015-09-16 09:40:03 -04:00
Jud Porter 508ced89f2 JS and library detection update. 2015-09-16 09:38:47 -04:00
Joshua Marantz 94e40ec820 Don't iframe robots.txt & favicon.ico; proxy it. 2015-09-11 11:33:19 -04:00
Joshua Marantz 8bad75d2b1 Create a separate JS file for running the theme, and remove theme
detection from the mobilization JS. (jud)
2015-09-11 08:30:25 -04:00
Joshua Marantz 499b2b5f44 Don't try to resize images with invalid desired dimensions. 2015-09-11 08:09:36 -04:00
Jeffrey Crowell b64070a3b1 Merge pull request #1140 from pagespeed/jcrowell-102694840
take CXX from environment variable
2015-09-10 16:09:46 -04:00
Jeffrey Crowell 5874872e81 serf's new home is on apache svn 2015-09-10 12:04:53 -04:00
Jeffrey Crowell fdd54f9b33 fix build with gcc on travis-ci 2015-09-10 11:10:19 -04:00
Jeffrey Crowell b96efbdabf take CXX from environment variable
stop hardcoding /usr/bin/g++, instead just use CXX environment var.

closes #1131
2015-09-09 17:26:00 -04:00
Joshua Marantz 834edea9e5 Use EXPECT_FALSE(...) rather than EXPECT_EQ(false, ...) to remove
spurious warnings.
2015-09-08 23:29:54 -04:00
Jeff Kaufman 8567d353b1 Merge pull request #1135 from pagespeed/jefftk-101928907
Spelling fixes.
2015-09-08 16:49:41 -04:00
Jeff Kaufman cca0c65568 Spelling fixes. 2015-09-02 18:45:24 -04:00
Jeff Kaufman 9d5963c682 pagespeed libraries: add angularjs 1.4.5 2015-09-02 16:32:29 -04:00
Jeff Kaufman 499a5da566 ApacheFetch: add buffering
Before this change we would call ap_rwrite() etc from the rewrite thread, and if
that blocked for a while we might not have any rewrite threads available to
serve other requests.  With this change, all potentially blocking Apache calls
always happen on the request thread.  Writes are buffered in ApacheFetch until
the resource is complete, and then sent out in one go.

Most uses of this (ex: IPRO) were already not streaming, so we don't lose that
much by buffering.  We are doing more copying than we were, and to evaluate this
impact I ran "siege http://localhost:8080/$testimage -c200 -t1h" both with and
without the change, to really stress test this piece of ipro.  This test pulls a
single 1.1MB ipro optimized image with 200 concurrent readers for 1hr, and
should give us a worst-case indication of the slowdown buffering causes.

    before qps: 393.11
    after qps: 392.20

A 0.2% worstcase slowdown is not bad at all; buffering seems to not be a
problem.

This fixes some instances of #1048, but we're not sure yet whether it fixes all
of them.  It definitely doesn't fix ones due to slow filesystems, but we haven't
seen that version in the wild.

For uses of ApacheFetch that we know will always be synchronous we disable this
buffering, which is slightly more efficient.
2015-09-02 16:25:28 -04:00
Jeffrey Crowell 4394ca795e Merge pull request #1132 from pagespeed/travis_test
add travis-ci
2015-09-01 17:16:00 -04:00
Jeffrey Crowell 2e73ed1426 Merge pull request #1133 from pagespeed/gclient_threads
make gclient run one job
2015-09-01 17:04:22 -04:00
Jeffrey Crowell 88f8a9b6e3 make gclient run one job
travis output was mangled, hopefully fixes
2015-09-01 16:52:24 -04:00
Jeffrey Crowell d462c1e585 add travis-ci 2015-09-01 16:34:22 -04:00
Jeffrey Crowell 5de932d051 sync genfiles 2015-09-01 12:30:47 -04:00
Jeffrey Crowell 59d6541b91 add sparsehash to gitignore 2015-09-01 12:30:20 -04:00
Jeffrey Crowell cb1da99fbc use DEPS tracking from github instead of codesite 2015-09-01 12:29:17 -04:00
Jud Porter 4d40fcf9f7 Fix spurious goog.provide statements, and update genfiles. 2015-09-01 11:06:13 -04:00
Jud Porter 9fda316040 Fix initial sizing incorrect. 2015-09-01 11:05:41 -04:00
Jan-Willem Maessen ab760635d7 Change all pagespeed-inserted attributes from pagespeed_foo to
data-pagespeed-foo.  Permit both forms for pagespeed_no_defer and
pagespeed_no_transform, which are in our docs as user-settable.
2015-08-28 17:06:29 -04:00
Joshua Marantz 9fb167bca0 Take scoped_ptr from net_instaweb rather than the default namespace. 2015-08-27 11:45:09 -04:00
Joshua Marantz 972eaf3d20 Run lock callbacks on rewrite thread. 2015-08-26 15:49:01 -04:00
Jeffrey Crowell 3dd6b74305 Revert "move sparsehash, gtest, gmock DEPS to github"
This reverts commit 4a3cefd18a.
2015-08-26 13:43:07 -04:00
Maks Orlovich 6a91cbdb8d Reinstate the big failure caching cleanup., but with two fixes:
1) Restore the separate TTL for metadata on 4xx. The removal of it is what caused
regression test failures: a CSS linking to a missing image meant that we would try to
re-check the CSS every 5 minutes, which meant that the cache warming of optimizations from
1st and 2nd runs would be gone by the 3rd run. This restores the state of the world before.
2) Fix the check failures in fallback code, and nonsense logic around it.
2015-08-25 18:12:36 -04:00
Jeffrey Crowell 4a3cefd18a move sparsehash, gtest, gmock DEPS to github
serf is the only of the DEPS still on google code, but their apache svn isn't
up yet for it
2015-08-25 11:37:03 -04:00
Jud Porter ef97650b2a Fix iframe size on firefox. 2015-08-25 10:26:59 -04:00
Jud Porter 24a45c2a32 Compiled JS update. 2015-08-24 13:22:50 -04:00
Jud Porter ecfb04ce24 Library detection update. 2015-08-24 13:22:31 -04:00
Jud Porter e884f08e8b Use font-size and em to scale the header bar. 2015-08-24 13:22:04 -04:00
Maks Orlovich 56c20ea768 Remove dead option (that couldn't be accessed from config). 2015-08-20 16:38:01 -04:00
Maks Orlovich e376d9dc1b Explain why the cache hammering text should expect things that seem like evictions. 2015-08-20 16:31:15 -04:00
Maks Orlovich f0458f5f16 Sync CSS parser upstream 2015-08-20 16:18:41 -04:00
Maks Orlovich 92d94102ea (by jud): Cap the maximum scale of the nav panel to prevent it from
enlarging the body size when expanded.
2015-08-20 16:17:26 -04:00
Maks Orlovich b20e6c856a Update with some new libraries. 2015-08-20 16:16:20 -04:00
Maks Orlovich 287b4e7c13 Reapply: Remove dead field and its debug logging.
(Overwritten by myself, probably because I screwed up and did the initial
 export while forgetting to submit to perforce).
2015-08-20 16:13:36 -04:00
Joshua Marantz 748ca84ef7 Merge branch 'master' of github.com:pagespeed/mod_pagespeed 2015-08-20 11:03:03 -04:00
Joshua Marantz 47c25a972d Add a cache-spammer test for the shared-memory cache. 2015-08-20 11:00:46 -04:00
Jeff Kaufman 13846358ef Check that ImageJpegNumProgressiveScans can turn on. 2015-08-20 10:45:15 -04:00
Joshua Marantz a76bd6f3af Reference scoped_ptr in namespace net_instaweb. 2015-08-19 17:55:27 -04:00
Maks Orlovich d0da952307 Fix race in SharedMemCache between Delete and other write ops.
(Josh has a test that caught this pending)
2015-08-18 15:27:19 -04:00
Maks Orlovich d7aadcdbcc Export upstream style cleanup 2015-08-18 15:26:48 -04:00
Maks Orlovich 6e188cc3b5 (by jmaessen): Blacklist non-Chrome Android browser from mobilization for the moment,
as mitigation for some bugs with it.
2015-08-18 15:25:34 -04:00
Maks Orlovich b1aa630ba1 Update pagespeed_libraries.conf 2015-08-17 09:38:39 -04:00
Maks Orlovich b246c0e04b Rollback the new failure caching, shows trouble on full-system regtest
(Some images not optimized.)
2015-08-17 09:37:15 -04:00
Maks Orlovich 07154a74aa Remove dead field and its debug logging. 2015-08-14 11:33:40 -04:00
Steve Hill ffd2adb960 Fix compiler_version.py for single-digit compiler versions, including
gcc 5.
2015-08-13 17:30:26 -04:00
Joshua Marantz 662de320a2 For single-resource on-the-fly transforms (e.g. extend_cache),
propagate last-modified time from the input resource.

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1085
2015-08-12 16:22:40 -04:00
Jeffrey Crowell e67c1a8f73 bump DEPS to include domain_registry_provider gitignore 2015-08-12 09:35:51 -04:00
Jeffrey Crowell fed1cc4762 replace Date.now with goog.now for ie8- compatibility on mobilization,
on delay_images.js and local_storage_cache.js, use pagespeedutils.now.
2015-08-11 16:56:48 -04:00
Jan-Willem Maessen a83fd6d5ce Fix error in add_ids_filter when dealing with an element that has an explicit
mobilization configuration in its classes but has no id and is not div-like.
2015-08-10 10:27:37 -04:00
Maks Orlovich 994e38f9d0 Add option to add an extra category parameter to mobilizer beacon. 2015-08-10 09:42:41 -04:00
Maks Orlovich fab286164d Centralize negative caching policy.
Before this CL, we had two notions of kinds of failure:
1) At HTTP cache level, there were a few kRecentFetch* variants that HttpCache could remember, applying a different TTL based on the kind of failure.
2) Resource had FetchResponseStatus, which had slightly different categories, which were not perfectly aligned with the HTTPCache's, and had their own TTL policy, expressed largely via code inside RewriteContext::AddRecheckDependency, that was not quite aligned with HTTPCache's, either.
3) Resource's FetchResponseStatus classification was completely lost when there was a cache hit rather than fresh fetch, and it wasn't really possible to restore it accurately, since, again, HTTPCache had somewhat different notions of kinda of failures.
This CL moves the FetchResponseStatus enum up to HTTP level, expands it to cover all the cases that matter to both layers. TTLs are also centralized there, via HttpCacheFailurePolicy struct, as is classification of failures --- which was done slightly differently in different spots, too.
(Though this still doesn't fix in_place_resource_recorder having own logic... but maybe I can iterate that)
2015-08-07 14:15:05 -04:00
Maks Orlovich 1bf116ead2 by jmaessen: menu improvements:
- beacon events for activity in the mobile menu.
- Tweak the handling of menu open and menu close events (in particular making sure
to use a consistent  source of truth rather than independently toggling several settings).

- Tweak the presentation of the menu dropdown image to be a bit more like what seems to be
standard practice: point right until opened, then point down.  Close all submenus on navigation
(this last decision is debatable UX, but at least makes us consistent between iframe and
non-iframe modes).
2015-08-07 12:44:33 -04:00
Maks Orlovich 881ecd76e7 by jmaessen: Fix serialization of colors. 2015-08-07 12:42:47 -04:00
Jeffrey Crowell 38208a67d0 move page-speed sdk DEPS to github 2015-08-06 14:42:41 -04:00
Jeffrey Crowell 58418eea93 bump version of domain-registry-provider
new version includes gitignore
2015-08-06 11:39:50 -04:00
Jeffrey Crowell c19c229e2e update serf.diff from previous change 2015-08-06 11:19:57 -04:00
Jeffrey Crowell 2c2e53b0d5 tweak for BoringSSL compatibility.
change by mab@
2015-08-06 10:14:19 -04:00
Jud Porter cb7d28f1c3 Fixes for some sites displaying with the wrong viewport width. 2015-08-03 13:32:43 -04:00
Jeffrey Crowell 118be0a234 use pkg-config openssl instead of libssl
on newer version of opensuse (due to openssl 1.0.2 maybe?)
`pkg-config --libs libssl` no longer returns -lcrypto, but
`pkg-config --libs openssl` does. This change is required to allow linking with
system libs on suse tumbleweed.

closes #1117
2015-08-03 10:59:44 -04:00
Jud Porter cfcec527a6 Use position: fixed for ios safari. 2015-08-03 10:08:15 -04:00
Jud Porter e8f133fce4 Give better gen204 feedback about google voice number retrieval failures. 2015-08-03 10:07:33 -04:00
Joshua Marantz 97906ac755 Log slow file operations. 2015-07-31 17:04:16 -04:00
Jeff Kaufman ccd8a29bc8 Remove AprFileSystem: no longer used 2015-07-31 11:20:47 -04:00
Jud Porter 2acdef55d6 Integrate threadsafe lock manager into unit tests and a new
rewrite_proxy system test. (from jmarantz)
2015-07-31 09:47:29 -04:00
Jud Porter baa5d2f8c0 Remove unused mobile css class. 2015-07-31 09:45:50 -04:00
Jeff Kaufman cde9823cec Fix race in ApacheFetch.
It's not safe to reference any class members after we've set abandoned_=true and unlocked.
2015-07-30 13:10:12 -04:00
Jeffrey Crowell d2c0c5c901 update readme.md - 1.9.32.6 is the latest version. 2015-07-29 17:01:42 -04:00
Jeffrey Crowell 7e36d7da2b add check for null dereference in SSL serf fetcher
SSL_set_tlsext_host_name did an unchecked dereference of context->ssl
which could be null. Check for null and log on this case.
2015-07-27 13:11:54 -04:00
Jan-Willem Maessen 4c1fab7adf Fix CSS problem in mobilization. Roll forward other changes that look like they were mistakenly rolled back. 2015-07-24 23:01:01 -04:00
Jeffrey Crowell db5ef321de turn off rewriting of X-Sendfile and X-Accel-Redirect files 2015-07-23 17:46:59 -04:00
Jeff Kaufman 9f0414aa96 fetching: add PrepForCrossDomain hook, for things like adding headers 2015-07-20 11:19:32 -04:00
Jeff Kaufman b97d166a29 canonical libraries: recognize Angular 1.4.3 2015-07-20 11:17:57 -04:00
Jeff Kaufman c2468acb6b typo: yeilding -> yielding 2015-07-20 11:16:25 -04:00
Jeff Kaufman 4c2a39c1af Threadsafe wrapper for MemLockManager. This required a new API for
Scheduler to allow adding an alarm with the lock already held.

It also required a bugfix for a latent bug in mem_lock_manager.cc
about capturing a temp StringPiece in the map when querying it via
operator[]; it must be queried using find().

In this wrapper we use the scheduler-mutex for protecting the
MemLockManager, but we ensure that we are not holding that mutex when
we call the NamedLock callbacks.  All of the code in this CL is around
doing that, and connecting the wakeups/alarms of the scheduler with
those needed by the MemLockManager.

Another commit will follow, which tests the migration of the system-test and
unit-test framework to use this lock manager.

[work by jmarantz; committed by jefftk]
2015-07-20 11:15:23 -04:00
Jeff Kaufman dcb2e68d76 js: generated canonical js, now that e45a2a5 is in 2015-07-20 11:07:57 -04:00
Jeff Kaufman e45a2a54c3 jscompiler: use consistent ordering for the closure library files
Before this change the ordering of closure library files inside our
compiled js files would change depending on which computer the build
ran on.  This would lead to a lot of noise on commits, where unrelated
js 'changes' would get included in commits despite no actual changes
in the js source.

By explicitly telling closure compiler about all the js files in a
deterministic order the files it generate become deterministic as
well.  This is a bit of a hack, sticking a find | sort | sed
into the gyp file, but I think it's the least hacky way to fix it.
2015-07-20 11:06:16 -04:00
Jeff Kaufman 474b861fd7 style: actions_since_last_call -> ActionsSinceLastCall 2015-07-17 09:51:27 -04:00
Jeff Kaufman 4eee66dfb9 options: allow MessageBufferSize and Num(Expensive)RewriteThreads to be 0
These options have documented meanings for 0, but on 2014-06-18 we added a check that they be >0.  Relax that restriction.

Fixes https://github.com/pagespeed/mod_pagespeed/issues/1109
2015-07-16 14:45:29 -04:00
Jud Porter ca0dafc644 Add better tracking on the call button. 2015-07-16 13:38:49 -04:00
Jeff Kaufman eb95331de4 Don't set Last-Modified on IPRO Requests
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1106
2015-07-16 11:30:41 -04:00
Maks Orlovich 69e530065f Add a test-only RemoveWithPrefixForTesting to LRUCache.
This is to make it easy to dump just the rname/ (aka the metadata cache)
entries when testing while leaving http cache intact.
2015-07-15 16:02:14 -04:00
Jan-Willem Maessen 39762ced81 Add disable switch for iframe mode, so that particular sites can be turned into 2015-07-14 12:47:57 -04:00
Jan-Willem Maessen 8720e243e1 When navigating the iframe, strip .pagespeedmobilizer.com and replace with the
original domain.
2015-07-13 22:57:45 -04:00
Jud Porter a19741b61a Update compiled JS. 2015-07-13 15:09:15 -04:00
Jud Porter becd07ecb2 Add multiple site theme extraction (from huibao). 2015-07-13 15:08:49 -04:00
Jud Porter cfdb7e1a99 Use a smaller font size on smaller devices 2015-07-13 15:05:34 -04:00
Jud Porter 132c0b1ede Update library conf. 2015-07-13 15:04:31 -04:00
Jan-Willem Maessen 4e3fb0aae0 Explicitly disable rewrite_domains for iframe_fetcher generated iframe, but enable it generally in iframe mode to ensure that the mobilization menu is rewritten and absolutified.
Fix system test that existed but was actually looking for an iframe loop.
2015-07-10 20:11:23 -04:00
Jeff Kaufman f3b09e2c66 Unit test ApacheFetch and ApacheWriter.
* pulls ApacheFetch out into it's own file
* creates a set of mock apache functions that log to a global varible
* extends NullCondvarCapableMutex to support condvars
* comments on, but does not fix, bug in cookie stripping
2015-07-10 16:42:04 -04:00
Jan-Willem Maessen d57bc99f40 Remove MobNavServerSide option, which must be on at all the times in practice
now.
2015-07-08 15:36:53 -04:00
Jeffrey Crowell 352fcf1f90 modify slow_js test to use fetch_test_domain instead of the full url. 2015-07-07 14:57:58 -04:00
Jud Porter 0d32d3b10f Add escaping for iframe viewport. 2015-07-06 13:18:03 -04:00
Jud Porter 4a331098fa Fix ios blurriness 2015-07-06 13:14:58 -04:00
Jud Porter 177ce2be34 Fix error in iframe viewport. 2015-07-01 15:59:51 -04:00
Jud Porter 674d89acf3 Add an option to configure the viewport tag when in iframe mode. 2015-07-01 14:46:27 -04:00
Jeffrey Crowell 67f4530155 add "class" to friend declaration.
fixes issue #1104 https://github.com/pagespeed/mod_pagespeed/issues/1104
allows buiding with the centos vm again.
2015-06-29 11:18:46 -04:00
Maks Orlovich b39d6bfeaa Fix mobilizer iframe mode + noscript
We want to redirect to original page since the iframe setup requires js to run.
2015-06-26 15:29:48 -04:00
Jan-Willem Maessen cbd89f8061 Include table elements in navigational computation in an attempt to capture 2015-06-26 14:10:45 -04:00
Joshua Marantz 5bbb55cf85 If we are not mobilizing the page, serve a redirect rather than an iframe. 2015-06-25 23:21:28 -04:00
Maks Orlovich 6c77da8142 Mobilizer requires JS, act accordingly:
- Classify mobilization as JS-using filter, and teach SupportNoScript filter about it.
Note that this doesn't fix noscript in iframe mode.

- Actually apply the disabling-JS-producing-filters-for-XHR policy in mod_pagespeed (and ngx_pagespeed, I think),
by implementing it at RewriteQuery level (where it's more logical) rather than in the 'merge configs' helper used
by ProxyInterface.
2015-06-25 16:10:56 -04:00
Maks Orlovich a5451f42ff Prepare GoogleUrl-using code to be buildable with newer (Chromium) versions. 2015-06-25 15:49:30 -04:00
Jud Porter 6a0c10aecb Remove the mobilize_ prefix from our JS and css files to unify naming. 2015-06-25 14:28:32 -04:00
Jud Porter a8b4f38a57 Remove the mobilize_ prefix from our JS and css files to unify naming. 2015-06-25 14:23:08 -04:00
Joshua Marantz 42a02f9fe6 Provide & test a simple CSS minification API. 2015-06-23 15:21:06 -04:00
Jud Porter 8da32f3a39 Navigate just the iframe in iframe mode. 2015-06-23 15:10:31 -04:00
Jud Porter 3d0ef01ce6 Add a 500ms timeout when sending the 204 beacon. 2015-06-22 18:16:43 -04:00
Joshua Marantz 0d3eaa9a38 In iframe-mode, redirect to the origin site for browsers we have not
explicilty tested.
2015-06-22 13:09:50 -04:00
Jud Porter c0c60f6adf Draw the header bar immediately if theme info is available, rather than wait until the DOMContentLoaded event. 2015-06-22 10:17:05 -04:00
Jud Porter d79cfdbe4b Fix negative number error condition. (from rdm) 2015-06-18 13:45:37 -04:00
Jud Porter 3c7fcf7054 Update library detection config. 2015-06-18 13:44:26 -04:00
Jud Porter 1d5a1d25ba Tweak the logic around requesting the google voice phone number so that we don't block waiting for both the gen204 beacon and the jsonp request. 2015-06-18 13:43:39 -04:00
Jeffrey Crowell a83b98fe24 Merge pull request #1095 from pagespeed/32_4_release_docs
docs for 1.9.32.4 as latest beta/stable
2015-06-17 14:35:01 -04:00
Jeffrey Crowell 92b1616c32 docs for 1.9.32.4 as latest beta/stable 2015-06-17 14:24:34 -04:00
Maks Orlovich 78d090100c Remove complexity in HTTPCache that was needed only to support no longer existing WriteThroughHTTPCache. 2015-06-17 12:29:48 -04:00
Maks Orlovich cfa953bba2 Port away from WriteThroughHTTPCache, and remove it.
(Now that HTTPCache+WriteThroughCache does the job)
2015-06-17 09:43:30 -04:00
Maks Orlovich 396f857fc9 Sync the library index again 2015-06-17 09:34:47 -04:00
Huibao Lin 4cb5415e49 Refactor image resizer and pixel format optimizer 2015-06-17 08:59:53 -04:00
Maks Orlovich b91a30098b Sync genfiles 2015-06-16 16:30:07 -04:00
Maks Orlovich 973e909bc7 Make domain_rewrite_cookies pay attention to mobilize rewriter level.
(Change by Huibao)
2015-06-16 16:28:25 -04:00
Maks Orlovich 60b5f0cfce Add build system changes for the memlock manager changed,
looks like they sneaked out from that somehow.
2015-06-16 16:27:18 -04:00
Maks Orlovich 124d0b48e2 Make it possible to use HTTPCache directly w/WriteThroughCache.
(Rather than needing separate WriteThroughHTTPCache). Port over
all the WriteThroughHTTPCache tests to show it works. The plan is to
kill WriteThroughHTTPCache in follow up changes, and also to simplify
HTTPCache API to take advantage of removal, dropping virtualness in the
class.
2015-06-16 16:24:35 -04:00
Joshua Marantz b909324d42 Add in-memory lock manager & test.
Note that this change does not incorporate the new lock manager into
any production code; it just adds a test.

To add this to a single-process server it needs a wrapper (or update)
to add thread safety.  To add this to MPS/NPS it needs a server/client
wrapper for serialization and an RPC infrastructure.

By itself this new lock manager does not provide a measurable benefit,
but it enables us to gauge popularity of a resource and use that to
avoid optimizing unpopular images.
2015-06-14 21:41:39 -04:00
Shawn Ligocki 234cd25d03 Create http_value_explorer
Tool for decoding and encoding HTTPValues. Can be used to decode values in mod_pagespeed cache.
2015-06-12 18:37:12 -04:00
Jud Porter 24551727b2 Add better type checking to js files. 2015-06-12 17:37:26 -04:00
Shawn Ligocki 89c1c5ab01 Mark CreationLockBeforeStartFetch as const. 2015-06-12 15:23:29 -04:00
Jeff Kaufman b094d53251 ApacheFetch waits for asynchronous processing inside PSOL. Currently that wait has no timeout, but as described in https://github.com/pagespeed/mod_pagespeed/issues/1048 PSOL sometimes fails to return. In Nginx and other event-loop based servers this causes a problem for that single request but doesn't take down the server, but in Apache we currently tie up a thread indefinitely waiting for the fetch to finish. This change makes Apache act more like the other servers: after a 2min timeout it gives up waiting on PSOL and frees up the thread.
This doesn't solve the underlying PSOL issue(s), but it makes it much less damaging to Apache servers.
2015-06-12 14:04:16 -04:00
Jeff Kaufman 87cb5ff53c Domain Registry Provider moved to GitHub; update our reference. 2015-06-12 12:56:26 -04:00
Shawn Ligocki fb49739928 Fail to serve source maps if they have a hash mismatch. If the hash is different then the source map is completely useless and will only confuse users trying to debug.
Fixes Issue #931.
2015-06-12 10:58:42 -04:00
Shawn Ligocki 841b46db7f added file from last checking 2015-06-12 10:58:23 -04:00
Shawn Ligocki 8e228b5e82 Add a button base class, and make the menu, dialer, and map button inherit from it. (jud) 2015-06-12 10:57:36 -04:00
Shawn Ligocki d3ecfa9604 genfiles 2015-06-12 10:57:21 -04:00
Joshua Marantz f5e034faf8 Style & consistency upgrades for JS. 2015-06-11 11:49:07 -04:00
Shawn Ligocki 0a1a5c2a22 Update css_parser export process. 2015-06-10 13:24:41 -04:00
Shawn Ligocki fc185af6b9 Fix font size and family of nav panel. Also add a charset to the iframe page for cases where the menus have unicode symbols. (jmarantz) 2015-06-10 13:09:15 -04:00
Shawn Ligocki e7ae0c09c5 Few touch-ups for responsive images:
1) Add 3x to default densities based on my PSS user tests.

2) Update doc to note things we have fixed and change densities in example.

3) Add another example to the mod_pagespeed_example/ file.
2015-06-10 13:07:41 -04:00
Shawn Ligocki 58e2b86575 genfiles 2015-06-10 13:05:34 -04:00
Maks Orlovich 7b7d69a2a0 Export UrlToFilenameEncoder::Decode, needed for a test program. 2015-06-09 11:17:12 -04:00
Maks Orlovich 7f6a833280 Remove pointless copy from ParseProtoFromStringPiece helper. 2015-06-09 11:07:42 -04:00
Jud Porter 8318a506a7 Update compiled js. 2015-06-09 09:51:47 -04:00
Jud Porter de29d01f9d Add border to buttons. 2015-06-09 09:51:32 -04:00
Joshua Marantz 2d42b6c5a6 Cleanup / split-up / test / document mobilization layout mode. 2015-06-08 15:42:30 -04:00
Jud Porter 3e87edad52 Fix a few styling overrides. 2015-06-08 10:31:27 -04:00
Jud Porter 3649f99c9a Remove client side nav panel generation. 2015-06-05 10:42:43 -04:00
Jud Porter 00265131ca Fix offset of position:fixed elements. 2015-06-04 14:53:47 -04:00
Jud Porter 1080539463 Update js library detection. 2015-06-04 14:53:13 -04:00
Jeffrey Crowell 2f692f0e0c remove duplicate "automatic" folder
not sure why it was here in the first place...
2015-06-04 11:15:57 -04:00
Joshua Marantz baf75289f2 Remove blocking interfaces for locks. Changes call-sites in
production code to use non-blocking versions.  Leaves the blocking
interfaces in SchedulerBasedAbstractLock which remains accessible to
tests for blocking implementations.

Adds 'const' qualifier to NamedLock::name().
2015-06-03 09:23:06 -04:00
Joshua Marantz 2cebf5fd0e Add text to the call button when not in labeled mode. Also tweak the
font size. (jud)
2015-06-03 09:19:13 -04:00
Joshua Marantz 0184dafb98 Move lazyloader script load to end of head (or just before the first non-html
tag) rather than before the first image on the page.  Also inserts the script
pretty-much unconditionally (if we see the jquery slider script in head we don't
bother, but merely having no images doesn't prevent script insertion).
2015-06-03 09:07:07 -04:00
Jeffrey Crowell 83dea6349d replace "Fetch status not set when IsSafeToRewrite
was called" with a more
readable/less scary message.
2015-06-01 13:44:31 -04:00
Maks Orlovich 0a6ce072d1 Teach flush early to use link rel=prefetch on modern Chrome.
(Using Image object to prefetch CSS seems to occassionally result
 in double-fetches..)
2015-05-29 16:43:15 -04:00
Jeffrey Crowell 170f4455d5 fix Failed to stat error w/ LoadFromFile ngx#972
If you turn on LoadFromFile then 404s turn into errors in the log. These
shouldn't be errors, so don't log unless we see an errno which isn't ENOENT.
2015-05-29 11:24:18 -04:00
Shawn Ligocki 4990763bbf Make sure Source Map output resource is written even if option is disabled. 2015-05-28 16:13:38 -04:00
Joshua Marantz 8dca9d0531 Cleanup of the dialer code. 2015-05-28 13:05:38 -04:00
Shawn Ligocki ce28130628 Add Puzzle2 back into repo 2015-05-22 11:30:15 -04:00
Shawn Ligocki 44be1556dc Merge branch 'master' of github.com:pagespeed/mod_pagespeed 2015-05-22 11:07:16 -04:00
Shawn Ligocki dd90124331 Add window.devicePixelRatio to add_instrumentation beacon. 2015-05-22 11:05:51 -04:00
Joshua Marantz a7f64c4898 Add window.devicePixelRatio to add_instrumentation beacon. (sligocki)
Make a separate library target for the gflags support, and use that
rather than using the direct gflags dependency. (jmarantz)
2015-05-22 11:03:39 -04:00
Shawn Ligocki 9594358481 Get InlinePreviewImages and LazyloadImages working with srcset.
Before this CL, any srcsets would be ignored and thus browsers might load the non-preview or non-lazy version from srcset. We came upon this bug while talking about how ResponsiveImageFilter would interact with these filters. But this was also a bug for any user-added srcsets.
2015-05-21 14:05:35 -04:00
Shawn Ligocki 08bfdb95c9 genfiles 2015-05-21 14:03:27 -04:00
Steve Hill 9819a06e6b Add option for rewriter that will serve PSS deprecation notice. 2015-05-21 10:59:06 -04:00
Jud Porter 777d280433 Stop css from overwriting some default values for the logo image. 2015-05-21 09:50:17 -04:00
Jeffrey Crowell 9a137aa708 move remote config ports to 909x, prevent overlap
memcached is on port 9993, don't overlap with the netcat listeners in
the test
2015-05-20 16:00:25 -04:00
Jeffrey Crowell 34bf39804b genfiles 2015-05-20 16:00:09 -04:00
Jud Porter d836e9dfbe Fix iframe mode scrolling on ios. 2015-05-20 14:23:57 -04:00
Jud Porter cd0487336e pagespeed_libraries.conf update. 2015-05-20 14:23:12 -04:00
Jeffrey Crowell 0c4ff6435f fixed export flow, pull in changes to install dir
pull in the changes, fixes the js-blacklist test
2015-05-20 11:18:15 -04:00
Joshua Marantz e3379f80c6 Merge branch 'master' of github.com:pagespeed/mod_pagespeed 2015-05-19 17:48:47 -04:00
Joshua Marantz 1e9891a521 compiled JS update 2015-05-19 17:48:22 -04:00
Jan-Willem Maessen b28a9663a9 Add new library configuration after changes to build scripts to fix the bug that
prevented these from being exported.
2015-05-19 17:33:52 -04:00
Joshua Marantz a3cae9dad6 Use 'unplugged' rather than 'on/off' to gate cache-purge processing.
Incorporate more config data into the key used for sharing CachePath
objects so that we don't share cache objects between vhosts that have
purging enabled/disabled, and we don't share between those that have
different cache-flush filenames.

https://github.com/pagespeed/mod_pagespeed/issues/1077
2015-05-19 11:10:31 -04:00
Jud Porter fa64c3ef6c Fix a race occuring in FileCache by adding a mutex and add some misisng thread safety annotations to FileCache and MemFileSystem. 2015-05-18 15:40:44 -04:00
Jud Porter b944fd7111 Update precompiled JS. 2015-05-18 14:46:31 -04:00
Jud Porter b3b7567acd Add "labeled" mode mobilization. 2015-05-18 14:46:08 -04:00
Shawn Ligocki 6cb8edf763 Merge branch 'master' of github.com:pagespeed/mod_pagespeed 2015-05-18 11:36:27 -04:00
Shawn Ligocki c72247b6dc Add option for cutomizable responsive image densities (default still 1.5,2). 2015-05-18 11:35:47 -04:00
Shawn Ligocki 28d6bbcf62 genfiles 2015-05-18 11:34:33 -04:00
Jeffrey Crowell 55f026c801 Downgrade Leaked Rewrite Drivers message to kInfo
Closes #1039, downgrading to kInfo as discussed.

https://github.com/pagespeed/mod_pagespeed/issues/1039
2015-05-18 11:34:22 -04:00
Shawn Ligocki 6c78f97f5a Add versioning to HTTPCache, so that we can flush it.
Flush HTTP and Metadata Cache because of potential poisoning from Issue 1050.
2015-05-15 16:58:53 -04:00
Shawn Ligocki b8e6b713f9 genfiles 2015-05-15 16:58:26 -04:00
Jeff Kaufman cfee21a77a If we're receiving a response slowly and the user aborts, we need to note this and not record the truncated resource to cache.
Fixes https://github.com/pagespeed/mod_pagespeed/issues/1081

Nginx side of the change: https://github.com/pagespeed/ngx_pagespeed/pull/966
2015-05-15 10:33:10 -04:00
Jeffrey Crowell a5376f148b Remove "HTC One" and "Nexus 7" from the known screen dimensions.
HTC One is ambiguous, with many models with varying resolutions, Nexus 7 has
models with 1920x1200 starting in 2014, and 1200x800 previously.
2015-05-15 09:59:42 -04:00
Jeff Kaufman 0b399cc1f2 Fix https://github.com/pagespeed/mod_pagespeed/issues/1078 by removing a DCHECK for valid image dimensions. 2015-05-14 15:28:28 -04:00
Jud Porter 13cdc14a67 Use 100% sizing for iframe mode. 2015-05-14 09:45:34 -04:00
Jan-Willem Maessen 219c18b895 Clean up uses of pagespeed attributes to use a bare attribute rather than
passing the empty string.
2015-05-13 17:28:24 -04:00
Jeffrey Crowell 79d426c5b6 blacklist opera mini for lazyload images
Add Opera Mini to the lazyload images blacklist,  closes #1070
2015-05-12 16:25:23 -04:00
Jeffrey Crowell e85528a898 genfiles 2015-05-12 16:25:05 -04:00
Shawn Ligocki 78da6f4710 Fix srcset parsing in responsive.js. Specfically, deal with the fact that URLs may contain commas in the middle. Add a lot more testing for whitespace and comma potential corner cases. 2015-05-11 17:34:30 -04:00
Jan-Willem Maessen 4ecd07606e Store mobile labelings in the property cache. Also refresh the mobilization js. 2015-05-07 18:28:33 -04:00
Joshua Marantz fbabf8d83a Add unit stress-tests for the memcached interface. 2015-05-06 17:49:27 -04:00
Jeffrey Crowell b4a2ed85d8 handle pagespeed off w/o file cache path set
fixes issues reported in ngx_pagespeed
https://github.com/pagespeed/ngx_pagespeed/issues/956
2015-05-06 13:51:26 -04:00
Jeffrey Crowell 3e8dcb18c4 genfiles 2015-05-06 13:51:12 -04:00
Shawn Ligocki 8f93d5cefc Do not rewrite nor cache empty resources.
While there is nothing technically wrong with caching and rewriting empty resources, there's not much value and we have run into situations where we unexpectedly produce empty resources.

Fixes issue 1050.
2015-05-01 17:16:26 -04:00
Maks Orlovich 1e5edecc31 Make sure to also apply domain suffix to css and scripts.
This is in particular important for css in case there are any @font-face rules,
since those have strict cross-domain restrictions.
2015-04-30 15:02:44 -04:00
Maks Orlovich 18a15d1ca7 Make NoGoogleFontCssInlineFilterAndWidePermissionsTest.WideAuthorization actually
test what it was supposed to test.
2015-04-30 14:18:50 -04:00
Maks Orlovich 924677c523 Don't use wget for tests that check 204's
Some versions of wget seem to have different behavior on 204,
so use curl instead. Analysis + initial patch by cheesy@
2015-04-29 18:04:28 -04:00
Shawn Ligocki e6aee72310 Wire up failure reason in InlineRewriteContext. This exposes that a google fonts test is failing for 4xx resource fetch when we expected it to fail because resource isn't cacheable. 2015-04-29 13:43:49 -04:00
Shawn Ligocki d55259fb73 Drop dependence of RewriteDomainTransformer on RewriteDriver,
since I want to use it (via upcoming DomainRewriteFetch) in
ApacheSlurp. (morlovich)
2015-04-29 13:43:20 -04:00
Shawn Ligocki b65e4e03db genfiles 2015-04-29 13:42:19 -04:00
Jud Porter d6753694a2 Improve mob rendering on desktop. 2015-04-27 10:38:21 -04:00
Joshua Marantz ff6d9739ac Fixes mobilize-iframe mode from a proxy. 2015-04-27 09:41:00 -04:00
Maks Orlovich 1b9011d078 Add an API to incrementally rewrite URLs in CSS delivered in chunks.
(Potentially retaining some unparsed pieces for the next chunk).
2015-04-24 13:53:42 -04:00
Joshua Marantz 97192f19e3 Fix spelling for DomainRewriteCookies option. 2015-04-24 13:09:10 -04:00
Joshua Marantz d21964af53 Ensure ComputeCaching is called when optimized inline resources are created. 2015-04-24 11:02:10 -04:00
Joshua Marantz 94c5478869 Update for js compiler change. 2015-04-23 15:56:47 -04:00
Joshua Marantz 157bb629e5 Rewrite location headers in ProxyFetch, to avoid problem in proxies
where domain_rewrite_filter does not run when the HTML body is empty
(e.g. a redirect).
2015-04-23 15:55:40 -04:00
Maks Orlovich 59afeab08c Remove needless argument for CssTagScanner constructor, and static'ify
some methods that don't need state (since other methods will benefit
from having state more).
2015-04-23 11:27:54 -04:00
Jud Porter f6d2bcf064 Fix some build warnings and update compiled JS. 2015-04-22 21:46:03 -04:00
Joshua Marantz 2c1f9e90a9 Remove spurious log message during tests 2015-04-22 16:40:03 -04:00
Jud Porter 4ece33f07b Avoid dereferencing end() iterator. 2015-04-21 10:49:13 -04:00
Jeffrey Crowell b43781dd60 turn on HTTPs fetching by default 2015-04-20 11:28:57 -04:00
Jeffrey Crowell 6e24e6c85d genfiles 2015-04-20 11:28:39 -04:00
Shawn Ligocki b18a06426e Cleanup noticed while working on GoogleUrl::Sanitize():
* Rename GoogleUrl::Escape() -> EscapeQueryParam(), Unescape() -> UnescapeQueryParam() to clarify their limited scope.
* Change GoogleUrl::CopyAndAddEscapedQueryParam() -> CopyAndAddQueryParam() and do the escaping in the function, this seems like a safer and easier interface to use and most callsites were explicitly calling the escaper anyway.
* const StringPiece& -> StringPiece
* Add some more tests for CopyAndAddEscapedQueryParam().
2015-04-17 17:12:40 -04:00
Shawn Ligocki 3b8db3d1e4 Re-configure srcset resolutions. Add 1.5 because 1.5x and 2x seem very common resolutions. (My Moto X is 1.5x and AFAICT many android phones are as well). Drop 4x, since AFAICT there are no 4x devices. 2015-04-17 13:52:34 -04:00
Shawn Ligocki 9cabf55a9f Misc fixes for the MultipleFrameInterface API:
* Don't reference the wrong error code in case of WebPMuxAssemble failure.
* Create and use no-arg overload of MultipleFrameReader::Initialize() method.
* In GifFrameReader, downgrade messages about image data errors to be INFO messages. (vchudnov)
2015-04-17 13:41:25 -04:00
Shawn Ligocki 994dd36ca3 Fix a few small bugs noticed when streamifying this, and comment + testcase one thing that's not actually a bug.
(Split off since I felt mixing it in would make for a harder review). (morlovich)
2015-04-17 13:40:15 -04:00
Shawn Ligocki 6b47f8dde7 genfiles 2015-04-17 13:39:33 -04:00
Shawn Ligocki 29009c4932 Add get_utf8_string() and utf8_length() for UnicodeText::const_iterator
These two utilities are used at lots of places. (carbokuo)
2015-04-17 13:38:46 -04:00
Joshua Marantz bbc4246601 Zero out the SerfFetch::url_ structure on construction to avoid potentially
looking at uninitialized memory in DebugInfo() on failure.
2015-04-17 11:36:56 -04:00
Jan-Willem Maessen 18254110b9 Add missed in last commit. 2015-04-17 11:32:53 -04:00
Jan-Willem Maessen 0837440eff Move mobilize_label to use a proto to store its labeling. 2015-04-16 18:04:54 -04:00
Maks Orlovich 1f14cd7f60 Fix some bugs in fallback CSS rewriter 2015-04-16 17:30:54 -04:00
Jan-Willem Maessen 0938c2f00b Fresh versions of mobilization code. 2015-04-14 13:48:24 -04:00
Jan-Willem Maessen a07731fbca Fix out-of-range pixels in GIF frames. 2015-04-14 13:47:35 -04:00
Jan-Willem Maessen a50a9b1df2 Fix permissions on executables. 2015-04-14 13:44:59 -04:00
Jan-Willem Maessen 2444fa78cf Fix the problem with server-side mobilization deployment. The problem was that
the background fetch was trying to run mobilize_label_filter, but that filter
was failing to label the DOM elements because
driver()->request_properties()->IsMobile() was false for the subfetch (though it
was true for the enclosing page).
2015-04-13 19:14:36 -04:00
Jan-Willem Maessen c51550b8a4 Shorten very long menu entries by dropping text at natural boundaries in the DOM. 2015-04-10 19:01:42 -04:00
Jeffrey Crowell fe6410b0e2 +x to all of the scripts 2015-04-09 14:59:01 -04:00
Shawn Ligocki f04b8d4145 Escape all whitespace in URLs before putting them in srcsets. Also check that they don't begin or end with a comma (unfortunately comma is a reserved char for URLs ... I'm not sure exactly why, but that means that escaping them could potentially change the meaning of the URL.
Added a new GoogleUrl::Sanitize function to help for general cases where this comes up (we need to make sure that a URL is free of whitespace, '"' and other chars which may be safely escaped).
2015-04-09 14:42:31 -04:00
Shawn Ligocki 8048715660 genfiles 2015-04-09 14:27:28 -04:00
Joshua Marantz 93e0eb71f2 Use firstElementChild and nextElementSibling as appropriate to clean
up the layout traversal code.
2015-04-08 16:15:03 -04:00
Jeffrey Crowell 5a8359e167 create README.md
ported from google code site.
2015-04-08 15:43:20 -04:00
Jan-Willem Maessen c1aa4eed35 Fix bug where top-level nav in one region without <ul> would get used as the
title of a <ul> nav in the next navigational DOM
2015-04-08 14:56:40 -04:00
Jeffrey Crowell eb8fb1fdbb generate menus server-side
commit from jmaessen:

Generate menus on the server side using mobilize_menu_render_filter doing a
second fetch of the HTML in the background and running mobilize_label_filter and
mobilize_menu_filter on the results.  Inject the navigation bar on the server
side and adapt the mobilize_nav.js to properly handle the prsence of these
elements on the rewritten page.
2015-04-07 16:03:53 -04:00
Jeffrey Crowell e2b900392e dump genfiles 2015-04-07 16:01:29 -04:00
Jeffrey Crowell 45aad2c76d update install gyp and lastchange script 2015-04-07 16:00:38 -04:00
Jeffrey Crowell adaabab5f7 add gitignore 2015-04-07 13:26:48 -04:00
Jeffrey Crowell eed5330d76 make lastchange.sh use git instead of svn
add gitignore

Revert "add gitignore"

This reverts commit 649c31ba9e21cdb0222be8381a0f11cd5dc1064f.
2015-04-06 15:37:42 -04:00
Jeffrey Crowell 802418a8ad move everything from src to root 2015-04-06 11:29:33 -04:00
Maks Orlovich d5491e40af Skeleton for MobilizeMenuRenderFilter, which doesn't actually
output the menu (just dumps the proto), but has the control flow/pcache
wiring.
2015-04-03 17:10:40 +00:00
Shawn Ligocki 50920b2aec Stop including 1x version in srcset. Browsers default to using src for that. 2015-04-03 14:37:12 +00:00
Shawn Ligocki c149315f80 genfiles 2015-04-03 14:36:09 +00:00
Jan-Willem Maessen e6c9f22057 Change how we extract mobile menus with a link in the title. 2015-04-03 02:01:57 +00:00
Jud Porter 929cc5245d Add tracking for page onload. 2015-04-02 22:23:10 +00:00
Jud Porter 9330384aac Some code analysis tool cleanup. 2015-04-02 22:22:59 +00:00
Jud Porter 9fda4ba6d4 Some code analysis tool cleanup. 2015-04-02 22:22:19 +00:00
Shawn Ligocki bbd09e955f Improve interaction between Responsive and Inline image filters.
Specifically, we now do the following:
1) If the highest resolution image is below the inline threshold (or some lower threshold), use that high-res image inline as the src (no srcset). This includes the case where the image had native dimensions == height & width attributes and was below the inline threshold.
2) Else, disable inlining and just add a normal srcset.

Notably here, we never mix inline images with responsive images. Technically, it is possible to mix the two (have a 1x version with data URL, but 2x without). However, it seems like this is (A) wasteful for the 2x browsers, (B) complicated to understand and (C) unlikely to be particularly common/much value to support.
2015-04-02 19:38:25 +00:00
Shawn Ligocki ff5a050861 genfiles 2015-04-02 19:33:41 +00:00
Jeffrey Crowell 65dad93ec6 change declaration of HttpOptions to struct
was declared as class, when it should be struct.

Allow for building with -Werror on ngx_pagespeed
2015-04-02 17:03:47 +00:00
Maks Orlovich 1c37c4861b Remove dead argument (will require a follow up nginx change):
https://github.com/pagespeed/ngx_pagespeed/pull/944
2015-04-01 18:08:05 +00:00
Maks Orlovich 28ca8f5aa6 Change by jefftk: Style cleanups 2015-04-01 18:07:24 +00:00
Maks Orlovich 9857a5422c Change by jefftk:
Style cleanups
2015-04-01 18:06:50 +00:00
Josh Marantz f5e46be204 Lint fixes, and use goog.net.Cookies to hack cookies. 2015-04-01 13:22:14 +00:00
Jan-Willem Maessen 68ad3d52a7 Menu extraction filter. Creates a MobilizeMenu proto representing the menu
structure of the page identified by data-mobile-role=navigation.  Runs a
simplifier to clean up the often-messy data that results.
2015-04-01 03:13:18 +00:00
Shawn Ligocki 91589944d2 Replace deleted virtual images with debug placeholder messages in Responsive Image Filter. 2015-03-31 21:43:31 +00:00
Shawn Ligocki 868ee61e14 genfiles 2015-03-31 21:42:35 +00:00
Josh Marantz 9903ce97b4 Factor out the dialer from mobilize_nav.js so it can live it its own
class and file.
2015-03-31 19:26:52 +00:00
Maks Orlovich 6a32654770 Fix handling of POSTS in per-origin pcache page path. 2015-03-30 20:35:25 +00:00
Jud Porter 53add3acc1 Add analytics to the mobilization features. 2015-03-30 19:54:34 +00:00
Jud Porter 7ecf301e44 Add support for longer StrCat. 2015-03-30 16:18:31 +00:00
Jud Porter 7ffc9b9f4b Compiled JS update. 2015-03-30 16:15:43 +00:00
Jud Porter 9f7bc8b78e Add third_party/gflags 2015-03-30 16:01:14 +00:00
Josh Marantz c1db558214 Interactively adjust the logo with ?PageSpeedMobConfig=on by clicking
the logo.  When a new logo is selected it will be switched on the site,
and a config-snippet for MPS for the selected logo is emitted.
2015-03-27 21:49:32 +00:00
Huibao Lin 686ab1150c Workaround for click-to-call problem for Android browser in Note 2 2015-03-26 19:52:41 +00:00
Jeffrey Crowell 254fd2085d Update gflags and mod_spdy deps
gflags and mod_spdy have moved off of googlecode.

update genfiles too
2015-03-26 15:19:17 +00:00
Jan-Willem Maessen 55e042d5f1 Refactor mobilize_label_filter to pull out a base class. Pull out some of the
common functionality that was lurking in the rewrite filter but shared by the
label filter.
2015-03-26 13:50:11 +00:00
Jud Porter a331d2950f Fix order the mobilization scripts are added in. 2015-03-25 15:59:35 +00:00
Shawn Ligocki d900d9c094 Add DebugFilter comments to ResponsiveImageFilter. 2015-03-24 22:22:53 +00:00
Josh Marantz 202578e518 Replace COVERAGE with LOADTEST in the Makefile infrastructure. 2015-03-24 22:07:34 +00:00
Maks Orlovich bbbc0324c0 Fix usage of CacheUrlAsyncFetcher in proxy-like setups,
and improve its docs a bit.

Only do caching in ApacheSlurp in proxy suffix setups, and 
not slurp or testproxy modes which we usually use for loadtests.
2015-03-24 18:06:07 +00:00
Shawn Ligocki 849a6cc523 Do not add srcset if height and width attributes are same as native size. Similarly, do not add 4x if 2x is already native size, etc.
We do this by noting the actual final dimensions in the ImageRewriteFilter and then checking them before constructing the srcset.

Fixes issue 1052.
2015-03-24 15:57:29 +00:00
Shawn Ligocki 340b9c4c40 Modify size of the icons
Make sure that the map and call buttons fit in the header bar exactly. Make the map and call button to have the same size.

This change helps http://www.ligo.co.uk. (huibao)
2015-03-24 15:57:10 +00:00
Shawn Ligocki 2f5c34dec2 Refactor ResponsiveImageFilter to allow arbitrary list of resolutions internally (we still do not provide any way to set these levels, but this is useful for a follow-up change I'm making). 2015-03-23 19:43:24 +00:00
Shawn Ligocki 5a02131cb7 Fix locations of slurp files, don't run IPRO recording in
slurp-fetching vhost. (jmarantz)
2015-03-23 19:43:04 +00:00
Shawn Ligocki b713c6dd6b genfiles 2015-03-23 19:40:48 +00:00
Huibao Lin f428b293c1 Detect logo and colors from multiple links in the site 2015-03-23 17:09:47 +00:00
Huibao Lin 26030f63f3 Cosmetic change to JS code 2015-03-23 17:02:40 +00:00
Jud Porter c85dac6067 Updates for opera mini 2015-03-20 22:15:55 +00:00
Jud Porter 0b4ead23f5 Compiled JS update. 2015-03-20 22:15:29 +00:00
Jan-Willem Maessen bef5498cc2 Proto for menu extraction. 2015-03-20 22:00:41 +00:00
Jeff Kaufman 03f882a83c Domain Registry Provider -> r37. Pulls in:
* public suffix list update
* crash fix for casting bug on mvsc
* memory issue on empty string
2015-03-19 22:38:36 +00:00
Jeffrey Crowell 94eab7a868 Update BoringSSL to recent commit
Update the BoringSSL library to a recent commit, update build files (asm, err_data.c) to be from chromium.
add UPDATING_BORINGSSL document for information on how to update the BoringSSL library
2015-03-19 17:05:52 +00:00
Jeff Kaufman bbd107ceff Move system/public/ to system/ 2015-03-19 00:15:52 +00:00
Maks Orlovich 56c7b6e39c Add an API for easily computing things based on parse of fetched HTML, while blocking
rendering until that's ready.
2015-03-18 17:34:56 +00:00
Maks Orlovich 0f407f5537 Change by jmarantz:
Restore a comment explaining the policy of having inline_images and
resize_images override preserve_image_urls.
2015-03-18 17:04:05 +00:00
Maks Orlovich dcf4e69c8b Sync genfiles 2015-03-18 17:03:16 +00:00
Jud Porter 0522211a9f Add workaround for android stock browser touch event bugs. 2015-03-18 15:00:00 +00:00
Jeffrey Crowell 67647fed59 fix flakes in remote configuration test
kill listeners on port before starting new listeners
remove -p flag from netcat, as old versions can not mix -l and -p
2015-03-17 15:24:24 +00:00
Jud Porter 9eaa5a0660 Prevent the jFlow plugin from closing the nav menu. 2015-03-16 17:27:50 +00:00
Maks Orlovich 79f4f38688 Add an API to permit background computations that affect rendering but don't
use the usual RewriteContext framework.
2015-03-16 15:44:51 +00:00
Jeff Kaufman 02af155afb Move automatic/public to automatic/ 2015-03-13 13:50:51 +00:00
Jeff Kaufman 9c88025adf Move automatic/ to pagespeed/ 2015-03-12 00:54:33 +00:00
Maks Orlovich 94bda8f880 Tiny cleanup: don't give cheap_method_names to refcount ops on RewriteDrivers,
the decrement in particular can be quite expensive.
2015-03-11 19:33:58 +00:00
Shawn Ligocki 2229538c82 Responsive image filter.
Inserts srcset attribute with multiple resolutions of the image.

Based on the prototype Josh presented at Velocity, I've added testing, properly static'd the JS and fixed many bugs discovered in the process.

There are still many TODOs including:
1) Adding system tests
2) Deciding on what resolutions to add (currently adding x2 and x4, we probably want to make an option for this and test for sensible defaults)
3) Don't add srcset if all images are the same contents.
2015-03-11 17:14:27 +00:00
Shawn Ligocki 5af3e80876 genfiles 2015-03-11 17:13:16 +00:00
Shawn Ligocki 16c1e15f18 Change our cache fragmentation to use the Accept header. The old strategy was:
if (*):
  use no ua dependent optimizations, large screen
if (Chrome/Firefox/Gecko/...):
  use ll,ii,dj
if (Chrome versions that support webp):
  use ll,ii,dj,jw,ws
if (Various old browsers, tablets):
  use no ua dependent optimizations, large screen
if (mobile):
  use no ua dependent optimizations, small screen

This CL changes it to:

if (*):
  use no ua dependent optimizations, large screen
if (Chrome/Firefox/Gecko/...):
  use ll,ii,dj
if (accept header has 'webp'):
  use ll,ii,dj,jw,ws
if (Various old browsers, tablets):
  use no ua dependent optimizations, large screen
if (mobile):
  use no ua dependent optimizations, small screen

The motivation for this change is that IE Edge reports as a version of Chrome that would support WebP but doesn't actually support WebP. (jefftk)
2015-03-11 17:08:17 +00:00
Shawn Ligocki 95361359f0 genfiles 2015-03-11 17:06:21 +00:00
Josh Marantz fbd482f486 Dynamically size the iframe based on the screen's physical size. 2015-03-10 21:29:39 +00:00
Josh Marantz 3694a63c2c Render the site using an iframe rather than proxying it based on a new
switch MobIframe.
2015-03-08 17:17:27 +00:00
Maks Orlovich 579f7020ca Add support for deleting entries to HTML version of metadata cache viewer 2015-03-04 20:32:13 +00:00
Maks Orlovich fd7810dca4 Wire up the showads -> adsbygoogle filter, and add a basic
example and integration test.
2015-03-04 19:51:55 +00:00
Maks Orlovich 0cce907c5d Sync genfiles. 2015-03-04 19:50:39 +00:00
Jeffrey Crowell 38785af7c0 Add remote configuration options.
Allow users to specify a secondary "remote configuration" option to
modpagespeed.
2015-03-04 18:25:07 +00:00
Jud Porter 5123b2f434 Cleanup some misc iOS and older android issues. 2015-03-04 18:11:32 +00:00
Jud Porter 834444936b Update the closure compiler dependency. 2015-03-02 19:22:21 +00:00
Josh Marantz f1d59376c4 Change the logo API to make it possible to calculate the top N logo
candidates, rather than hardcoded to just grab one.  Of course in the
current usage we just grab one.

This is in preparation for prototyping a logo-picker GUI.

Also use swap-with-last to remove elements from the middle of an array
rather than nulling out and having to copy over a new array.
2015-02-27 16:30:00 +00:00
Maks Orlovich 1cf48cc7ff Add infrastructure for looking up precompute theme from pcache, and storing it there. 2015-02-27 15:22:03 +00:00
Maks Orlovich 4fb5ba0767 Also optionally support rewriting Set-Cookie domains when we are proxying on a different domain. 2015-02-26 19:13:49 +00:00
Maks Orlovich 436a227a03 Sync genfiles 2015-02-26 19:12:46 +00:00
Jan-Willem Maessen 4d20385201 Fix behavior of mobilization labeling. Page did not get any nav because there
are two <head> tags, one of them unclosed.  We now ignore the head tags.  We
also put in some more debug logging that yields useful information when flushes
prevent us from annotating the DOM (this allowed me to find the bug on a 3-flush
page).

Also update pagespeed_libraries.conf to match current released libraries.
2015-02-26 16:21:51 +00:00
Josh Marantz 9ba7b5e46a Set the forgroundImage in the LogoRecord constructor. 2015-02-26 14:12:02 +00:00
Josh Marantz 97ac58820e Compiled JS update.
Add a fetcher-proxy for the mobilization system tests.
2015-02-25 18:59:34 +00:00
Jud Porter 98c268f396 Workaround for touch event bug in stock android browser. 2015-02-24 21:19:45 +00:00
Huibao Lin a9e8194913 Refactor logo detector and theme color computation 2015-02-24 19:50:06 +00:00
Jud Porter 2b6b7f1036 Use goog.dom.getViewportSize instead of docEl.clientHeight. 2015-02-24 18:47:09 +00:00
Jeff Kaufman 4dd75df5e6 This test wasn't testing what we thought it was because the line continuations were broken (and had been broken since submission). Otto noticed this in https://github.com/pagespeed/ngx_pagespeed/issues/921. This change fixes the string combination and also handles (a) that there are spaces between the alts and (b) that there's now a 10-char hash argument to inlineImage. 2015-02-23 19:29:46 +00:00
Jud Porter c7947450ce Ignore compiled JS files that change on every export. 2015-02-23 18:53:10 +00:00
cheesy@google.com 449772b65c Fix alternate_origin_domain experiment to allow host:port in serving domain.
Guard against non-numeric ports.
2015-02-23 18:31:42 +00:00
Jud Porter 64f46a074a Make drawing of nav bar more reliable. 2015-02-23 18:18:53 +00:00
Jud Porter 94e5546630 Add method of disabling menu items. 2015-02-20 19:45:31 +00:00
Maks Orlovich a5e629cda2 Add a filter flag for offline computation of mobilization theme. 2015-02-20 18:07:43 +00:00
Jud Porter 8038173b65 Add method of disabling menu items. 2015-02-19 23:26:55 +00:00
Jud Porter fd16e87068 Fix header bar on resize. 2015-02-18 15:57:44 +00:00
Jan-Willem Maessen 7d35b54cda Allow explicit configuration of particular classes / ids as navigational or
non-navigational.  For simplicity of configuration we simply store a
comma-separated list with optional leading + or -, and match both classes and
ids against names on the list.
2015-02-17 23:45:57 +00:00
Maks Orlovich 766f9710f7 Support manually specifying the mobilizer logo + theme rather than doing expensive
computation for them.
2015-02-17 19:42:29 +00:00
Shawn Ligocki 6395fb308b Make sure we are respecting pagespeed_no_transform even when resizing. I thought we weren't by mistake, but figured it's good to have this test anyway. 2015-02-17 18:22:52 +00:00
Shawn Ligocki 443d7d3a2f genfiles 2015-02-17 18:17:41 +00:00
Jud Porter 091ccc8c12 Fixup calls to node.tagName. 2015-02-13 19:14:01 +00:00
Jud Porter ec98725026 Fix bad interaction with the nav menu and the jquery fastclick plugin. 2015-02-12 20:03:30 +00:00
Jud Porter a88de000b7 Add offset for spacer div to absolute position elements directly under the body. Also fix JS error that occurs when no nav panel is present. 2015-02-11 21:51:46 +00:00
Huibao Lin aec64f68a3 Optimize arrow icon and apply theme color to it 2015-02-11 21:39:13 +00:00
Jan-Willem Maessen 2993df3b05 Re-factor labeling to better distinguish classified labels, explicitly assigned
labels, and propagated labels.  Parent labeling now happens in one pass.
2015-02-11 20:43:23 +00:00
Huibao Lin 36fb5bd76f Optimize map icon image and apply theme color to it 2015-02-10 19:58:32 +00:00
Josh Marantz a5c05472e0 Add conversion-tracking for map links 2015-02-10 18:41:18 +00:00
Jud Porter 0173da5b6a Fix nesting issue with menus. 2015-02-10 14:30:51 +00:00
Maks Orlovich d6d037376b Add a notion of origin-wide property pages, and have ProxyFetch load
them when needed.
2015-02-09 18:51:05 +00:00
Maks Orlovich 6d61b917c7 Update compiled JS... 2015-02-09 18:48:33 +00:00
Josh Marantz f83963b6df For non-layout mode, remove the progress bar. Solve initial reflow by
injecting the spacer in C++ and sizing it properly in JS.
2015-02-09 13:38:20 +00:00
Josh Marantz 030b3cb0c1 Add new options for click-to-map. 2015-02-06 19:16:31 +00:00
Jud Porter 8f3b6db776 Keep the logo when not in layout mode. 2015-02-06 16:22:58 +00:00
Jud Porter 80721afd52 Only remove nav sections if in layout mode. 2015-02-05 23:39:47 +00:00
Jud Porter 7dfa4f45b0 se textContent instead of innerText to determine if a node has content. 2015-02-05 23:32:25 +00:00
Maks Orlovich 297383887a Fix build with libc++ 2015-02-05 17:39:08 +00:00
Jud Porter f1b0f0417f * Fix the offset applied to position: fixed elements to compensate for the
* spacer div.
* * Fix the menu bar being positioned incorrectly on initial load.
* * Make the spacer div transparent.
2015-02-05 15:29:29 +00:00
Huibao Lin 92a04c2d8f Fix an issue in background color detection 2015-02-04 21:42:05 +00:00
Jud Porter 7a5c68b898 Fix size of spacer div so that the header bar doesn't hide content. 2015-02-03 14:10:29 +00:00
Josh Marantz 856c63ae39 closure-compile update
Don't try to fix the size of the call button when there is none.
2015-02-02 19:59:54 +00:00
Maks Orlovich 257fc37717 Also permit multi-part POST forms.
Avoids a lot of 400s on various forms on our test mobilizer proxies.
2015-02-02 17:25:40 +00:00
Huibao Lin 2f646b2fea Improve size and position for the elements in the header bar 2015-02-02 15:41:16 +00:00
Jud Porter 093805f165 Fix duplicate nav menu item removal. 2015-01-30 16:44:58 +00:00
Josh Marantz c642933d8b Wrap console.log to avoid errors on sites that null out 'console'. 2015-01-29 23:56:46 +00:00
Jan-Willem Maessen d2c3af5c06 Clean up some tech debt in the label filter: we don't really need all these
flags anymore, they just complicate the code.  Meanwhile, the way we actually
are doing mobilization doesn't match the filter's model of labeling, causing us
to (say) label content inside a navigation region even though we roundly ignore
that fact (and the labeling is probably wrong).  Finally, it looks like we might
have been classifying while logging training samples, which is definitely,
definitely wrong and would cause us to over-fit our past classifiers rather than
ignoring them completely as we ought to.
2015-01-29 21:41:42 +00:00
Josh Marantz 2ce7d69979 Don't extract menus for nav elements that lack parents. Lint fix on
'require' order.

Closure compiler generated code updates.
2015-01-29 15:57:27 +00:00
Jeffrey Crowell b45db75885 Fix crash when invalid host headed is sent. 2015-01-28 22:43:03 +00:00
Maks Orlovich d8a302fef0 Make sure not to convert ads that specify non-HTML output to async format,
since adsbygoogle.js doesn't handle those.
2015-01-28 14:12:12 +00:00
Jan-Willem Maessen b7968aebb4 Find some instances of titles associated with navigational sections, and expand
the navigation to encompass them.  This is a starting point, but only labels
whole enclosing <div>s; we see instances where the titles are part of an
enclosing div that also contains other content, and that will require us to make
finer-grained decisions (and perhaps increase the set of tags subject to
labeling, since there are titles that are not found in <div>-like structures.
2015-01-27 23:07:37 +00:00
Shawn Ligocki cbba24023b Register inline attribute ResourceSlots into RewriteDriver the same way that HtmlResourceSlots and InlineResourceSlots are. This way, if we ever add other filters which modify inline attributes, their access will be serialized appropriately. 2015-01-27 18:17:35 +00:00
Shawn Ligocki 701c6c09d0 Stop appending ?PageSpeed=off to .pagespeed. resources in the sources list for source_maps.
We must append ?PageSpeed=off to non-pagespeed URLs because otherwise IPRO might rewrite the source and lead to a non-sensical source map. However, IPRO does not modify .pagespeed. URLs, so we can safely avoid this query param. Furthermore, the param does not make sense for .pagespeed. resources and seems to 404.

Fixes issue 1043.
2015-01-27 18:15:03 +00:00
Shawn Ligocki 14d0ff971c genfiles 2015-01-27 18:12:36 +00:00
Josh Marantz bcd1399e4b Add click-to-call functionality, driven by configuration. 2015-01-26 20:44:43 +00:00
Josh Marantz 7d132400cc closure compiler update 2015-01-26 20:34:44 +00:00
Jeff Kaufman 8df1c9bab3 removed genfiles that aren't generated anymore 2015-01-26 16:24:55 +00:00
Jeff Kaufman b0bf9ea03e Initialize cache_flush_timestamp_ms_ even if cache_flush_count_ was already initialized.
Should fix https://github.com/pagespeed/ngx_pagespeed/issues/887.
2015-01-26 16:22:40 +00:00
Jud Porter da510223c1 Add nav bar for non-mobilized sites. 2015-01-23 19:23:57 +00:00
Shawn Ligocki 57c51c0073 Move Inline CSS rewriting into ResourceSlot::Render() from RewriteContext::Render(). Rendering in the slot is better because the same slot will be used across all filters modifying the resource. Thus we guarantee that rendering is done consistently. Previous to this CL, correct rendering required all RewriteContext::Render() methods to use consistent rendering (which was not true before a prev rev).
Somewhat unrelated, I added a new field, CachedResult::is_inline_output_resource, and modified RewriteContext::CreateOutputResourceForCachedOutput to recreate InlineOutputResources if appropriate. Previously it was Creating vanilla OutputResources for all requests leading to confusing server state.

Additionally, I added a new field, ResourceSlot::preserve_urls, to distinguish between uses of set_disable_render() which meant (this slot was already rendered, so don't re-render) and (preserve_urls is on, so don't edit URL). Before this CL all ResourceSlot::Render() implementations edited URLs, but the new ones update inline data, so they should be used even if preserve_urls is enabled.

Background:

Before prev rev inline CSS was being modified in two different ways in different filters:
  1. Editing the characters_node.mutable contents() directly.
  2. Replacing the characters node from the parent element.
So after doing #2, another filter might come along and try to write to the original Characters node (#1), which is now dead.  While this won't crash or leak it won't perform the second filter's optimization.

This change makes it so that the optimization of inline CSS follows more closely the slot used for external resources, and therefore adds more robustness to the rewriting infrastructure.
2015-01-22 22:58:38 +00:00
Shawn Ligocki 0861118ba0 genfiles 2015-01-22 22:57:05 +00:00
Huibao Lin 1b9d57b704 Prepare for upgrade to giflib-5.1.1 where the interface to DGifCloseFile and EGifCloseFile were changed 2015-01-22 15:00:59 +00:00
Huibao Lin f4506696cc Use high resolution image for the call button 2015-01-22 14:59:00 +00:00
Huibao Lin c24f4ab415 Apply theme color on the domain string shown in the header bar 2015-01-22 14:58:18 +00:00
Huibao Lin a31dc7e3ad Remove the requriment that the logo image must be smaller than the bounding box of logo element 2015-01-22 14:57:37 +00:00
Huibao Lin 3978260801 Fix a bug in computeColor_() 2015-01-21 14:17:11 +00:00
Huibao Lin 4c9b772424 Use 'href' as a signal for detecting logo 2015-01-20 16:17:43 +00:00
Huibao Lin c8265aea95 Reduce influence of position and size on best logo selection 2015-01-20 13:55:46 +00:00
Huibao Lin 97f7104d32 Fix issues in proxyImageUrl() 2015-01-16 20:46:09 +00:00
Jan-Willem Maessen 9abeffa452 Don't classify elements that are embedded inside a link, unless they themselves
contain nested links (indicating a serious error in the source html).  This
avoids eg. content-classifying the text of a nav entry when it's in its own div.
2015-01-16 16:27:01 +00:00
Maks Orlovich 200115da86 - Make DomainRewriteFilter's header fix up code understand <meta http-equiv>
- Make it understand (and update) Refresh: lines
2015-01-16 15:24:44 +00:00
Jud Porter 13e1522f1a Mobilization nav cleanup. 2015-01-15 19:29:00 +00:00
Shawn Ligocki 882b544c0d Attribute TODOs. 2015-01-15 17:51:17 +00:00
Shawn Ligocki 7ddc07b6f1 genfiles 2015-01-15 17:50:32 +00:00
Jeffrey Crowell 1c0585baa2 Update BoringSSL
update to include bug fixes from 1.0.1k OpenSSL
2015-01-14 22:20:38 +00:00
Jud Porter 72fbd8094f Lint fixes for mobilize js. 2015-01-14 15:30:27 +00:00
Jan-Willem Maessen 98cf184030 Remove workaround for mobilization nav bug, since the current classifier handles this correctly. 2015-01-13 22:33:23 +00:00
Josh Marantz 65abadc621 Allow resources fetches to work in the context of proxy_suffix. In
this scenario, we do *not* want the origin-mapping to strip the proxy
suffix, because the result would be 'loopbacked' which we don't want.

The loopback fetcher has a good mechanism for this:
RequestContext::IsSessionAuthorizedFetchOrigin.  We just need to
populate that in RewriteOptionsManager::PrepareRequest, which is easy.
The pain-point here was to change all the call-sites for
PrepareRequest to pass in the request context, if there is one.
2015-01-12 20:28:40 +00:00
Josh Marantz 23277bc4fc We were CHECK failing in debug mode when an element contained unicode characters
in its id (and we double-label the element, which is bad).  This fixes that;
thought I could get away with unescaped ids since the spec seems to claim that
stuff that needs escaping is naughty -- but that's not how things work out in
the big bad world.  Tests added (yes, they failed).  Glad I put that CHECK in
there. (jmaessen)

Update deps for BoringSSL (jcrowell)
2015-01-12 20:27:52 +00:00
Jeffrey Crowell 72523cf2ae Roll back ssl change that broke build.
Need to fix up gypi file then will resubmit.
2015-01-12 18:20:10 +00:00
Jeffrey Crowell cf5aab2ed4 Update BoringSSL to include bugfixes from OpenSSL 1.0.1k 2015-01-12 15:56:59 +00:00
Huibao Lin a3b9bcad94 Construct hamburger icon using DIV and CSS; code improvement 2015-01-12 15:04:12 +00:00
Maks Orlovich f62b555626 Use a separate setting for CSS font inlining threshold (with a larger default),
since current for-Chrome CSS produced by fonts.g.c is quite large.

Addresses https://code.google.com/p/modpagespeed/issues/detail?id=1040
2015-01-09 17:45:09 +00:00
Maks Orlovich 5be1f4db46 Sync genfiles 2015-01-09 16:31:08 +00:00
Huibao Lin b217ddb3d3 Access pagespeedNavigationalIds through the window object 2015-01-09 14:35:49 +00:00
Huibao Lin 4dd8ac9760 Improve position of the elements in the header bar 2015-01-09 13:51:05 +00:00
Huibao Lin 15644bc992 Add test for image resolution limit. Remove image_oom_test. Add call button to mobilized page. 2015-01-08 23:38:35 +00:00
Josh Marantz 1057133b92 Use the annotated image sizing information computed in C++ for layout and
logo calculations, when available.
2015-01-08 20:02:06 +00:00
Jeffrey Crowell 35e9016e51 Fix tests to run in trunk.
Allow "-" in the regexp search for "XHR-Mobilize" javascript.

Fix paths for INSTAWEB_CODE_DIR in several tests

Fix formatting in stop_apache.sh
2015-01-08 17:28:48 +00:00
Josh Marantz bea807f5e4 Allows turning layout engine off but still run navigation and logo resynthesis.
Some of the CSS in mobilize.css had to be split off to a different
file because it works only in conjunction withe the layout algorithm,
and would bork a desktop site without it -- this represents the bulk
of the files.
2015-01-07 17:57:12 +00:00
Josh Marantz 7f6165dd37 Get the correct URL for the image-size map when the image is not optimizable. 2015-01-07 17:48:05 +00:00
Jeffrey Crowell 3ce2e1faa0 Change check for directory to check for file
Fixes build on trunk.
2015-01-07 17:40:22 +00:00
Josh Marantz 1c0fc4fc30 Avoid crash in logo computation when computing based on an img tag
that has not been loaded yet.

Generated file update.

Make RewriteContext::ToString() easier to call from the debugger.
2015-01-07 02:03:41 +00:00
Jeffrey Crowell 187f8ace46 Fix build with GCC v4.1.2
see related GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25950
2015-01-06 18:28:05 +00:00
Maks Orlovich 010a536fe6 Fix documentation link, as reported in:
https://code.google.com/p/modpagespeed/issues/detail?id=1038
2015-01-06 17:28:30 +00:00
Jeff Kaufman 7af7efa477 Don't assume all data2c input files are under net/instaweb. Fixes breakage caused by r4483. 2015-01-06 14:30:55 +00:00
Jeff Kaufman 03d091757b Move net/instaweb/system to pagespeed/system 2015-01-06 11:53:19 +00:00
Jud Porter 503d626cab Support unit tests for mobilization js. 2015-01-05 18:31:56 +00:00
Jan-Willem Maessen 31ad80595c Clean up a lot of trivial formatting in our logging and I/O. There's more scope
for cleanup here, this is just the low-hanging fruit.
2015-01-02 21:21:00 +00:00
Jeff Kaufman 227fa64532 Mark apache/system_test.sh as executable 2015-01-02 18:26:01 +00:00
Jeff Kaufman 0b0ace4328 Unbreak apache_debug_system_test by correctly finding apache/system_test.sh 2015-01-02 16:35:36 +00:00
Jeff Kaufman 760cd74c83 Move net/instaweb/apache to pagespeed/apache 2014-12-30 20:14:44 +00:00
Jeffrey Crowell 027101e6e7 satisfy compiler warnings on -Wnarrowing 2014-12-23 20:08:59 +00:00
Josh Marantz a9f22ace78 Revert a spriting heuristic that turned out to mark lots of images as sprites. 2014-12-22 21:00:14 +00:00
Josh Marantz 316838cc61 Deliver mobilize_nav.js even if MobNav is off because we goog.require it anyway.
Improve heuristic to recognize sprites so we can give
background-images on empty divs a min-heighto.  Isolate the
sprite-recognizer into its own method so we can later test it, etc.

Add heuristic to recognize slideshows.  Currently it just looks at
class=nivoSlider but we can expand it obviously.  We don't want to
blindly mess up any styling inside a slideshow.

Rip out absolute positioning, solving a variety of problems.
2014-12-22 17:19:12 +00:00
Jan-Willem Maessen bf022369db Add a "just log this string please" path to the message_handler and use that to
get rid of a bunch of duplicate formatting that was happening in various of the
handler classes (and a lot of "%s" format strings, which is what send me down
this hole in the first place; still plenty of those left in our code).

The big savings here should be 2- or 3-fold formatting in the
mock_message_handler and some double-formatting in the system message handler
subclasses.
2014-12-19 21:35:45 +00:00
Josh Marantz 531ab02fee Hack some heuristics for recognizing slide-shows.
Don't set min-height of divs to accomodate an entire sprited image.

JS compiled code update.
2014-12-19 18:18:05 +00:00
Jeff Kaufman 7413aa2c00 Tweak paths for the install directory when used inside google. 2014-12-19 14:37:55 +00:00
Jeff Kaufman 14df18bd33 Update genfiles. 2014-12-18 14:26:58 +00:00
Josh Marantz b3ca072578 Use static asset manager to server mobilization JS & CSS.
Hookup the logo/theme/color stuff better (dependencies, signature
configuration) so it works when compiled.
2014-12-18 03:12:49 +00:00
Shawn Ligocki 46b12f99a8 Add benchmarks for CSS and JS rewriting.
Noticed we didn't have these while investigating the fact that JS filter minified inline JS blocking the main parsing thread while CSS filter does it async using a ResourceSlot.
2014-12-18 00:32:59 +00:00
Shawn Ligocki 59849458ed Turn on new JS minifier by default. 2014-12-17 22:24:48 +00:00
Shawn Ligocki 6beddecc2a Save ForbidFilter failures. If this flakes we want to know why. 2014-12-17 21:58:35 +00:00
Maks Orlovich a963d3e979 Woops. Don't allocate these on the stack, since they're
too big in some use cases.
2014-12-17 21:43:42 +00:00
Huibao Lin 97699273ae Add theme extraction 2014-12-17 21:11:19 +00:00
Maks Orlovich efa9153697 Wire up mobilize.css for StaticAssetManager 2014-12-17 20:05:35 +00:00
Jan-Willem Maessen da85de6222 Fix badly-executed re-gold that was totally my fault. Hopefully this means
future include changes shouldn't disrupt things.
2014-12-17 20:04:50 +00:00
Maks Orlovich be3486f252 Make it possible to use the mechanism normally meant for serving compiled-in static
assets from gstatic for an arbitrary server; to be used during development for easier
iteration.
2014-12-17 18:58:33 +00:00
Maks Orlovich 02abc5f245 Change by jmarantz:
Attempt to correct negative margin-bottom for resized images to make
slide-shows work.

Change handling of float:right;clear:right; to use display:block and
avoid reordering nodes.

Don't account for the vertical space consumed by visibility:hidden
absolute nodes.
2014-12-17 18:57:23 +00:00
Maks Orlovich 9808ed1bb3 Change by jefftk:
We can get stuck waiting for apache to exit when the problem is that valgrind isn't exiting.  Kill it instead of waiting forever.
2014-12-17 18:56:33 +00:00
Maks Orlovich 6891d0c849 Sync genfiles 2014-12-17 18:55:02 +00:00
Jan-Willem Maessen d593015640 Make mobilization labeler flush-free by injecting JS with a list of the ids of
elements with each classification.  Strip out automatically-inserted ids if
we're not actually using them.
2014-12-16 21:11:31 +00:00
Jeffrey Crowell f8a29efdaf Add casperjs tests for admin site. 2014-12-16 19:13:27 +00:00
Jan-Willem Maessen 7a582eb598 Move AddJsToElement from StaticAssetManager to CommonFilter. 2014-12-16 14:59:31 +00:00
Josh Marantz f057ccf6cb Remove MobLogo option -- that's now bundled with MobNav. 2014-12-15 22:17:39 +00:00
Josh Marantz 92b784a524 Clean up the mobilization CSS flow. 2014-12-15 16:27:35 +00:00
Josh Marantz 3f14c78994 Use a string-map rather than a long || chain for flexible-width-tags. 2014-12-12 22:20:46 +00:00
Jud Porter 6002d561db Cleanup some JS in the open source flow. 2014-12-12 21:11:21 +00:00
Jan-Willem Maessen 5b2842b637 Rollback of navigational decision trees. Breaks navigation on some sites.
Revisit with acceptance tests.
2014-12-12 20:04:05 +00:00
Jeffrey Crowell 1b9f53a495 Fix syntax error on admin_site
for the onclick events for checkboxes on the caches page.
2014-12-12 17:57:09 +00:00
Josh Marantz 4a9195deac Adds JavaScript source for the mobilization layout. 2014-12-12 15:24:27 +00:00
Josh Marantz b27c030b5f Convert: DLOG(FATAL) -> LOG(DFATAL). LOG(DFATAL) will log an ERROR in
opt mode. That way if any of these are firing we will see them in the
error logs. This seems categorically better. (sligocki)

Make it possible to update static asset config dynamically (morlovich)

Compiled code updates
2014-12-12 15:18:09 +00:00
Jan-Willem Maessen 178c74421c New decision trees that account for parent role.
Also updated pagespeed_libraries.conf and rebuilt js.
2014-12-11 20:07:44 +00:00
Maks Orlovich 0ed098a0ac Fix up StaticAssetManager's gstatic/CDN configuration APIs
to actually keep track of original configuration so update 
configurations can be reverted.
2014-12-11 15:25:49 +00:00
Maks Orlovich 6f57594c5c Change by jmarantz:
Lint fixes
2014-12-11 15:24:45 +00:00
Shawn Ligocki 566009475a Remove LOG(DFATAL) for InlineOutputResource::url().
Document how an empty return from Resource::url() means that the resource has no URL.

I surveyed the callsites to Resource::url() and only a handful should be called for inline resources. Among those, several were simply for logging. The rest are addressed here: specifically: Adding the URL to the CachedResult for URL purging (Does not apply to inline data) and trying to find base and trim URLs in CssFilter.
2014-12-10 21:50:38 +00:00
Shawn Ligocki cee7f86d53 genfiles 2014-12-10 21:49:05 +00:00
Jud Porter 1eb7049611 Fix open source build when not use closure compiler. Resolves issue #1031 2014-12-10 18:36:50 +00:00
Jud Porter c912ccfeca Fix externs and flags for open source closure files. 2014-12-10 16:53:50 +00:00
Jan-Willem Maessen be8c964782 Add the add_ids_filter, which is based on Jason Hoch's old DOM structure filter.
The clever bit here is that if an element already has an id, we attempt to use
that id in creating the ids for its children.  The hope here is that those
labels will be consistent even as the page updates, particularly for areas
around the edges of the page (navigation, header, footer).

Also update generated JavaScript and libraries configuration.
2014-12-09 23:29:34 +00:00
Josh Marantz b6fb90d3ed Add copmiled XHR hijacking library and load it into mobilization filter. 2014-12-09 15:48:26 +00:00
Jan-Willem Maessen df6709cc7e Add signal that makes parent's classification visible to child. Training
excludes the same-classification signal because it dominates the classification
task, and is redundant with parent->child propagation in the labeling filter.
So this is intended just to lower the rate of "parent is content, child is
navigational" that we see if our input data doesn't support it.

I also updated the decision trees based on pre-CL training runs.  New trees
based on the new signals will be tested next.
2014-12-09 15:16:51 +00:00
Jud Porter 27d2ae9599 Nav mobilization fixes. 2014-12-08 21:28:18 +00:00
Jeff Kaufman 12619ea24e turn off parallelism in system tests 2014-12-08 20:06:57 +00:00
Jan-Willem Maessen 65ef0cc75f Avoid decision tree test segfaults when tree is malformed by conservatively
assuming any null child pointer makes a node into a leaf.

Also check in new builds of js code.
2014-12-08 19:32:03 +00:00
Jeff Kaufman 6dea5cece8 When we're waiting for a test to finish at a barrier, send its output to stdout. 2014-12-08 16:29:29 +00:00
Jud Porter 9d1497f927 Add nav mobilization JS. 2014-12-08 15:33:12 +00:00
Maks Orlovich e4436705a4 Add locking to StaticAssetManager so new gstatic/CDN config can be
updated from a thread.
2014-12-08 15:12:33 +00:00
Maks Orlovich d69f397704 Genfiles update 2014-12-08 15:08:18 +00:00
Josh Marantz 0f42ec395d Add new HTMLParse primitives for inserting script tags in various ways. Use
them in the mobilization filter to contorl whether the mobilize JS is loaded
in its compiled form or as original JS files.
2014-12-06 15:07:35 +00:00
Jeff Kaufman e6476d0473 Fix a test flake by making fetch until wait for both prerequisites, not just the one that usually happens first. 2014-12-06 14:26:56 +00:00
Jeff Kaufman 0023ea3487 Fix test flake by switching to fetch_until 2014-12-06 01:28:21 +00:00
Jeffrey Crowell 780c03cf3a fix hang in css parser on malformed unicode 2014-12-05 18:35:50 +00:00
Maks Orlovich 8a8cb10d3d Add a new proto-based API for configuring finding our static resources on gstatic
(or really any CDN), and port the old esting one to run on top of it.
2014-12-05 17:53:37 +00:00
Maks Orlovich d22ebe3835 Genfiles sync. 2014-12-05 17:52:37 +00:00
Shawn Ligocki 75ce722c84 Add new files (should have been in r4385). 2014-12-04 22:51:12 +00:00
Shawn Ligocki 98ffc6e1c4 Fix bug where Prioritize CSS would write a mixture of optimized and unoptimized content.
Two changes were necessary:
1) Change CssFilter to mutate the Characters Node contents, instead of replacing the node, so that the downstream CriticalSelectorFilter could read and write the new contents.
2) Register slots for inline rewrites so that they will be consistently processed in the correct order.

Note that the proper way to fix (1) is probably to use information from the InlineResourceSlot to Render the change in CriticalSelectorFilter, but that is a bit more complicated, for now we continue to use the saved Characters Node and expect that earlier filters will not replace it.
2014-12-04 21:57:19 +00:00
Jeff Kaufman 3086c7365c * When tests fail that we expect to fail, call it MOSTLY PASS instead of FAIL.
* Upstream an exit code change from ngx_pagespeed: https://github.com/pagespeed/ngx_pagespeed/pull/857
* Wait longer in fetch_until when running tests in the background.
2014-12-04 20:18:25 +00:00
Maks Orlovich 307d47c6c8 Make the font_inline test work with some changes in what
fonts.g.c produces.
2014-12-04 19:57:57 +00:00
Jan-Willem Maessen 20e6a0e5fe Make mobilization rewriting flush-tolerant. Also check in freshly generated versions of the js. 2014-12-04 19:20:46 +00:00
Maks Orlovich b131fc663c Add a proto for configuring gstatic/cdn resource paths. 2014-12-04 16:40:58 +00:00
Maks Orlovich b2ab7346ec Genfiles update 2014-12-04 16:39:38 +00:00
Maks Orlovich d1c92a4340 Change by cheesy:
Add alternate_origin_domain experiment option.
2014-12-04 16:38:59 +00:00
Jeff Kaufman 0056250d5d Fix a test flake in OptimizeForBandwidth when inherit vhost config is off. 2014-12-04 15:58:46 +00:00
Jeff Kaufman 1e9f878de4 Better paths for reporting errors on failures 2014-12-04 15:57:44 +00:00
Shawn Ligocki c1dbfcb5f6 Add onerror handlers to lazyload and delay images filters. Previously they only had onload handlers, but if the initial source failed to load, these handlers wouldn't be called. This could happen, for example, if the placeholder pixel was blocked server-side or something like that.
Fixes issue 1020.
2014-12-03 22:02:43 +00:00
Jeff Kaufman 971a7e5eb8 Move duplicate tests from apache/ and nginx/ to system/. Nginx side of the change is https://github.com/pagespeed/ngx_pagespeed/pull/852 2014-12-03 01:18:30 +00:00
Jeff Kaufman 958891d1ef genfiles update 2014-12-02 18:41:38 +00:00
Jeff Kaufman bd45145f2a Rework separation for parallization.
* Before, TEMPDIR was used in a few tests, was global to the user, and wasn't
  ever cleared.  Tests that worked in TEMPDIR and ran in both Apache and Nginx
  could conflict when run in parallel, and tests that wanted to be free from the
  influence of previous runs of the same test would use 12640 suffixes on files.

* Make there be one TEMPDIR for Apache and a separate one for Nginx that get
  cleared before every run.  This means we don't need the 12640 suffixes anymore.

* TEMPDIR should now only be used for test infrastructure and TESTTMP should be
  used by individual tests.  When running parallel tests, each test has it's own
  TESTTMP under TEMPDIR, so they won't collide.

* The cache flush test previously assumed it had exclusive write access to
  /mod_pagespeed_test/cache_flush/, which was wrong.  Now it copies the files it
  needs into /mod_pagespeed_test/cache_flush/12640 and works there.

* Simplify the filenames for parallelization logs and and temporary directories
  to be just the name of the test, and not include the PID of the process
  executing the test.

* Nginx side of the change: https://github.com/pagespeed/ngx_pagespeed/pull/855
2014-12-02 18:41:18 +00:00
Jud Porter e544adafa8 Update compiled JS. 2014-12-02 18:21:46 +00:00
Josh Marantz b031fa388d revert accidentally committed file. 2014-12-02 16:04:46 +00:00
Josh Marantz 702aea84a0 Load mob.js last since it calls the other two mob*.js files. 2014-12-02 15:37:02 +00:00
Jud Porter af21324c3f Update compiled JS. 2014-12-01 21:43:39 +00:00
Maks Orlovich 235de96620 Rename static_asset_config -> static_asset_enum, since I want to
put more stuff than just the enum there.
2014-12-01 16:30:42 +00:00
Maks Orlovich fb2f267cfd Regen 2014-12-01 16:29:52 +00:00
Jeffrey Crowell 0904e57668 update apache DEPS 2014-11-26 20:14:16 +00:00
Maks Orlovich 98bd0c00fe Extract out the enum used to name static resources in a proto,
so we could more sensibly talk about those in Googley configuration things.
2014-11-26 17:31:33 +00:00
Maks Orlovich 1201ccae5d Sync compiled JS 2014-11-26 16:42:53 +00:00
Josh Marantz 250fd30d80 Do not disallow */wp-admin/* as the underlying problem in the JS minifier
was fixed long ago.
2014-11-25 22:31:48 +00:00
Josh Marantz 808d178f09 Changes due to JS compiler update 2014-11-24 13:13:46 +00:00
Jud Porter 69813a0dd4 Restore accidently deleted ghost_click_buster_opt.js 2014-11-21 19:06:43 +00:00
Jud Porter 49479d3402 Export open source compiled JS. 2014-11-21 16:40:31 +00:00
Jeff Kaufman e38dfa690c Start running some system tests in parallel. 2014-11-21 16:36:06 +00:00
Jud Porter 7872a38e24 Enable building of JS files with closure compiler in the open-source flow. 2014-11-21 16:11:28 +00:00
Jeffrey Crowell 6f25a29843 Update jsoncpp dependency to track github.
Updates to jsoncpp v1.0.0
2014-11-20 18:15:27 +00:00
Jeff Kaufman a716f3d43f Stop assuming we always know how long a url will be and just remove from the end. 2014-11-19 15:14:28 +00:00
Jeff Kaufman 965fe7bfe2 Include PID in OUTDIR so apache and nginx system tests can be run in parallel. 2014-11-18 21:13:57 +00:00
Jeff Kaufman c91afcf595 Split tests into separate files that run in their own processes in preparation for parallelizing them. 2014-11-18 21:04:03 +00:00
Huibao Lin ecbac9cc18 Append more CSS to mobilize rewrite filter 2014-11-17 20:58:17 +00:00
Maks Orlovich 50c39fe2e7 Extend JS export of image info for mobilization to handle image rewriting
inside CSS files as well, including when files are touched indirectly by the flattener.
2014-11-17 18:02:44 +00:00
Jan-Willem Maessen 96c28ed60a Make mobilization UA-sensitive. Right now, just applies to phone UAs. 2014-11-14 15:58:48 +00:00
Josh Marantz abfa219d09 Expand AddTwoProtocolOriginDomainMapping to support specifying a host
header. (cheesy)

Add Apache-specific (for now) cookie-based proxy-authentication
infrastructure (jmarantz)
2014-11-13 21:01:12 +00:00
Shawn Ligocki e36db5c88b (From vchudnov)
GIF images: fix quirks mode; pad in scanline interface

This CL:

(a) tweaks the quirks mode as described in b/16539233, and

(b) causes the GIF reader returned by CreateScanlineReader() to pad GIF frames when they are smaller than the GIF image (or, in GIF terminology, to pad GIF images when they are smaller than the GIF screen).

The latter is done by means of a new MultipleFramePaddingReader class to implement the actual padding. This allows FrameToScanlineReaderAdapter to focus on simply converting the function calls between the two APIs.
2014-11-13 19:30:18 +00:00
Shawn Ligocki dac64ab37e genfiles 2014-11-13 19:29:23 +00:00
Shawn Ligocki 38a8789d0b Add failing test for the mixture of optimized/unoptimized content bug.
There are actually two specific problems here:
1) Critical CSS Section: Inline non-critical CSS is not being stripped if rewrite_css runs on it.
2) Full CSS Section: Unoptimized versions of inline CSS are being used instead of versions optimized by rewrite_css.

I have a pretty good idea for why this is happening and I'm working on a fix.
2014-11-13 19:27:36 +00:00
Maks Orlovich f5a458502a Optionally expose info collected by image rewriting to the JS mobilizer to help it along.
Not covering CSS yet.
2014-11-13 15:31:02 +00:00
Josh Marantz 8112df483b Revert to using window.innerWidth rather than screen.width, because the
latter doesn't give the data we want for iframes.
2014-11-12 20:53:56 +00:00
Jan-Willem Maessen 249e2f6812 New decision trees for *all* labels, not just for navigational regions. Also
refactored MobileRole to pull out MobileRole::Level (used in classification)
from the metadata actually used during rewriting.
2014-11-10 23:05:26 +00:00
Josh Marantz a12bea08ae OOM handling in webp optimizer (vchudnov)
Add anchor-tag for mobilizer progress bar to show debug log (jmarantz)
2014-11-10 22:04:23 +00:00
Jeff Kaufman 230cd53943 IE9 and IE11 don't support defer js, which leaves IE10 (Trident/6) as the only remaining version of IE to support all three of lazy-load images, inline images, and defer javascript 2014-11-10 18:21:02 +00:00
Jeffrey Crowell 8ede94a63b Update build system to work on old versions of GCC
Use non _vec version of BoringSSL's poly1305.c with old versions of gcc.
2014-11-06 21:48:39 +00:00
Jeff Kaufman 42582ea592 Allow spaces between filter names. Fixes Issue 979. 2014-11-06 15:12:37 +00:00
Jan-Willem Maessen 0f6fb0cb6a Propagate values of labeled nodes to their parent, if all children match. Also
turned LabelingMode into a struct with boolean fields, as this makes things a
bit more readable I think.
2014-11-05 15:58:08 +00:00
Maks Orlovich 9a8d5e5377 Helper class for doing value replacements on expressions of form
Identifier.Identifier = StringLiteral
2014-11-04 19:36:08 +00:00
Jeffrey Crowell 0a43438e76 Move from OpenSSL to BoringSSL 2014-11-04 18:14:57 +00:00
Josh Marantz 6901e40f5d When run in 'debug' mode, show the progress information in the
scrim. Add escapes in the scrim as well, to remove the progress bar (&
scrim) and to go to the original site.
2014-11-02 15:35:51 +00:00
Jeffrey Crowell 888f54ed86 kill apache if it is still running after 30s.
If apache is still running after 30 seconds of waiting for it to gracefully
quit, then issue it a `killall -9`
2014-10-31 21:18:13 +00:00
Josh Marantz 7d2c685499 Add progress bar initialization to the filter when in mob_layout_ mode. 2014-10-30 12:52:58 +00:00
Jan-Willem Maessen b754edafbd Consider <ul> to be a candidate for labeling, and count <li> elements. Also
tweaked whitespace counting to handle &nbsp;.
2014-10-29 20:50:35 +00:00
Josh Marantz ea390b4046 '#if' out the code to translate jquery.js to jquery.min.js -- that doesn't work on
all sites.
2014-10-29 13:09:52 +00:00
Jan-Willem Maessen 242261b561 Don't remove dimensions for inlined images in non-img contexts. 2014-10-28 21:30:11 +00:00
Jan-Willem Maessen 0fda822640 Put the dumping of mobilization data to the logs under the control of a
non-externally-settable option rather than doing it when debug is switched on.  Compute relative density of text and image tags within links.  Update the navigational classifier to use the new signals.
2014-10-28 00:20:57 +00:00
Shawn Ligocki a2dd36dd1a Absolutify urls() in @font-face. 2014-10-27 15:19:03 +00:00
Shawn Ligocki 12d1a43d8f genfiles 2014-10-27 15:17:43 +00:00
Maks Orlovich ed2a8d2c38 - Make Location: updating in DomainRewriteFilter apply
proxy suffix rewriting.
- In ProxySlurp, apply DomainRewriteFilter's Location:
  fix up directly on 3xx, since normal HTML rewriting
  won't actually run on a non-200.
- Permit proxy suffix rewriting to work accross different
  schema.
2014-10-24 17:27:47 +00:00
Josh Marantz edf0e1314f Add proxy suffix to base URL and <img> src. (huibao)
Put meta-tag and capture width early in head. (jmarantz)
2014-10-23 17:39:27 +00:00
Josh Marantz 4b68b24ade Fix compiler issue with signed/unsigned compares.
Non-functional reorg of webp code (from webp team).
2014-10-23 13:54:50 +00:00
Jud Porter 58a2de982e Remove polymer nav, and insert mob_nav.css. 2014-10-21 17:49:23 +00:00
Jud Porter 6cc47dec86 Library CDN updates. 2014-10-21 17:48:19 +00:00
Maks Orlovich eaaace1e62 Support POSTs in slurp/test proxy mode (mostly useful
for the latter, since it won't just save the result once).
2014-10-17 18:23:56 +00:00
Maks Orlovich 53fd2214b8 POST support in the Serf fetcher. 2014-10-17 14:51:00 +00:00
Jeffrey Crowell 45c6b79856 Disable SSLv3/SSLv2 support in serf.
Disable sslv2/v3 in instaweb_ssl_buckets.c (POODLE)
2014-10-17 14:32:03 +00:00
Maks Orlovich 9d93c11b31 Add an extra setting to use currently very-buggy
c++ mobilier path instead of somewhat more stable JS one.
2014-10-15 18:19:36 +00:00
Maks Orlovich 565cc4c936 Fix one more crash in labeler w/flushes. 2014-10-15 18:07:49 +00:00
Maks Orlovich 5f6b7e228a Fix crash when we passed empty string to the serf fetcher with proxy configured.
I think this is only possible to hit in some test-only configs.
2014-10-14 20:20:05 +00:00
Maks Orlovich 6bf6419e8f Change by jmaessen:
Don't crash / check-fail during labeling if there is a flush window;
just don't label in that case.
2014-10-14 17:52:53 +00:00
Maks Orlovich a583931cfc Move property cache and request_context to pagespeed/opt/http.
Only forwarind headers left in n/i/util now.
2014-10-13 20:22:59 +00:00
Maks Orlovich dfd62ef307 Fix variable naming in JS combining when MapRewriteDomain has a subdir.
Fixes ngx_pagespeed issue #812.
2014-10-13 15:15:26 +00:00
Shawn Ligocki 16596a9af7 Modify css_inline_import_to_link filter to allow converting @imports even if the <style> contains non-@import statements. We just peel off the @imports and leave the rest of the CSS in the <style>. 2014-10-13 13:42:28 +00:00
cheesy@google.com 0cc10e2109 Add instrumentation for requests with no per-domain config. 2014-10-10 23:10:57 +00:00
Josh Marantz 4399eb3ec0 New JS compiler updates.
Add mode-bits to enable experimentation with mobilizer.
2014-10-10 19:00:59 +00:00
Shawn Ligocki a69cad2244 Allow parsing COMMA token in values. This is necessary for parsing generalized @font-face src: properites. 2014-10-10 18:17:36 +00:00
Shawn Ligocki fa4278b067 genfiles 2014-10-10 17:57:12 +00:00
Shawn Ligocki 6ce4c7553c Parse @font-face directives.
After a discussion on www-style@w3.org, it appears that moving @font-face above all rulesets does not affect the meaning, so we keep the font-faces in a separate list (like @import and @charsets).

These may be nested inside of @media rules, so I had to re-work the parsing framework to allow parsing at-rules inside of @media.
2014-10-09 18:24:52 +00:00
Maks Orlovich a1e9c1c7fd Initial cut of sync show_ads.js -> async adsbygoogle.js converter filter.
Not hooked up yet, and needs a few more safety guards, too.
2014-10-09 16:43:47 +00:00
Jud Porter f30a7f7790 Update js compiler flags to match the default flags in the open source closure compiler. 2014-10-09 14:29:38 +00:00
Jan-Willem Maessen 804949abdd Integrate decision trees into mobilization labeler. 2014-10-08 23:02:28 +00:00
Josh Marantz 5e4f3d9fb6 Add proxy-suffix capability to slurping. 2014-10-08 19:30:28 +00:00
Maks Orlovich 10775e9845 Add support for parsing more obscure show_ads tags found by running this over
actual sites.
2014-10-08 19:18:37 +00:00
Maks Orlovich 610dec100b Regen... 2014-10-08 18:55:41 +00:00
Maks Orlovich acba13bf6e hange by jmarantz:
Stop printing a defunct field in the WebpStats structure -- it is uninitialized and will cause valgrind errors.
2014-10-08 18:55:08 +00:00
Josh Marantz 98e176fb43 Factor out mechanism to create a CacheUrlAsyncFetcher so it can be called without
a driver.
2014-10-07 21:21:16 +00:00
Shawn Ligocki 5ede493847 Make sure we record unclosed @import statements as well as raising an error. CSS spec says that all unclosed expressions must be implicitly closed at EOF. We must still preserve error to indicate that input CSS is not self-delimiting. 2014-10-07 20:41:02 +00:00
Shawn Ligocki 082ea0e60d File parse error if @media is unclosed. 2014-10-07 19:22:57 +00:00
Shawn Ligocki 044d9aa2be Recover from parsing errors in at-rules (such as @media, @import and @charset). 2014-10-07 16:49:51 +00:00
Shawn Ligocki 70abcf60ef genfiles 2014-10-07 16:49:33 +00:00
Jeffrey Crowell d3d6b48fb2 Add load_from_file_cache_ttl_ms option.
Add option to specify the cache ttl for resources loaded from file.
Addresses issue #989
2014-10-07 14:56:24 +00:00
Josh Marantz 5c59c179d6 Make SharedCircularBuffer a subclass of Writer, which allows SystemMessageHandler
to be tested without bothering to set up shared memory.

Fix a bug found in our first-char-of-line encoding scheme for message-type in the
shared circular buffer (and test it).

Fixes Issue 998
2014-10-07 13:43:43 +00:00
Josh Marantz d0c13a180d Rewrite hyperlinks to add proxy_suffix if one is specified, and the configuration
has hyperlink rewriting enabled.
2014-10-02 21:38:55 +00:00
Josh Marantz e262fc3008 Add new proxy_suffix functionality in DomainLawyer, and parse it in pagespeed.conf. 2014-10-01 22:45:02 +00:00
Jud Porter b55c5592f4 Fix the key used for reading from the renderedImageDimensions array. 2014-09-30 14:14:19 +00:00
Jud Porter abff4435e1 Compiled js update. 2014-09-30 14:13:52 +00:00
Jud Porter 7610ba5977 Log UNSUPPORTED_FEATURE for webp dimensions > 16383. (from jpfeiff) 2014-09-30 14:13:07 +00:00
Shawn Ligocki 86c00be798 Limit recursive depth of function parsing in CSS. Previously a file with many function calls inside function calls, like: a(a(a(a(a(a(... would create as many stack frames (actually twice as many) parsing this statement. We now limit to a max depth of 3. In practice I've only seen 2 layers. 2014-09-29 15:43:09 +00:00
Shawn Ligocki 7ae06c350a Don't call ParseAny() from Skip* functions. ParseAny() can call back into Skip* and thus create unbounded recursive depth.
Half fix to issue 992.
2014-09-26 21:22:53 +00:00
Shawn Ligocki 4af09754d1 A few simple minifications that I noticed while checking the CSS Parser.
1) Get rid of trailing spaces on @imports.
2) Omit units when value is 0.
2014-09-26 17:31:53 +00:00
Shawn Ligocki 6d6cee883a genfiles 2014-09-26 17:31:32 +00:00
Josh Marantz 74b1f34a5c Partially fixes Issue 982 2014-09-26 12:22:27 +00:00
Josh Marantz 5466f1cc10 Just because a browser appears to be Chrome, don't trust that it can
accept webp.  Modern Chrome sends Accept:image/webp, and we should
check that before rewriting img URLs to point to webp files.

Proactively fixes predicted Issue 978
2014-09-25 17:20:08 +00:00
Huibao Lin 238de611d9 (By tombergan): Fail early in ScanlineToFrameWriterAdapter if trying to write a multi-frame
image
2014-09-25 12:13:27 +00:00
Josh Marantz ba1fa76b28 Do not run Blink or defer_javascript on IE11 due to insufficient testing.
I had to pivot and leave IE9 enabled for these features to avoid
diving into a regold nightmare in the FlushEarlyFlow testing, which
for some reason is testing defer_js on IE9.
2014-09-24 19:34:42 +00:00
Jan-Willem Maessen f66b22888b Add config for mobilization data collection. Update js files and css parser. 2014-09-24 17:38:01 +00:00
Maks Orlovich c53ff6ef4e Fix a bunch of bugs in metadata cache viewer, including making its encoding less adhoc. 2014-09-23 15:00:42 +00:00
cheesy@google.com 970b434870 Add support for new experiment option 'matches_device_type'. 2014-09-22 21:37:45 +00:00
cheesy@google.com 74cd4fe758 Update with latest library versions. 2014-09-22 21:36:57 +00:00
Maks Orlovich 216880db8c Move logging-related classes to pagespeed/opt/logging.
(Needed for pcache..)
2014-09-19 21:28:31 +00:00
Maks Orlovich 82f6b07b0c Rebuild JS files with newer JS compiler... 2014-09-19 20:44:20 +00:00
Maks Orlovich 640464fd0b Change by (awesome Googler doing cleanups):
Fix header guard here.
2014-09-19 20:43:57 +00:00
Maks Orlovich 8e93b47835 Change by huibao:
Move more image processing utilities to pagespeed/kernel/image
2014-09-19 20:43:07 +00:00
Maks Orlovich fe544f5dc2 Change by mdsteele:
Distinguish between statement labels and object properties in JsTokenizer.

This is an obscure case I discovered we weren't handling correctly.

1) In "{foo:{}/x/i}", the "foo:" is a statement label, so the "{}" is an empty
   block, so the "/x/i" is a regex literal.  We already get this correct.

2) In "z={foo:{}/x/i}", the "foo:" is an object property, so the "{}" is an
   object literal, so the "/x/i" is division.  We were getting this case wrong
   before by failing to distinguish it from case (1).  Fortunately the fix is
   very simple.

3) Finally, in "z=function(){foo:{}/x/i}", we're back to a statement label and
   a regex literal.  However, previously we were throwing away the BkHdr parse
   state that allowed us to distinguish this from case (2).  Fixing case (2)
   requires us to retain that state to avoid breaking this case (unfortunately,
   this causes a little bit of code churn in the unit tests).
2014-09-19 20:41:41 +00:00
Josh Marantz 5a0e7e88c6 Factor out the domain registry API out of SystemRequestContext. 2014-09-18 18:28:53 +00:00
Huibao Lin 2969bb9144 Move more image processing utilities to third party 2014-09-18 14:46:54 +00:00
Jan-Willem Maessen 0ae19a322c Determine feature values and log them, but continue to classify based only on html5 tags. 2014-09-16 21:22:34 +00:00
Shawn Ligocki e6520a8fa7 Refactor Css::Parser::Skip* functions to use the correct error handling proceedures:
1) Skip over nested {}, [] and ()
2) Skip over strings, identifiers, at-rules and other "any" values that may contain escapes like \}.

These cases were partially covered by different of the Skip* functions, but not in all.

Proper recovery for at-keywords in values lists was pretty unclear in the spec, but from a test in a variety of browsers, it appears that they do not follow the same recovery procedure as at-rules. Specifically at-rules are supposed to be terminated by the first of ;, the next {} block or a closing }. But almost all browsers interpret

.foo { font: bold 20px monospace @foo; color: green }

as simply:

.foo { color: green }

throwing away the font property because one of the properties wasn't valid, but also considering the ; to end the entire declaration, not just the unexpected at-keyword.
2014-09-15 19:57:37 +00:00
Huibao Lin beb1314428 Add Windows 2014-09-15 16:27:54 +00:00
Huibao Lin e9e75a71ac Reset color channels for transparent pixels in GIF images 2014-09-15 16:26:44 +00:00
Maks Orlovich c389584a20 Split out out RequestContext::TimingInfo into a separate class. This is because
LogRecord uses it, and I want LogRecord to go into pagespeed/opt/logging/ 
while RequestContext would go into pagespeed/opt/http/
2014-09-15 16:20:31 +00:00
Maks Orlovich cfab3e070c Regenerated with new additions... 2014-09-15 16:19:37 +00:00
Maks Orlovich 73fb6acafa Get rid of the no longer needed forwarding headers. 2014-09-15 13:52:52 +00:00
Josh Marantz 50eb010352 Fix compiler errors on gcc 4.6.3 due to mismatched format strings
and integer types.
2014-09-12 13:53:50 +00:00
Shawn Ligocki 0b035a23cd Raise CSS parser error for unclosed @import statements. Specifically, CSS combiner cannot combine @import statements that are not closed by ;. 2014-09-10 18:06:54 +00:00
Shawn Ligocki b32b91ff3b genfiles 2014-09-10 18:06:14 +00:00
Maks Orlovich ae8118bbe0 Fix a few remaining forwarding header uses. 2014-09-10 17:08:10 +00:00
Shawn Ligocki 0315d1c100 Fix CssInlineImportToLinkFilter to only inline if there were no parse errors. Before this CL the malformed expression:
<style>@import foo</style>

would be completely removed from a page. I can't think of any reason that that would break a page, since this is only true for malformed expressions, but it seems like it's better if we don't touch things we can't parse.

To make this work I also had to add an error for when ParseImport hits an unexpected token and remove one for when ParseMediaQueries hits EOF (because @imports technically do not need to be closed by a ; at the end of the file).
2014-09-09 21:47:59 +00:00
Shawn Ligocki 4f067fa44d Report parsing error if there comment is unclosed at end of file.
Much like unclosed an { brace, unclosed comments will specifically cause problems for CSS combining.
2014-09-09 19:35:52 +00:00
Shawn Ligocki af62e1e5bf Fix #define guards format 2014-09-09 17:29:13 +00:00
Shawn Ligocki baeaa20890 genfiles 2014-09-09 17:28:32 +00:00
Jan-Willem Maessen 03e166eac5 Decision tree death tests were causing test failures when testing in release mode. Those tests are now only run while in debug mode. 2014-09-08 18:01:16 +00:00
Jan-Willem Maessen a095644945 Include guard fix for image_spriter.h
Added decision tree logic to rewriter/. This only includes code for constructing
and running the decision tree, but not the actual decision trees we will use for
classification.

Don't CHECK-fail in IsSafeToRewrite.
2014-09-08 17:42:36 +00:00
Jeffrey Crowell addb80744c Update out of memory test.
Test now uses default threshold of 8x1024x1024 pixels and will pass on 32bit ubuntu.
2014-09-06 00:41:11 +00:00
Maks Orlovich 8646e9bdf2 Run the forward header use removal over remaining directories
in net/instaweb, and re-run it on some of previously converted
dirs to take advantage of fixes in the script.
2014-09-05 21:27:15 +00:00
Maks Orlovich 3a55d3780f Change by by stevensr:
Minor edit to mobilizing CSS to make headers look a bit nicer in some cases.

+genfiles sync
2014-09-05 20:16:17 +00:00
Maks Orlovich 2b0783a53e Move the enum .proto into proper spots under pagespeed/ and
start untangling some of the dependencies...
2014-09-04 18:44:19 +00:00
Shawn Ligocki 746a6b98e5 Remove unused css_parser files 2014-09-04 15:44:38 +00:00
Shawn Ligocki 23fe92d83e Remove forwarding headers 2014-09-04 15:44:20 +00:00
Maks Orlovich 7932f5ff84 Get rid of most uses of forwarding headers in
net/instaweb/r.*

(This is autogenerated; it is expected to miss a few things).
2014-09-03 20:15:47 +00:00
Maks Orlovich 26b9d92ea0 Get rid of most uses of forwarding headers in
net/instaweb/{h,j}*

(This is mostly autogenerated; it is expected to miss a few things).
2014-09-03 19:46:07 +00:00
Maks Orlovich 05700e83c4 Get rid of most uses of forwarding headers in
net/instaweb/{a,b,c}*

(This is autogenerated; it is expected to miss a few things).
2014-09-03 17:11:10 +00:00
Maks Orlovich af0f7f287e Woops, forgot to svn add it in the last commit 2014-09-03 17:10:05 +00:00
Maks Orlovich ad1cb41cf4 Changes by huibao:
Use OptiPNG and multiple configurations to improve Scanline PNG writer

This CL improves the Scanline PNG writer by
(1) using OptiPNG
(2) trying 4 set of configurations and using the best one.

On 10,389 GIF and PNG images test set, the average size has been reduced from 8,551 to 8,186 bytes. That is 4.3% improvement.
-----

Change LOG level to INFO for images with size different from that of frames

This is a quick fix to silent the log. A thorough fix is to pad the frame when it's smaller than the image.
2014-09-03 17:04:16 +00:00
Maks Orlovich 83cc2858ef Change by jcrowell:
Add logging on failed signature checks.
2014-09-03 17:02:38 +00:00
Maks Orlovich 795004daff Regen with one more version 2014-09-03 17:01:41 +00:00
Maks Orlovich e143c7ffb2 Sync JS/CSS genfiles. 2014-09-03 14:58:34 +00:00
Jeff Kaufman 8011709780 Add a test for https://github.com/pagespeed/ngx_pagespeed/issues/771 and apply Otto's fix. 2014-08-29 21:21:30 +00:00
Jeff Kaufman e523044b75 Include both Varnish 3.x and 4.x VCL 2014-08-29 21:20:13 +00:00
Jeff Kaufman c28dc43465 Enable In Place Resource Optimization (IPRO) by default. 2014-08-29 21:14:21 +00:00
Jan-Willem Maessen 62aa2c594e Label DOM elements based on the HTML5 tags we find there. Note that a lot of
this is really groundwork for more sophisticated signal gathering.  Eventually
we'll have to defer labeling any given element until we can compute some global
properties (such as count of words / characters / links).
2014-08-29 16:44:20 +00:00
Josh Marantz c954d45879 Lots of admin site visual cleanup.
When printing an error message that cache-purging is not enabled:
  1. Print the correct syntax for each server (nginx vs apache)
  2. Point to the user to the doc explaining the feature in more detail
  3. Allow C++ to emit HTML formatting to make all that look better.

Clean up the whole CSS world, using CSS for more of the styling rather than
inlining styles.  Avoid using "em" for font-sizes as it seems to make
embedded monospace look too small, instead using "12px" as our base size for
most text.

This gets our whole admin site using just sans-serif and (in limited
places) monospace.  There used to be other serif fonts mixed in and it
looked pretty bad.

In the purge table, draw a horizontal rule above it.  Omit the table
if it's empty.  Omit the sort-order button if there's just one
element.  Put the URLs in the second column and the dates in the first
column, since the dates are fixed width.

Generally make most stuff smaller.
2014-08-28 21:03:14 +00:00
Josh Marantz dda04cb17b Attempt to deflake the serf tests a bit.
js compiler update.
2014-08-28 20:01:49 +00:00
Maks Orlovich f239c9ec40 Improve debug output when we're replacing the destination IP
due to loopbackroutefetcher (or FetchOriginDomain), logging both the URL
as the destination server would see it and the connection host/IP.
Fixes mod_pagespeed issue 786
2014-08-28 17:57:00 +00:00
Josh Marantz 76dfa59d76 Remove superfluous check for a gif file that appears to be written
later in the script.
2014-08-28 17:15:15 +00:00
Josh Marantz 6ed6267f2e Lookup statistics variables at initialization time, rather than
every time we want to log something.  This is more efficient, and also helps
us fail on startup if we change the name of a stat at some point in the future,
rather than at some hard-to-predict point after requests start processing.
2014-08-28 17:07:52 +00:00
Jeff Kaufman facf765a30 The 'Do not proxy content with unknown type' test was broken because it expected modpagespeed.com/do_not_modify/unknown_file.unknown to be served with no content type. In the version of Apache modpagespeed.com runs, serving without a content type appears not to be possible, so the server is now running two little psuedo-http servers in userspace with netcat on ports 8091 and 8092 that serve files with and without a content type. It's a bit of a hack, but it means people can run the test again. 2014-08-27 20:26:32 +00:00
Shawn Ligocki 0b156e6e24 Print CSS text (rather than ids) when CSS tests fail. This makes it much easier to find which test failed.
Old failure log:

[ RUN      ] CssFilterTest.RewriteVariousCss
[0822/190921:WARNING:google_message_handler.cc(38)] CSS parsing error in http://
test.com/distilled_css_good70-inline.html
net/instaweb/rewriter/css_rewrite_test_base.cc:95: Failure
Value of: num_blocks_rewritten_->Get()
  Actual: 0
Expected: 1
distilled_css_good70-inline
net/instaweb/rewriter/css_rewrite_test_base.cc:97: Failure
Value of: num_parse_failures_->Get()
  Actual: 1
Expected: 0
distilled_css_good70-inline
...

New failure log:

[ RUN      ] CssFilterTest.RewriteVariousCss
[0825/113839:WARNING:google_message_handler.cc(38)] CSS parsing error in http://test.com/distilled_css_good70-inline.html
net/instaweb/rewriter/css_rewrite_test_base.cc:95: Failure
Value of: num_blocks_rewritten_->Get()
  Actual: 0
Expected: 1
a{_height: expression((parentNode.offsetHeight-17))}
net/instaweb/rewriter/css_rewrite_test_base.cc:97: Failure
Value of: num_parse_failures_->Get()
  Actual: 1
Expected: 0
a{_height: expression((parentNode.offsetHeight-17))}
...
2014-08-27 19:46:36 +00:00
Shawn Ligocki 45be1ce013 genfiles 2014-08-27 19:46:09 +00:00
Shawn Ligocki d4dfe13042 Make JsTokenizer more tolerant of invalid UTF-8 input.
Specifically, allow invalid UTF-8 characters in comments and string
literals, which is where they usually show up.

The main upside to this change is that it lets us (usually) get away
with passing unconverted Latin1-encoded input into JsTokenizer, even
though JsTokenizer requires UTF-8 input.  The main downside is that in
order to make this work, given RE2's limitations, I have introduced
some, um, subtlety into the way string literals are matched.  "Subtle"
is not something that one wants one's code to be.  So I'd appreciate
feedback on whether there's a better way to do this. (mdsteele)
2014-08-27 19:45:48 +00:00
Huibao Lin 06783018c0 Refactor image conversion timeout handler 2014-08-27 17:26:21 +00:00
Josh Marantz 6fed285454 Clean up admin graphics a bit. Tighten up the spacing for the
bar-charts.  Refactor the code a little to make it more compliant and
easier to follow.

Clean up the language around message filtering.

Count the initial change from 0 as an update when comparing frequency
of statistics updates.
2014-08-27 12:57:41 +00:00
Shawn Ligocki 2852e56e24 Fix bug in CSS parser found while investigating parsing errors for CSS like:
a { _height: expression((parentNode.offsetHeight-17)) }

Turns out there was a bug where ParseAny() would double count parentheses. For example, starting on "(2 + 3) 9 7)" it should skip over just "(2 + 3)", but before this CL it would skip all the way over the entire string by counting the first ( twice.

Improves non-recoverable CSS parsing failures from 137/2729 to 79/2729. (net/instaweb/rewriter:css_minify_count)
2014-08-25 21:17:03 +00:00
Shawn Ligocki 1d2fdffed6 Genfile update. 2014-08-25 21:16:24 +00:00
Huibao Lin e3cd89e534 Correct the path in image_analysis.* 2014-08-25 18:24:04 +00:00
Huibao Lin bdccb3677b Skip checking whether JPEG images have photo content and fix a bug in AnalyzeImage() 2014-08-25 18:07:05 +00:00
Shawn Ligocki cce6a5b9e7 Set HttpOptions in rewrite_proxy. For now we still default to kDeprecatedDefaultHttpOptions, but then set them later for both HTML and .pagespeed. resource flows. 2014-08-25 17:20:05 +00:00
Shawn Ligocki c5e1d241e0 Adding the "value" attribute for parsing it out of form input fields. (heinenn) 2014-08-25 17:18:42 +00:00
Josh Marantz 31ed5b5854 Clear WGET_ARGS at the end of each test, increasing test independence.
Clean up some confusing shell pipes that were expected to fail at the
end of the pipe.

Eliminate some redundant "|| fail" which is no longer needed now that we
run tests with "set -e" and "trap".

Adds a compile dependency for the static_rewriter .o files on the .a,
so we don't crash nginx tests when we change class layouts.  This is a
little conservative but recompiling those 2 object files is cheap.

This must be committed with https://github.com/pagespeed/ngx_pagespeed/pull/782
2014-08-23 17:19:33 +00:00
Shawn Ligocki 03124e7323 Fix "Double escaping \ in media queries" CSS bug. 2014-08-22 20:56:40 +00:00
Shawn Ligocki 70ee3a98c7 Add failing tests for all failed parses found in "State of the CSS Parser" tests. Next I will start fixing some of these. 2014-08-22 15:33:36 +00:00
Maks Orlovich 2dfee525f5 Remove handling of test-only variant of legacy resource encoding,
since it could result in log spam on some pretty reasonable URLs.
Should hopefully fix mod_pagespeed issue 688 in practice.
2014-08-22 14:27:09 +00:00
Maks Orlovich b2c3833c13 Change by jmarantz:
- Make the html restore tests less noisy.
- Explicitly test that responses with must-revalidate are cacheable.

Also regend of some debug JS genfiles.
2014-08-22 14:15:01 +00:00
Josh Marantz 010d6fedd9 Split off options for rewriting of external and internal JavaScript,
partially resolving
   https://code.google.com/p/modpagespeed/issues/detail?id=966
and fully resolving
   https://code.google.com/p/modpagespeed/issues/detail?id=853
2014-08-21 15:47:34 +00:00
Josh Marantz c3e1afef8a Make the html restore tests less noisy.
Explicitly test the must-revalidate semantics for caching headers.
2014-08-21 14:31:57 +00:00
Shawn Ligocki 11894119f0 Three small changes:
1) Move instructions for debugging rewrite_proxy_test.sh into scope where PID is defined so the instructions work.
2) Remove TODOne TODO.
3) Fix really easy TODO.
2014-08-20 19:48:31 +00:00
Shawn Ligocki a1ac241ab5 Upgrade CSS parse failures to Warnings so that they appear in logs and we can find real failing examples.
Driver()->InfoAt() appears to not even log to INFO logs (I think I remember it was too noisy, so we turned it off).
2014-08-20 19:03:31 +00:00
Jeffrey Crowell bbadba7c30 Make url_namer take in a RewriteOptions 2014-08-20 17:03:54 +00:00
Jan-Willem Maessen f1a42a2312 Ignore scoped css in css_summarizer_base; this should be safe for crtical CSS
according to Maks's spec investigations, as the scoped CSS blocks have higher
priority than the CSS rules we move and duplicate within the document.
2014-08-20 15:15:26 +00:00
Jeffrey Crowell 2da4551280 Add additional tests for hmac-sha1 and update string compare to be constant time. 2014-08-19 21:12:12 +00:00
Jeff Kaufman 8c2ff4583c Only log cookie mangling errors for cookies that might be ours. Fixes Issue 972. 2014-08-19 15:34:13 +00:00
Huibao Lin 48934ef692 Make the scanline readers return whether the image is progressively encoded 2014-08-19 13:32:03 +00:00
Josh Marantz ca68fcfd21 Add the ability to make an element 'invisible', which can be done any
time before the StartElement is flushed.  It achieves the same effect
for browsers as DeleteSavingChildren, but is a lot simpler because it
doesn't alter the in-memory DOM, it just affects the way it's
serialized.  Downstream filters of course would still see the element,
thought the HtmlWriterFilter will deliberately ignore it.

We store this 'invisible' bit into the 'style' enum, which prior to
this CL was closed close_style, CloseStyle, etc.  Most of the changes
in the CL are for that trivial rename.
2014-08-19 12:34:44 +00:00
Huibao Lin df97e7c6d4 Change 'Purge successful' to 'Added to Purge Set' for cache purging except for 'purge entire cache' and 'purge *'. Reformat the purge set, add sorting in ascending/descending time to it. 2014-08-16 03:11:04 +00:00
Huibao Lin b8d47f8e71 Disable WebP inlining for Chrome 36 & 37 on iOS 2014-08-16 03:07:10 +00:00
Huibao Lin 08a6c7e652 Upgrade libwebp to 0.4.1 2014-08-16 03:05:34 +00:00
Josh Marantz 377dab30e6 Remove spurious newline. 2014-08-15 20:15:05 +00:00
Josh Marantz 4b1433bdbf Another iteration at de-flaking SerfUrlAsyncFetcherTest.
JS compiler updates.
2014-08-15 19:10:35 +00:00
Jeff Kaufman f1407e7881 Change chromium openssl url to googlesource.com 2014-08-15 14:26:17 +00:00
xqyin 9c8852d10e Rename the JS files under /system. 2014-08-14 19:21:25 +00:00
xqyin 23a6b7eae0 For stats page, sort the list by the frequency of change. Fix data names with leading/trailing underscores and dashes. Fix location URL parsing when sending request on statistics page and graphs page. 2014-08-14 17:56:33 +00:00
Josh Marantz 4decc95b23 Add APIs for deferring and restoring HTML Nodes.
Make DeleteNode work when called at the StartElement for a node whose
EndElement event has not yet been parsed.
2014-08-14 01:16:20 +00:00
Huibao Lin d1e7298104 Disable WebP inlining for Chrome on iOS mobile devices 2014-08-13 20:16:56 +00:00
Huibao Lin a8d5296731 Add Chrome for iOS to WebP support list 2014-08-13 20:02:31 +00:00
Josh Marantz 2d5f7d1865 De-flake serf test.
JS update for compiler changes.
2014-08-13 15:30:16 +00:00
xqyin 94351d50da Show 'the # of filtered messages/the total # of messages' on statistics page and message history page. 2014-08-12 19:56:37 +00:00
Josh Marantz 19e18ce394 Clean up debug helper methods, to make them easier to call from the
debugger.  Add the attributes to the HtmlStartElement and HtmlEndElement
events, so we know more than just the tag name in when calling
DebugPrintQueue.

Simplify the implemenation of DeleteNode, eliminating a redundant
state variable.
2014-08-12 19:42:56 +00:00
Josh Marantz 2205e8e5cb Don't use "head -25" for testing admin-site HTML because now we inject
CSS.  In some contexts it seems like the CSS is getting inlined
unminified CSS injected including the boilerplate Apache comments, so
"head -25" doesn't have what we are searching for.

JS updates for new compiler release.
2014-08-12 19:38:06 +00:00
xqyin f1dc6f6f6a Use brown instead of blue for warnings on message history page. 2014-08-11 20:02:43 +00:00
xqyin 228db85f95 Move graphs/caches CSS to separate files. Put common styles that are shared by different pages to admin_site CSS file. Fix some naming mistakes according to the style guide. 2014-08-11 14:14:21 +00:00
Shawn Ligocki 1a1d902f91 Avoid ResponseHeaders::CopyFrom() in several places which led to options being confusingly set in different places. 2014-08-08 19:38:00 +00:00
xqyin 3ad5292b0c Add a 'Physical Caches' tab on caches page to show physical caches status. 2014-08-08 14:09:39 +00:00
Jan-Willem Maessen 0b7d3c50ce Fix treatment of scoped style blocks in css_move_to_head_filter and css_outline_filter. 2014-08-07 15:19:45 +00:00
xqyin 5b98fb2c86 Use 'textContent' instead of 'innerText' to support Firefox in admin site. 2014-08-07 13:43:00 +00:00
xqyin 63cf266ed7 Show the result of cache purging and metadata cache entry on the same page instead of going to a new page. 2014-08-06 17:55:49 +00:00
Josh Marantz b7f877cf05 Resolve compilation warning. 2014-08-06 13:18:57 +00:00
xqyin bb992187cb Replace PieCharts with BarCharts and use AnnotatedTimeLine to show statistics history on graphs page. 2014-08-05 17:48:38 +00:00
Josh Marantz e1fba76efa Fix error-code checking for mod_spdy integration test. 2014-08-05 12:35:36 +00:00
Josh Marantz da0b0d9308 Remove inadvertantly committed generated file. 2014-08-04 21:14:56 +00:00
Josh Marantz e5458b3f40 Make system tests fail when there is an error in the script. This
required wrapping all the commands that were expected to fail in
functions (check_not, check_error_code) that check for failure and
swallow it to avoid aborting the script.
2014-08-04 14:36:04 +00:00
Maks Orlovich b0d3a12f0c Open-up some ad related functions; hopefully we may be able to use
them to make a "make_google_adsense_async" filter at some point...
2014-08-01 19:31:00 +00:00
Jan-Willem Maessen c343c4687d Propagate fetch failures. The core here is the change to
Resource::IsSafeToRewrite, which I'd already started work on when Shawn flagged
it as a TODO in his CL.  Note the TODO: I've fixed the most-used call site, but
need to fix the others (mostly resource combiners).
2014-08-01 14:11:21 +00:00
Josh Marantz 9369f9fa93 Make sure we mate all the 'check_not_from' with 'check_from' to ensure that
the output we are testing is not simply empty, or an unrelated error.

Factor out the different ways we test for '200 OK' into some common helper
functions.
2014-08-01 01:49:08 +00:00
Josh Marantz 9687e967a9 Move the method for computing image format to pagespeed/ so it can
also be used by other products.
2014-08-01 01:45:26 +00:00
Jeffrey Crowell 1fef22020d update system_test to use fetch_until where files exist. 2014-07-31 18:29:38 +00:00
Jud Porter 1d0b8277fe Modify JS compiler flags. 2014-07-31 17:34:13 +00:00
xqyin e277be69a9 Showing the number of messages on message history page and statistics page. 2014-07-30 20:19:53 +00:00
xqyin ee48d61efa Use '#' in URL and underline current active tab under graphs page and caches page. 2014-07-30 19:30:15 +00:00
Jud Porter be22e68934 Add mising .a files from psol.a. 2014-07-30 18:40:36 +00:00
Jud Porter 363e6638b8 Remove some outdated console code. 2014-07-29 22:13:26 +00:00
Josh Marantz 77d70fa8a8 console JS recompile update
use fetch_until to deflake a system test.
2014-07-29 20:33:40 +00:00
Josh Marantz 54d6590ada Don't use UpDownCounters for the HTTPCache stats, use one-way
variables.  This required being a little more careful with how we
account for stats on a write-through, since we can't add negative
corrections.

Note that there was some regolding as the currently results counted
expirations for both L1 and L2.  I think that was golded wrong: the
expirations should only count once per lookup for the entire
write-through flow.
2014-07-29 20:32:46 +00:00
xqyin 24b170ce1c Add a StatisticsJsonHandler to dump data in json format for statistics page and graphs page. Use ConsoleJsonHandler for the first refresh to get historical data and use StatisticsJsonHandler to get snapshots. 2014-07-28 21:18:16 +00:00
Shawn Ligocki d2d38c55d9 Remove respect_vary param from one of the HttpCache::Put() starting to weed out passing this option explicitly. 2014-07-25 20:34:29 +00:00
Maks Orlovich 6a517c04f3 Make metadata cache inspector form available at
rewriter/ level, for ports which don't use system/
2014-07-23 17:45:51 +00:00
Shawn Ligocki d7fa9e1b87 HttpOptions in HttpCache.
Lots of TODOs to get rid of explicit passing of respect_vary parameter. Replacing that parameter will be a bit of work.
2014-07-23 17:36:30 +00:00
Maks Orlovich c810b20c7e Change by cheesy:
Unit test hygiene; Fix a couple of bugs where the driver script wasn't very
robust to unexpected inputs, at least one of which was causing a false positive
on a broken test.
2014-07-23 17:25:52 +00:00
Jeffrey Crowell 2c13241622 fix sed command in system_test
added required trailing slash to sed command for generating url.
2014-07-23 14:22:13 +00:00
Jeffrey Crowell cd93407214 fix system_test error caused by generate_url
generate_url was used incorrectly, so that in some configurations, a test would fail.
2014-07-22 20:11:55 +00:00
Maks Orlovich 98d2efdc80 Properly handle null <img src> in debug filter critical
image info, by making sure we make a StringPiece, not a
GoogleString.
2014-07-22 17:13:54 +00:00
xqyin 9afe89626b Move the listener of xhr outside of performRefresh() to avoid calling drawChart functions multiple times in one refresh. 2014-07-21 18:06:29 +00:00
Maks Orlovich 65764ac3bd Fix a race in FlushEarlyFlow, involving the request headers:
- Write on configuration read callback.
- Read in AsyncFetch::HeadersComplete, invoked after property cache
  lookup (which proceeds in parallel to config lookup) completes.

This is done by gating successful property cache callback infocation
on having the configuration read/request headers computation complete.
2014-07-21 14:38:07 +00:00
Maks Orlovich 35975a03b9 Regen with newer version. 2014-07-21 14:30:55 +00:00
Shawn Ligocki 5cad60a867 Propogate HttpOptions more widely:
Store a copy in InPlaceResourceRecorder.

Add respect_vary to HttpOptions.
2014-07-18 21:22:25 +00:00
xqyin 9d7cf356f7 Make different tabs query params to fix the 'refresh and return to default tab' issue on caches page. 2014-07-18 19:25:37 +00:00
Shawn Ligocki 5a8b4055bd Propogate ResponseHeaders option setting more widely. 2014-07-17 20:23:56 +00:00
xqyin fd591e5c3c Add auto-refresh and filtering to statistics page (move raw mode from graphs page to statistics page). 2014-07-16 21:38:45 +00:00
Jud Porter aa548137b1 Cleanup gmock includes. 2014-07-16 14:50:25 +00:00
Shawn Ligocki 2a052f3116 Print debug messages when OutputResources could not be created because:
1) URL would be too long,
2) Rewriting was disallowed,
3) Domain not authorized (we'd expect this to trigger on inputs first, right?)
4) Input resource was not cacheable, 404, etc.
2014-07-15 20:30:47 +00:00
Jan-Willem Maessen 61f2cd90fc Include content hashes using new minifier in addition to the ones using the old minifier. 2014-07-15 20:10:06 +00:00
xqyin bec7b4581d Use open sourced externs file for google.visualization API. Remove the duplicate listing in js_externs.js file. 2014-07-15 14:59:09 +00:00
xqyin 5eef55f7f0 Fix the TAP break caused by segment fault in ShowCacheHandler method. Fix the messages_js_test. 2014-07-14 22:26:09 +00:00
xqyin 3fd4ae3aad Integrate various charts to a new graphs page in admin site. 2014-07-14 19:07:24 +00:00
Matt Atterbury 59846be69e MPS issue #850: Add an id to the scripted inline image and look that up in
the JS, rather than assuming it is the element immediately before the script.
Even without a repro testcase this seems a sensible thing to do.
2014-07-11 16:49:47 +00:00
Shawn Ligocki 9eaa13e884 Framework for rooting in implicit_cache_ttl_ms from RewriteOptions into every ResponseHeaders object. Currently we have a set_implicit_cache_ttl_ms() method, but many callers do not use that setter and thus end up with default options.
Create HttpOptions structure (and future uses that want to access options from http/ directory).

Store a copy of HttpOptions in RequestContext. These contexts are a good way to get options into ResponseHeaders constructor in AsyncFetch.

Store a pointer to RewriteOptions in Resource. Resources also create ResponseHeaders and storing a version in here is useful.

I tried to pass in the correct custom options in each case, but in many places I could not access custom options. These are all marked with TODOs (or Notes explaining why default options are fine). A follow-up will pipe in custom options in those cases that need them and verify that the rest do not. Note: I believe that this does not regress anything. Just exposed the places where we are using default rather than custom options.

Also TODO is getting rid of the default ResponseHeaders constructor and forcing all construction to explicitly pass in options.
2014-07-11 15:30:04 +00:00
xqyin 2260603090 Add purge cache UI to caches page in admin site. 2014-07-11 14:41:24 +00:00
Jeffrey Crowell 2bd6b831ad add additional system information to the debug filter 2014-07-10 20:56:03 +00:00
Maks Orlovich 203fb48030 Fix the mod_spdy integration fetch test with wget >= 1.14 2014-07-08 18:14:26 +00:00
Maks Orlovich 657796af78 Update g++ versions we use -Werror on for Trusty, and drop whatever that was before precise.
Fix the one failure that shows up.
2014-07-08 14:58:05 +00:00
Matt Atterbury 3032940939 Added +debug message for when a resource isn't rewritten because its domain
isn't authorized. That happens in a LOT of places!
2014-07-08 14:19:46 +00:00
Maks Orlovich 90f014c09c Export some more library mappings. 2014-07-08 13:18:12 +00:00
Jud Porter 9b6649772d Update gtest and gmock versions so we can use some of the newer gmock matchers available. 2014-07-07 17:16:18 +00:00
Jud Porter 3dc91b0dd6 Added two test cases for JSON code blocks to ensure the JS minifier properly minifies it. (from stevensr) 2014-07-07 17:15:30 +00:00
cheesy@google.com 71afc7fef6 Add messages to DebugFilter for every Filter that decides to disable
itself due to request parameters. Filters may optionally add a reason
when they disable themselves which will also be output.
2014-07-07 15:26:05 +00:00
Maks Orlovich 7cdf54696b Close the FileSystem::OutputFile objects to delete them,
so we don't get leak warnings on exit.
2014-07-02 16:59:52 +00:00
Huibao Lin cd7fecaac4 Fix msan failure by clearing image data after allocating a WebPPicture 2014-07-02 14:29:09 +00:00
xqyin 498a43e32a Move Javascript and CSS files related to admin site from rewriter/ to system/. 2014-07-01 22:26:57 +00:00
xqyin 018ea48691 Add revseing lists, auto-refresh, filtering to message history page. 2014-06-30 20:51:05 +00:00
Jud Porter 29b9307a09 Cleanup some calls to StringPiece::data() where StringPiece::size() was missing. 2014-06-24 16:50:03 +00:00
Maks Orlovich 155a23691f Change by vchudnov:
Fix msan failure triggered by gif_square.

The uninitialized value appears to come from giflib5 not clearing or copying the flag when creating a new ColorMap object.
2014-06-23 16:42:26 +00:00
Shawn Ligocki f47604455e Make source maps less verbose by only outputting mappings when chars are removed, not at every token. 2014-06-23 15:50:35 +00:00
Maks Orlovich b9b7dd43df Do not propagate debug messages up in the filter itself;
the framework will do it automatically, and do so without violating
thread safety:

Before this it was possible for a nested image rewrite 1 to be
rewriting and touching parent CachedResult from a slow-rewrite thread,
while a second one was being Propagate()d on main rewrite thread touching
the same thing. Now all the propagation is on main rewrite thread.

Fixes tsan failure.
2014-06-23 13:17:49 +00:00
Jeffrey Crowell 45f147f31a Add allow invalid signatures option for transition to signed resources 2014-06-20 20:35:46 +00:00
xqyin 45f4be62c7 Inject debug comment for introspective JS in cache extender. 2014-06-20 17:23:23 +00:00
Jan-Willem Maessen f1aef8e470 Read animated GIFs via a new GifFrameReader class.
As per previous discussions, I am also changing the MultipleFrameReader
interface so that Get{Image,Frame}Spec() assign a copy rather than a
pointer. Some of the other changes made it obvious this was the time to do it.

This CL depends on the changes in
https://code.google.com/p/page-speed/source/detail?r=2578
(checked-in, thank you bmcquade@!) and in
http://page-speed-codereview.appspot.com/1170001/ to support, in
ModPageSpeed-land, the giflib encryption target needed by the tests.
2014-06-20 00:06:02 +00:00
Jan-Willem Maessen 3cdd4da223 Move methods related to SharedCircularBuffer to a new class
SystemMessageHandler. So we can keep the format of messages in Apache and Nginx
consistent and easier to modify.  Add unit test for
AdminSite::MessageHistoryHandler.
2014-06-20 00:02:00 +00:00
Jan-Willem Maessen 977c5d8a71 Add a mandatory abstract element() method to resource_slot but remove all error
printing functionality.  This should mean that slots can ignore the
RewriteDriver.

Also modifies RewriteDriver::Propagate(...) to propagate errors stored in the
CachedResult into the context.  I *think* this makes this the only necessary
caller to RewriteContext::AddDebugMessages (one of the overloadings of
RewriteContext::AddDebugMessage, which I've renamed).
2014-06-19 23:35:41 +00:00
Jeff Kaufman b133075ce9 Move lff_ipro from examples to test because it's not a demo. 2014-06-19 20:30:58 +00:00
Jeffrey Crowell 6259f5ce36 Add debug message for image resizing.
If "debug" filter is turned on, insert information about whether the image is
resized, detailing errors if resizing fails.
2014-06-19 18:48:47 +00:00
Josh Marantz e23f485473 Integrate PurgeSet into RewriteOptions. Add off-by-default option to activate
individual URL purging in MPS/NPS.

Fixes Issue 651
2014-06-19 18:06:36 +00:00
Josh Marantz 279e09d430 Restrict LoadFromFile to resources we will be able to identify content
types for.  Also keep InPlaceRewriteContext from serving 200/OK when
in-place rewrites fail.

LoadFromFile needs to be able to get the content type from the extension, so
for files with unknown extensions we should fall back to our normal fetcher.

Fixes https://github.com/pagespeed/ngx_pagespeed/issues/719 which was
originally reported as an ngx_pagespeed bug but applies to both nginx
and apache.
2014-06-19 18:01:30 +00:00
Jeff Kaufman 42c0b696c8 Restrict LoadFromFile to resources we will be able to identify content types for. Also keep InPlaceRewriteContext from serving 200/OK when in-place rewrites fail.
LoadFromFile needs to be able to get the content type from the extension, so
for files with unknown extensions we should fall back to our normal fetcher.

Fixes https://github.com/pagespeed/ngx_pagespeed/issues/719 which was originally reported as an ngx_pagespeed bug but applies to both nginx and apache.

Nginx side of the change (just config): https://github.com/pagespeed/ngx_pagespeed/pull/720
2014-06-19 15:29:10 +00:00
Maks Orlovich b47b03906f Change by huibao:
Add debug message for image classification

    	If "debug" filter is turn on, insert information about whether the image is a photo and transparent to html.

    	Message sample: <!--Image has [no ]transparent pixels and is [not ]sensitive to compression noise.-->

Change by vchudnov:
	Change libwebp dependency to come from the official libwebp repository
.
2014-06-19 14:09:22 +00:00
Jeff Kaufman 6a937f00ea Support setting NumRewriteThreads and NumExpensiveRewriteThreads in ngx_pagespeed.
This means moving a bunch of thread-related code from apache/to system/. While we're at it, also move handling of use_per_vhost_statistics, install_crash_handler, and rate_limit_background_fetches to system/ so they're no longer duplicated between nginx and apache.

I also partly cleaned up the way we handle options that are set on the factory, getting the duplication out of apache/ and nginx/ and moving the code into system/.

nps change: https://github.com/pagespeed/ngx_pagespeed/pull/731
2014-06-18 19:19:02 +00:00
Shawn Ligocki e2d62c86d1 Add debug messages to rewrite_css for for parse failures and situations where we cannot optimize the file.
Add TODOs for some other failures that require more general fixes (unauthorized files, URL too long, etc.)

Refactor CSS flattening test debug framework to be used by all inheritors of css_rewrite_test_base.
2014-06-18 18:22:10 +00:00
Maks Orlovich f9072ecdfa Make strict mode detection in JS combiner more accurate
(mod_pagespeed issue 909)
2014-06-18 17:54:22 +00:00
Maks Orlovich 8a2b7a6959 Update to pull in fixes from OpenSSL 1.0.1h. 2014-06-17 20:58:49 +00:00
Maks Orlovich b0bcc7ab37 Change by jud:
Change automatic/Makefile back to using Release build
(was swapped over accidentally when debugging)
2014-06-17 20:58:14 +00:00
xqyin 546bef5ca0 Insert Comment in JS filter for introspective Javascript. 2014-06-17 19:24:36 +00:00
Jud Porter d655b46b4f Implement immediate propagation of cache purges. (from jmarantz) 2014-06-17 18:39:05 +00:00
Jud Porter 5d220ee364 Disable add_instrumentation for bots. Resolves issue #813. 2014-06-17 18:37:46 +00:00
Josh Marantz b0905c7e63 JS update for compiler change.
Make gperf keyword match check string length.
2014-06-17 14:55:46 +00:00
Matt Atterbury e377c92a9e Structural changes required to insert +debug comments into the HTML when we
do not rewrite a resource because its URL is on an unauthorized domain. A CL
is in progress to actually use all this new plumbing.
2014-06-13 21:20:07 +00:00
Josh Marantz 28c0b2c4b4 Eliminate LOG(DFATAL) that was firing on load tests pending further review. 2014-06-13 18:17:49 +00:00
Jud Porter 7a68bb86c0 Update compiled JS. 2014-06-13 15:06:28 +00:00
Maks Orlovich e8db5c1b08 Add debug filter handling to the inliners. 2014-06-13 14:53:35 +00:00
Maks Orlovich 7b2d3fd7d3 Change by jud:
Insert comment with critical images at bottom of page in debug filter. Also modify the IsCriticalImage calls to take a StringPiece instead of a const GoogleString&.
2014-06-13 14:48:33 +00:00
xqyin 4a3f143d90 Fix the TAP build. 2014-06-12 16:10:48 +00:00
xqyin dd39241ab8 2014-06-11 18:45:57 +00:00
Josh Marantz b4f0d489c6 Deflake signing system test via fetch_until. (jmarantz)
Add debug messages for HTML resource tag rewrites that expire. (jmarantz)

Clean up a bunch of const StringPiece& and const GoogleString&
arguments to StringPiece in test bases. (sligocki)
2014-06-11 17:10:12 +00:00
Jeff Kaufman 3ea4d95848 Test html file missing from r4028 2014-06-11 15:49:57 +00:00
Jeff Kaufman 4331cd5b56 Better debug messages for css combining. 2014-06-11 15:49:02 +00:00
Josh Marantz daa5108573 Do not consider 'debug' when computing options signature, but *do* consider it
for IsEqual.
2014-06-10 17:41:56 +00:00
Jeffrey Crowell c3879b79cb Add signing for .pagespeed resources. 2014-06-10 15:24:50 +00:00
Matt Atterbury 54f973545c Raise the default flattening limit from 2k to 100k.
Based on analysis of approximately 70 of the top 100 sites.
2014-06-04 21:09:09 +00:00
Matt Atterbury e322f07a13 Run dedup_inlined_images after inline_preview_images so we can dedup them.
Added a test to the dedup UT.
2014-06-04 13:42:13 +00:00
Josh Marantz 5675ce56b1 Pass through CXXFLAGS to nested makes. Reduce the amount of spew to stdout by
redirecting to some log files.
2014-06-04 09:56:09 +00:00
Matt Atterbury 086f541d35 Move the redirecting-retains-PageSpeed-query-parameters test from the system
specific scripts to the all-systems script.
2014-06-03 17:58:22 +00:00
Jeff Kaufman 5cf6f1bca4 Set content length when serving from cache.
Without this change ngx_pagespeed will serve .pagespeed. resources from cache with chunked transfer encoding instead of setting a content length.

Fixes https://github.com/pagespeed/ngx_pagespeed/issues/712
2014-06-03 15:27:55 +00:00
Matt Atterbury 830450537d Added an example of how collapse_whitespace can break a page. 2014-05-29 15:05:13 +00:00
xqyin 9a3bf3ed67 Color the messages in message_history page. Add system test for this change. 2014-05-28 22:20:26 +00:00
Josh Marantz aac42bb807 Eliminate alternate SimpleStats constructor. 2014-05-28 01:55:07 +00:00
Josh Marantz 7d2fbb3e57 Switch from requiring a ThreadSystem to create any Statistics object to
requiring Statistics subclasses to implement AddHistogram and pass it a
mutex however it wants.

This reduces the amount of implicit dependencies and lets us once
again remove NullThreadSystem from our production path.
2014-05-27 22:00:04 +00:00
Josh Marantz a81e69490d Avoid double-deadlock when a real mutex is used for SimpleRandom::GenerateHighEntropyString 2014-05-27 21:29:24 +00:00
Josh Marantz 4cc6cace9a Setup the thread system on construction of SimpleStats. 2014-05-23 16:37:28 +00:00
Josh Marantz da716b3beb Add temps for readability and (marginal, theoretical) efficiency. 2014-05-23 14:39:42 +00:00
Josh Marantz dffa229e40 Remove the inheritance relationship between Variable and UpDownCounter.
To avoid duplicating all of the content of classes that were basically
the same physical implementation of two different interface (Impl), I
added template helpers VarTemplate and UpDownTemplate.  These use a
common Impl class so that each Statistics implementation doesn't have
to grow to accommodate this disinheritance.
2014-05-23 03:26:19 +00:00
Matt Atterbury b018d3d41d Test case for mod_pagespeed issue #400. 2014-05-22 17:25:37 +00:00
Matt Atterbury 89a0a6303f Added tests for GoogleUrl::Escape/Unescape for
(a) any ASCII character and
(b) an already encoded string.
2014-05-20 19:20:57 +00:00
Matt Atterbury 76bb27e3ab One more check for sticky options: check that the cookie is set ONCE. 2014-05-20 16:15:05 +00:00
Josh Marantz 62ddc5e628 Redefine Variable to have 'counter' semantics, lacking a Set method, and
DCHECK-failing on a negative Add.

Add a new UpDownCounter in parallel which allows Set and negative increment,
using that where required.

The plan, after this, is to do a massive rename of Variable->Counter.  And
UpDownCounter to Variable, or something like that.
2014-05-20 02:22:22 +00:00
Jeffrey Crowell 024198c8c7 Add wrapper classes for computing HMAC 2014-05-19 20:48:25 +00:00
Matt Atterbury c26fdc549a Added query parameter to make the other query parameters "sticky" by
returning cookies that set them so are passed in subsequent requests.
2014-05-19 16:39:42 +00:00
Jan-Willem Maessen 0d97075d54 Why did this testing file disappear? 2014-05-16 21:44:53 +00:00
Jan-Willem Maessen 1ff81465ad Trivial fix to make it clearer why combining is failing, since the two failure
modes are pretty different.
2014-05-16 21:40:23 +00:00
Maks Orlovich 8ec615cd6d Fix permissions of cache directory in .deb files
(issue 945): updating an existing fakeroot index requires
both -i and -s, not just -s alone (which will overwrite)
2014-05-15 15:19:50 +00:00
Josh Marantz 58699712a6 Add option for images to respond with cache-control:no-transform to
prevent further optimization by proxies.
2014-05-13 20:24:20 +00:00
Josh Marantz 00f24b4cd3 Send back publicly cacheable responses when new option
PubliclyCacheMismatchedHashesExperimental is specified.
2014-05-13 01:53:52 +00:00
Josh Marantz 5f949f38c0 Use chunked encoding when we are stream-absolutifying contents.
Fixes https://code.google.com/p/modpagespeed/issues/detail?id=941
2014-05-12 22:33:30 +00:00
Josh Marantz f36c41aa44 Do not proxy content that lacks a content-type. 2014-05-12 19:31:21 +00:00
Josh Marantz 6b52367852 libraries update.
Remove the 'bogus' subdirectory from the debug configuration, as it
was producing startup noise.
2014-05-11 16:40:10 +00:00
Josh Marantz b6a31439a7 Remove obsolete code supporting the now-deleted blocking interface.
JS libraries update.
2014-05-09 17:37:09 +00:00
Josh Marantz d1e76a8ff7 Allow arbitrary options in comamnd-line invocation. 2014-05-09 16:51:00 +00:00
Matt Atterbury 9cbfe5074c Added a system test for re-adding PageSpeed query parameters when we get a
redirection response.
2014-05-09 15:20:09 +00:00
Josh Marantz 417335e894 Remove extraneous string conversions. 2014-05-08 14:14:24 +00:00
Josh Marantz f7085cc8df Add a testcase for controlling rewriter settings using response headers
from an origin, with rewriting in a reverse proxy.
2014-05-07 14:29:24 +00:00
Matt Atterbury 9219484760 Fix handling of experiment spec so that options are applied if we are using
the default filters.
2014-05-06 01:12:45 +00:00
Maks Orlovich 5533f569b3 Implement various </script> parsing eccentricities. 2014-05-05 18:56:57 +00:00
Maks Orlovich 7e5e009971 Change by a non-team googler:
Remove some redundant string conversions.
2014-05-05 18:22:01 +00:00
Huibao Lin 8ac70863a4 Migrate WebP writer and GIF reader to ImageFrame interface 2014-05-05 12:50:00 +00:00
Matt Atterbury 335865bda6 Rename QueryParams::Parse to ParseFromUrl.
Add a wrapper around it that takes an untrusted string: ParseFromUntrustedString
2014-04-30 14:16:04 +00:00
Maks Orlovich c3a084b1a6 Temporarily revert r3969, shows some trouble under loadtest. 2014-04-30 13:48:50 +00:00
Maks Orlovich a030155ea9 Change by matterbury:
Don't join with +, causes trouble on buildbots.
2014-04-30 13:45:48 +00:00
Jan-Willem Maessen a39861f4e7 Fix spacing in comment. 2014-04-29 21:37:04 +00:00
Jeffrey Crowell 115cd4f76c add RequestOptionOverride option and tests
adds RequestOptionOverride, as well as system tests and unit tests
2014-04-28 18:12:37 +00:00
Maks Orlovich 94c81290e8 Fix us not not setting cache_fields_dirty_ when response status changes.
This is a high-risk change due to risk of hitting !cache_fields_dirty checks.
2014-04-25 15:05:19 +00:00
Maks Orlovich 4e2be18634 Change from matterbury:i
Fix for windows build bots for core libs fixing our python2_6 dependency
since Chromium seems to have removed it from its DEPS. We still get
it from Chromium but from its tools directory directly. Also fixed
formatting to be consistent - whitespace (and parens) changes only.
2014-04-25 14:47:27 +00:00
Jeff Kaufman c8a58e331d Speed up creation of pagespeed_automatic.a by doing more work in parallel. 2014-04-24 20:38:58 +00:00
Josh Marantz 9ae0d58ee3 Turn off proactive resource freshening for now, as we
have seen flakiness in nginx we think might be correlated.

We will re-introduce this when we have time to dive in deep and make
sure it is robust in nginx.
2014-04-24 13:52:27 +00:00
Jan-Willem Maessen 361681015c Make sure local_ip field of SystemRequestContext is a valid host name form for a
url by putting IPv6 addresses in brackets.  This was causing consistent and
baffling smoke test failures on instaweb.cam and its VMs.  As a result this
change will need to be patched onto the 1.8 release branch.
2014-04-23 19:15:13 +00:00
Maks Orlovich 8afa7456ca Fix a couple of buglets in FlushEarly flow:
- Tighten some HttpOnly cookie handling guards
- Make sure one of the scriplets doesn't pollute global scope
2014-04-23 18:51:11 +00:00
Josh Marantz 69429111c5 Add test for Issue 932: "cache flushing does not work in subdirectories
with MPS directives in Directory scope".
2014-04-23 17:53:58 +00:00
Jud Porter 80321f6235 Attempt to deflake prioritize_critical_css test by switching from blocking rewrite to fetch_until. 2014-04-22 19:32:45 +00:00
Jud Porter 70d7eafa1a Turn on ProactiveResourceFreshening and CompressedCache by default. (from jmarantz) 2014-04-22 19:32:20 +00:00
Shawn Ligocki 7468d1e0ce Turn off OptimizationOnly() for source maps. 2014-04-21 22:05:27 +00:00
Shawn Ligocki 7cd63ad545 export changes. 2014-04-21 22:03:42 +00:00
Matt Atterbury 442decd201 Don't process query parameters etc until we have the domain specific options.
This is required for a follow-up CL that requires domain specific knowledge
when processing options etc.
2014-04-18 20:26:42 +00:00
Josh Marantz 57aca97e92 Give the AdminHtml variable a name in MessageHistoryHandler so
that we don't close the HTML and signal the condition variable
before writing our content.
2014-04-18 18:30:54 +00:00
Jan-Willem Maessen a93c16fea6 Update to latest Chromium version of OpenSSL and fix shadow .gyp files accordingly. 2014-04-18 16:20:42 +00:00
Jud Porter 851e78280a Cleanup a TODO to use PageSpeed=noscript instead of ModPagespeed=noscript. 2014-04-18 15:04:18 +00:00
Josh Marantz d5f642163a Allow optional "Accept-Encoding" in cookie-related tests.
Make sure we pass the APACHE_DOC_ROOT down the process call-chain 
when running memcached tests.
2014-04-18 13:47:33 +00:00
Josh Marantz 8d99094189 Separate aliased APACHE_CONF into APACHE_CONF_DIR and APACHE_CONF_FILE.
They had gotten conflated breaking install-tests.  (jmarantz)

cleanup png_optimizer_test (mdsteele)

updates for js compiler
2014-04-18 00:44:50 +00:00
Jeff Kaufman 6d085a2cde Make the location of static assets configurable, and change the default from /mod_pagespeed_static and /ngx_pagespeed_static to /pagespeed_static. 2014-04-17 19:56:48 +00:00
Jan-Willem Maessen 183cfc1de5 Copy OpenSSL build gyps to third_party/serf so that we can fix a compilation
problem there.  I've now patched this in and verified it fixes the build on
CentOS (and no longer breaks the universe elsewhere).
2014-04-17 19:14:45 +00:00
Jud Porter 0f486f49fe Fix issue #921 where multiple slashes would appear in the purge url if ModPagespeedDownstreamCachePurgeLocationPrefix had a slash in it. 2014-04-16 22:23:38 +00:00
Jan-Willem Maessen 257f732a37 Fix parsing of Set-Cookie header as RFC 6265 says there is exactly one
cookie per header.
2014-04-16 19:01:24 +00:00
Jan-Willem Maessen b7729c178b These tests were relying on undefined behavior for out-of-range enums. They're
testing a library that does exhaustive switch statements without defaults on the
enum values, but were testing values outside the enum range.  What happens in
this case is undefined, so we shouldn't test it against an expected value that
assumes fall-through.
2014-04-16 18:55:57 +00:00
Jan-Willem Maessen 8556c36e00 Change build of base to patch cpu.cc and use that, fixing the build on CentOS. 2014-04-15 18:06:54 +00:00
Shawn Ligocki b9d848b4cf Use FileSystem::WriteFileAtomic() instead of manually doing this in several locations.
Also use the atomic version where non-atomic versions used to be used (but atomic seems better).

Also fix up data_to_c to actually fail (and thus cause Make failure if file writing fails.
2014-04-15 14:42:29 +00:00
Shawn Ligocki 7267ab8175 genfiles 2014-04-15 14:41:59 +00:00
Jeff Kaufman be89891be0 Allow custom url-valued attributes to override spec-defined ones. Fixes https://code.google.com/p/modpagespeed/issues/detail?id=928 2014-04-14 19:58:08 +00:00
Jud Porter 5ec5057d0a Fix defer_js for old versions of safari. Fixes issue #927. 2014-04-14 15:08:21 +00:00
Jan-Willem Maessen 1df89cad82 Don't unconditionally lazyload images if we're simply waiting for beacon
data to arrive.  Do lazyload all images if beaconing has explicitly been
disabled.
2014-04-11 20:33:46 +00:00
Jeff Kaufman 81c146d10d MapRewriteDomain shouldn't change Location headers in redirects.
In r3029 we changed ProxyFetch to use RewriteDomain mappings on Location
headers.  This was to support Adwords experiments that we're no longer
pursuing, and is not necessary any longer.  It also creates a bug in
ngx_pagespeed, where people don't expect MapRewriteDomain to affect redirects.
Reverting this back to how it was before.

Fixes https://github.com/pagespeed/ngx_pagespeed/issues/656
2014-04-11 17:52:50 +00:00
Josh Marantz 9143c12e22 Add a comment reminder to update doc when we update which filters are in which
filter-sets.
2014-04-11 15:23:00 +00:00
Jeff Kaufman b90ee6b210 In ngx_pagespeed downstream caching removes cache-control headers from .pagespeed. resources. Test mod_pagespeed to make sure the bug isn't present in both.
https://github.com/pagespeed/ngx_pagespeed/pull/653
2014-04-10 19:37:03 +00:00
Jeff Kaufman b77e08c1c9 Make ResourceFetch::StartWithDriver public to support an external custom proxy. 2014-04-10 17:13:37 +00:00
Huibao Lin 90f4dbf1a1 Add write failure stats to file_cache 2014-04-09 17:58:06 +00:00
Josh Marantz db7d243c8f Merge conflicting cache cleaning settings for a given file-cache path. 2014-04-09 15:54:07 +00:00
Josh Marantz ee8a19117e Split css_minify into css_minify and css_absolutify, so that other code can re-use
the serialization code from css_minify without pulling in the whole asynchronous
rewriting framework (nikhilmadan)
2014-04-09 14:56:47 +00:00
Matt Atterbury 99a935dac7 Handle Pagespeed query params when we get a 301 or 302 response for a fetch by
putting them back onto the redirected-to location iff its domain is the same
as that originally requested.
2014-04-08 18:07:39 +00:00
Josh Marantz dc8db53a45 Remove empty temp files leftover when trying to atomic-write to full file system. 2014-04-08 13:41:43 +00:00
Shawn Ligocki 248d89b9cc Remove ref to my home dir. 2014-04-07 21:02:21 +00:00
Jud Porter 3988715917 Change the default handling of missing -DCHROMIUM_REVISION to assume the newer chromium version. This cuts down on the need to pipe that flag into the ngx_pagespeed build scripts. 2014-04-07 19:47:04 +00:00
Jud Porter fb036b75a2 Compiled JS update. 2014-04-07 19:46:40 +00:00
Maks Orlovich 979de1afa6 Disable _GLIBCXX_DEBUG: it's dangerous for building PSOL
since it requires client code to use the same flag.

It also causes trouble for LOG(FOO) but that needs further investigation
to be certain of the cause.
2014-04-07 17:39:15 +00:00
Maks Orlovich d7f5c3019f Change by jud:
Wait for lazyload to load all images before checking critical images.
2014-04-07 17:25:49 +00:00
Josh Marantz b8dbb4b2c6 Minify the admin css, html, and javascript. This required making the
histogram-printing function release its lock before calling the writer
callback to avoid deadlock.
2014-04-07 16:14:21 +00:00
Jan-Willem Maessen e713a4f058 Clean up redundant rewrite_driver fields in filter and context objects. Also
changed the invariant on rewrite_context to cache the parent's driver field
locally rather than chasing the parent chain looking for a non-NULL context.
2014-04-07 14:51:37 +00:00
Maks Orlovich 5f0ad8d41c Extend the metadata cache dumper to also show information on in-place
rewritten resources.
2014-04-04 21:21:07 +00:00
Josh Marantz 3611b37ba0 Re-commit https://code.google.com/p/modpagespeed/source/detail?r=3915 which
I accidentally reverted with https://code.google.com/p/modpagespeed/source/detail?r=3916
2014-04-04 21:11:04 +00:00
Josh Marantz 473e82cb8c Rename QueryParams::ToString to QueryParams::ToEscapedString to
reflect its function.
2014-04-04 20:56:33 +00:00
Shawn Ligocki f57646dde9 Turn PreserveUrlRelativity on by default. 2014-04-04 20:43:31 +00:00
Josh Marantz 82e898604d Add the ability to show metadata cache values in mod_pagespeed.
Note: this switches us from using "protobuf_lite" to using
"protobuf_full_do_not_use", and makes 64-bit Release
libmod_pagespeed.so 639k larger (8.5M vs 7.9M).  Is this worth it?  We
could also maintain our own hand-crafted serializer for the data in
the protobufs for a lot less bytes if we care.
2014-04-04 19:50:36 +00:00
Josh Marantz f66bc508bb Show the cache structure in /pagespeed_admin/cache 2014-04-03 21:32:11 +00:00
anupama@google.com 0e839c4de3 Moving DownstreamCache* logic into a separate class.
Also addressing https://code.google.com/p/modpagespeed/issues/detail?id=752 which means that purges will only be issued if the original request had the GET request method.
2014-04-03 19:23:02 +00:00
Josh Marantz 3c0523733f Report cache latencies in the histograms up to 1 second, rather than
up to 5ms.
2014-04-03 16:55:47 +00:00
Josh Marantz 56acb429b7 Change default memcached network timeout to 500ms from 50ms. 2014-04-03 15:43:08 +00:00
Josh Marantz e35061937a Use the shared-memory cache for the file system metadata cache,
if needed and available.

Update console JS for new compiler.
2014-04-03 15:36:13 +00:00
Maks Orlovich 052b1ad46c Let PartitionAsync have a ternary result the way Rewrite does,
so we can also handle loadshed partitions properly.
2014-04-02 18:45:21 +00:00
Matt Atterbury 557d51cb41 Changing criticality check for images to happen at image.onload time in
addition to the one done at page.onload time, so that first image of a
slideshow (or similar stuff) gets detected as critical.
The CriticalImagesBeaconFilter now adds an onload handler which can be checked
by LazyloadImagesFilter and DelayImagesFitler to ensure that they add an onload
handler only if the previously added onload handler was added by the beaconing
filter. The LazyloadImagesFilter and DelayImagesFitler also need to now add
back the image-onload-check-for-criticality whenever applicable.
2014-04-02 17:58:03 +00:00
Huibao Lin f5f9547e83 Add ImageFrame API that will be used for animation support 2014-04-02 13:09:56 +00:00
Josh Marantz c7e765a2bc Clarify some comments. 2014-04-01 18:10:20 +00:00
Maks Orlovich 84289e3471 Revert r3895: StatisticsPage, not StatisticsHandler is the method to use,
so no need to make the internal helper public.
2014-04-01 14:36:48 +00:00
Josh Marantz fadadc732a Factor out the cache load generator from threadsafe_cache_test to make
it easier to write new multi-threaded unit tests for caches with intrinsic
thread safety, such as AprMemCache.
2014-04-01 01:54:26 +00:00
Jud Porter a7b9c81705 Add url directory. 2014-03-31 20:28:25 +00:00
Jud Porter 87f8aaab9b Update chromium revision from 161115 to 256281. 2014-03-31 20:12:06 +00:00
Josh Marantz 726718c7ca Manage the delayed literal tag via scoped_ptr so an early destruction
of HtmlParse without calling Finish doesn't leak memory.
2014-03-31 17:59:16 +00:00
Josh Marantz 8e1a5563d5 js library list update 2014-03-31 17:56:51 +00:00
Josh Marantz eb66c4e48c Don't break up script or style tags (or other literals) on a Flush. 2014-03-31 13:23:00 +00:00
Josh Marantz 8e76ad46da Eliminate race in ApacheFetch::Wait against the destruction of the RewriteDriver. 2014-03-28 22:21:47 +00:00
Shawn Ligocki 8627a960c4 genfiles and interface update 2014-03-28 22:08:52 +00:00
Maks Orlovich c0d2aeb525 ngx_pagespeed needs StatisticsHandler, and not in a SystemServerContext subclass,
so make it public.
2014-03-28 21:13:40 +00:00
Shawn Ligocki 60b4138b44 Add system tests for source maps and fix a few bugs that I found. 2014-03-28 20:15:11 +00:00
Josh Marantz a105c8f0f8 Remove write-only fields from memcached structures 2014-03-28 03:34:11 +00:00
Josh Marantz 06717dedd9 Clean up unused member variables for statistics location (jmarantz)
Use check_file_size rather than wc -c (sligocki)
2014-03-27 16:38:07 +00:00
Josh Marantz e926a52518 Add pagespeed_admin handler. 2014-03-27 15:44:00 +00:00
Shawn Ligocki ec75abee78 genfiles 2014-03-27 15:36:21 +00:00
Jan-Willem Maessen 7e482c0939 Fix build dependency issue that was introduced last week.
Fix potential decrement of start iterator in HtmlParse::DeleteNode
2014-03-27 14:34:53 +00:00
Josh Marantz d68e198447 Use a MemFileSystem to avoid broken tests if two instances are run in parallel. 2014-03-26 17:11:31 +00:00
Josh Marantz 011b24df19 Avoid caching authorized resources in ipro flow. 2014-03-26 17:08:38 +00:00
Maks Orlovich 3e33116637 Don't convert scoped styles to links, since those don't have scope feature (fixes issue 918). 2014-03-25 20:49:18 +00:00
Huibao Lin ae25810f0b Fix resizing for empty images 2014-03-25 20:39:07 +00:00
Huibao Lin 52f28d3b62 Suppress noise from image_test and image_filter_test 2014-03-25 15:56:09 +00:00
Josh Marantz ce863d3f04 Strip PageSpeed* query params before fetching from origin. 2014-03-25 15:45:44 +00:00
Josh Marantz afa85b2adc Persist RewriteQuery in InstawebHandler so we don't have to re-parse query params. 2014-03-25 15:26:15 +00:00
Josh Marantz 0e73c84a5e Unescape query-params as part of the interface, as it's not at all
obvious that the query-params previously came out escaped sometimes.
2014-03-25 14:07:51 +00:00
Josh Marantz 249a90e38b Get rid of filename_encoder.cc layer, which didn't add much over
url_to_filename_encoder.cc.
2014-03-25 03:48:48 +00:00
Maks Orlovich 56369d2919 Go ahead and just copy over Chromium's version.py into our build
directory, to avoid trouble with checking it out.
(e.g. issue 897, and reports on mod-pagespeed-discuss)
2014-03-24 20:47:35 +00:00
Maks Orlovich 173db83bd4 Issue 915 pointed out that on some compilers RemoveCommentsFilter::OptionImpl gets
FastWildcardGroup emitted, and it's not in base_core, so link fails in
html_minifier_main_dependency_check. Since that class isn't used outside tests
(RewriteOptions provides an own subclass), just move it to tests.
2014-03-24 19:25:25 +00:00
Maks Orlovich b4ee18c8ea Use FallbackCache when we're not using an SHM metadata cache w/WriteThrough
so that oversize writes don't get lost.

Also avoids some of the messages about oversize writes being lost (issue 907),
so I feel comfortable downgrading that warning -> info.
2014-03-24 19:16:37 +00:00
Maks Orlovich b6f583a4cd Add file forgotten from r3875. 2014-03-24 17:51:24 +00:00
Jeff Kaufman 074fb80298 When a nested rewrite failed due to lock contention we weren't marking the parent rewrite as failed. 2014-03-24 14:26:59 +00:00
Shawn Ligocki 2fbb012d4f Fix CHECK. 2014-03-21 18:22:32 +00:00
Shawn Ligocki fe5c96ddf9 const 2014-03-21 18:21:24 +00:00
Jan-Willem Maessen 636484d859 Serve Cache-Control: private resources to IE rather than Vary: Accept, with an
option to disable this behavior for proxy caches and CDNs that handle Vary:
Accept.
2014-03-20 16:42:40 +00:00
Jan-Willem Maessen 1d0f3b2a5e UserAgentMatcher::IsIe must detect IE 11. This is because http headers can put
us into backward-compatibility mode which we must treat like older versions of
IE.
2014-03-20 14:52:39 +00:00
Matt Atterbury 1a09822e91 Made accessor const, coz it is. 2014-03-19 20:19:44 +00:00
Maks Orlovich 71cf4d4cfe Add a utility simulated fetcher class for running simulations of
proxy behavior with backends of different speeds.
2014-03-19 19:33:22 +00:00
Maks Orlovich 4d1ee50590 Change by jmarantz:
Use request headers rather than query-params for recursive wgets.
2014-03-19 19:21:39 +00:00
Jeff Kaufman 0dad8f4bf3 Enable minimal private suffix optimization. This depends on the public suffix list, so I've added domain_registry_provider as a dependency. 2014-03-19 15:45:14 +00:00
Jud Porter 0993b6df74 Static JS update. 2014-03-18 21:32:15 +00:00
Josh Marantz 7250cf7941 Make RewriteQuery a class with state, simplifying its interface slightly
(no more scoped_ptr<RewriteOptions>*).  Ultimately, this interface
cleanup enables us to hang onto the QueryOptions object a little longer
so we can use it to check for other query-params that are not represented
in Options.
2014-03-18 15:12:39 +00:00
Josh Marantz 23c62b7853 Fix memcached test flow.
Update for new JS compiler
2014-03-18 15:04:51 +00:00
Jud Porter 05636c79ec Disable defer_js for firefox 3. 2014-03-18 13:46:28 +00:00
Shawn Ligocki e84ff7c5c5 Final step in source_maps: Producing and serving the actual source map resource. 2014-03-17 20:42:01 +00:00
Jeff Kaufman 756156a448 Allow virtual hosts to control cache fragmentation. Preparation for adding public suffix list optimization. 2014-03-17 14:49:17 +00:00
Josh Marantz 757098ff2d Refactor handlers a bit more to share more code. In particular, consolidate
the custom options computation into one method in InstawebHandler that's
accessed by mod_instaweb.cc, rather than duplicating the logic.
2014-03-14 21:56:51 +00:00
Josh Marantz 64ccf7f8fa Use https for third_party dependencies. Also update a few google code project URLs. (jud) 2014-03-14 19:42:11 +00:00
Josh Marantz 06c9050fb2 Add a script to use to set up any apache-server to serve as a source for
the unit and system tests that require fetches.
2014-03-14 19:38:16 +00:00
Jud Porter 48f087777e Update third party dependency URLs to use https. 2014-03-14 17:49:00 +00:00
Jud Porter f60f070da2 Fix a race condition in proxy_fetch_test. (from pulkitg) 2014-03-14 17:48:36 +00:00
Jud Porter 642bee372a Compiled JS updates. 2014-03-14 17:47:22 +00:00
Josh Marantz edc86f6459 Make an easier-to-compress css file so that clever Apache 2.4 will send a
Vary:Accept-Encoding, which we were testing for.

Update our configuration to a new set of JS libraries.
2014-03-13 17:26:48 +00:00
Jan-Willem Maessen 3b0ca25d60 Update third_party/css_parser. 2014-03-11 16:55:27 +00:00
Jan-Willem Maessen 753648b7b0 Remove unused IsIe[67] methods from UserAgentMatcher. 2014-03-11 16:50:13 +00:00
Jan-Willem Maessen 8c1a63f559 Don't add Vary: headers to IPRO resources if it doesn't look like they're
necessary.  We do this by plumbing that actual webp variations we'll require up
into the CachedResult from deep in the bowels of image.cc (the image optimizer),
where final format decisions are made.
2014-03-10 21:07:45 +00:00
Maks Orlovich 53902341d6 Remove unused (and dangerous) inflation blacklist code. 2014-03-10 19:23:55 +00:00
Josh Marantz e473f22a11 Make a shortcut PRIMARY_SERVER bash varaible for http://$HOSTNAME to simplify
test scripts a little.
2014-03-07 22:03:55 +00:00
Josh Marantz feca94a326 Refactors to clean up instaweb_handler.cc. 2014-03-07 21:38:38 +00:00
Jeff Kaufman 296e11a8a9 Add a query parameter EnrollExperiment=<id> that assigns a visitor to a particular experiment.
While normally experiments are disabled if we get PageSpeed query params,
to support ForceExperiment we make an exception and don't disable experiments
in its presence.

When porting to nginx we'll need to change https://github.com/pagespeed/ngx_pagespeed/blob/master/src/ngx_pagespeed.cc#L1392
2014-03-07 20:17:11 +00:00
Maks Orlovich 5f83b5b72f Restore ability to use non-modpagespeed.com
hosts for system tests by properly
fixing the test that hardcoded modpagespeed.com to use
@@TEST_PROXY_ORIGIN@@ instead.... then rename
@@TEST_PROXY_ORIGIN@@ to @@TEST-PROXY-ORIGIN@@ so that
our config file checks don't complain about using _
in host name.
2014-03-07 20:08:27 +00:00
Maks Orlovich 051b2f91a1 Decompress gzip'd content in InPlaceResourceRecorder; that's needed for
reverse proxies. Because of the weird filter ordering in Apache
we actually end up looking at headers twice: first to see if it was gzip'd
by a reverse proxy, and next for complete headers (while in nginx we just
get the full headers the first time).

Addresses issue 896.
2014-03-07 18:59:20 +00:00
Shawn Ligocki 8ac32f357f Update comment runetypebody-5.0.0.c -> runetypebody.c as per rsc's update. 2014-03-07 16:29:00 +00:00
Shawn Ligocki ba06a9c119 Add MinifyUtf8JsWithSourceMap() function which uses JsTokenizer minifier to build a source mappings. 2014-03-06 22:13:02 +00:00
Josh Marantz fd1f43602e copy runetypebody-5.0.0.c to runetypebody.c 2014-03-06 21:30:17 +00:00
Josh Marantz 435326e09b Console JS tweak for compiler update.
Include the full option name in the output from OptionsToString,
aligning the columns for the values based on the longest name.

Include the invalidation timestamp in the output as well.

Remove the "InlineUnauth:" prefix from the ToString implemenation
for ResourceCategorySet, as adding that extra prefix means (a) it is
not similar to other ToString methods and (b) we cannot parse what
we print.

Add testing for OptionsToString.
2014-03-06 19:35:32 +00:00
Josh Marantz 2af3c6b4f8 Make an explicit mode for supporting purging of individual URLs, rather
than being adaptive.  This saves a stat() call in the legacy mode, and
lowers risk of misinterpretation.
2014-03-06 19:29:46 +00:00
Josh Marantz 0c983cce44 Update JS for compiler revision.
Outline ~ApacheConfig and make it explicitly virtual.
2014-03-05 03:35:33 +00:00
Maks Orlovich f65cb92457 Provide proper mutex to log record here to prevent occassional
race, as spotted by TSAN (~5% of the time).
2014-03-03 20:18:58 +00:00
Josh Marantz 4a9747272f Move contents of handlers.* into system_server_context.* to make the
handlers easier to test.
2014-02-28 01:00:59 +00:00
Maks Orlovich 30e1601d74 Fix a race detected by TSAN:
we were writing to css_base_gurl_/css_trim_gurl_ in
RewriteSingle simultaneously to reading them in
AbsolutifyIfNeeded called from HandleDeadline.

We do this by basically just computing the right value
on demand from available information and the initial value.
This is made somewhat more tricky since OutputResource::url
isn't thread-safe.
2014-02-27 22:22:09 +00:00
Jud Porter d5bd57c8f5 Add lock analysis annotations. 2014-02-27 21:08:06 +00:00
Josh Marantz b29e880434 Remove superfluous file. 2014-02-26 17:19:21 +00:00
Josh Marantz 115a0d679b Add checking and tests for Cookie2. Add more system-tests
around cookie handling in ipro.
2014-02-26 02:09:19 +00:00
Maks Orlovich 7598b8ea0a Regenerated with newer js compiler... 2014-02-24 19:02:24 +00:00
Maks Orlovich 1bcd9d9f35 Trying to fix version.py weirdness; take 2 2014-02-24 18:37:44 +00:00
Maks Orlovich ccda16dbd5 Workaround the version.py weirdness by checking it out
from the new location.

Should fix issue 892
2014-02-24 18:03:03 +00:00
Jud Porter c081272788 Fix races in tests using FetchRoutingManagerTestBase by making CountHistogram take a real mutex instead of NullMutex. 2014-02-21 22:20:51 +00:00
Maks Orlovich 9136a712b0 Fix TSAN-detected test-only race in distributed_rewrite_context_test:
Wait till we're fully done with the rewrite_driver_ before starting new
ops on it.
2014-02-21 19:10:03 +00:00
Jeff Kaufman 087be66174 Document and error check options= for experiments 2014-02-20 21:27:05 +00:00
Jeff Kaufman efcc10546e updated console js 2014-02-20 21:26:40 +00:00
Jeff Kaufman 73d05cd0dd Added jquery mobile 1.4.1 2014-02-20 21:26:10 +00:00
Maks Orlovich b31b8f664b Fix bugs in handling of 304 and some other statuses in InPlaceResourceRecorder 2014-02-20 17:37:49 +00:00
Maks Orlovich 7a00afbe54 Do minification within JS combiner (when JS rewriter is on)
rather than via separate filter. This avoids trouble with 
hashes from nested rewriters changing when files are updated.

This reordering does make it impossible for me to keep one 
regression test, and makes a couple no longer relevant.
2014-02-20 15:47:29 +00:00
Maks Orlovich ae9f468a6d Put back some accidental reverts. 2014-02-20 15:26:45 +00:00
Jan-Willem Maessen 2dde4b4850 Use Accept: image/webp as a signal for webp capability in all circumstances, and
use it exclusively for in-place optimization requests, serving webp images with
an appropriate Vary: accept header accordingly.  Note in particular that the
"webp" user agent is no longer singularly magical, which required a bit of test
fixing.  This is part 1 of 3-4.  The next part will eliminate Vary: headers in a
number of cases where the underlying image will not actually change format.
Part 3 will disable URL mutation for images in IPRO CSS requests.  Finally, we
may optionally add Cache-Control:private for IE to avoid must-validate behavior
for cached Vary:Accept images.
2014-02-19 23:19:02 +00:00
Jud Porter baac5f8a32 Add candidate key detection to critical image beaconing, which also enables the more advanced rebeaconing scheme. 2014-02-19 22:53:43 +00:00
Huibao Lin c89f478f20 Suppress valgrind noise from ImageAnalysisTest and ScanlineResizerTest 2014-02-19 22:43:25 +00:00
Huibao Lin aa411fdc6c Refactor the enums for ImageFormat, PixelFormat, and the supporting methods 2014-02-19 20:05:29 +00:00
Jan-Willem Maessen 7f2e729839 Clarify behavior of http headers when there are multiple headers or comma
separated fields within a header.
2014-02-18 15:33:16 +00:00
Matt Atterbury d8fdd66aa0 Issue 865: use the ImplicitTtlMs directive value for IPRO resources. 2014-02-18 12:21:07 +00:00
Josh Marantz 1005a0f58d Explicitly require a ProcessContext passed into the factory ctor, and
simplify the flow of initializing the js tokenizer patterns.
2014-02-14 22:13:05 +00:00
Maks Orlovich 9027bc6fd1 Remove incorrect DCHECK for non-NULL property_page. That can happen
in some cases (e.g. when it's html with a .jpeg extension and the like)
and methods like DecodeFromPropertyCache<> already handle this case
properly.
2014-02-14 20:22:06 +00:00
Maks Orlovich bbd7ccc556 Try to explain this code a bit better. 2014-02-14 20:15:31 +00:00
Josh Marantz 703714bb0d Update to the the version of re2 synced to the rest of our Chromium
dependencies, which is easier to use in the context of a static
constructor.
2014-02-14 18:55:01 +00:00
Josh Marantz 9cea519dcc Experimental update to a later version of re2 based on Chromium. 2014-02-14 18:24:20 +00:00
Josh Marantz cb103d1292 Run memcached tests using memcached on a random port, rather than 6765, to allow
multiple unit tests to run in parallel on the same computer.
2014-02-13 23:23:12 +00:00
Josh Marantz 7911c7b471 To speed up debug tests, don't reconstruct the JS Tokenizer
Patterns on every test method.  Instead do it once per
process and inject into the factory.  This complicates
the factory slightly but speeds up debug tests a lot.
and probably more under valgrind.

with test-pattern "RewriteQuer*":
old: 61 tests from RewriteQueryTest (3750 ms total)
new: 61 tests from RewriteQueryTest (575 ms total)

I had noticed the speed degredation right away while
debugging today.
2014-02-13 19:04:04 +00:00
Huibao Lin b60d3b2502 Adjust log level in image compression library 2014-02-13 18:36:39 +00:00
Jud Porter 37811a8b1e Add some missing tests to open source. 2014-02-13 17:56:19 +00:00
Jud Porter 6057b268e5 Update generated JS. 2014-02-13 17:56:07 +00:00
Josh Marantz 1a64de44ac Add experiment info to the ToString method and test it, so we can see
the experiment setup in /mod_pagespeed_statistics?config
2014-02-13 14:18:08 +00:00
Josh Marantz 27351b3719 HTTPCache should know about a few request properties, and whether
Vary needs to be respected.
2014-02-12 21:36:23 +00:00
Jeff Kaufman cc89ac4383 Change OptionStringPair to hold GoogleStrings instead of StringPieces to fix a memory lifetime issue. 2014-02-12 20:00:34 +00:00
Josh Marantz c8d481b785 Demote css url encoding errors to warnings. 2014-02-12 18:56:46 +00:00
Huibao Lin 75b69292ec Refactor the message reported from AnnotatedMessageHandler 2014-02-12 16:03:33 +00:00
Maks Orlovich 6549f5b971 Rollback r3760.
My approach here was difficult on multi-server deployment 
owners when they upgraded, and Josh suggested a different 
approach that doesn't have that downside.
2014-02-12 14:30:34 +00:00
Jud Porter 3c8cbfe3ce Removes flaky and disabled cache stats test that was still enabled in ngx_pagespeed. Increases time that fetch_until will wait on an expected failing test, since waiting 0 seconds was causing flaky tests to always fail. 2014-02-11 22:24:11 +00:00
Jud Porter cbbc24952a Update js library detection. 2014-02-11 22:23:39 +00:00
Josh Marantz 40aad03f9b Clean up the query-param handling to make it easier for factory
subclasses to inject new options they'd like to be able to set.
2014-02-11 17:28:38 +00:00
Maks Orlovich e46c18082c Avoid large stack use per function warnings here. 2014-02-11 15:15:56 +00:00
Josh Marantz ecd469a934 Fix broken Merge semantics for the preserve-vs-extend_cache
resolution.  The way in which Merges actually occur for a global
options with vhost overrides is:

1. parse and compute options for global
2. parse and compute options for vhost
3. construct blank new options.
4. Merge global into new options
5. Merge local into new options

Thus the prioritization I previously wrote was exactly backwards.
2014-02-10 21:09:37 +00:00
Shawn Ligocki 5cab432303 Move source_map to base/.
I missunderstood the difference between base/ and util/ before this. Now I see that js/ doesn't want to depend on util/, so let's move this to base/.
2014-02-07 22:41:28 +00:00
anupama@google.com 0c760c685e Changing the syntax and name for the directive
ModPagespeedInlineUnauthorizedResourcesExperimental <true|false> 
to 
   ModPagespeedInlineResourcesWithoutExplicitAuthorization <off|comma-separated-list-of-resource-types> 
where comma-separated-list-of-resource-types can only contain strings from the set {Script,Stylesheet}.
2014-02-07 19:31:31 +00:00
Josh Marantz 1e2d2dbfa4 Add APIs to use build options using protobufs, and to access HTML
attributes by name (rather than predefined symbol).  (chenyu)
2014-02-07 17:35:17 +00:00
Shawn Ligocki 11fcbe7543 Add option UseExperimentalJsMinifier to allow using the new JsTokenizer-based minifier in PSOL.
It's off by default for now while we let the new minifier get some testing, but eventually, we'll remove this option and always use the JsTokenizer.
2014-02-06 18:43:13 +00:00
Jud Porter 14ef7f4b73 Allow two different rebeaconing modes for prioritize_critical_css, a low and a high frequency mode. When we see new candidate keys, we start in high-frequency mode, beaconing often. Once we've collected a few beacons, we then transition to low-frequency mode and increase the length of time between beacons. Also tracks the number of expired beacons to use as a signal that beacon handling is not configured correctly, and only do low-frequency beaconing if that's the case. 2014-02-06 18:37:01 +00:00
Jud Porter 3bfd2caea0 Update compiled JS. 2014-02-06 18:25:07 +00:00
Shawn Ligocki 3d7cceb3ea Update AddHead filter to always add <head> element, even if there is no <body> element.
The new algorithm is to add a <head> element before the first non-<html> element (if it's not a <head> element).
2014-02-06 18:24:35 +00:00
Shawn Ligocki cb8a1757f8 Fix gcc warning that clang ignores. Followup to cl/61131476. (jefftk)
Add AllowWhenInlining so DisallowResourcesForProxy can have some disallows that only apply when not inlining. (jefftk)
2014-02-06 18:23:34 +00:00
Huibao Lin ed9b1ae8e8 Use image classification to aid rewriting PNG and GIF 2014-02-05 20:37:56 +00:00
Maks Orlovich 16f2b6ea84 Instead of having a per-ServerContext decoding RewriteDriver,
have a single global one inside RewriteDriverFactory, and just
pass in options manually when using it for URL decoding.

This is a humongous memory win when there are lots of VHosts ---
my 30,000 vhost test config's usage goes down from
1.368GiB to 847MiB, which is about 38% savings.

Unfortunately, this is rather brittle in design: RewriteDrivers
are connected to ServerContexts heavily, which means the decoding
driver is connected to one as well, and we have to be careful to make
sure to always pass in the right options when using it.
2014-02-05 17:43:44 +00:00
Josh Marantz d53d269877 Use blocking memcached lookups for the pcache rather than working through
the batcher.
2014-02-04 19:36:32 +00:00
Maks Orlovich bf55992223 Provide a wrapper so ngx_pagespeed can call apr_init nicely
without knowing about our name mangling scheme.
2014-02-04 15:54:31 +00:00
Huibao Lin 6d3015c890 Add 'convert_jpeg_to_webp' to 'CoreFilters', 'recompress_images', and 'rewrite_images' 2014-02-04 15:52:16 +00:00
Maks Orlovich c5f83d3c3c Unwind .pagespeed. resource names in VarName computation as they include
content hash, which can cause variable names to change if the input is updated,
potentially causing HTML/JS inconsistencies.

Fixes https://code.google.com/p/modpagespeed/issues/detail?id=881

Unfortunately this changes variable names so care must be taken when 
deploying on multi-server deployments.
2014-02-03 17:37:59 +00:00
Josh Marantz 70351252d1 Set a mutex for the thread-compatible pools. It appears that
our current implementation of AprCreateThreadCompatiblePool does
not establish a mutex for the allocator.

See apr/memory/unix/apr_pools.c:134
I confirmed in the debugger that allocator->mutex is NULL.

I believe this was leading to a race when I tried testing with
ModPagespeedMemcachedThreads set to 0.  In that scenario, we will
initiate memcache operations from the apache request thread for
pcache lookups, and from the rewrite thread for metadata and
http cache lookups.  During load-tests I found 4 spinning httpd
processes, and debugging them I found them spinning in apache pool
cleanup.  Meanwhile we were writing "waiting for property cache"
log entries 1 per second.  After making this change I can't repro
this in load-tests.

The ModPagespeedMemcachedThreads default is 1, though, so most
of the accesses get throttled through a single thread for
end-users, but I found an exception in
SystemCaches::GetFilesystemMetadataCache, which provides a
blocking interface.  Our load-testing does not hit this situation
because it doesn't enable LoadFromFile.

Early reports from one user indicate that this does resolve the issue.

Fixes Issue 885.
2014-02-03 16:03:28 +00:00
anupama@google.com eaaa43ea79 If running on Valgrind, update InPlaceRewriteDeadlineMs to kValgrindWaitForRewriteMs as we do for the normal RewriteDeadlineMs. 2014-01-31 23:24:04 +00:00
Shawn Ligocki 080380a96a Small change to JsTokenizer interface to take pointer instead of ref, since we're saving a copy of the pointer. This avoids accidentally passing in a temporary and makes it more clear in the interface that the JsTokenizerPatterns object should be long lived. 2014-01-31 21:56:52 +00:00
Maks Orlovich c48a4f623f Fixed Clone()d pooled (e.g. in MPS/NPS) RewriteDrivers not
getting nested bit set, which could cause inconsistency in JS Combiner
resource hashes when reconstruction of minification missed the deadline
(which it should not honor due to nested bit).

Fixes https://code.google.com/p/modpagespeed/issues/detail?id=880
2014-01-31 15:20:37 +00:00
Josh Marantz 0bac4dbb6a Expose Scheduler::RunAlarams as a public method. 2014-01-31 15:20:25 +00:00
anupama@google.com 46cf347e76 Documentation changes for downstream-caching+beaconing support. 2014-01-31 15:02:31 +00:00
Shawn Ligocki 99fe4a2e98 Rework JavascriptCodeBlock to use explicit (rather than lazy) rewriting and checking for success.
In another CL I'm working on, I ran into problems when I added a comment at the end of the JS file because that might change the result of ProfitableToRewrite().

AFAICT, there's no advantage to this being lazily rewritten. Additionally, now that we explicitly rewrite, we can avoid all the mutable variables.
2014-01-30 23:46:35 +00:00
Josh Marantz 24fb93fe64 Remove the env-var sensitivity on test_url_namer, cleaning up a
couple of tests a bit.
2014-01-30 22:22:54 +00:00
Jud Porter 4aa48f66a9 Disable beaconing for bots. Resolves issue #813. 2014-01-30 22:03:41 +00:00
Jud Porter dfb30147a0 Making one of the downstream caching tests more robust. (from anupama) 2014-01-30 22:02:52 +00:00
Jud Porter 6428b569a5 Update generated JS. 2014-01-30 22:01:43 +00:00
Josh Marantz 757ff89af2 Create new accurate JsTokenizer, and use it to power js_minify. (mdsteele)
This is a rewrite of JsLexer meant to solve the intermittent problems
we've been having with JS minification.  Unlike the previous design,
it's not a pure lexer, but instead keeps track of an abbreviated sort
of parse state -- not enough to generate a full parse tree, but enough
to accurately detect regex literals and semicolon insertion.  It
passes all of the existing JS minification tests, as well as some new
ones that the old minifier couldn't hope to pass, and it even does a
slightly better job of removing linebreaks because its semicolon
insertion detection is more accurate.
2014-01-30 19:52:01 +00:00
Josh Marantz 941d25660c Tests that ipro works on first view with LoadFromFile and
InPlaceWaitForOptimized.
	
Adds support for instant-ipro also with LoadFromFile and
InPlaceRewriteDeadlineMs < 0 and test that.
	
Fixes Issue 871.
2014-01-30 14:04:07 +00:00
Josh Marantz 42900d9f43 Use bool-table-lookups rather than binary search to accelerate
RewriteOptions::Enabled's tests for Level and Preserve membership.
2014-01-30 13:53:17 +00:00
anupama@google.com 83fee5d632 Fixing flaky "inline_unauthorized_resources" test. This test had a fetch_until condition that checked for the presence of beaconing code. However, the selector from the unauthorized file was not appearing in the beaconing selectors, because of the fetch failing to complete. Fixed the fetch_until condition to wait for the correct number of desired selector occurrences, so that the test does not flake. 2014-01-29 22:18:23 +00:00
Maks Orlovich cdc0eb4656 Fix the bug where giving authorization to fonts.googleapis.com
would break the fonts filter, since other filters would create a plain
UrlInputResource for the same slot in the HTML, and then would fail
to do anything with it since the results are private.

Do this by adding a notion of a ResourceProvider which stakes out
the portion of URL namespace as out of reach of normal CreateResource.

Also uses this notion to tweak debug filter messages produced, in
particular fixing production of misleading warnings about athorization
for fonts API resources.
2014-01-29 19:45:18 +00:00
anupama@google.com 2da5a3b799 Sample varnish config that shows how to configure the beaconing integration for downstream caches.
Also added a basic test for apache_downsteam_caching_test.sh to check beaconing interaction.
2014-01-29 19:35:49 +00:00
Jud Porter 9512ba2c44 Unify rebeaconing time under the existing option for it, instead of the hard coded const. Also backs off the rebeaconing time from 5 seconds to 1 min. 2014-01-28 23:51:57 +00:00
Josh Marantz f953de8ee5 Tweaks to improve metrics for OptimizeForBandwidth. Measure actual CPU
time rather than wall-clock time for image rewriting when possible.
2014-01-27 22:26:06 +00:00
Josh Marantz 0b5ad91dff Use prefix-matching for ?ModPagespeed=noscript parsing.
Fixes Issue 874, where there was still logfile noise from ?ModPagespeed=noscript?
2014-01-27 21:46:31 +00:00
Maks Orlovich 0cd9c8ce71 Don't shadow a variable, it's hard to read. 2014-01-27 20:35:00 +00:00
Huibao Lin 86c4cc9c0e Add metric for classifying images to graphics and photos 2014-01-27 16:33:28 +00:00
Maks Orlovich f9a5a71c42 COW the large wildcard group objects in options.
In a no-decoding_driver world with 10k vhosts seems to save
~4.7% of memory.
2014-01-27 15:20:52 +00:00
Josh Marantz 0db13364db Turn on lossy webp transcoding for OptimizeForBandwidth.
Change the way filter-enabling is computed in the presence of Preserve
to be functional, rather than having a conflict-resolution phase
mutate the filter set, as that is destructive to subdirectory
overrides where we might want to turn preservation off.
        
Add a semantic to have an explicit extend_cache_xxx setting override preserve-URLs for that type.
        
This establishes a hierarchy of configuration precedence:
        
a. explicit forbid is permanent all the way down the hierarchy and cannot be overridden
b. "lower level" configs (vhost, query-params, subdirectories) override higher level
c. explicit filter setting overrides preserve
d. preserve overrides rewrite-level
2014-01-27 13:54:27 +00:00
anupama@google.com 98a4f19971 Follow-up changes for downstream caching integration with beaconing dependent filters: If a downstream cache rebeaconing key is configured, we should instrument the page only if the key present in the PS-ShouldBeacon header matches the one in the configuration. This allows us to send no-cache headers for anything that carries the right beaconing key, and continue to send out the original cache control headers in other cases where downstream caching is enabled. 2014-01-25 04:26:01 +00:00
Maks Orlovich 7b5c7a61ae Clear the symbol table (freeing up memory) as soon as we've ready
to stash the rewrite driver for recycling and not just when we
begin a new parse. Without this case I observed us keeping
~100MiB of junk around on my 10K vhosts + traffic setup.
2014-01-24 16:41:00 +00:00
Shawn Ligocki 8574d1516e Basic utility for encoding source maps. This merely converts an already constructed mapping into the Source Map v3 format with JSON, VLQ Base64 and all that jazz.
Follow up to this will be to actually construct this mapping in the JS minifier.
Some useful documentation for the spec:
* https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
* http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/
* http://en.wikipedia.org/wiki/Variable-length_quantity
2014-01-23 20:31:41 +00:00
Shawn Ligocki 9f0664ff06 genfiles 2014-01-23 20:31:19 +00:00
Shawn Ligocki 883d760cb7 Fix up a couple comments.
UrlEscaper comments were especially stale, talking about use escaping . which we no longer do, etc.
2014-01-22 16:29:46 +00:00
Maks Orlovich 9739094b76 Fix a couple of bugs in the Serf fetcher, which could result in
SSL fetches getting 400 in some cases:

1) We were not forwarding the explicit Host: header to to the SNI
host name, which mattered when the URL was different (e.g.
when LoopBackRouteFetcher did its thing)

2) SNI hostname should not include the port; so fetches from non-standard
ports weren't working.
2014-01-22 16:20:43 +00:00
Maks Orlovich 6f7182cc9e Centralize parsing of FetchHttps in SystemRewriteOptions
so ngx_pagespeed can get it too.

To keep the helpful error_message from SerfUrlAsyncFetcher, wire it
through RewriteOptions as a new-fangled error_detail.
2014-01-22 16:01:49 +00:00
Huibao Lin f804ce94fd Add utilities for computing image gradient and color histogram 2014-01-21 15:19:56 +00:00
Jud Porter ea102bbd97 Add BeaconCriticalLineInfoFinder class. The CriticalLineInfoFinder class is used by split_html to find the below-the-fold xpaths. 2014-01-17 21:25:22 +00:00
Jud Porter 8763efd025 Updated closure compiler flags for static JS files. 2014-01-17 18:49:12 +00:00
anupama@google.com 24b33ed89a Adding checks for standard ports while authorizing domains that are not explicitly authorized. 2014-01-16 14:18:50 +00:00
anupama@google.com 316af17a7c Checking for absence of closing style tags in selectors or critical-css inlined via critical_css_beacon_filter or critical_selector_filter. 2014-01-16 03:28:53 +00:00
Huibao Lin 93bb928633 Change log message and level in GIF reader 2014-01-15 15:49:10 +00:00
anupama@google.com 3327d3dd80 Load test changes for InlineUnauthorizedResources. 2014-01-10 20:31:03 +00:00
Shawn Ligocki 537338aa0f genfiles 2014-01-10 20:03:18 +00:00
Josh Marantz 8863192008 Turn off PageSpeed during resource fetch from origin, to avoid
double-optimizing via ipro.
2014-01-09 21:31:50 +00:00
Jud Porter 82a869487e Remove unused import from proto file. 2014-01-09 15:49:37 +00:00
Jud Porter 1a3e80436d Compiled JS update. 2014-01-09 15:49:24 +00:00
Josh Marantz 9c7eb2b810 Fix Issue 863.
Obey 'cache-control:private, no-transform' for html.  We were
failing to properly check "no-transform" when it was preceded
by whitespace.
2014-01-08 21:17:33 +00:00
anupama@google.com e27a2d9c23 1) Adding system tests to ensure that flatten_css_imports does not flatten out unauthorized @import lines (or even authorized @import lines accompanying unauthorized ones).
2) Add statistic variables to track how many js/css were inlined and how many css resources were used for critical css computation.
2014-01-08 14:35:35 +00:00
Josh Marantz c0146287af Add new RewriteLevel "OptimizeForBandwidth", intended to make it easy
for hosting providers to turn on mod_pagespeed/ngx_pagespeed by default
without risking the breaking of sites.
2014-01-07 14:31:57 +00:00
Shawn Ligocki d20c735f4b Simplify Transform() interface to use same arg for input and output, thus eliminating ambiguity in the kNoChange case. 2014-01-06 17:43:15 +00:00
Josh Marantz d1cfd0f31e Clean up usage and open-source definition of FindIgnoreCase to
consistently use the correct stringpiece-specific position
type.
2014-01-06 16:29:49 +00:00
anupama@google.com 8108f1a2f3 Enabling InlineUnauthorizedResources feature for inline_css and prioritize_critical_css filters. 2014-01-03 21:25:48 +00:00
anupama@google.com 032c2cd954 Fixing flatten_css_imports to retain unauthorized css files included in @import lines without eating them up. 2014-01-03 13:28:28 +00:00
anupama@google.com e6f1b0a394 Adding debug messages in HTML for cases where inlining did not occur due to domains not being authorized or inline_unauhtorized_resources not being enabled. 2014-01-02 23:12:06 +00:00
Jud Porter e69aaa6233 Allow inlining scripts that contain <script> or </script> by hex-encoding the 's' as '\u0073'. (from jefftk) 2013-12-30 20:14:14 +00:00
Jud Porter fd4ca0b3d1 Compiled JS update. 2013-12-30 20:12:54 +00:00
anupama@google.com 1f5657da68 Initial prototype for supporting an InlineUnauthorizedResources option. Only inlining of unauthorized js resources is being implemented and tested in this change.
The basic approach involves allowing filters (mostly inlining filters) to declare that they allow unauthorized resources to be processed. And, in case a resource is found to be unauthorized but allowed by the filter, it is fetched and stored into a separate cache-key-space prefixed with unauth:// (or unauths://). Checks and tests should ensure that we never end up using such a resource's URL directly anywhere.
2013-12-20 19:25:56 +00:00
Jud Porter 9eb5cd1fc6 Change the event that the CSS is loaded in the prioritize_critical_css filter from DOMContentLoaded to requestAnimationFrame to ensure we aren't blocking render. 2013-12-20 16:40:37 +00:00
Jud Porter 8b7a7b8c7a Changing CssSummarizer (which is used by CriticalCssBeaconFilter and CriticalSelectorFilter) to not invoke SingleRewriteContext::Partition (or the subsequent CreateOutputResourceFromResource) call since it does not really operate on or create an OutputResource anyways. (from anupama) 2013-12-20 16:39:59 +00:00
Jud Porter 6dfdfae7e0 Add missing include. 2013-12-20 16:37:51 +00:00
Huibao Lin 436aad14d0 Add URL to image rewrite messages 2013-12-19 18:31:30 +00:00
Josh Marantz b1959c1288 Fix Issue 781 -- track whether a UA can inline images or not in the
CSS metadata cache key -- at least if css image inlining is enabled.

Remove the support files for a system test -- this is easier covered
in a unit test.
2013-12-19 15:26:23 +00:00
Jud Porter 9104340b9d Bug fixes and cleanup of the rendered image size and critical image JS. 2013-12-18 16:16:46 +00:00
Jud Porter eb6f907c08 raise the file size limit check for webp rewrite test (from skal) 2013-12-18 16:15:41 +00:00
Jud Porter ca9ebba25e Updated compiled JS. 2013-12-18 16:14:16 +00:00
Maks Orlovich 378d24f2c5 Remove indirection of nearly all of our dependencies via
Insight's libpagespeed: we no longer use its DEPS file,
and now only use it for googleurl_noconv and some 3rd party
libraries.

This did require yoinking its base/ build system, but
with that we really can update chromium version independently.
2013-12-17 18:17:59 +00:00
Jeff Kaufman ae09f8d443 Disable flaky cache tests 2013-12-17 15:45:26 +00:00
Josh Marantz 64ec1314e8 Remove underscores from testing domain names, which make it hard to
share test scripts with ngx_pagespeed.
2013-12-16 21:30:19 +00:00
Josh Marantz be9bb79ad4 For .pagespeed. URLs: Don't deliver cached webp to webp-incapable
browsers, if serve_rewritten_webp_urls_to_any_agent is off.

For non-.pagespeed. URLs, don't consider the cached result valid if it
contains vary:accept and content-type:image/webp, and the
request-headers don't include accept/image:webp.

Fixes Issue 846, and offers a more complete resolution to Issue 848.
2013-12-13 22:06:30 +00:00
Josh Marantz dc6f71ec62 Fix range error in HtmlElement debug infrastructure
Fix type error in option (passing 'true' into an int64 parameter).
Console JS update for Closure Compiler update.
2013-12-13 15:39:30 +00:00
Maks Orlovich 9439efc753 Put the clean ups back in, but also add in some
needed API adaptors.
2013-12-12 20:46:24 +00:00
Maks Orlovich e0f1b9d36e Stop mechanically depending on, and checking out, the actual
code portion of Insight's libpagespeed since we do not actually
use it any more. This did require yoinking its copy of
pagespeed_overrides.gypi here (almost identically, modulo stuff
like our own path and duplicate chromium_version%).

The result is that we can now bump up Chromium version w/o worrying
about circular dependencies. Whee!

We still use libpagespeed_deps and some libraries from Insight's
repo, however; some of that should probably be cleaned up
in a follow up.
2013-12-12 20:03:29 +00:00
Maks Orlovich acb6268aef Temporarily manually rollback r3673 to avoid
build trouble until proper fix is done.
2013-12-12 15:34:25 +00:00
anupama@google.com 8d0a28fb99 Adding sharedmem_pb.a to Makefile. 2013-12-12 15:19:30 +00:00
Josh Marantz 63a28893df Add better lookups for Accept in request headers.
One of several steps toward addressing these three issues:

https://code.google.com/p/modpagespeed/issues/detail?id=817
https://code.google.com/p/modpagespeed/issues/detail?id=846
https://code.google.com/p/modpagespeed/issues/detail?id=848
2013-12-11 23:15:36 +00:00
Maks Orlovich 120a19b21e Don't pass through non-rewritten cached resources in IPRO in non-proxy mode
since streaming HTML like that can cause MPS to deadlock in property
cache fetch if we're using memcached.

To be more detailed, the deadlock chain is:
Cache hit on html -> RecordingFetch -> ApacheWriter 
-> MPS HTML apache filter -> blocking pcache lookup,  where the last 
deadlocks when using memcached cache since CacheBatcher will not issue 
a new lookup until callbacks for the current batch complete.
2013-12-11 18:37:24 +00:00
Maks Orlovich 29f17c279d Export someone else's cleanup of some html color handling
utilities.
2013-12-11 18:21:49 +00:00
Josh Marantz d4ef6f237c Don't run a slow test in debug mode. 2013-12-10 14:25:50 +00:00
Maks Orlovich 22b0405153 Remove broken DCHECK that shows up on load tests: empty strings
can sometimes have canonical representation, so it was possible
for IsKeySaved to return the wrong value.
2013-12-09 18:37:50 +00:00
Maks Orlovich 5eaf350e4d Fix inappropriate locking in SchedulerBlockFunction::Cancel,
as pointed out in mod_pagespeed issue 840. To enable that,
clearly establish invariant on lock status from RewriteDriver
callbacks (not held), and make it follow that.
2013-12-09 15:19:10 +00:00
Maks Orlovich b7429dcce6 Improve error message reporting when shared memory segment creation fails. 2013-12-09 15:05:35 +00:00
Jud Porter 6cc92c6982 Fix the performance of DomainRewriteFilter::StartElement
by moving a loop invariant out of the loop. (from matterbury)
2013-12-06 21:07:03 +00:00
Shawn Ligocki f6c9db7482 Set rewritten_url in DomainRewriteFilter::Rewrite() for non-web-valid URLs (for example data: URLs). Contract for this function is that it should set rewritten_url even if it returns kDomainUnchanged, this was not consistently done. 2013-12-06 16:56:18 +00:00
Huibao Lin 40ab5d5bb7 Fix image spriter for transparent images. This is done by using canvas with alpha channel when any input has a transparent color. 2013-12-05 19:54:52 +00:00
Maks Orlovich 8e9219673a Don't improperly call SummariesDone for every flush window in cases
involving filters deleting slots (e.g. CSS combiner) and multiple
flush windows --- it's supposed to be called only at the very end.

This could potentially lead to multiple beacon insertions, and also
to really confused HTML parser, since we were trying to do
Insertion-at-body-end at a midpoint of document, which spammed loadtest
with "HtmlElement Parents of ..." warnings.
2013-12-04 15:10:45 +00:00
Maks Orlovich 4802f849a1 Change by jefftk:
Allow multiple calls to CreateShmMetadataCache(default) without giving an error

Users of 1.7.30.1 are seeing 'Default shared memory cache: Cache named
pagespeed_default_shm already exists' in their error log.  This is not
actually a problem, and is caused by LookupShmMetadataCache returning
NULL for a given name even after a successful call with that same name
to CreateShmMetadataCache, due to LookupShmMetadataCache needing
cache_to_use to be set (which doesn't happen until RootInit).  Just
silently accept these additional calls to CreateShmMetadataCache and
do nothing.
2013-12-04 14:38:06 +00:00
Josh Marantz f4f1134614 Apply user-agent in an in-place fetch. system-test
in_place_optimize_for_browsers in MPS.
2013-12-03 22:28:21 +00:00
Huibao Lin 8f65c2f0f3 Rename '*ImageWebpRecompressionQuality*' to '*WebpRecompressionQuality*' 2013-12-03 18:30:16 +00:00
Josh Karlin c2e572b175 Distributed rewrites properly rate controlled. 2013-12-03 17:45:04 +00:00
Josh Marantz 327f0619fb Add option to allow webp files to be reconstructed for any user-agent.
I made this an option because I believe that we believe that it's better

to serve origin resources for webp URLs to non-webp-capable browsers so
that link-sharing does not fail. The reason that this change is necessary
is to support sites that want to use proxy-caches that cannot work with
Vary:Accept, in which case they will not be able to downgrade responses
to old browsers.
    
Fixes Issue 848.
    
See also Issue 846 which, means that setting this option 'off' doesn't
currently work, since our http cache lookups currently do not
incorporate any bits indicating whether the client can support webp.  Thus
setting the default of the new option to 'on' for now.
2013-12-03 13:43:12 +00:00
Josh Marantz 43507953e8 PageSpeed console JS update due to updates in Closure Compiler.
Add core filters into testing-set.
2013-12-03 13:31:35 +00:00
Maks Orlovich 5fe03d31fe Obscure corner case bugfix fix for the css filter. 2013-12-02 22:19:51 +00:00
Maks Orlovich a768bed3e6 Code for creating/restoring and marshaling/demarshaling snapshots
of ShmCache state. Not hooked up to anything yet.
2013-12-02 20:47:57 +00:00
Jan-Willem Maessen a566725f25 In js_defer.js we override some document. and window. functions and need to revert
to the original behavior when we're done running deferred scripts.
Unfortunately the page we load may override our overrides (calling through to us
as it does so)!  So we can't just put the original functions back.  As a result
we check object state and a flag to see whether we should simply revert to the
original behavior or continue to behave as if overridden.
2013-12-02 19:08:19 +00:00
Maks Orlovich d28a4523ee Fix a race: RateController::CustomFetch::HandleDone could
call DeleteFetchInfoIfPossible and have it destroy the map
entry and HostFetchInfoPtr + HostFetchInfo simultaneously with
a new call to ::Fetch having grabbed the entries and released
RateController::mutex_ but not yet incremented the outstanding
events count.
2013-12-02 18:24:50 +00:00
Josh Marantz 18d5b7cb6e Add host_header into domain signature and display. 2013-12-02 17:57:56 +00:00
anupama@google.com 5d287f88b9 Adding support for responding from both critical-css and critical-images filters with an instrumented page whenever PS-ShouldBeacon is present in the request headers. 2013-12-02 17:35:02 +00:00
Josh Marantz eca7b41080 Remove some experimental code for referer-mapping. 2013-12-02 14:20:13 +00:00
Jud Porter 78a5d961e4 JavaScript updates and cleanup, mostly of critical images beacon. 2013-11-30 22:38:14 +00:00
Josh Marantz 6a3a0442c4 Avoid sending etags for resources that are have inconsistent hashes or
are not yet optimized.  Fixes Issue 845.
2013-11-27 22:52:39 +00:00
Josh Marantz e29d0b1ffa Add optional control of Host header in MapOriginDomain.
Fixes Issue 838.
2013-11-27 20:33:20 +00:00
Huibao Lin d542592fb5 Add 'IsOptimizable' method to 'PixelFormatOptimizer' 2013-11-27 20:12:08 +00:00
Josh Karlin b7338057cc Set the distributed rewrite key in all distributed requests, not just metadata requests.
Also, minor css formatting in console.
2013-11-26 16:35:39 +00:00
Maks Orlovich 3a0727afd2 Include all of ngx_pagespeed PSOL deps, including
Serf, apr and OpenSSL into pagespeed_automatic.a (plus a few
console data files that got lost).

This should simplify ngx_pagespeed build a bit, and now 
that we do symbol renaming make it possible to use HTTPS
there, since symbol renaming should prevent OpenSSL inside 
pagespeed_automatic.a from clashing with any in ngx_pagespeed
2013-11-25 21:39:20 +00:00
Maks Orlovich 6cf8ebbe45 Use xargs to parallelize the calls to objcopy. This is needed for
my pending change of including OpenSSL into psol.a: doing that
would make the renaming take ~5:50, which is insanely slow, and parallelization
brings it down to ~1:21.
2013-11-25 18:09:23 +00:00
Maks Orlovich da762395ba Regenerated with newer closure compiler.. 2013-11-25 18:01:06 +00:00
Maks Orlovich 0f7fe504ab Update OpenSSL version, to avoid duplicate symbol
trouble on x86-64 for rename_c_symbols.sh
2013-11-22 18:19:17 +00:00
Maks Orlovich 799a730812 Remove a couple of never set (but sometimes read as default) fields from RewriteDriver. 2013-11-22 18:05:19 +00:00
Maks Orlovich 88a00e9751 Teach rename_c_symbols.sh about common symbols and x86 PIC
thunks. Needed for OpenSSL which is needed to get https in ngx_pagespeed.
2013-11-22 14:27:29 +00:00
Huibao Lin f60cadf82e Remove the option of 'use_image_scanline_api' 2013-11-21 12:52:32 +00:00
Shawn Ligocki e11560c635 Rename ApacheServer::config() -> global_config() and SystemServerContext::system_rewrite_options() -> global_system_rewrite_options() to make it clear that this config does not take .htaccess into consideration. 2013-11-20 23:33:12 +00:00
Maks Orlovich 07d82867a3 To avoid the risk of things like zlib (and OpenSSL, if we turn its use on)
colliding with symbols in nginx, do a processing run on libpagespeed_automatic.a
renaming most of non-C++ symbols.

(Part of this snuck into r3636 --- the change in net/instaweb/automatic/Makefile 
 due to an oversight on my part)
2013-11-20 20:44:15 +00:00
Huibao Lin d40fad76f5 Use 'net_instaweb::scoped_array' instead of 'scoped_array' 2013-11-20 20:32:57 +00:00
Huibao Lin 2c3c052d3b Add a class for stripping opaque alpha channel 2013-11-20 19:19:41 +00:00
Shawn Ligocki 63064fabb7 Document RespectXForwardedProto to be server-scope only. It already is de-facto for resources (which were just silently ignoring it on directory scope). Nginx also does not support this on directory scope. Supporting kDirectoryScope seems to require a bit of circular dependency. 2013-11-18 19:16:44 +00:00
Maks Orlovich 3b68433274 Fix handling of protocol-relative URLs in GoogleFontCssInlineFilter.
That required slight refactoring of URL resolution functions in
CommonFilter: that's the right place to do it since it sees the
<base> tags.
2013-11-18 15:43:21 +00:00
Josh Marantz 42c9dff41e Silently strip extra quotes on noscript redirect. you can never
account for broken clients, bots, etc. Fixes
https://code.google.com/p/modpagespeed/issues/detail?id=627
2013-11-15 23:45:38 +00:00
Josh Karlin 27de4597a6 Tests that verify that mod_pagespeed won't redundantly rewrite the
same resource twice around the same time.
2013-11-14 19:53:54 +00:00
Maks Orlovich b6b4577496 Fix interaction of IPRO with some other modules which may not
behave 100% by the book.
2013-11-14 18:15:48 +00:00
Josh Marantz 025dc2ee54 Fix dcheck-failure in static_rewriter.cc demo program when compiled for debug
console UI updates
2013-11-14 16:03:56 +00:00
Josh Karlin 6214701cc2 Removing sleep in system test. 2013-11-13 16:22:42 +00:00
Josh Karlin 3034f1ace0 Fixing a flaky test. 2013-11-13 15:13:57 +00:00
Josh Marantz 880aa78671 Restore slamm's fix to Issue 441 in r3625, accidently reverted in r3626.
Add normalization of http domains with :80, and https domains with :443.
2013-11-13 14:13:52 +00:00
Jan-Willem Maessen eedf6b6a11 Remove support for legacy critical css and critical image proto fields. This
moves us completely to the support-based implementation and gets rid of a pile
of code cruft.  This change is basically 100% deletions.
2013-11-12 22:51:42 +00:00
slamm@google.com a461f8bb3e Fix typo in google analytics snippet. 2013-11-12 21:58:08 +00:00
Josh Marantz c86df45376 Declare SerfThreadFn using APR_THREAD_FUNC macro.
Update libraries list.
2013-11-12 15:15:59 +00:00
Josh Marantz 76a7c8023e Fix Issue 692 -- don't case-fold entire path for domain directives. We should only
case-fold the domain.

Pagespeed JS Libraries update.
2013-11-12 15:04:32 +00:00
Maks Orlovich 5faa74d19f Fix a race reported by TSAN: we don't want to be
modifying the properties array on every options creation.
2013-11-12 14:32:02 +00:00
Maks Orlovich 99a40eb6c7 Disambiguate this error message, to make logs with it easier to follow. 2013-11-11 21:15:41 +00:00
Maks Orlovich 8d0e5ab62f Add a regression test for a bug fixed a while back. 2013-11-11 20:42:47 +00:00
Maks Orlovich a665652b11 Fix a bug with ProactivelyFreshenUserFacingRequest set to on
(thankfully not currently possible in {mod,ngx}_pagespeed:

Do not cache empty content when a proactive background
refresh fetch is triggered by a HEAD request.
2013-11-11 15:34:47 +00:00
Maks Orlovich 1134cc9f59 Remove some dead code and fields. 2013-11-07 20:35:32 +00:00
Maks Orlovich 93a7a4d14a Change by vchudnov:
Tweak the output format of ScanlineStatus messages.
2013-11-07 20:25:18 +00:00
Josh Marantz 9a70a75f31 Eliminate now-superfluous forward declaration. 2013-11-06 16:28:43 +00:00
Josh Marantz b051c478c4 Make our scoped_array declaration compatible with both old versions of
Chromium, that support scoped_array directly, and newer versions of
Chromium, which have specialized scoped_ptr for arrays but omitted
scoped_array.
2013-11-06 16:03:49 +00:00
Maks Orlovich 8203266aec TSAN detected races in MockTimer use in automatic/proxy_interface_test
and rewriter/distributed_rewrite_context_test

In response, force all users to provide mutexes to MockTimer's constructor, rather than as a separate
optional call to set_mutex.

(Also pulls in some cleans up and an experimental flag).
2013-11-06 15:45:01 +00:00
Josh Marantz 635a92d18f Expose ModPagespeedMaxCombinedJsBytes as a settable option. 2013-11-05 16:08:14 +00:00
Jeff Kaufman 19e99e6e78 Enable the shared memory metadata cache by default.
Any virtual host that does not already have a shared memory metadata cache will share a default 50MB one.  Users can configure the size of this cache by setting DefaultSharedMemoryCacheKB and they can disable it entirely by setting that to 0.
2013-11-04 21:59:44 +00:00
Shawn Ligocki 8321fc3476 Migrate some system tests from apache/ to automatic/. 2013-11-04 19:59:20 +00:00
Shawn Ligocki 287b848a65 Get rid of sleep in IPRO stat test code.
In order to do this I had to:
1) Create a new helper function get_stat()
2) Move wget results from the root $OUTDIR to a subdirectory (so that that subdirectory could be rm'd without nuking everything in the $OUTDIR). In this case we need to keep stats outputs from previous runs, but fetch_until needs to rm -rf wget output dir between runs.

Note: As far as we can tell this doesn't fix the issue that Huibao found, but this is my first step in de-flaking this test and cleaning up some technical debt.
2013-11-04 17:23:18 +00:00
Josh Marantz 388c9aa2ec Serve defer_javascript to some bots. 2013-11-03 22:10:39 +00:00
Josh Marantz fa81f87561 Send slurp 404 messages to INFO, not WARNING, to reduce spew during load tests (jmarantz)
Fix png comment (vchudnov)
2013-11-02 03:16:03 +00:00
Jan-Willem Maessen 56a75772b4 Bring core PSOL options more in line with what's deployed in PageSpeed Service.
combine_javascript is now a core filter, and convert_png_to_jpeg is core and
added to rewrite_images.  Critical css and webp conversion are not yet switched
on by default by this CL, and more measurement is required for move_css_to_head
(default in PSS) vs move_css_above_scripts vs doing nothing.
2013-11-01 20:40:27 +00:00
Maks Orlovich 271e02c0ee Address tsan warnings in SerfUrlAsyncFetcherTest.TestTrackOriginalContentLength
by using the test's synchronized helpers rather than thread-unsafe StringAsyncFetch
2013-11-01 18:01:21 +00:00
Josh Marantz b32d0c7a6c Fix build on CentOS 5.4 32-bit, which was having an ambuity in a
virtual method override with a instance of the templatized base class
variable as an argument.  This change simplifies the semantics by
reducing the number of virtual methods and eliminating the need to
have a base class instance as an argument.
2013-11-01 15:44:37 +00:00
Maks Orlovich 20b4788d0d Google Fonts Css Inline Filter.
Also fix our UA for tests to not have quotes around it. Yes, they were
getting passed through to HTTP.
2013-11-01 13:50:37 +00:00
Josh Marantz bb2e9c2c2c Partially address Issue 811 by respecting the common headers between
combined CSS & JS files.
2013-10-31 21:38:39 +00:00
Josh Marantz 880d97e874 Temporarily de-flake a system test under valgrind by adding sleeps till we understand
the real issue.
2013-10-30 19:09:05 +00:00
Maks Orlovich 57830ce3ed Accept null in ctor, it's useful for some subclasses. 2013-10-30 18:20:24 +00:00
Jud Porter cc23a45a9d Add require_prior_support param to WriteCriticalKeysToPropertyCache. 2013-10-30 17:22:35 +00:00
anupama@google.com 230a7ff47b ModifyCachingHeaders should not touch Cache-Control headers if downstream-caching is enabled.
https://code.google.com/p/modpagespeed/issues/detail?id=756
2013-10-30 14:45:37 +00:00
Huibao Lin 52bec82668 Minor changes to ScanlineStatus for consistency with similar error reporting in the dependent product. (by vchudnov@) 2013-10-30 11:41:49 +00:00
Josh Karlin fa5bd9297b System test to verify that Apache err_headers_out are kept in IPRO 2013-10-29 18:34:55 +00:00
Shawn Ligocki feeba142d8 Get Image spriting to respect PreserveUrlRelativity.
The only thing I know left that doesn't support this feature is CSS-flattening which can change the base URL for the contents and thus it's not clear whether we should still try to preserve URL relativity.
2013-10-29 16:52:41 +00:00
Huibao Lin 5380cf1a3f Add grayscale support to WebpScanlineWriter 2013-10-28 19:31:08 +00:00
Maks Orlovich 732e41b9b0 Factor out handling for errors, stats, and logs. Add nosniff protection. 2013-10-28 15:16:03 +00:00
Huibao Lin e52dab2680 For GIF image, do not check color of the background if it is invisible 2013-10-28 13:47:35 +00:00
Huibao Lin 65c886f861 Update doc 2013-10-28 13:43:03 +00:00
Josh Marantz 0901b557a3 Fix Issue 809: do not disable mod_headers or mod_expires in the HTML
flow when there is a Cache-Control header added upstream of mod_pagespeed.
This was never needed: we have a different mechanism for correcting
the caching headers in HTML.
2013-10-25 20:45:50 +00:00
Shawn Ligocki 4a38d41c48 Get PreserveUrlRelativity working for image rewrites.
Aparently I overlooked this when I did the huge refactor a while back. Jeff just noticed this recently.
2013-10-25 18:59:20 +00:00
Maks Orlovich 91a36883b4 Extract out UaSensitiveFetcher into its own file, since
I want to use it in another test.
2013-10-25 16:50:07 +00:00
Josh Marantz f9b34586bb Expose InPlaceRewriteDeadlineMs sp it can be set in pagespeed.conf. Load-test with
that option.
2013-10-25 15:48:22 +00:00
Huibao Lin 2b3e82d158 Fix bug for PNG images with grayscale format and tRNS chunks 2013-10-25 11:36:46 +00:00
Jeff Kaufman afa5a140a3 Refactor duplicate apache/nginx code for post-config initializing of server
contexts into system/.

This is a prerequisite for the change I'm working on to turn on SharedMemCache
by default, which would happen in SystemRewriteDriverFactory::PostConfig().
2013-10-24 21:41:25 +00:00
Jeff Kaufman ab42f6b19a Extend the resource_tag_scanner::ScanElement api to handle cases where an
element has multiple url-valued attributes.

The main fix is that if someone is doing their own lazyloading we can optimize
something like <img src="data://" big-src="realimage.jpg"> with custom
UrlValuedAttributes.

This also means we can now optimize "poster" on <video>, "longdesc" on <frame>,
<iframe>, and <img>, "formaction" on <input>, and "cite" on <body>.

Fixes Issue 466.
2013-10-24 21:37:41 +00:00
Maks Orlovich ed03f4a53b Make font loader CSS actually loadable in Apache & ngx (and not
just unit tests):

- Add a mechanism to RequestContext to permit session-specific
  permitted fetch origin domains, to be used on top of IsDomainKnown

- Teach GoogleFontServiceInputResource to ask for fetches of
  {http://,https://}fonts.googleapis.com, as needed.

- Teach LoopbackRouteFetcher to honor the RequestContext whitelist.
2013-10-24 14:38:31 +00:00
Huibao Lin b29ce7b913 Allow GIF image with logical screen smaller than the encoded image (by huibao@)
Allow load-tests to combine CSS and inline images by disabling flush_subresources and turning off critical image beaconing (by jmarantz)
2013-10-24 13:47:35 +00:00
Maks Orlovich 6ecde8e873 Turn rate limiter on by default 2013-10-22 21:29:08 +00:00
Jud Porter 349827b496 Compiled JS updates. 2013-10-22 18:09:15 +00:00
Jud Porter 566280ff01 Updated pagespeed_libraries.conf 2013-10-22 15:48:11 +00:00
Jud Porter 48c3e4f591 Don't slurp beacon URLs. 2013-10-22 15:45:17 +00:00
Maks Orlovich 5895d7cae7 Add a comment on part of behavior of this method that's
relevant to security
2013-10-21 19:48:40 +00:00
Maks Orlovich 5d81450339 Remove remnants of dead downstream_cache_lifetime_ms.
(It's not registered or used anywhere)
2013-10-16 14:47:11 +00:00
anupama@google.com 1359f3ea0d 1) Don't allow </style> in CSS that is to be inlined because this causes the inlined style block to end early.
2) Regenerated dbg.js files due to minor js compiler change.
2013-10-16 14:33:21 +00:00
Maks Orlovich 40be396b0a Change by vchudnov:
More detailed error codes from the scanline interface classes.

This change defines a ScanlineStatus class that is used to report the
success or error of various operations in the Scanline{Reader,Writer}Interface 
classes and of the CreateScanline{Reader,Writer} utilities. The old APIs are still 
present for backwards compatibility, though it would probably be a good idea in a 
follow-up changes to convert the clients to the new convention and get rid of the old APIs.
2013-10-14 20:20:03 +00:00
Josh Marantz 568a04e5b9 Fix Issue 803: recheck metadata cache entries after an optimization failure
due to a dropped request after 10 seconds, rather than 5 minutes.

Otherwise you can get into a situation where pages with 5 minute TTL on
resources can never be fully optimized, and even if they have longer TTL
will take 5 minutes to optimize.

Note that this will definitely affect pages with >500 resources, or whatever
our max queue length is, but it can affect smaller pages as well because
this count is kept across all pages.
2013-10-12 14:43:50 +00:00
Maks Orlovich 9dccfe4dc7 A few more steps towards Font Service integration:
- Manage UA normalizers in the factory, and use them in GoogleFontServiceInputResource
- Add some additional paranoia checks to GFSIR
2013-10-11 21:27:09 +00:00
Maks Orlovich 102c757d25 Rebuilt with newer compiler version.. 2013-10-11 18:48:39 +00:00
Jud Porter f5420b0768 Use InsertNodeAtBodyEnd in filters that insert JS at the end of the body and have not been converted yet.
Also make InsertNodeAtBodyEnd insert before </body> even if the open tag has been flushed already, by adding a new public CanAppendChild method to HtmlParse.
2013-10-10 23:08:12 +00:00
Jud Porter 557b7201c5 Cleanup and unify the usage of pcache cohorts in the finder classes. 2013-10-10 22:32:02 +00:00
Jud Porter 4e6a5574ed Don't rename window.mod_pagespeed_start in compiled js. 2013-10-10 21:53:15 +00:00
Josh Marantz 34d3e2d36e Remove superfluous commented-out test. 2013-10-10 18:12:41 +00:00
Josh Marantz a6998d8139 Fix Issue 801 --avoid segv with 'ModPagespeed unplugged' in root and
'on' in vhosts.
2013-10-10 17:23:45 +00:00
Josh Marantz b3cdd83200 Re-slurp with ?ModPagespeed=off for ngx_pagespeed & PSS results. 2013-10-10 17:10:05 +00:00
Huibao Lin 7fa0debde1 Suppress noise from image unit tests. Remove plumbing for 'use_image_scanline_api'. 2013-10-08 17:33:37 +00:00
Matt Atterbury 3ee07604b9 Take the width and height attributes into account when caching images
in local storage. They are included only in the image's hash and that
is now used of part of the local storage lookup key (for images). We
don't mutate the pagespeed_lsc_url because that is used as a fallback
when the image isn't found in local storage.
2013-10-07 16:05:26 +00:00
Huibao Lin 949fca5556 Turn on "KeepAlive" in tests. 2013-10-02 21:04:34 +00:00
slamm@google.com e62d86c4b0 Have CriticalSelectorFilter disable further processing of a stylesheet link if it is deleted. 2013-10-02 20:08:22 +00:00
Maks Orlovich f560805a24 Implement RateController::ShutDown, largely to avoid
a deadlock between SerfUrlAsyncFetcher::ShutDown and RateController
deferred fetches.
2013-10-02 15:41:45 +00:00
Josh Marantz bb4b035c38 Fix Issue 757
Allow adjusting the max size of an image to optimize.
2013-10-02 15:20:47 +00:00
pulkitg@google.com e72bd80476 Added Purpose HttpAttribute 2013-10-01 23:29:16 +00:00
Shawn Ligocki b9a9c638b9 Update StatisticsLogging defaults so that we only log once every 10 minutes and only store 1 MB of log data. This is still about 2 weeks of back-data, but takes only about 0.1s to parse the 1 MB file, whereas 100MB took about 10s, blocking /pagespeed_console render.
We should really fix this to be more efficient in parsing in some way, but for now this should help people with default settings (especially those with cheap shared hosting).
2013-10-01 21:33:12 +00:00
Shawn Ligocki 0644f58d96 rm mod_pagespeed_example/.htaccess file which does a lot of really confusing things that have several times caused problems for me (for example, I edit config in pagespeed.conf, but that change is not visible in mod_pagespeed_example/ directory).
AFAICT only the two directives I moved over to debug.conf.template were being tested. Perhaps this .htaccess file was there just to test that .htaccess config works? In that case, we now have plenty under mod_pagespeed_test/ that should cover that.
2013-10-01 19:23:20 +00:00
Shawn Ligocki edf63a8140 Preserve URL relativity in JS combining.
Also refactor to put RelativizeOrPassthrough() logic into a single function, rather than independently in 4 different places.
2013-09-30 20:10:18 +00:00
Maks Orlovich ac0a00c47f Fix leak in test (spotted as "possibly lost" by vg) 2013-09-30 16:57:59 +00:00
Maks Orlovich 49b963c629 Teach ModSpdyFetchController to shut down, and hook that up.
Add some histograms for ModSpdyFetcher.
2013-09-30 16:48:36 +00:00
Huibao Lin 951dcf9a51 Re-commit Change r3519, which was overwritten in r3520 2013-09-30 13:01:19 +00:00
Shawn Ligocki e925033fcc Enable PreserveUrlRelativity and fix all the tests. 2013-09-27 21:21:57 +00:00
Jeff Kaufman 4faa9556b4 Fix broken MOD_PAGESPEED_ROOT usage. 2013-09-27 20:39:13 +00:00
Shawn Ligocki ef01346a39 Cleanup 16 TODOs for Google 15. Most were just stripped because they were unnecessary, already done, etc.
Did do a couple: convert uses of static_server --cache_control_headers= to generic --add_headers= and removed space from HTML id.
2013-09-27 20:09:00 +00:00
Huibao Lin 9a8c0776be Make system_test.sh executable 2013-09-27 19:54:36 +00:00
Maks Orlovich 326cd05522 Implement Josh's suggestion and just have a scoped_array adapter
in our namespace for now, to help migrate towards Chromium revisions 
that go scoped_array<T> -> scoped_ptr<T[]>
2013-09-27 14:28:38 +00:00
Maks Orlovich 53d14b177f Change by pooja:
Add Directory scope for resize_rendered_image_dimensions. Also link
documentaion.
2013-09-27 14:10:01 +00:00
Huibao Lin ff8fc03c8d Use value within 32bit range in add_instrumentation_filter_test 2013-09-26 17:07:33 +00:00
Jeff Kaufman 9dad1a7480 Allow users of SystemRewriteDriverFactory to specify their own shared memory runtime. 2013-09-26 14:17:53 +00:00
Huibao Lin 346397109f Remove OpenCV (by huibao@)
No need to ConsiderResponseHeaders in InPlaceResourceRecorder::DoneAndSetHeaders if we've already failed (by jefftk@)
Add header dependency to rdestl needed for google3 (by jbelmonte@)
2013-09-26 12:02:29 +00:00
Huibao Lin db7196ece3 Rollback r3510, which doesn't include all of the relevant files. 2013-09-25 18:10:20 +00:00
Huibao Lin a10e32c15f Remove OpenCV (by huibao@)
No need to ConsiderResponseHeaders in InPlaceResourceRecorder::DoneAndSetHeaders if we've already failed (by jefftk@)
2013-09-25 16:31:52 +00:00
Shawn Ligocki 817b68ea59 Add mechanism for preserving URL relativity in HtmlResourceSlot, CssResourceSlot and AssociationSlot.
I default the option to off so that this CL doesn't get overwhelmed by all the test changes. A follow-up CL will turn this option on and fix all tests.

This also leaves some things pathways out (for example, the image combining path). But I didn't want to bloat this CL too much.
2013-09-24 22:14:05 +00:00
Jeff Kaufman 996bc9853d No need to ConsiderResponseHeaders in InPlaceResourceRecorder::DoneAndSetHeaders if we've already failed. This allows calling recorder->Fail();recorder->DoneAndSetHeaders(NULL) 2013-09-24 20:09:37 +00:00
Maks Orlovich e7b60c1e74 Adjust some of our compat headers to work with newer version of Chromium tree,
in expectation of updating to it eventually. This also includes GoogleUrl
moving into it.
2013-09-24 15:34:31 +00:00
Jeff Kaufman b75016a48d Don't crash on non-existent log file 2013-09-23 19:07:22 +00:00
Josh Marantz b9d542dbb3 Enable some previously hidden options in mod_pagespeed. 2013-09-23 16:21:38 +00:00
Maks Orlovich fa03128bfc Rename ExperimentalFetchFromSpdy -> FetchFromSpdy, in preparation to
documenting it.
2013-09-23 14:41:12 +00:00
Matt Atterbury e1c418b25e 1. Another attempt at quieting MSVC warning.
2. Remove reliance on scoped_ptr's special casing for self-resets (deprecated).
2013-09-18 17:42:37 +00:00
Matt Atterbury d87dda8323 Fixed an MSVC compiler warning that is promoted to an error.
Regenerated some JS scripts.
2013-09-18 15:21:36 +00:00
Huibao Lin 9f8f354e23 Fix bugs in GifScanlineReaderRaw. 2013-09-13 19:23:10 +00:00
mpalem@google.com f242b36c64 1. cl/52249821 Add a class attribute to the HTML if fix reflows filter applied.
2. cl/52252498 If returning stale content from cache, allow lookups in remote caches if any, in case there is fresher content there.
2013-09-12 23:51:41 +00:00
Jud Porter 50917cf31a Fix up some style issues in static js files. 2013-09-12 21:02:02 +00:00
Jud Porter a040ae57ae Bring attribute lexing in line with HTML5 spec. (from morlovich) 2013-09-12 20:59:14 +00:00
Jeff Kaufman 3ac8851e40 Create a SystemThreadSystem for shared mod_pagespeed/ngx_pagespeed functionality. This includes verifying that no threads are started before ChildInit(). It also includes disabling all signals in started threads because the servers we're integrating with generally are using signals for something else. 2013-09-12 20:58:15 +00:00
Josh Marantz 757a4596be Bring attribute lexing in line with HTML5 spec. (morlovich)
Testcase files for bug 781 (jmarantz)
2013-09-12 18:54:56 +00:00
Maks Orlovich 51cc3b4271 Bring attribute lexing in line with HTML5 spec.
The big potential downside is that it eats some extraneous / characters 
when we would have preserved them before.
2013-09-12 17:18:22 +00:00
Maks Orlovich 7e05b57fa1 Add basic integration test for ModPagespeedExperimentalFetchFromModSpdy. 2013-09-12 16:58:10 +00:00
Maks Orlovich 145108ea12 Change by hwright: Cleanup: remove redundant string conversions. 2013-09-12 14:16:45 +00:00
Jeff Kaufman 0f2b1cceab We only need to shut down the caches in child processes because they are not started in the master process. This wasn't a problem before, but shutting down the caches can start a thread which isn't safe to do in the master process of a forking server like Nginx.
Fixes https://github.com/pagespeed/ngx_pagespeed/issues/364
2013-09-11 17:04:27 +00:00
slamm@google.com e1f4278914 Add an option to allow run-time switching between critical_css_filter and critical_selector_filter. The former will be dropped in favor of the latter. 2013-09-10 20:54:49 +00:00
Huibao Lin 6e9f9ae056 Turn on image scanline utilities by default 2013-09-10 20:13:53 +00:00
pulkitg@google.com f6b8b40eb6 - Use transparent image for image inline preview filter.
- Use global_options incase domain_options is not available in ProxyFetchPropertyCallbackCollector::ExecuteConnectProxyFetch().
2013-09-10 19:58:12 +00:00
Jeff Kaufman 16d2e29774 system-test: the current file is ${BASH_SOURCE[0]} not $0 2013-09-10 19:35:15 +00:00
Maks Orlovich 9a4dbac756 Provide a way for tests to see if mod_spdy is loaded. 2013-09-10 17:06:07 +00:00
Matt Atterbury c9a6ac31d9 More fixes to get things to compile on Windows. 2013-09-10 15:32:37 +00:00
Matt Atterbury 9bdddc457f Yet more fixes to get stuff to compile on Windows. 2013-09-10 13:54:17 +00:00
Jan-Willem Maessen 90eaccdd0c Use nonce to protect critical image beaconing against DoS. 2013-09-10 00:03:17 +00:00
Matt Atterbury 7c4dbb8dbf More fixes to get this to compile on Windows. 2013-09-09 20:42:23 +00:00
Jud Porter 905574a1dc Have split_html beacon JS send back BTF nodes instead of xpaths. 2013-09-09 17:59:03 +00:00
Jud Porter 551b3d3a3c Update compiled console js. 2013-09-09 17:58:01 +00:00
Josh Marantz b5063acf60 Fix Issue 664. Strip Connection and other hop-by-hop headers when
saving input resource, because the underlying server will add a new
Connection header.
2013-09-09 17:19:50 +00:00
Jeff Kaufman c1c7a15e4f move non-apache system tests out of apache/ 2013-09-09 15:48:05 +00:00
Matt Atterbury 279f02862e More windows build fixes. 2013-09-08 22:07:00 +00:00
Matt Atterbury 6df760beae Attempt to get stdio_file_system.cc to compile on Windows.
Don't know about the genfiles - I presume someone forced their regeneration,
or perhaps some included JS was modified?
2013-09-06 20:41:35 +00:00
Josh Marantz 571dc0a4f6 Use a sorted StringPiece vector rather than a set to do a Headers Remove.
Use StringMultiMap::RemoveAllFromSortedArray to make
Headers::RemoveAllFromSortedArray faster.

This CL is a prereq of fixing bug 664 because that will add a lot more
removing of "hop-by-hop" headers, and I don't want to risk a
performance degredation.  See
http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html for details on
the list of headers we must strip.
2013-09-06 18:38:07 +00:00
Jan-Willem Maessen ee38cc61e3 Remove critical_iamges_callback, which is unused. 2013-09-06 17:14:32 +00:00
pulkitg@google.com 89953180d4 Added a flag to control Property cache Fast Finish lookup. 2013-09-06 00:36:03 +00:00
Shawn Ligocki 0ae1379170 Get rid of strange GoogleUrl behavior. I don't think there's any good reason to do this. 2013-09-05 21:56:50 +00:00
Shawn Ligocki 28bbb4874f gflag for hide_referer_using_meta option. This is needed for borg changes required for search servers. 2013-09-05 20:52:59 +00:00
Josh Karlin 9af54628dc One line fix for distributed rewriting to prevent writing to the
output too early.

  --This line, and those below, will be ignored--

M    net/instaweb/rewriter/rewrite_context.cc
2013-09-05 16:42:03 +00:00
Josh Marantz 1884c58422 Clean up debug-assert. Update compiled JS per change in toolset. 2013-09-05 03:18:59 +00:00
Maks Orlovich e34f6a68e7 Simplify RewriteDriver memory management and waiter wake up.
Instead of having a bunch of bools with slightly different semantics 
and complicated logic to determine when to delete and when to ->Signal,
just use a categorized refcount (e.g. active rewrites, detached rewrites,
etc.), and check IsDone before and after changing it.

There is a bit of a semantic change: previously ->Cleanup would roughly set a 
"now it's safe to care about refcount 0" bit, now it's actually a deref,
so it's no longer sort-of idempotent.

There are also a few more checks; in particular you can no longer just 
call StartParse lots of times without doing a FinishParse, a few 
tests stumbled on that. ->ReleaseDriver also complains when its handed 
something that has non-zero refcounts, so most spots that used it are now 
calling ->Cleanup() instead
2013-09-04 21:29:58 +00:00
Jud Porter 4fde97cb20 Fix potential segfault in CriticalImageFinder if the rendered_image_dimensions filter is enabled, but no critical image info is in the pcache. 2013-09-04 20:34:09 +00:00
Jud Porter 92a03d414d Updated pagespeed_libraries.conf 2013-09-04 20:32:37 +00:00
slamm@google.com 55bd263a08 Clean up the !UseBeaconResultsInFilters path by skipping the beacon JavaScript code.
That path only needs the list of selectors and now uses its own code to compute the
critical CSS.
2013-09-04 18:42:50 +00:00
Josh Marantz 71c0409a6f Add support for embedded NULs in StringMultiMap keys. This probably
saves some runtime (not specifically measured) by reducing the number of .as_string()
calls needed to make temps for use in Lookup.

It costs some memory by forcing an extra StringPiece object
for use as the key, while still keeping the GoogleString
backing-store for that string in the value.

This has one small interface change: name(index) returns
a StringPiece now rather than a const char*.

Also a new method RemoveAllFromSortedArray was added, along with a
speed test illustrating why it's better to use that than a
StringInsensitiveSet to implement RemoveAll.
2013-09-04 04:26:50 +00:00
Jan-Willem Maessen d2e504a0be Refactor nonce handling so that we pass around a struct containing a beaconing
status and (if applicable) a nonce.  This simplifies a bunch of control flow and
makes it less ad hoc.  Also changes the contract of PrepareForBeaconInsertion to
shift a bunch of checking to the caller, since those checks are more
class-specific than we initially supposed.
2013-09-03 22:02:15 +00:00
Jan-Willem Maessen 185690a84c Fix GoogleUrl::Swap which neglected to Init the other url after swapping. Now
we just swap the cached is_ values.
2013-09-03 21:11:42 +00:00
Shawn Ligocki 57596579e8 Allow any URLs for HtmlParse::StartParse() because some tools depend on file:// URLs for now. 2013-09-03 20:29:16 +00:00
Shawn Ligocki f9bea43ea7 Replace most uses of GoogleUrl::is_valid() and ::is_standard() with ::IsWebValid (I think this is the common thing people want), ::IsWebOrDataValid() (Needed if you also accept data: URLs) and ::IsAnyValid() for a few use-cases where we want to accept even funky or made-up protocolos, like gfnt:. 2013-08-30 20:03:20 +00:00
Maks Orlovich 921bd3db0f Add + test a CategorizedRefcount helper template, to be used for RewriteDriver
memory management.
2013-08-30 15:46:44 +00:00
Matt Atterbury 5e50e28b23 1. Fix determination of how many properties to merge. The old code was
effectively min(max(A, B), A) so if A > B then A would always be used,
   resulting in setting or getting an invalid index. What we want is just
   min(A, B) which is the new code. Note that the DCHECK and the fact that
   A would always be <= B means that this couldn't trigger but it is wrong.
2. Removed an unnecessary template parameter by replacing it with the known
   type, which is actually more type safe.
2013-08-30 13:34:46 +00:00
Maks Orlovich ed6c492c72 Change by vagababov:
- Add audio (and some video) content-types to our table

+ Regen of compiled console JS
2013-08-29 20:55:19 +00:00
Jeff Kaufman 7cb2c8b273 move statistics reporting to system/ 2013-08-27 21:39:55 +00:00
Shawn Ligocki 9556984b7d Fix JavaScript library identification issue where totally://bogus.protocol/ was rejected, but totally:bogus.protocol was accepted! Now we reject all non-standard protocols.
Also clarified some tests on GoogleUrl demonstrating a really strange behavior we have there. Follow-up CL coming to fix that wacky behavior, right now I just want to demonstrate it in tests.
2013-08-27 20:41:10 +00:00
Huibao Lin 08045ed4d0 Use 'MessageHandler' to log message in the image utilities. 2013-08-27 19:16:20 +00:00
Michael Piatek f65b8744cf Respect existing experiment IDs if set when writing logs. 2013-08-27 18:33:10 +00:00
Josh Karlin 8dcdc6bfc7 Removed the OutputResource lock and moved the creation lock to before
the metadata lookup in the .pagespeed. fetch path.
2013-08-27 11:11:45 +00:00
Jeff Kaufman 905f2be6b4 Move Apache/NgxServerContext::ChildInit to SystemServerContext
This drags along all the ApacheServerContext statistics code including initialized-tracking and histograms.
2013-08-26 20:01:39 +00:00
bharathbhushan@google.com 492ba5b929 Fix reflow logging. 2013-08-23 23:06:29 +00:00
bharathbhushan@google.com c3ddbba3f9 Filter to fix reflows caused by defer js. 2013-08-23 20:27:39 +00:00
Matt Atterbury b3d761e29c 1. Extended CssRewriteTestBase with:
- kExpectCached to indicate that everything should come from cache.
   - kInputHtml and kOutputHtml so that methods can know if they're being
     called when generating the HTML input or output, such as ...
   - CssDebugMessage virtual method that tests can override to inject the
     debug message they expect after the rewritten CSS.
2. Added debug messages to CSS flattening that explain why flattening
   failed. It will be generally useful for any debug messages. It
   necessitated a new field in the cached results so that we can emit
   the reason when we're emitting the cached value. Also modified the
   flattening tests to actually test that things are coming from the
   cache as originally intended (kExpectSuccess | kNoStatCheck is an
   ugly incomplete hack).
2013-08-23 14:22:36 +00:00
Jud Porter 1a27d0b35e Divide critical_css_js into multiple loops with window.setTimeout to reduce the instrumentation JS blocking other events. 2013-08-22 17:51:17 +00:00
Jud Porter 7a37a09e16 Fix split_html crash (from bharathbhushan) 2013-08-22 17:50:38 +00:00
Shawn Ligocki b3e1663602 Scrub gyp files 2013-08-20 22:13:53 +00:00
Huibao Lin 24a8d58626 Speed up image resizer (by huibao@)
If the origin returns non html content while flushing early, trigger a redirect to a noscript version of the page with flush early disabled (by poojatandon@)
2013-08-20 19:32:28 +00:00
Jud Porter ee8f7cf1ea Fix URL for jsoncpp repo. 2013-08-20 18:34:54 +00:00
Jud Porter 1d89ba13a8 Make critical CSS load at DOMContentLoaded instead of onload when using the critical_selector_filter. 2013-08-20 18:04:04 +00:00
Huibao Lin cf01987632 Use PSNR to measure the accuracy of decoded WebP 2013-08-20 01:32:46 +00:00
Josh Marantz cfa7f285c6 Add headers APIs to detect must-revalidate and proxy-revalidate 2013-08-19 23:03:18 +00:00
Shawn Ligocki 6a546bfcdd Allow debugging version of console.js.
The major pain here was wiring query param-based options into ConsoleHandler(). We usually only check them in the HTML filter or .pagespeed./in-place resource handlers.
2013-08-19 17:42:41 +00:00
Maks Orlovich c94d19f6dc Add a test to make sure we do the right thing wrt to cacheability of
partial replies. (I was a bit worried about InPlaceResourceRecorder).
2013-08-19 17:16:25 +00:00
pulkitg@google.com f509a8da73 Put values from secondary property store to primary property store if value is present in secondary property store. 2013-08-17 00:46:12 +00:00
Shawn Ligocki c684a85a57 Use StaticAssetManager for console JS and CSS.
First step to allowing debuggable JS.
2013-08-16 17:31:34 +00:00
pulkitg@google.com 83fe7f1160 Added statistics variable to track how much time after cancellation lookup finishes. 2013-08-15 20:26:42 +00:00
Maks Orlovich a9e3053c86 Privatize the HtmlName ctor. It's a lot harder to misuse
now, but why not make it impossible?
2013-08-15 20:18:09 +00:00
Maks Orlovich f72b52c6c0 StringPiece'ify atoms, for saner length handling an less risk of
bugs due to embedded nuls. 

This does slow down the symbol_table_speed_test, significantly,
by as much as 15-20%, but doesn't seem noticeable on html_parse_speed_test.
2013-08-15 16:51:48 +00:00
Maks Orlovich 741ecff25e Rollback accidental revert of r3426.
Some include fixes.
2013-08-15 14:46:37 +00:00
Shawn Ligocki 6712e42cc5 Remove loudest info logs that don't seem to be particularly useful.
Based on a sample load test run (with LogLevel info):
$ wc -l pagespeed.messages
4979581
$ sed 's/.*\]//' pagespeed.messages | sed 's/http[^ ]*//' | sort | uniq -c | sort -n | tail -20
    9199  Reset: flush in a script.
   11547 HTTPCache key= remembering not-cacheable status for 299 seconds.
x  14139 Rewrite script  to 
   22405 HTTPCache key= remembering not-found status for 299 seconds.
x  22732 Starting to rewrite images in CSS in 
   28065 RenderedImage not found in cache
x  57399  Found script with src 
   82402 Cache entry is expired: 
x  88018 Cannot sprite: no explicit dimensions
x  88580 Could not rewrite resource in-place because URL is not in cache: 
x 102364 Could not rewrite resource in-place: 
x 118189 Found image URL 
x 119582 Attempting to sprite css background.
x 196582 Fetch succeeded for  status=200
x 204861 Fetching resource 
x 214974 Attempting to save resource in-place: 
x 328035 Fetch complete: 
x 328166 Initiating async fetch for 
x 637666 Serving rewritten resource in-place: 
x 828610 Trying to serve rewritten resource in-place: 

(x's added to messages I've removed)

Also removed a few others:
$ grep -c "Inline element not outlined" pagespeed.messages
152899
$ grep -c "Unlocking lock" pagespeed.messages 
134177
$ grep -c "Locking (lock" pagespeed.messages 
134177
$ grep -c "Successfully rewrote CSS" pagespeed.messages 
20238

Reducing messages 4979581 -> 1188193 (76%).
2013-08-15 13:58:53 +00:00
pulkitg@google.com 37e72936f8 Makd ServerContext::CreatePropertyStore() virtual function. 2013-08-14 23:12:49 +00:00
Maks Orlovich c5558bdca7 Make the JS escaper avoid hitting some obscure
HTML parsing quirks.
2013-08-14 19:35:48 +00:00
Shawn Ligocki feda65f915 Move simple_stats and some other things that depend on util/platform.h into util dir. Also rename target from nebulous :base_test_infrastructure to :simple_stats.
There are still 2 tests in base that depend on targets in util and sharedmem, it'd be nice to break that dependency, but at least the rest of the tests don't depend.
2013-08-14 19:05:57 +00:00
Shawn Ligocki 1095529fc4 genfiles 2013-08-14 18:57:42 +00:00
Maks Orlovich d6d508068a Try to clarify this documentation a bit, since it can be reasonably
read as suggesting that ModPagespeedDomain is the only thing that
can expand the authorization list rather than just one of these things.
2013-08-14 15:26:52 +00:00
Josh Karlin 612e5fca81 Gracefully handle null request headers when distributing. 2013-08-14 12:40:13 +00:00
Huibao Lin ee9916d950 Add an option to switch between OpenCV and new image utilities (by huibao@)
Use rendered dimensions for resizing images (by poojatandon@)
2013-08-14 12:01:25 +00:00
Shawn Ligocki 00e0ab5c99 file_system_test cleanup. 2013-08-13 19:30:14 +00:00
pulkitg@google.com 385b97d284 detach_ should not be used in function which ran outside of sequence as it can lead to Race. 2013-08-13 17:17:54 +00:00
pulkitg@google.com c2539c7a3c Resolve depedency between http/... and util/... 2013-08-12 19:42:15 +00:00
Huibao Lin 49a4fe17b2 Replace libjpeg with libjpeg_turbo 2013-08-12 17:58:23 +00:00
Josh Marantz 8c0b5dafe2 Instantiate a SystemServerContext in SystemCachesTest.
Include the on/off/unplugged status in the options-to-string converter.
2013-08-12 17:14:59 +00:00
anupama@google.com 1e82124bdf * Moving apache downstream-caching system tests into a separate file.
* Added a couple of environment variables that can be used to specify the varnish host:port and whether the default vcl needs to be backed up.
2013-08-12 13:42:13 +00:00
Josh Marantz f07b9d5336 Move fetch_with_gzip out of the factory and into SystemRewriteOptions. 2013-08-11 19:15:12 +00:00
pulkitg@google.com 4dbcdc4711 Added a function to check given url is fallback url or not. 2013-08-09 23:31:17 +00:00
mpalem@google.com e300525db2 Add a new flag to control proactive freshening of input resources. 2013-08-09 23:27:24 +00:00
pulkitg@google.com 7f4b1bacaa Setting enable_get_cancellation_ to false by default. 2013-08-09 22:40:11 +00:00
Josh Marantz 51ac4fd1f9 akes the system more strongly connected, and harder to
unit-test.

Move ModPagespeedDangerPermitFetchFromUnknownHosts into system_rewrite_options, and expand the general-purpose option-processing mod_pagespeed to enforce strict/non-strict process-scoped settings.

Add missing virtual dtor in SystemServerContext

Put all the options for creating fetchers into the fetcher map key.
2013-08-09 22:06:07 +00:00
Jeff Kaufman f75a38e338 Move some defaults from apache/ to system/
All of these are the same in Apache and Nginx except for DefaultTimer() where Apache uses an AprTimer and Nginx uses a PosixTimer. I think PosixTimer is a good enough default that it should be in system/, however, and Apache can just override it to get an AprTimer.
2013-08-09 21:19:08 +00:00
pulkitg@google.com 0251b34a12 Added a class TwoLevelPropertyStore which lookups first at the first level and if result is not available then it initiates the lookup in second level storage system. It also have the capability to cancel the lookup and fast return with the result available from first level lookup. 2013-08-09 21:16:44 +00:00
Josh Marantz 5352bc67ac Tweak the semantics of PurgeSet to match exact existing behavior that
if I purge at time X then resources at time X will be invalid.  Previously
resources at time X would be valid, but X-1 would be invalid.  This reduces
regolding when we switch to PurgeSet.
2013-08-09 19:25:41 +00:00
pulkitg@google.com d1be36eefb Introduced a class AbstractPropertyStoreGetCallback is introduced which tries to fast finish property cache lookup in case html returns and lookup is not yet complete. 2013-08-09 00:27:40 +00:00
Josh Marantz d3b3e2528c Fill in HTTPCache::Callback methods for validating cache in
ApacheProxyFetch, and in InPlaceResourceContextTest's FakeFetch.  Add
a unit-test and a system-test for cache-purging with IPRO.

Fix the URL used for the InPlaceDataRecorder in Apache to have the
?ModPagespeed query-params stripped.

Remove method ResponseHeaders::IsDateLaterThan and instead incorporate
that into RewriteOptions::IsUrlPurged.
2013-08-08 19:53:51 +00:00
Jud Porter 680601a0b9 Verify we have the original getAttribute before restoring it in lazyload_images.js. Use querySelector instead of querySelectorAll. 2013-08-08 17:25:54 +00:00
Jeff Kaufman 3a03f34e59 Add a hook for implementations to substitute other fetchers.
Also document the mutilevel caching we use for fetcher allocations.
2013-08-08 14:47:54 +00:00
bharathbhushan@google.com 2a885a7dee Defer instrumentation beacons when split_html is enabled (bharathbhushan)
Simplify PropertyCache application code in proxy_fetch.cc by using Sequences.
Now all three functions Done(), ConnectProxyFetch() and Detach() will run on a
sequence to avoid the possibility of race across them (pulkitg)
2013-08-07 23:27:42 +00:00
mpalem@google.com 9ed2b8a9d6 On Freshen() of a resource, freshen its dependencies as well. 2013-08-07 18:50:31 +00:00
Jan-Willem Maessen 461844976b Add support for statistics gathering. 2013-08-07 15:37:46 +00:00
Jan-Willem Maessen cbfbab8af8 Rename Scheduler::AddAlarm to Scheduler::AddAlarmAtUs, removing last trivial TODO from scheduler.h. 2013-08-07 15:31:10 +00:00
Jan-Willem Maessen 6fb58522f2 Fix https://code.google.com/p/modpagespeed/issues/detail?id=759 and clean up some renaming TODOs in the scheduler while we're there. 2013-08-06 17:50:24 +00:00
Jeff Kaufman 281d4c6864 Moving fetchers and options from apache/ to system/ 2013-08-06 13:50:22 +00:00
mpalem@google.com fcf5761229 De-dup the other dependency field of rewrite context partitions. 2013-08-05 22:07:08 +00:00
Maks Orlovich 8844268d97 Try to fix various buildbot issues on non-Linux platforms:
- We need a dummy file for rewriter_html to get a binary on OS X
- rewriter_html (and html_minifier_main) should be relying on
  pagespeed_http_core, not pagespeed_http (as the latter in particular
  needs RE2 which isn't officially supported on Windows)
2013-08-05 20:53:57 +00:00
Shawn Ligocki e1851239e1 fix up build release tarball 2013-08-05 20:38:35 +00:00
Shawn Ligocki 09a04721a6 genfiles 2013-08-05 20:38:11 +00:00
Jeff Kaufman 54da49d459 When an nginx server reloads its configuration it temporarily runs both the old
and new configurations in parallel in the master process.  These are independent
instantiations and shouldn't try to share segments.  By adding an instance
number to the segment name that is incremented every time a PthreadSharedMem is
created, segment names won't overlap.

This change has been in ngx_pagespeed in a forked version of the files since March [1] but as it should work with Apache and other ports it would be good to merge it upstream.

[1] https://github.com/pagespeed/ngx_pagespeed/pull/179
2013-08-05 19:51:52 +00:00
Josh Marantz df162fa9b7 Fix stray refs to util/wildcard.cc 2013-08-02 20:35:26 +00:00
Josh Marantz 5287baf0dd Fix stray referenes to util/fast_wildcard*. 2013-08-02 20:17:37 +00:00
Josh Marantz 9ab6f3e648 Remove superfluous string copy. 2013-08-02 15:35:36 +00:00
Josh Marantz bbe198f1cd Move over the few simple HTML minifier filters that Insights uses from
net/instaweb/rewriter over to pagespeed/kernel/html/.

That also required pushing the wildcard support up util -> base_core, since comment 
removal is configured using them.

Original author: morlovich
2013-08-02 12:59:38 +00:00
ksimbili@google.com 2c0cdcc92e Reverting the change made accidentally. 2013-08-01 04:07:36 +00:00
ksimbili@google.com 07ba3afa9f Fixing the infinite reload issue.
We were using iframe to download js files in parallel. But this causes
all frame busting techniques to fail and ends up in reloading of pages
infinitely.
2013-08-01 04:04:02 +00:00
anupama@google.com 6df30b1f86 Script to verify downstream caching setup for a webmaster. 2013-08-01 01:55:48 +00:00
Jan-Willem Maessen 91680b830e Add helper string for disable_rewrite_on_no_transfrom rewrite option
so it works in mod_pagespeed. Also add a system test for the same.
2013-07-31 22:07:31 +00:00
Jan-Willem Maessen c29d3a5e98 Rename NumSetsToKeep to SupportInterval to better reflect the new reality of using support values. 2013-07-31 22:02:38 +00:00
Josh Marantz 8d14992275 console compiled JS update
add 2-arg Callback*.
2013-07-31 21:01:11 +00:00
Shawn Ligocki d32269fdd2 Only count HTTP cache expiration statistics to be incremented in the HTTPCache::Find() path.
Previously, this stat was being incremented in the Put() and "should we rewrite this file?" paths. Those cases are not really things expiring out of the cache so much as never ending up in the cache in the first place. This puts all the HTTP cache stats together and allows us to actually post an info message noting that specific URLs expired out of cache.
2013-07-31 17:27:11 +00:00
Josh Marantz 0d5075a770 Move speed-tests and net/instaweb/http (excluding fetchers) to pagespeed/kernel/... 2013-07-30 21:47:11 +00:00
Jud Porter 24089289c7 Refactor critical_images.proto to use support values from critical_keys.proto. (from jmaessen)
Remove unused timer memeber var from CriticalSelectorFinder.
2013-07-30 20:48:36 +00:00
Jeff Kaufman 64520fd8de Move in_place_resource_recorder to system/ 2013-07-30 19:26:36 +00:00
Huibao Lin eeee9b79a1 Make sure all CSS files are fetched in the test for MaxCombinedCssBytes (by huibao@)
Handle relative URL inside CSS that has been @import from its own relative location (by matterbury@)
2013-07-30 17:05:38 +00:00
Jeff Kaufman 6750050aba Move much of ApacheRewriteDriverFactory into SystemRewriteDriverFactory 2013-07-30 15:24:18 +00:00
Josh Marantz 5be69d4892 Fix compile-errors when compiled with default flags. It appears that
many of these files are currently compileed without all the warnings
we usually use.  These edits are needed to get the to compile with the
default flags.
2013-07-29 20:50:39 +00:00
Jud Porter 3a9e412db8 Add filter for injecting the split_html instrumentation JS. 2013-07-29 19:17:30 +00:00
slamm@google.com 995e096741 Integrate CriticalSelectorFilter with cache_html_flow and flush_early_flow.
- Save selector pcache data for the two flows.
- For critical_css, move link-adding script before <body> (makes testing easier).
- For flush_early, test both critical_css_filter and critical_selector_filter.

The critical_css_filter will be going away eventually.
2013-07-26 23:01:05 +00:00
Jud Porter c5faee82f0 Option to disable distribution of IPRO and .pagespeed. fetches. (from jkarlin). 2013-07-26 19:22:19 +00:00
Huibao Lin 2bf5f57bf6 Remove compilation warnings in gif_reader.cc 2013-07-26 17:21:37 +00:00
Huibao Lin 6c19b5d557 Add option for limiting size of the combined CSS 2013-07-26 17:07:25 +00:00
Shawn Ligocki 66e496d810 genfiles 2013-07-26 16:47:48 +00:00
Maks Orlovich 1fc3cf07dd Make it possible to build against system openssl 2013-07-26 15:49:38 +00:00
Josh Marantz 1a894dfdca Move most cache files to pagespeed/kernel/cache 2013-07-26 13:28:32 +00:00
Josh Marantz f119856254 Move a bunch more files from net/instaweb/util to pagespeed/kernel/util 2013-07-25 23:48:41 +00:00
Josh Marantz 462ed459e6 Only have one critical CSS finder (the other is NULL). (slamm) 2013-07-25 22:27:03 +00:00
Josh Marantz 8e240fd4e3 Only have one critical CSS finder (the other is NULL). (slamm)
Move a bunch more files from net/instaweb/util to pagespeed/kernel/base (jmarantz)
2013-07-25 19:15:48 +00:00
slamm@google.com 1745dc1f3e Only have one critical CSS finder (the other is NULL).
This makes it easier to integrate with flush_early_flow and cache_html flow and facilitates testing the integration.
2013-07-25 18:46:31 +00:00
bharathbhushan@google.com c9b9f8bd18 Add response code and request id to the instrumentation beacon. 2013-07-25 15:20:15 +00:00
nikhilmadan@google.com 222f6cf707 Change static_asset_manager constructor to accept an asset base url instead of UrlNamer. 2013-07-25 00:36:59 +00:00
bharathbhushan@google.com cba1b581b0 Prefer split html config from pcache over split html config from domain options. 2013-07-24 23:44:54 +00:00
pulkitg@google.com c013cee248 Added a functionality to pass callback to PropertyStore::Put() which will be called after lookup is done. 2013-07-24 22:14:15 +00:00
bharathbhushan@google.com e765634d67 Use performance.getEntries, in the instrumentation js, when it is available. 2013-07-24 19:58:29 +00:00
Maks Orlovich 5ec5240251 Fix major shm leaks on apache2ctrl graceful. What that mode does in the root process[1] is basically tear us all down and start it back up, w/o exiting the root process.
This CL fixes:
1) Actually unmap the released segments
2) Properly release shm cache segments
3) Properly release local stats segments
[1] children wrap up current requests and exit
2013-07-24 19:43:49 +00:00
Josh Karlin 7053a488fd Distributed IPRO and .pagespeed. fetches now occur early, at the RewriteDriver, instead of late, in RewriteContext. 2013-07-24 18:25:26 +00:00
Maks Orlovich 86a44dab45 Add a version map so we don't leak OpenSSL symbols,
which we did for assembly-implemented ones.
2013-07-24 18:13:33 +00:00
Matt Atterbury 24df7c8851 Fixed brokeness in testing where we treated an URL as an id and ended
up with URLs like http://test.com:/http://test.com/testname.html.
2013-07-24 18:00:59 +00:00
Josh Karlin 82326e0cb1 Fix for Issue 748 in which repeated rewrites had empty URLs when rewrites were dropped due to kTooBusy for load shedding or the random dropping option. 2013-07-24 17:45:21 +00:00
Maks Orlovich 0dbdf666a2 -Change by jkarlin:
- make some system tests more robust to system changes, library versions

Also regen add_instrumentation.js
2013-07-24 17:01:40 +00:00
slamm@google.com 33a66930b7 Add pagespeed_no_defer attribute to critical_selector_filter script to
add all styles (critical_css_filter has this).

Move ImageFormat to scanline_interface.h
Make ImageFormat, its string representation, and its associated MIME type be derived from a Single Point of Truth (SPOT) via macros. The latter two can be obtained via utility functions defined in the scanline_interface.
Fixed an error in the macro collision check for the pixel format macros in scanline_interface.h.
Regularized the macro names.
2013-07-24 03:46:57 +00:00
nikhilmadan@google.com bb59c29327 - Add support for rewriting url valued attributes in inline preview images. 2013-07-23 18:36:28 +00:00
bharathbhushan@google.com 139f2f0945 Fix the bug in split_html/split_html_helper filters while handling nested tags (ksimbili)
Fix firstPaintTime reporting in add_instrumentation (bharathbhushan).
2013-07-23 17:40:30 +00:00
bharathbhushan@google.com 9484c8eb63 Cleanup device info logging. 2013-07-23 15:51:59 +00:00
Maks Orlovich 1e8aba76f8 Revert r3321, since that actually *reverted* a whole bunch of
trunk changes incorrectly.
2013-07-23 13:43:36 +00:00
Shawn Ligocki 6d603a68fb Move most of the console variable dumping logic into StatisticsLogger.
Move the logger tests to statistics_logger_test.cc as well to make unittests more local in nature.
2013-07-22 19:50:40 +00:00
Shawn Ligocki 24bdff269e Sync in many changes. 2013-07-22 19:50:12 +00:00
nikhilmadan@google.com 16d123c9c0 Disable flush early if the request has conditional validators.
Add a few more bot detection patterns
2013-07-22 19:31:59 +00:00
anupama@google.com c76c9f4743 More strict checking for capabilities specified in PS-CapabilityList header so that we need not worry about dummy strings that happen to have "ll" etc. 2013-07-22 18:40:47 +00:00
nikhilmadan@google.com ae6500ede6 - Allow url-valued-attributes to pick alternate attributes if the usual one it
is looking for doesn't exist.
- Have a default min caching TTL and use this value to cache resources that
have an explicit cache value set, which is less than the chosen min value.
Hide this behind an option until the experiments are done. This is intentionally
kept separate from implicit_cache_ttl as that applies to resources that
do not have an explicit cache control set.
2013-07-22 18:26:26 +00:00
nikhilmadan@google.com c6702535c6 Add an option to disable triggering background fetches for bot requests. 2013-07-19 23:42:23 +00:00
bharathbhushan@google.com df40f2f726 Create a critical line info finder class. 2013-07-19 22:15:02 +00:00
bharathbhushan@google.com 124fda933a Cleanup RE2 message on apache startup (bharathbhushan)
Sample VCL (anupama)
2013-07-19 16:14:53 +00:00
slamm@google.com c23c9b4ebb Make CriticalCssFilter use "class" instead of "id" on <noscript> element that lists the full CSS. It only expects one such <noscript> element. However, the change makes it easier to migrate our code form the former to the latter. 2013-07-18 21:47:03 +00:00
slamm@google.com 982322b3cb Replace the 1 use of .innerHTML in console.js with explicit text and element costruction to provide extra XSS protection. 2013-07-18 21:44:12 +00:00
Shawn Ligocki 9306bddf1c Explicitly construct DOM elements. 2013-07-18 20:10:37 +00:00
slamm@google.com d4a377524a Add support to flush critical CSS early. 2013-07-18 19:09:42 +00:00
pulkitg@google.com 5e7f91ab3e Change PropertyPage::Read() method to issue single Get() call and CachePropertyStore internally manages the different CacheCallbacks. 2013-07-18 18:52:27 +00:00
Maks Orlovich c4ceb94e79 Initial implementation + testing of GoogleFontServiceInputResource,
with some corresponding API changes to CacheableResourceBase and
AsyncFetchWithLock.

Not integrated anywhere, nor is the rest of the framework taught about the
new url() vs. cache_key() distinction.
2013-07-18 17:01:51 +00:00
Josh Marantz ae10d90aca Correct comment grammar (jmarantz)
fix a warning about negating an unsigned results
in an unsigned, so cast it to int before negating it (matterbury)
2013-07-18 15:44:07 +00:00
Josh Marantz 4fc53e9763 Rolled back this change:
Fix checkin tests by switching from 1.gif to an optimizable image.
	Our 'optimization' of cache-extending 1.gif broke I think because
	gstatic started serving 1-year cache lifetimes.

This change to the test is no longer necessary, as we can now proxy
long-TTL files now.  It is better to use a more reliably present gif as our
test file.
2013-07-18 13:33:05 +00:00
Josh Marantz 5f76b3901c Do contents-check when https succeeds. 2013-07-18 13:26:06 +00:00
Josh Marantz 13784f398f Updated compiled JS 2013-07-18 13:24:33 +00:00
pulkitg@google.com e446b22bba PropertyCache key generation function is moved to CachePropertyStore. 2013-07-18 00:25:56 +00:00
Huibao Lin b8bbfa961c Use PNG as the only intermediate image type when resizing GIF images 2013-07-17 20:41:35 +00:00
Huibao Lin 5aec49cb38 Add CreateScanlineWriter() method 2013-07-17 20:16:08 +00:00
pulkitg@google.com ec37cc5b2c - Make AsyncFetchWithLock::Start non-static function
- Revert the change which blocked rendering of the page when defer_javascript is enabled.
2013-07-16 23:20:44 +00:00
pulkitg@google.com ef202812e6 Introduce a class PropertyStore which is the helper class to read from the cache server.
Note: This cl does not introduce new functionality. Its just move cache accessing code from PropertyCache to newly created class CachePropertyStore.
2013-07-15 23:02:13 +00:00
pulkitg@google.com 43919be03e Made cache-control header to private, max-age=0 and removes Expires header while serving stale content and revalidate in background. 2013-07-15 18:38:26 +00:00
nikhilmadan@google.com 58e89908d8 Fix crash due to js_disable_filter calling AppendChild in StartElement 2013-07-13 01:04:16 +00:00
bharathbhushan@google.com 388773cead Reduce the code duplication between split-html and split-html-helper. 2013-07-12 22:49:05 +00:00
mpalem@google.com 3c13966867 1. Fix the flush early mechanism in Chrome to download scripts that are flushed
early. The old technique worked up to Chrome/26, but broke in Chrome/27.

2. Use max of resource cache TTL and implicit cache ttl for caching the
    	resource when rewrite
    	Partition() fails and goes through AddRecheckDependency().
2013-07-12 21:31:47 +00:00
nikhilmadan@google.com b354e92e7c Fix Headers::AddToMap to be in sync with the proto for empty comma separated fields. 2013-07-12 16:47:24 +00:00
Jud Porter 22788ff3a7 Allow sharing of JS snippets between static JS files. 2013-07-12 15:22:25 +00:00
nikhilmadan@google.com b0f1d99bdc Use window.location to construct the btf url instead of passing it into the JS 2013-07-12 00:47:13 +00:00
bharathbhushan@google.com c38cab65fb Add options to avoid inline-preview if:
1. low-res image is larger than some limit
2. low-res size / full-res size is larger than some percentage
2013-07-11 22:46:35 +00:00
Shawn Ligocki 75b852f90b Replace all @@-variables in pagespeed.conf.template.
Add 2 levels of testing for this:
    	1) Test in installer.include that there are no @@'s left in pagespeed.conf file.
    	2) Actually restart httpd after purge/install of new binary on VMs, this will check that the default configuration does not cause httpd to crash.

    	Also added a fix to PSOL binary building.

    	Fixes issue 742.
2013-07-11 18:55:27 +00:00
Shawn Ligocki cce16c6284 genfiles 2013-07-11 17:53:11 +00:00
nikhilmadan@google.com 7dbead77c2 Change the bot detection logic to consider any user agent (lower cased) which
contains bot,	spider or crawl as a bot. Also, consider the empty string as a
bot.
2013-07-10 22:27:51 +00:00
Matt Atterbury c08a8c0e89 1. Fix ReduceWebpImageQuality so that it preserves the alpha channel.
2. Process beacons and static asset requests even if they come from
   ourself or another upstream mod_pagespeed.
2013-07-10 20:34:25 +00:00
Maks Orlovich f9ac65a0fd Fix improper handling for must-revalidate 2013-07-10 17:30:47 +00:00
Jeff Kaufman 4942cd0588 Documentation for core filters 2013-07-10 16:48:46 +00:00
Huibao Lin 614c3650f5 Ensure accessing only valid memory in ResizeColArea::Resize() 2013-07-10 12:39:10 +00:00
Huibao Lin ba4f689b01 Add a method for creating scanline reader (by huibao@).
Fix link to documentation for ModPagespeedMapProxyDomain (by matterbury@).
Handle the hash fragment occurring in non-critical parts (by yuizumi@).
2013-07-10 12:33:48 +00:00
Matt Atterbury 2f70659466 When determining the charset for CSS, do NOT use a charset attribute on a style
element, since that's illegal and will (?) be ignored by browsers.
2013-07-09 20:24:46 +00:00
ksimbili@google.com e669ae625e Fixing the bug where non-critical is bound before ATF scripts execution.
Improving scrolling performance when deferJs is enabled.
2013-07-09 20:01:45 +00:00
Maks Orlovich fcfa335b6b Sanity check to make sure that some things that are
not supposed to be externally controllable aren't.
2013-07-09 16:35:58 +00:00
Maks Orlovich 2042f0e822 Change by yuizumi:
Use the About page instead of the Google's homepage in SerfUrlAsyncFetcherTest, 
to prevent the test failing by getting a redirect (e.g. to ccTLD outside US).
2013-07-09 16:17:59 +00:00
satyanarayana@google.com cef435452c 1) Move all non-critical loading after 'load'.
2) Cleanup few log statements.
2013-07-09 01:58:27 +00:00
bharathbhushan@google.com e004250346 Add unit tests for split-html-helper filter. 2013-07-08 20:12:31 +00:00
Maks Orlovich 87af9cdf8d Move all the caching/fetching code UrlInputResource => CacheableResourceBase,
fixing up some comments along the way. The exact interface/hooks will likely
need changes once there is a second subclass.
2013-07-08 19:22:02 +00:00
Maks Orlovich 7d968edc43 Changes by poojatandon:
- Logging for Image resizing using rendered dimensions.
- Use rendered dimensions only when they are smaller in size than the
  image attributes.
2013-07-08 19:17:31 +00:00
Shawn Ligocki 3359a1b099 Fix add_instrumentation system tests. 2013-07-03 18:54:57 +00:00
Shawn Ligocki 927d4915a0 genfile update. 2013-07-03 18:54:17 +00:00
Maks Orlovich e6fed64e09 Fix a mostly symbolic bug in RewriteTestBase::DefaultResponseHeaders
--- Expires: was left at 1 year rather than matching the actual TTL.
This mostly didn't matter since max-age is supposed to win, but made
for some ultra-confusing debugging sessions.

Fixing it exposed a unit error in a test in RewriteContextTest:
CachingHeaders can't parse headers for 1 million year validity,
and now we are providing them for both Expires: and Max-Age,
while previously Expires: of one year ended up getting picked up.
2013-07-03 18:28:23 +00:00
Maks Orlovich ad9ac8929b Change by ksimbili:
js_defer fix: document.querySelector cannot accept '.' in tagName, but
getElementsByTagName does.
2013-07-03 18:15:31 +00:00
Jeff Kaufman a808790b1d Move referrer computation to the client. 2013-07-02 21:50:31 +00:00
nikhilmadan@google.com 688c0911a2 Use js escaping for the BTF url in split. 2013-07-02 19:46:48 +00:00
nikhilmadan@google.com 6c7c1303f7 Delete the splitOnload code. Make split load high res images itself. 2013-07-02 01:14:27 +00:00
bharathbhushan@google.com 00f07dbbf6 delay_images should remain active if split_html_helper is enabled - since
it will fill up the critical image info.
2013-07-01 21:51:11 +00:00
ksimbili@google.com 222f230fc9 Removing local storage usage from deferJs. 2013-07-01 19:01:57 +00:00
Maks Orlovich d229554fdd Add some utilities for normalizing UA strings for better
use as cache keys.

(Also required a few more portability helpers for RE2, so
 we can use StringPiece output and not just input)
2013-06-30 21:27:25 +00:00
Huibao Lin cdca1530a7 Add bechmark test for image rewrite. 2013-06-30 20:07:16 +00:00
nikhilmadan@google.com ff6ed95e5a - Fix an issue with ScanSplitHtmlRequest which wasn't modifying the url
correctly.
- Add apache system tests
- Fix issue because of which we weren't setting the critical images correctly in the split_html_helper_filter.
- Add an option to add a meta referer in the split filter.
2013-06-29 02:46:08 +00:00
Maks Orlovich dc6fba261b Add statistics to CacheableResourceBase (and hence to UrlInputResource),
though I mostly want it for fonts stuff. Along the way, make UrlInputResource
stop pretending it doesn't want a RewriteDriver, and update one test that
passed a NULL one to it. Oh, and make its constructor private, since you're
not supposed to create these directly, either.
2013-06-28 20:36:56 +00:00
gee@google.com aedd8eb367 Added config/rewrite_options_manager.h. Replace usage of UrlNamer::{DecodeOptions,PrepareRequest} 2013-06-28 19:04:28 +00:00
Jud Porter 3cd2d69bd4 Fix compiler error due to virtual function hiding. 2013-06-28 15:58:15 +00:00
Jud Porter 07e6c3f6a0 Factor out generic functionality from critical_selector_finder into critical_finder_util. 2013-06-28 14:53:19 +00:00
Jud Porter cde662694a Factor out generic functionality from critical_selector_finder into critical_finder_util. 2013-06-28 14:46:17 +00:00
Josh Marantz 60e36f77fa Delay writing purges to a file for 1 second so we batch up bursts of
updates and avoid hammering the disk.

Note that if we have 20 processes we can still write 20 qps to the disk
which is quite high.  So perhaps this needs to be scaled back, but let's
see how this goes.
2013-06-28 14:44:22 +00:00
Josh Marantz eb04cb4024 extend_cache is supposed to work with long-TTL resources that get
domain-mapped.  However, it was not working with resources that
get mapped from a subdirectory.  This fixes that.
2013-06-28 14:26:40 +00:00
Maks Orlovich abf93f277f Update Debian dependencies requirement to accept
2.4 provided by unstable.
2013-06-27 20:02:03 +00:00
Shawn Ligocki dafb60feb4 Update ConsoleHandler to spit out server agnostic configuration information, depending mostly on the documentation link to explain how to correctly configure. 2013-06-27 19:54:02 +00:00
Josh Marantz 1197f3645d Removing dependency on otherwise unused DownstreamCacheLifetimeMs and
instead depending on DownstreamCachePurgeLocationPrefix for deciding
whether the feature is enabled or not. Also removing
DownstreamCacheLifetimeMs option completely.  (anupama)

Fix system-test break due to a changed TTL at gstatic. (jmarantz)
2013-06-27 15:34:18 +00:00
Huibao Lin ab1d4cd209 Cast 'size_t' value to 'int' before converting it to string 2013-06-26 20:40:18 +00:00
Josh Marantz 0f12d5f0be Avoid depending on local-variable state around a setjmp 2013-06-26 16:50:52 +00:00
Matt Atterbury 569fd80244 Remove the idea of an enum for an option and just use its name instead. 2013-06-26 14:28:41 +00:00
nikhilmadan@google.com 012accf773 Allow critical line config and defer js experimental to be set in conf. 2013-06-26 01:04:43 +00:00
bharathbhushan@google.com b0e1bf40a2 Rename X-PSA-Split-Btf url param to x_split.
Also change RequestContext::is_split_btf_request to split_request_type.
2013-06-25 23:01:31 +00:00
Josh Marantz 15d8758bc2 Factor out the disable-caching logic into a re-usable library for
sharing with ngx_pagespeed.
2013-06-25 22:13:31 +00:00
Shawn Ligocki e91cacdb71 Up trunk version number now that we branched 1.6 (so that trunk builds will appear as 1.7.0.0) 2013-06-25 19:48:50 +00:00
Shawn Ligocki e94e3b9fd1 Add vcl sample from previous commit. 2013-06-25 19:36:13 +00:00
Shawn Ligocki f0b0462380 From anupama:
* Changing DownstreamCachePurgePathPrefix to DownstreamCachePurgeLocationPrefix which takes a host:port location in addition to the path prefix. We add the host:port combination as a known-domain to the DomainLawyer, so that purge requests are sent directly to this domain.
	* Modified the purge-url generation logic to use the DownstreamCachePurgeLocationPrefix everywhere.
	* Added system tests (with and without varnish installed)
2013-06-25 19:35:29 +00:00
Shawn Ligocki 722b06322d Rename /mod_pagespeed_console and friends to be /pagespeed_console for some commonality between ngx and mod pagespeed. 2013-06-25 19:24:50 +00:00
Shawn Ligocki 60ecdbd5d2 genfile 2013-06-25 18:19:46 +00:00
Shawn Ligocki 550e159b36 Use explicit constructors for structs that have constructors. Open-source vesions of G++ seem to require this. Before this change I was getting errors such as:
error: braces around scalar initializer for type 'const pagespeed::image_compression::GoldImageCompressionInfo'
2013-06-25 18:12:13 +00:00
Shawn Ligocki 638820fc66 Allow configuring pagespeed statistics URL in console. 2013-06-25 18:07:49 +00:00
Shawn Ligocki b2ded0e0e1 Sort console graphs by priority. List the overall percentage (which is also the priority for now) in the stat graph titles. 2013-06-25 16:35:43 +00:00
Josh Marantz 81b6d7ebe9 Fix Issue 683. Retain HTML caching directives that we don't need to
change, retaining no-store, must-revalidate etc from whatever settings
the user might have had.

Changes HttpAttributes::kNoCache from having max-age=0 in it as well,
moving that concatenation to another constant.
2013-06-25 16:32:40 +00:00
bharathbhushan@google.com ae35f7a5d5 Add a split_html_helper filter to modify img attributes appropriately for
inline_preview_images/lazyload_images.  This is intended to be used with
split_html filter.
2013-06-25 14:37:48 +00:00
Jud Porter 436d56301e Ignore query params in custom mod_pagespeed beacon URLs. This is to address bullet #2 in https://code.google.com/p/modpagespeed/issues/detail?id=690. Currently, if you set a custom query param in the beacon URL you'll get a 404 since the comparison is with gurl.PathSansQuery(). 2013-06-25 14:11:13 +00:00
Shawn Ligocki 03ac6d6ff0 (1) Add helpful failure message to /mod_pagespeed_console when not configured correctly.
(2) Update console documentation to fit with new console.
(3) Link from graphs to documentation sections which explain the metric and possible remedies.
2013-06-25 04:03:08 +00:00
nikhilmadan@google.com 04b962c924 Eliminate special casing around blink.js and allow it to be served under the regular StaticAssetManager flow. Also, open source the input files. 2013-06-25 01:16:27 +00:00
Josh Marantz f717f8d4e5 Add wrapper header around rdestl hash map for consistency. 2013-06-25 01:12:51 +00:00
ksimbili@google.com 6676fea21a Added support to add access-control headers to response headers. 2013-06-25 00:49:26 +00:00
slamm@google.com a6e21f0374 Log HTML status in CriticalSelectorFilter. 2013-06-24 23:04:19 +00:00
nikhilmadan@google.com 7e388b2b3b Fix suppress_prehead_filter to not need a start html tag before the <head> to determine pre-head.
When referer matches a known pattern, do blocking rewrite.  When a new header 'X-PSA-Blocking-Rewrite-Mode: slow' is present force the blocking rewrite to wait for async events.
2013-06-24 22:47:25 +00:00
nikhilmadan@google.com f119bdb32b Don't DCHECK fail if we see a combined CSS file in the critical_css_filter. Also, clean up the code around decode url. 2013-06-24 21:55:43 +00:00
nikhilmadan@google.com b38663e917 * Changing SerfUrlAsyncFetcher to use the HTTP Request Method specified in the Fetch's RequestHeaders.
* Adding a "PURGE" request method to be used for downstream cache purging in a later CL (e.g. Varnish-cache-purges from Apache). Note that Purge method support is not being added to Fastnet/Hope paths because it does not seem to be relevant.
 *  Modified RewiterDriver to use the purge-method (e.g. PURGE) in the purge-request. Also, added a few basic stat checks for number of purges issued. (System test modifications will need varnish installation and will be done in a follow up CL.)
# Re-name to ScanSplitHtmlRequest to DecodeSplitHtmlRequest, and make it no-op when split isn't enabled. Also, add to OS flow.
2013-06-24 21:13:38 +00:00
nikhilmadan@google.com ebd49686eb Pass the xpath config used for the ATF in a request header along with the BTF to ensure that both use the same split config.
Varz for images rendered using rendered dimensions.
2013-06-24 20:00:42 +00:00
Shawn Ligocki 5d8c7a24ec Make console graphs display % units on y-axis. 2013-06-24 18:03:16 +00:00
Shawn Ligocki 3d9076f175 Use blank image for inline preview instead of a low resolution version of the original image. Hide this behind an option. (mpalem) 2013-06-24 18:02:44 +00:00
Shawn Ligocki 58469001da Do not allow @import after rulesets (also don't allow @charset after any other rule).
Fixes issue 722.
2013-06-24 15:43:23 +00:00
anupama@google.com 997005474d * Moving RequestProperties and DeviceProperties classes from http/ to rewriter/
* Adding a DownstreamCachingDirectives class that uses PS-CapabilityList request header value to decide whether certain optimization-related capabilities such as image inlining, webp etc. are to be supported for this request. Such headers are required in order to allow downstream caching layers to dictate the optimizations that will be done on this request (in sync with their cache fragmentation logic).
* Changing RequestProperties to refer to DownstreamCachingDirectives in addition to DeviceProperties in order to decide whether an optimization is supported or not. Note that only few properties are supported via DownstreamCachingDirectives right now. This will be expanded in future CLs.
2013-06-24 14:01:12 +00:00
Huibao Lin fbf299054e Add GIF scanline reader 2013-06-24 01:05:19 +00:00
Huibao Lin 171a968d37 Add image resizer which is based on the 'area' method. 2013-06-23 18:54:40 +00:00
Josh Marantz de5493ba3a Don't request BTF if no split found. (ksimbili)
Tweak cache paths so they don't have annoying extra slashes. (jmarantz)

Add StringPiece hash functions (matterbury)
2013-06-22 14:59:22 +00:00
Shawn Ligocki 370ca79fde We cannot use inline constructors for GoogleUrl in open-source. This seems to activate a copy constructor in open-source and we've explicitly DISALLOWed copy construction. 2013-06-21 15:24:49 +00:00
pulkitg@google.com 1dd7d56ba8 Fixed a crash. Cause: driver->decrement_async_event_count() is called though driver->increment_async_event_count() was never called. This happens when fetch is failed to acquire a lock. 2013-06-20 22:50:01 +00:00
Shawn Ligocki 0409a23c23 Make sure we create statistics logging file directory and give it the correct permissions.
Add ModPagespeedLogDir for use by statistics logging file and other future logs (for example, log of failing URLs).

Fixes issue 559 and allows us to enable statistics logging for users.
2013-06-20 22:28:22 +00:00
Shawn Ligocki b8514f9b27 Fix up chcon command a bit so that it doesn't outright fail on new domains. You can reproduce the failure I got if you rm -rf /var/cache/mod_pagespeed* and then try to do a build_release_platform.
The error is:
    	chcon: can't apply partial context to unlabeled file ...

AFAICT, this has been failing for $(MOD_PAGESPEED_CACHE), but succeeding for $(MMOD_PAGESPEED_CACHE)-alt and thus the Makefile succeded because the last command in the for loop succeeded, but this failed when I added $(MOD_PAGESPEED_LOG) to the list.
2013-06-20 19:01:15 +00:00
Shawn Ligocki 7f6946f97a Fixing path to js file in test html file for downstream caching. (anupama) 2013-06-20 19:00:39 +00:00
nikhilmadan@google.com f49f261444 Allow serving the split ATF as browser cacheable.
Adding support for Ghost Click Buster.
2013-06-20 01:27:53 +00:00
ksimbili@google.com bb188f5b26 Add support for ghost click buster. 2013-06-19 22:01:21 +00:00
nikhilmadan@google.com 0cf2b2aabe Add support for serving the split html response in two chunks - one for ATF and the other BTF. 2013-06-19 18:23:32 +00:00
pulkitg@google.com eba18d78a7 Call headers->ComputeCaching() before calling headers->CacheExpirationTimeMs() and move the IsImminentlyExpiring() call before response headers are modified to serve 304. 2013-06-19 17:53:27 +00:00
Maks Orlovich fb4dd2b996 Fix sloppiness with signedness that broke the Linux buildbots. 2013-06-19 17:07:33 +00:00
Maks Orlovich 1dca31e25e Try to resolve races on access to RewriteDriver::request_headers(),
by both making it semantically const and forcing the map inside
RequestHeaders to be immediately eagerly initialized.
2013-06-19 16:46:23 +00:00
Maks Orlovich be849e8489 As our reference counting is now built only on low-level
primitives, we no longer need this hack for Chromium's
RefCountedBase.
2013-06-19 15:23:24 +00:00
Jan-Willem Maessen 305011f465 Add nonce to beacon. Also move decay of critical evidence to the point where
the beacon value arrives (we couldn't do this before, because an attacker could
send lots of beacon results and age out legitimate beacon values).
2013-06-19 14:36:16 +00:00
Jud Porter 1fbc89088d Change the default JS prefetch elements to 6.
Change by mpalem.
2013-06-19 06:30:39 +00:00
Jud Porter 39248dc782 Copy flush early driver's request headers from main driver rather than base_fetch since the latter is likely to be mutated concurrently (by the parallel fetch).
Change by sriharis.
2013-06-19 06:28:57 +00:00
Jan-Willem Maessen 10481286d7 Add more overloadings for open-source StrCat and StrAppend. Switch to
overloading from using default arguments (which require static initializers).
2013-06-19 00:05:39 +00:00
nikhilmadan@google.com 6805da7c62 Fix rendered image dimensions calculation in image_rewrite_filter.cc.
Add *simpleviewer.js* to the proxy blacklist.
2013-06-18 21:30:32 +00:00
slamm@google.com 7e2973961c For critical selectors, add the ability to skip verification when they come from a trusted source. 2013-06-18 17:44:51 +00:00
bharathbhushan@google.com a9a4325a76 Add Googlebot-Mobile to bot list. 2013-06-18 15:19:12 +00:00
Shawn Ligocki 0ffa2ac47e Use JS escaping for Image.src() and not HTML escaping. (mpalem) 2013-06-18 14:08:30 +00:00
Shawn Ligocki 3d49f61dd5 Use MockTimer::kApr_5_2010_ms instead of magic numbers in statistics_logger_test.cc 2013-06-17 20:19:41 +00:00
Shawn Ligocki d70cd913ec From morlovich:
Improve log messages when things aren't combinable somewhat;
    	longer term it would be helpful to surface them in a more
    	accessible way, however.

From ksimbili:
      Remove old escaping method for tags which has been there since blink
    	time.
    	This was there to solve the early closure of script tag due to
    	</script> inside the string.
    	for example:
    	<script> var str="</script>"; </script>
    	will through an error.
2013-06-17 20:19:08 +00:00
Maks Orlovich a36d8df23b Change by hujie:
Add mutex protection for last_referer_ and most_recent_fetched_url_
2013-06-17 18:55:48 +00:00
ksimbili@google.com c866b93ceb -Dont inline CSS element if it is under <noscript> tag.(mpalem)
-Add support for Above the fold scripts execution.
-Move the code in deferJs, so that the costly operation of setting attribute is
done only when needed.
2013-06-17 18:00:51 +00:00
Jud Porter c9d048ab5f Don't combine JS files with pagespeed_no_defer attribute set. 2013-06-17 14:24:17 +00:00
Jud Porter 252f77a599 Updated genfile. 2013-06-17 14:24:02 +00:00
Shawn Ligocki 3f51551e23 Remove ConsoleSuggestions stuff, since we're replacing it with JS-based console code. 2013-06-17 13:56:08 +00:00
Shawn Ligocki 4411b8594b Initialize the hash value as I got an possibly-used-uninitialized warning which caused my build to fail. (matterbury) 2013-06-17 13:55:55 +00:00
Maks Orlovich c84f2e8c4c Remove legacy ReadAsync wrappers, and just call Resource::LoadAsync directly instead. 2013-06-16 20:24:25 +00:00
Maks Orlovich f3a0867c79 Change by sligocki:
Fix weird bug where variable lists and timestamp lists would sometimes have different lengths.
Force variables to have values at every timestamp. If they did not have any stored in the log, return 0.

+Fix accidental rollback.
2013-06-16 15:04:34 +00:00
anupama@google.com 9e5335a29b Adding a script file inclusion in the downstream caching example html (test) file, so that defer_javascript can be used while testing in ngx system tests. 2013-06-14 21:53:30 +00:00
Jan-Willem Maessen 8dd12a6609 Add a nonce generator, initially to be used for critical selector beaconing.
This just plumbs the nonce generator into the rest of our infrastructure; I
decided to split off the actual *use* of the nonce generator in beaconing into a
separate revision for your sanity and mine.  This one touches a lot of files
fairly minimally; the next will touch a few files but make some largish changes
(especially in tests).
2013-06-14 21:52:26 +00:00
Maks Orlovich 337da07002 Trying to fix the linux buildbot, take 2. 2013-06-14 21:24:40 +00:00
Maks Orlovich ae6a97165b One more signedness mismatch affecting Linux buildbots. 2013-06-14 20:55:49 +00:00
Maks Orlovich bccaa5e2ad No gmtime_r on Windows, so use _gmtime_s there instead. 2013-06-14 20:18:23 +00:00
Maks Orlovich cf3f01034c instaweb_htmlparse_core also causes trouble on OS X
by being an empty forwarding target; but Insights
relies on it so instead of removing it add a dummy file.
2013-06-14 20:08:06 +00:00
Shawn Ligocki 6a56edbeba Add rest of "notable issues" into console.js and kImportant list of variables to log.
Convert graphs to show percent rather than ratio.
Add percent_total shortcut.
2013-06-14 19:58:51 +00:00
Shawn Ligocki bcd2d58818 Fix several buildbot compile problems on several platforms.
Signed vs. unsigned compare
    	struct vs. class
    	unnessesary const specifier
2013-06-14 19:41:03 +00:00
Maks Orlovich 7ffc0e059d Move the bulk of ServerContext::ReadAsync into a new subclass, CacheableResourceBase.
This removes the weird split between ServerContext and Resource here, and removes the 
need for the cache code to be aware of non-cache-using things like data: and LoadFromFile resources.

This new class will also be a target for factoring out code from UrlInputResource, 
so an another subclass, FontApiResource can share most of it.

Unfortunately, we can't quite remove Resource::UsesHttpCache, since it has external uses, 
but at least it lets me remove Resource::rewrite_options().
2013-06-14 19:10:47 +00:00
Josh Marantz fbdcc13833 Change PurgeContext interface to callback-based to ease integration to
RewriteOptions.
2013-06-14 18:43:51 +00:00
Shawn Ligocki 97ebc66c05 Compile JavaScript console code and run it on the /mod_pagespeed_console page (instead of ConsoleSuggestions-based prototype). 2013-06-14 18:43:13 +00:00
Maks Orlovich 8ce1bc42b3 Remove the compatibility util_core target and update
its users; OS X build seems to have trouble with
empty library targets.
2013-06-14 16:53:34 +00:00
Josh Marantz 6bdc44e4bd More early exits in output-filters when unplugged. 2013-06-14 14:56:40 +00:00
Josh Marantz 9bfba6cddd MemFileSystem should update mtime even when atime is not enabled.
Track mtime and atime across file renames.
2013-06-14 12:29:43 +00:00
pulkitg@google.com f744618f39 Serve Stale content(only non-html requests) while revalidate in the background, so that future requests will be served with fresh content. 2013-06-13 22:08:48 +00:00
Josh Karlin 1fbc625d3e Don't write metadata back to headers if detached. 2013-06-13 16:00:04 +00:00
nikhilmadan@google.com 6b89dc5695 Revert changes to metadata cache staleness to use the old hash, and not a zero hash. 2013-06-12 20:15:48 +00:00
Josh Marantz e68c07876a Factor out CopyOnWrite::Merge from RewriteOptions
Add and test NewPermanentCallback.
2013-06-12 20:08:46 +00:00
Shawn Ligocki b04201c5de Stop setting js and css as executable 2013-06-12 17:12:35 +00:00
Huibao Lin d0122af735 From huibao@: Ignore warning message about truncated / incomplete image file.
From sligocki@: Port basic graph drawing functionality from mod_pagespeed_console.js to a new console.js just meant to draw "notable issues" graphs.
2013-06-12 17:05:58 +00:00
Josh Marantz abb6a34388 Switch from using std::map to using rdestl_hash_map for LRUCache as it
benchmarks about 2x faster than std::map and 1.6x faster than dense_hash_map.

                           Put   Replace   Replace       Get       Get   Evictions
                               SameValue  NewValue       Hit      Miss             relative to rde_hash_map
                      -------- ---------  --------  --------  --------  ---------  ------------------------
rde::hash_map         72004200  24722800  37736540  20468140  12692430   76843850  1
hash_map             115242500  36771680  48077800  31957060  20449350  181387400  1.64913575793296
hash_map             122718600  59997100  65601300  50665100  76725250  241863200  2.92287675730797
__gnu_cxx::hash_map   91814900  24216820  30869620  20547800  14778520   82307900  1.05200853252645
std::map             109087600  51920750  56382050  43240860  42383140  162348100  2.11229509227931
undordered_map        87951100  22625680  31584640  15499550  14240220   77012100  0.975835334397439

Benchmark code is in pagespeed/kernel/cache/lru_cache_speed_test.cc
2013-06-12 12:56:23 +00:00
Josh Marantz 6cdfc0123d Use Image.src() in the <body> to download js scripts early when defer
JS is enabled. This CL fixes the recently found chrome27 issue where
Image.src() does not apply in the <head> portion of HTML.  (mpalem)

Fix the valgrind failure caused by a recent change by copying the rewrite
option to a member variable. (mpalem)
2013-06-11 23:27:05 +00:00
Josh Marantz ef108bc8d3 For each resource fetching request, if there is no referer field in
the request header, we add a referer field in the request header.
Also we do not add any referer for any original html request.  (hujie)

PurgeSet: Enforce monotonically increasing times coming in from the API (jmarantz)

Using Rendered Dimensions Filter to resize images. (poojatandon)
2013-06-11 19:15:12 +00:00
Josh Karlin 2a369ce3ae Adds a referer field to the request header if one does not exist when
fetching resources.
2013-06-11 18:28:04 +00:00
Josh Karlin 5cca1fd470 Add ability to randomly drop CSS rewrites. 2013-06-11 17:08:39 +00:00
Josh Marantz 812946c290 Add RDESTL's hash_map implementation. 2013-06-11 14:30:01 +00:00
pulkitg@google.com e278e2c093 Freshen user facing request if it about to expire. It will be update only in the response to a request from user with our cache value at 80% of TTL or 5 mins which ever is minimum. 2013-06-10 21:11:28 +00:00
Jan-Willem Maessen b32db477fd Make PSOL, and default configurations match up, part #1: Common options with big effects. By and large default values now match the values found by testing in PageSpeed Service.
##### WHAT CHANGED
DefaultCssImageInlineMaxBytes = 0 (was 2048)
DefaultImageInlineMaxBytes = 3072 (was 2048)
DefaultMinImageSizeLowResolutionBytes = 3072 (was 1024)
AvoidRenamingIntrospectiveJavascript: true
DefaultMaxInlinedPreviewImagesIndex = -1 (was 5)

All of these were -1 (lossless):
DefaultImageRecompressQuality = 85
DefaultImageJpegRecompressQualityForSmallScreens = 70
DefaultImageWebpRecompressQuality = 80
DefaultImageWebpRecompressQualityForSmallScreens = 70
2013-06-10 20:31:51 +00:00
slamm@google.com 92a686c740 Add beacon-less approach to CriticalSelectorsFilter.
Add webfont 1.4.7 conf.
2013-06-10 20:17:41 +00:00
Jud Porter a9cd1b695c Changes to make pagespeed_automatic.a work for ngx_pagespeed.
Add pagespeed/libpagespeed_sharedmem.a.
Pass CXXFLAGS through so that we can use CXXFLAGS="-DSERF_HTTPS_FETCHING=0" when building for ngx_pagespeed.
2013-06-10 16:54:26 +00:00
Josh Karlin a07e86ec30 Provides the option for random dropping of image rewrites. This addresses issue 719. 2013-06-10 16:05:07 +00:00
Maks Orlovich 0edf78ba92 Remove the synchronous fetcher interface, porting the test-mainly
fetchers that we do use to the asynchronos one, and removing redundant
and unused ones. In some cases the remaining implementation needed to
pickup a few fixes from the removed one.
2013-06-10 15:52:51 +00:00
Maks Orlovich cb96cc636b Export regen of scripts with newer closure compiler 2013-06-10 14:28:58 +00:00
anupama@google.com 991408752c Adding a new class RequestProperties which will contain an object of type DeviceProperties and other request-specific properties, such as request headers. Special request headers will be used in an upcoming CL to communicate the optimizations (or capabilities such as image inlining, webp etc.) that are to be supported for this request. Such headers are required in order to allow downstream caching layers to dictate the optimizations that will be done on this request (in sync with their cache fragmentation logic). 2013-06-10 14:06:04 +00:00
Maks Orlovich d952cdee08 Make this a proper forwarding header rather than
a duplication what's under pagespeed/util/
2013-06-07 21:45:24 +00:00
Maks Orlovich 5c39804f55 Change by bharathbhushan
Log image size for non-background rewrites too. 
Save the size in the metadata for doing the logging. 
Also log low res image type.

image_rewrite_filter.cc has the functional change. 
Rest are just for testing it.
2013-06-07 21:24:58 +00:00
Maks Orlovich e488dd7c0a Change by matterbury:
Fixed bug in size of option_id_to_property_array_: it was sized after
the base properties were added, to all_properties_->size(), but more
properties could later be added by subclasses.
2013-06-07 21:17:07 +00:00
Maks Orlovich e2d9c11817 Change by jkarlin:
Addresses Issue 707 in which filters that returned
kTooBusy had their RewriteContext::Render() method called, causing
empty image URLs to be returned.

With this change, if a context was too busy to rewrite then it (and
its parents!) will not render.  This means that if just one image of a
CSS file fails to rewrite, then the CSS as a whole will not rewrite.
2013-06-07 21:15:53 +00:00
Maks Orlovich 6a2b1c36db Document + DCHECK a non-aliasing assumption. 2013-06-06 17:13:53 +00:00
Josh Karlin 774423c260 Makes SimpleRandom thread safe. 2013-06-06 16:52:49 +00:00
pulkitg@google.com 8fdc5e0509 Created AsyncFetchWithLock(which will acquire a lock before fetching) by moving code from url_input_resource.cc. 2013-06-05 20:55:45 +00:00
Maks Orlovich b56d3508ca Speed up LRU freshening by using list::splice rather than
creating/destroying nodes.

Effect on the speed bench (with std::map --- other implementations
are likely to be improved more) is ~5% speed up of LRUReplaceSameValue,
and ~10% speed up of LRUGets
2013-06-05 19:59:39 +00:00
bharathbhushan@google.com e60e3dda85 Add some diagnostics for insert-dns-prefetch filter. 2013-06-05 19:03:18 +00:00
Huibao Lin 9200a04272 Add WebP scanline reader 2013-06-05 13:38:22 +00:00
Josh Marantz e8dc7e9bb0 Minor tightening up of a hash loop, and tweak the speed test to avoid measuring
the setup time.
2013-06-05 02:16:08 +00:00
ksimbili@google.com f4e2aad4ad - Fixing bugs with flush early flow.
- Use HTML escaping for ref added to beacon.
2013-06-04 22:18:48 +00:00
satyanarayana@google.com 206de36a01 1) Don't rewrite to origin urls for proxied requests.
2) Remove the check that disables flush early for http only cookies.
2013-06-04 21:00:56 +00:00
nikhilmadan@google.com 609eb533dd Fix flush early behavior with http only cookies.
Tweaks to lazyload images - 
1) Set the buffer to 200 pixels after onload, so that images just below the
fold are pre-loaded.
2) Attach the onscroll handler even in the onload setting, so scrolls before
onload trigger image loads.
3) Remove the set timeout on onload since the interaction issues with inline
preview no longer exist.
2013-06-04 20:34:26 +00:00
Josh Marantz 6eb6a78b1d upgrade to openssl 1.0.1e 2013-06-04 19:36:13 +00:00
Josh Marantz d90d790e77 purge context for maintaining bounded-size sets of invalidation URLs
between multiple processes.
2013-06-04 15:12:34 +00:00
Josh Marantz 2b46b5f7bf Fix Serf SSL tests for CentOS. (jmarantz)
Change the Fallback PropertyPage suffix for query params and base
path.  Update kStatusCodePropertyName and
kIsLazyloadScriptInsertedPropertyName in fallback property page also. (pulkitg)
2013-06-04 13:51:25 +00:00
nikhilmadan@google.com 01e65baea6 Add a bit to domain_lawyer to authorize all domains, and skip the FindDomain flow. 2013-06-04 01:14:35 +00:00
Jeff Kaufman 9cba51d49a Move non-apache-specific fetchers into system/ 2013-06-03 23:26:20 +00:00
nikhilmadan@google.com ebf030f08b Fix the flush early unstable status code redirect to use JS escaping instead of HTML escaping. 2013-06-03 22:38:49 +00:00
Jan-Willem Maessen 3c5e1a001d Store candidate critical selectors in pcache when beacon is inserted. Only
accept these candidates in beacon results, preventing flooding of pcache with
spurious data.
2013-06-03 19:58:51 +00:00
Maks Orlovich 852818d97e Make trunk's version newer than last beta branch. 2013-06-03 15:45:16 +00:00
Jeff Kaufman 32f2b49764 Move InitiatePropertyCacheLookup logic to ProxyFetchFactory 2013-06-03 15:35:07 +00:00
Josh Marantz dbe3876450 Move LRUCache to third_party/pagespeed/kernel/cache and add a new speed test. 2013-06-03 02:05:11 +00:00
Huibao Lin 1e704c34e8 Add PNG scanline writer 2013-05-31 20:05:07 +00:00
Shawn Ligocki 1a146ff521 Stop testing rolling_hash_test in open-source because it does not compile on 32-bit g++ 4.1 where std::tr1::hash<> does not have a <long long unsigned int> specialization.
Perhaps we should provide that specialization so that we don't hit this bug again in actual code in the future?
2013-05-31 18:08:54 +00:00
Josh Karlin 946431f301 Block rewrites when distributing nested driver rewrites. 2013-05-31 18:02:39 +00:00
Josh Karlin d088ddbb5e More unit tests for distributed IPRO fetches.
Moving definition of "status" into the "#if SERF_HTTPS_FETCHING" block because
SERF_HTTPS_FETCHING is going to be set to 0 in ngx_pagespeed for now, and we don't want
"status" to become an unused variable during compilation.
2013-05-31 16:52:52 +00:00
Josh Marantz a8f704b63f Use c-initializer for UA Matcher than static C++ ctor 2013-05-30 20:47:36 +00:00
Maks Orlovich fedb0025c1 Make library identification data copy-on-write to avoid catastrophic memory
usage on deployments with huge number of vhosts.
(Issue #712)
2013-05-30 20:14:03 +00:00
Maks Orlovich cb6a66c595 Change by huibao:
Use the latest WebP in mod_pagespeed.

Change by slamm:
  critical_css_beacon_filter:
    Avoid adding empty value (becomes undefined in JavaScript)
    for CSS file with no selectors.

    Add test for a CSS file with no selectors.

    Refactor tests to eliminate some boilerplate.

Update CSS parser
2013-05-30 20:03:44 +00:00
Jan-Willem Maessen aecfebcc61 Move example library recognition config to .htaccess file. Left it in .conf
commented out merely to show users what such a configuration line is supposed to
look like.
2013-05-30 17:06:57 +00:00
Josh Karlin 287f8cd93d Fixing a flaky unit test. 2013-05-30 14:55:57 +00:00
Maks Orlovich dd97ff0b74 Add some additional loadtest configuration templates for
debug config
2013-05-30 14:48:58 +00:00
satyanarayana@google.com 3b096f68be 1) If additional origin rewrite rule is specified, we convert the url early even before property cache lookup.
2) Added RequestContext::TimingInfo::{FirstByteReturned,GetTimeToFirstByte}
   Replace remaining usages of LoggingInfo::timing_info with RequestContext::TimingInfo.
3) Moving of shared_mem* files to new location.
2013-05-30 01:29:46 +00:00
Shawn Ligocki aff3c2be33 Move shm support files to kernel/sharedmem (jmarantz) 2013-05-29 22:17:23 +00:00
Shawn Ligocki fd7dcda8bd Remove -fno-rtti from g++ flags in gyp. We were already adding -frtti, so this just clarifies that we are using RTTI in open-source.
Also change a file that's clearly bash: /bin/sh -> /bin/bash.
2013-05-29 22:01:13 +00:00
Josh Karlin a7a9bb3578 Upgrading FakeFilter from IPRO into its own files. 2013-05-29 16:30:13 +00:00
Jud Porter 0de93e51cb Fix IE8 JS errors. 2013-05-29 15:46:13 +00:00
Josh Marantz ccb9c029f9 Fix typo in bounds check. 2013-05-29 15:09:24 +00:00
Maks Orlovich afec02c51a Possible fix for canary crashes; we can't release the mutex
before signaling since the RewriteDriver may get deleted in the meantime.
2013-05-29 14:57:26 +00:00
Josh Karlin d4ee75a9e7 Distributed rewrites for resources for in HTML. 2013-05-29 11:54:55 +00:00
nikhilmadan@google.com 82c5d84111 In flush early, consider any node after the html tag as the start of the head. 2013-05-28 20:32:50 +00:00
Jan-Willem Maessen 36564f02cd Handle critical selector beacon by accumulating "support" with each beacon
result.  Support values decay over time as new beacons are sent out.
2013-05-28 19:33:50 +00:00
Josh Karlin 829fbf5463 Fixes a race in distributed rewrites where the base fetch is written to before cleaning up the RewriteContext. 2013-05-28 17:54:38 +00:00
Shawn Ligocki 73c737fdad Use constants for all variable names instead of explicit strings.
(Except for serf variables which should be in system/ but are in apache/ for unclear reasons).
2013-05-28 17:08:25 +00:00
anupama@google.com 53745bcf7e Initial version for supporting caching of rewritten HTML in external caching layers (E.g. usecase: nginx's proxy_cache).
RewriteOptions have been added to indicate whether the feature is enabled or not, how much rewriting (before the response is served out) qualifies an entry for being retained in the cache, and the path to be used for cache purging. If the feature is enabled, if there is significant rewriting remaining to be done (after the response is served out), we detect this case in ReleaseRewriteDriver and then initiate a cache purge. The cache purge in the nginx case is a loopback request that hits the same server (which has a configured proxy_cache). 

Some obvious TODOs for future CLs: Support cache purging variations with other pagespeed-internal caches, and other external caching layers (varnish) in a generic manner. Fine tune the "rewritten-percentage" computation.
2013-05-28 15:29:16 +00:00
Shawn Ligocki 5487b095dc Add in stats for CSS combine effectiveness. 2013-05-28 14:18:56 +00:00
Josh Marantz e3b94afd24 Move some files from util to base in preparation for moving stuff to sharedmem/ 2013-05-28 13:53:06 +00:00
Shawn Ligocki f1b3118ebf Add more "issue metrics":
* High cache eviction.
* High cache expiraton.
* Image rewrites failed.
2013-05-24 22:59:18 +00:00
Josh Marantz 4833e928e1 add some missing tests. 2013-05-24 21:28:15 +00:00
Maks Orlovich 36062f8456 Fix potential leak when we are in a blocking-for-async-events
mode and noone external is waiting.
2013-05-24 19:28:24 +00:00
Josh Marantz f599fa4218 Move threading related infrastructure to pagespeed/kernel/thread 2013-05-24 18:41:00 +00:00
Josh Marantz 6881decdfc More util/base moves in preparation for thread/. 2013-05-24 14:54:13 +00:00
Huibao Lin c66ec9ee4c Add JPEG scanline reader. Log pcache miss for inline preview filter. Trigger the lazyload image recomputation on window resize. 2013-05-24 12:26:13 +00:00
Josh Marantz 332e3c4bca Strengthen TimingInfo abstraction (gee)
Move a few files into kernel/base that need to go there for dependencies. (jmarantz)
2013-05-24 12:13:15 +00:00
Matt Atterbury cf3306f433 1. Changed set_request_headers back to SetRequestHeaders.
Removed the SetRequestHeaders call from ProxyFetch constructor to avoid
   race conditions in request_headers_ usage.
   Introduced a check for request_headers_ being NULL when SetRequestHeaders
   is called, so that we know if there are other race conditions in our code.	
2. Fix pagespeed_automatic_smoke_test w/clean make tree (Makefile).
3. When doing a blocking rewrite, wait for pending events too.
2013-05-23 12:24:25 +00:00
Shawn Ligocki a63ce4f9dc Track more "issue metrics" in mod_pagespeed_console. Added TODOs for all other metrics.
Goal is to get all metrics in here and send out to beta testers while I'm working on graph integration on the side.
2013-05-22 17:34:41 +00:00
Josh Marantz 8b0e67afc0 Move more files from 'util' to 'kernel/util' 2013-05-22 15:19:41 +00:00
Matt Atterbury 38525ee1e7 New filter to deduplicate inlined images. 2013-05-22 15:13:57 +00:00
Maks Orlovich c20b546b36 Move html parser core to pagespeed/kernel/html 2013-05-21 20:18:50 +00:00
Maks Orlovich d969c433a0 Change by anupama:
Rollback the request headers memory management change, leads 
to crashes due to a race.
2013-05-21 19:35:54 +00:00
Shawn Ligocki 15bfb086d5 Replace most uses of IsBrowserCacheable() with IsProxyCacheable() in code where I'm pretty sure that is what we're looking for. Also cleaned out most calls to IsBrowserCacheable() in test code where we don't seem to be explicitly caring about browser/private cacheability. 2013-05-21 18:35:35 +00:00
Josh Marantz 38f5cdbcab Move more files from net/instaweb into pagespeed/kernel/base and
pagespeed/kernel/util
2013-05-21 17:34:56 +00:00
Josh Marantz 638c44070a Add PurgeSet implementation to assist with cache-purging of URLs
using a bounded amount of space.
2013-05-21 13:00:14 +00:00
Jeff Kaufman c10d0f0a09 removing uses of the codename 'furious' for the experiment framework 2013-05-21 05:43:22 +00:00
Josh Marantz 1bf5202b21 Pass mutex explictly into MockMessageHandler rather than using
Platform::CreateThreadSystem just to get a mutex.

This facilitates splitting up util a bit when moving to pagespeed/.
2013-05-20 21:41:17 +00:00
pulkitg@google.com 3cf6072df5 - Removed extra fallback property page lookup for the homepage request as there can't be any fallback values for such request.
- Removing trailing slash for obtaining fallback property page key.
- Remove the blink specific options.
2013-05-20 21:34:17 +00:00
Maks Orlovich d25d6420a6 Move the rest of util_core to pagespeed/ in preparation of
moving the parser, except for two files --- charset_util and
countdown_timer --- that are not actually needed at this level,
and which got pushed up to :util.

Also drop the unneeded dependency of util_core on protobufs.
2013-05-20 14:40:57 +00:00
Maks Orlovich 27768025b7 Change by anupama:
- Properly export log_record_test
2013-05-20 14:03:51 +00:00
Shawn Ligocki 71335bf2a1 Rename ResponseHeaders::IsCacheable() to IsPrivateCacheable() to emphasize that it is not what we want for checking if we can put it in our cache.
Removed several calls in our code which were basically the completely redundant: IsCacheable() && IsProxyCacheable().

Annotated with TODOs several places where we are currently using IsPrivateCacheable(), but should be using IsProxyCacheable().
2013-05-17 21:19:14 +00:00
Shawn Ligocki aee5495831 genfile-update 2013-05-17 21:18:36 +00:00
Maks Orlovich 46fb7dc7bf Port symbol_table to dense_hash_set after some benchmarking.
It's measurably faster than __gnu_cxx::hash_set and doesn't need
any of the ugly hacks.
2013-05-17 20:39:34 +00:00
Maks Orlovich 0c5b10df2f Change by mpalem:
Flushing critical CSS early as base64 encoded HTML caused page bloat.
  Fixing it here by flushing critical css rules as innerHTML inside
  a script element that is flushed early. This results in better compression.

Change by ksimbili:
  Move mod_pagespeed_console_test away from some deprecated APIs.
2013-05-17 19:44:16 +00:00
Shawn Ligocki 2d8f5a34fd Fix-up and test TODOs in combine_css filter while looking through debug filter work there. 2013-05-16 19:42:24 +00:00
nikhilmadan@google.com d4b1e2b5e0 Check for output resource url size limits using the url_namer itself.
Revert a few changes to determine pre head in flush early.
2013-05-16 18:47:16 +00:00
anupama@google.com 579dd09c3d Changing RewriteDriver's set_request_headers method to SetRequestHeaders and preventing sharing of the RequestHeaders object sent from call-sites. This is required in order to retain the request headers in the rewrite driver beyond the point where the associated fetch gets deleted. We need to retain the request headers upto the point the rewrite driver is recycled or deleted for many of our upcoming features to work correctly (e.g. caching of rewritten html, and distributed rewrites). 2013-05-16 15:28:22 +00:00
Huibao Lin 9e148f67ed Move 'src/pagespeed/image_compression/' to 'kernel/image/' 2013-05-16 13:50:16 +00:00
satyanarayana@google.com 11606fe94e Delete the reference of a file that got moved to pagespeed folder.
Add support for rewriting the Location headers when rewrite domains filter is enabled.
2013-05-16 03:03:47 +00:00
gee@google.com b49086af5c Migrate remaining timing info tracking to RequestContext::TimingInfo. 2013-05-15 22:12:48 +00:00
nikhilmadan@google.com 0506c4d654 Change the set_gstatic_hash signature for StaticAssetManager. 2013-05-15 21:22:47 +00:00
Maks Orlovich 2c88d75a8c Move over GoogleUrl and its dependencies to third_party/pagespeed/ 2013-05-15 17:02:58 +00:00
Jud Porter d7330d867e Move the beacon's url= query param from the post body to the URL. Partially addresses issue #690. 2013-05-15 14:55:13 +00:00
nikhilmadan@google.com 7df76d1b1e Don't defer iframes inside noscript tags .
Fix crash in JsDisableFilter. InsertNodeAfterNode isn't safe in StartElement.
2013-05-15 00:53:04 +00:00
Jud Porter 48a24cfe7f Make CriticalImagesFinder::UpdateCriticalImagesCacheEntry a static method. Also cleanup the control flow of that function. 2013-05-14 21:02:20 +00:00
Jud Porter 236e9dec99 First step towards using Rendered Image dimensions filter. Extracts the rendered image dimensions, populates the proto and the property cache. (from poojatandon) 2013-05-14 20:58:38 +00:00
Maks Orlovich a4e47e27ad {dense,sparse}_hash_{map,set} need to be in base/ not util/
since they're needed by parser and hence insights, and we don't
want to have insights rely on util/
2013-05-14 19:27:39 +00:00
Maks Orlovich 72ec2f4c2b Change by nikhilmadan:
- Add time to first paint to the beacon.

Change by ksimbili:
- js_defer: The change to pass the event object 
  to the event handlers for the events that we 
  fire(DOMContentLoaded, load).
2013-05-14 19:05:10 +00:00
Jan-Willem Maessen 30e0ea5f2d Remove dead declaration that was no longer needed in test code. 2013-05-14 18:50:25 +00:00
Josh Marantz e2236b277b Switch openSSL versions. NULL out member-variables after freeing the structures they point to.
From http://git.chromium.org/gitweb/?p=chromium/deps/openssl.git;a=summary
  before:  2013-03-26 digit@chromium.org    Restore the x509_hash_name_alpgorithm_change patch.
  after:   2013-01-19 tfarina@chromium.org  Remove <(library) usage from openssl.gyp.

The 2013-03-26 version results in valgrind failures on 7/10 runs:

  valgrind --leak-check=full \
     .../src/out/Debug/mod_pagespeed_test \
     --gtest_filter="Serf*Goog*"

Rolling back to the 2013-01-19 version results in all valgrind tests working.
2013-05-14 18:39:22 +00:00
nikhilmadan@google.com 21d48e80de Remove the check that disables flush early for http only cookies. 2013-05-14 18:06:21 +00:00
Josh Karlin 10bfccc89c Add a distributed rewrite key so that only servers that are supposed
to be able to ask for distributed rewrites are able to.
2013-05-14 17:50:31 +00:00
Maks Orlovich 56c565c319 Update includes in htmlparse/ to skip forwarding headers and go
directly to pagespeed/. This is in preparation of moving
this directory, as it makes it much easier to see what non-moved
dependencies it still has (and will make it not refer to net/instaweb
immediately after the move).

I did not re-alphabetize mixtures of net/instaweb/util/public
and pagespeed/kernel/base includes since I expect the
former to convert to latter.
2013-05-14 16:36:09 +00:00
Maks Orlovich 9a72d9f302 Remove file added by accident. 2013-05-14 16:23:33 +00:00
Josh Karlin e7afd4489e Updates to system tests. 2013-05-14 13:38:04 +00:00
Maks Orlovich 76e79577ed Move some of the dependencies of the parser to the new path. 2013-05-14 13:22:26 +00:00
Josh Marantz eb87a1a3eb Update include-reference. 2013-05-14 12:36:43 +00:00
Maks Orlovich 576acd5ef8 Change by ksimbili:
Reinstate a fix for double-download of JS files in flush_early 
now that the prehead fix is in.
2013-05-14 12:18:15 +00:00
Josh Marantz 9457b3b758 Comment out unit tests for https://google.com; they are failing in some
environments.
2013-05-14 01:56:59 +00:00
Josh Marantz 98d0dbcf55 Move LRUCache implementation into a template class so it can be
re-used for non-string payloads.
2013-05-13 21:51:56 +00:00
Maks Orlovich c965e71474 net/instaweb/util/public/timer.h should forward to rather than duplicate(!)
the pagespeed/kernel/base/timer.h file.
2013-05-13 20:01:29 +00:00
Maks Orlovich 91bf0f6176 Remove some unused methods in UrlToFileNameEncoder, and StringPiece'ify
it a little bit.
2013-05-13 19:09:36 +00:00
Josh Marantz 1a2f9c633a Add referer to the timing beacon. This helps in finding if the request
was a landing page or a navigation request.   (ksimbili)

Consider any node after <html> as part of head.
http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#the-before-head-insertion-mode
This is needed so that we don't consider nodes as prehead and flush
them when they are supposed to be in head. (ksimbili)

Compile in HTTPS fetching with Serf in our binaries, but leave it off by default.
2013-05-11 13:44:11 +00:00
Jeff Kaufman e05bcb58c5 Accept PageSpeed*= query parameters in addition to ModPagespeed=* ones 2013-05-10 22:10:39 +00:00
Jan-Willem Maessen 9e7d6951c7 Re-factor critical selector handling entirely into CriticalSelectorFinder so
format changes are less invasive.
2013-05-10 22:01:44 +00:00
nikhilmadan@google.com b1d124a6b8 Replace multiple copies of CriticalImageFinder mock's with a single one. 2013-05-10 21:53:29 +00:00
Maks Orlovich 824d286d99 Make rewrite_context.h a bit friendlier:
- Some more overview comments
- privatize a bunch of methods
- somewhat better grouping of the rest.
2013-05-10 21:16:06 +00:00
Maks Orlovich c6bbd3443a Remove the concept of threaded vs. non-threaded fetches ---
we always want to be threaded these days; and accordingly
adjust Serf fetcher tests to not try to use the non-threaded path.
This required making sure that stats get adjusted before Done() is called.

The fetcher code itself isn't yet simplified, however.
2013-05-10 21:11:05 +00:00
nikhilmadan@google.com c6f72c0784 Delete more blink code. 2013-05-10 20:31:10 +00:00
Maks Orlovich 271dfc91fa Make SyncFetcherAdapter use threaded fetches and conditional variables
rather than non-threaded polled fetches. Kill UrlPollableAsyncFetcher.

Prerequisite towards removing non-threaded mode from the Serf fetcher.
2013-05-10 19:47:11 +00:00
pulkitg@google.com ea1f197a54 Allow CriticalCss property to use fallback values. 2013-05-10 19:09:20 +00:00
Jud Porter b1fca0f04d When defer javascript filter is enabled, script execution is delayed
until the DOM content is loaded. This delays the download of the scripts
to a later point as well. Instead, try to download a predetermined
number of scripts early (currently 3) but defer execution.
2013-05-10 18:51:50 +00:00
Jud Porter 8bc6b9126f Refactor code in CssSummarizerBase for placing scripts intelligently in EndDocument and change js defer script placement to use this. Js defer will now insert scripts before </body> instead of after </html> if possible. 2013-05-10 18:36:11 +00:00
Josh Marantz 48c40eee70 Fix minor typo & semantic confusion in NamedLockManager doc.
Freeze the options during config merge.
2013-05-10 18:07:42 +00:00
pulkitg@google.com 55b6c74b3c Download full css at DomContentLoaded instead of onload. This is to minimize the effect of wrong rendering due to incorrect critical css information served. 2013-05-10 17:17:43 +00:00
nikhilmadan@google.com 7946578cf0 Delete blink flow critical line. 2013-05-10 00:46:14 +00:00
nikhilmadan@google.com 5fb14b6266 Clean up the critical finder interfaces to not pass in the url. 2013-05-09 23:33:59 +00:00
Josh Marantz 67cb2d092f Copy the enable_cache_purge bit into the Resource object so we don't
wind up looking at the rewrite_options_ after they are freed.

Remove the RewriteDriver parent_ pointer and the options() indirection
as it appears we have no such guarantee that parent drivers outlive
their children, particularly with freshening.
2013-05-09 20:26:00 +00:00
Matt Welsh 6b11693531 Remove unused client_state mechanism (mdw). 2013-05-09 17:06:11 +00:00
Jud Porter 55b6506fcd Fix bot database URL in comment. 2013-05-09 15:21:17 +00:00
Josh Marantz 303b67215b avoid running some slow tests under valgrind. 2013-05-09 15:19:16 +00:00
Josh Marantz 0c53be010e Separate SetParent from Clone, as Clone is used in two places
where a parent relationship is not desired.
2013-05-09 14:53:58 +00:00
pulkitg@google.com 30bc967c4c DomCohort, BlinkCohort and BeaconCohort is now hold by ServerContext and all callers will use the them instead of using Pcache::GetCohort() function. This cl also reduced every call site check pcache != NULL and get the cohort and also check cohort is not null and then call PropertyCache::UpdateValue() and PropertyCache::WriteCohort functions. 2013-05-09 06:48:52 +00:00
Maks Orlovich 72db20b827 Change by ksimbili:
Rollback attempt to fix some double-load of CSS in flush early filter, 
as it has issues with regression where there is no start head, but 
there are link tags in prehead.
2013-05-08 21:46:36 +00:00
sriharis@google.com 2ff528ccc0 Fix URL cache invalidation when enable_cache_purge is false. 2013-05-08 21:25:01 +00:00
Maks Orlovich 4fe944c489 Get rid of test-only RewriteDriver::set_rewrite_deadline_ms,
just set the options correctly in tests that used it.

Also kill RewriteDriver::mutable_options() which was only 
used to implement set_rewrite_deadline_ms
2013-05-08 20:44:21 +00:00
Jud Porter 9ac5880f67 Add Google-StructuredDataTestingTool to bot list. 2013-05-08 19:58:38 +00:00
Josh Marantz 78b1e45e5d Share RewriteOptions* between parent/child drivers. This is because
child drivers can instantiate Resource objects that need to continue
to have valid rewrite_options() objects after the child drivers have
been retired.
2013-05-08 19:38:29 +00:00
Josh Marantz 814faff73e Add 4-arg form for Function for future use. 2013-05-08 19:18:35 +00:00
Huibao Lin aa9b57ed4d Move condvar and checking_thread_system to third_party/pagespeed/kernel/. 2013-05-08 15:42:17 +00:00
Shawn Ligocki 9009cd66f9 Move Get(), Set() and Add() methods implementations to MutexedVariable so that SharedMemVariable just needs to implement *LockHeld() methods. 2013-05-08 15:29:23 +00:00
nikhilmadan@google.com cd5b536cea Fix a flaky test. 2013-05-08 01:34:43 +00:00
ksimbili@google.com 1c11018cd5 Fixing double downloads of stylesheets with flush subresources. 2013-05-07 23:59:03 +00:00
nikhilmadan@google.com a62f7042f7 Enable blink & cache for mobile. 2013-05-07 23:03:44 +00:00
Shawn Ligocki b98c2af9f7 Only update statistics log once per request (rather than once per stat change). This should streamline calls to Variable::Add() and make sure none of them are blocked for an Update call (includes reading all variables and file write). 2013-05-07 22:32:23 +00:00
Shawn Ligocki 71d2f38772 Generalize StatisticsLogger to use an abstract MutexedVariable instead of a SharedMemVariable. This helps to disentangle the classes a bit more. 2013-05-07 21:16:54 +00:00
Shawn Ligocki b0c46892f1 genfile 2013-05-07 21:16:28 +00:00
Shawn Ligocki 05115772ce Fix the bug because of which split never applied when cache partial html applied. Also, fix a crash that happened only locally since the finder was NULL. (nikhilmadan) 2013-05-07 21:15:30 +00:00
Jud Porter f1c9932933 Disable all js inserting filters for XHR requests. Also disable critical css. (from bharathbhushan) 2013-05-07 19:48:30 +00:00
anupama@google.com 64d33a1bd9 Refactored UserAgentMatcher tests.
Updates to pagespeed_libraries.conf.
2013-05-07 17:15:02 +00:00
bolian@google.com 7c773c8631 Support request header "CacheContro: no-transform" and change UrlNamer::PrepareRequest to take a Callback1<bool> as opposed to a
Function.
2013-05-07 07:09:01 +00:00
Huibao Lin 74f427d15f Move files from net/instaweb/util/ to third_party/pagespeed/kernel/base/. 2013-05-06 23:24:03 +00:00
Jud Porter 50205a232a Use /no_content instead of beacon for serf 204 test. 2013-05-06 22:26:17 +00:00
Maks Orlovich 36c607059a Cleanup some node vs. element confusion in HtmlParse method naming.
(I want the methods that actually deal with elements to be accurately
 identified since some of them will need to deal with fully parsed
 conditional comments as well).
2013-05-06 19:17:49 +00:00
Maks Orlovich e22a0ebb2c Change by jefftk:
Mark beacon responses as uncacheable.

 This was also a problem in nginx:

  bug: https://github.com/pagespeed/ngx_pagespeed/issues/316
  change: https://github.com/pagespeed/ngx_pagespeed/pull/323/files
2013-05-06 19:09:14 +00:00
Huibao Lin 73b7fdf8cd Add kIgnoreSize for indicating size that is ignored in the test 2013-05-06 13:19:45 +00:00
Huibao Lin 1a2458a9c6 Stop checking the exact size of rewritten WebP images. 2013-05-06 12:40:45 +00:00
nikhilmadan@google.com 1861921efa Delete unused option for inline_preview_images_experimental 2013-05-03 20:18:28 +00:00
Shawn Ligocki 47bf8d0aa6 Split SharedMemConsoleStatisticsLogger into separate file from SharedMemStatistics.
First step in making these interfaces more modular and helps make sense of the TEST_Fs only used to test the logger without need for the rest of the interface.
2013-05-03 20:08:39 +00:00
Josh Marantz 7f228583da Use CopyOnWrite semantics for DomainLawyer so we don't have to
deep-copy them for every level of .htaccess.

Benchmarking indicates that this more than doubles the speed of
option-merging when only one of the sides of the merge has a non-empty
DomainLawyer.
2013-05-03 19:45:40 +00:00
pulkitg@google.com bd0f1f2f4e Removed updating unused fields in LoggingInfo proto. 2013-05-03 19:02:05 +00:00
Josh Marantz df055e0d00 Remove unused/misplaced http-related function from general purpose string library. 2013-05-03 16:27:54 +00:00
Josh Marantz 101c263d78 Predeclare ContentType as a struct, not a class, to match its actual declaration. 2013-05-03 14:34:07 +00:00
Josh Marantz 5e39bca9de Remove extraneous calls to StringPiece::as_string() as actuals for
StringToInt*.
2013-05-03 14:25:01 +00:00
Josh Marantz 169c935592 Move content_type and time_util to new dir pagespeed/kernel/http. Add
new class CachingHeaders which refactors the implementation in
Pagespeed Insights in a way it can be efficiently used in both places. (jmarantz)

When an image is rewritten by the CSS image rewriter, the context info
does NOT include all the flags that are needed to make the image
rewriting decisions. Fix this by using the same path to set the resource
context as the regular image rewriting. (mpalem)
2013-05-03 12:56:35 +00:00
nikhilmadan@google.com 1b876f7004 Move the writing of dom cohort to FinishParseAsync. 2013-05-02 21:38:22 +00:00
Jud Porter 852e7c634f Fix the debug filter breaking CSS blocks that span multiple flush windows. 2013-05-02 14:06:56 +00:00
pulkitg@google.com 26bb61959c Change RewriteDriver::UpdatePropertyValueInDomCohort() to take PropertyPage as an argument. 2013-05-01 22:40:15 +00:00
Maks Orlovich 93724ff8c3 Change by jud:
Clean up a couple TODOs in critical images finder.
  * Modifies UpdateCriticalImagesCacheEntry to not take ownership of the StringSets it is passed, matching behavior of critical selector finder.
  * Rename critical_image_set to html_critical_image_set.

Change by gee:
  Add implementation for MemberCallback_1_1.

Change by morlovich:
  Implement FinishParse in terms of FinishParseAsync, to remove
  code dupe (and differences --- sync version wasn't updating a stat!).
2013-05-01 22:14:39 +00:00
Shawn Ligocki 6acffc4609 From jkarlin:
More integrated distributed rewrite tests.  Instead of mock fetches
from the distributed task the distributed task is run using a test
fetcher that calls RewriteTestBase's other_driver()->FetchResource(). 

This also let's us test the shared cache interaction between the ingress
and rewrite tasks.
2013-05-01 21:47:56 +00:00
Josh Karlin d7025f0171 Make the elide_attributes filter more conservative, it no longer removes the default type=text from inputs. 2013-05-01 14:30:44 +00:00
Josh Marantz f1d5e61649 Verify RewriteOptions are written only from one thread, and that
unfrozen options are only Merged from the same thread that wrote
them.
2013-05-01 13:34:12 +00:00
satyanarayana@google.com 237712ac12 Adding a extended instrumention js that add more information to the beacon.
This is added in separate js file so that we can make this injected
optionally.
2013-04-30 22:36:33 +00:00
pulkitg@google.com 2621285164 Use fallback values as a base path (path without leaf) for the urls which don't have query params. 2013-04-30 20:45:34 +00:00
Shawn Ligocki 9b66d5a22c Strip out histogram logging from statistics logger. Histograms take up at least 90% of the stats log and aren't particularly useful (we aren't planning to use them in the console yet and have no way to display histograms over time). 2013-04-30 20:33:05 +00:00
Maks Orlovich 29fa361dba Fix invalid base computation when css_summarizer_base follows
a directory-changing combine_css, which could result in bad paths
in critical_selector_filter.
2013-04-30 19:59:41 +00:00
nikhilmadan@google.com 6fa686802d Constrain the disable for ajax.googleapis.com to only JS files for now.
Move img tag counting from logging_html_filter to to a new dom_stats_filter.
Also add counting of external css, script nodes and the number of critical images
used on the page.
2013-04-30 19:23:37 +00:00
nikhilmadan@google.com c7b9dd52ad - Simplify and fix inline preview images for mobile. There was a bug in the
earlier code which was inserting the javascript code multiple times in the
	page, which ended up clearing the state of the map, and caused us to not found
	the high_res_src in the map, leading to blank images.
	- Get rid of the experimental mode. We now have 3 modes
	1) For desktop - we rewrite inplace
	2 & 3) For mobile - insert low res and end of flush window, and either load
	high res at end of body, or load it lazily.
2013-04-30 19:14:15 +00:00
Huibao Lin a3f57fe99c Rename libbase.a to libpagespeed_base.a 2013-04-30 18:59:01 +00:00
Maks Orlovich f174001cc8 Fix a problem with OS X (and probably Windows) build. 2013-04-29 18:02:16 +00:00
Shawn Ligocki 02acfe2abe Add option for limiting size of statistics logfile so that it doesn't fill up disks. Currently just deletes file when it hits max (default 100Mb), we can work on a more intelligent trimming later.
Also increased default logging interval from 3s to 1minute, so that we don't fill up the logfile quite so fast. 1 minute seems reasonable for the console use-case, but we can always tweak as needed in the future.
2013-04-29 17:42:00 +00:00
Josh Marantz 7371c8962a Move ref_counted_ptr to third_party/pagespeed/kernel/util. Add
new CopyOnWrite class & test it.  Remove dead file ref_counted_object.h
and its test.
2013-04-28 23:11:06 +00:00
Shawn Ligocki 7c6abe446f Switch //webutil/css to use locally defined SplitSkippingEmpty() method instead of deprecated StringPieceUtils::Split(). 2013-04-26 22:37:03 +00:00
Josh Marantz 0a0acd171d Add ThreadSystem* to rewrite_options arguments for easier
mconstruction of mutexes and eventual validation of consistent thread
access before freezing.
2013-04-26 22:08:06 +00:00
Maks Orlovich 5a81f41770 Try to make our dependencies more accurate, in hope it'll
help with the link problems on buildbots: kernel.gyp:base
basically encapsulates Chromium base, so it should depend on
it and export it...
2013-04-26 20:49:18 +00:00
Maks Orlovich bf3d6d4e9d Roll this back; the right fix is to not try to build
this on Win32 in the first place.
2013-04-26 20:13:26 +00:00
Maks Orlovich 9611f608f2 Trying to fix Windows build bots, take 2:
We don't want to use RE2 for targets that Insights
wants, since RE2 isn't directly portable to Windows,
while PSI is. In practice that means we want to use
kernel.gyp:base, not kernel.gyp:util (as the latter
includes RE2) from those targets (and perhaps pull
in hashtables directly if we need them).
2013-04-26 19:52:58 +00:00
Maks Orlovich 6c805a37a3 Attempt to fix RE2 (and hence MPS) build on Windows buildbots by providing a
barebones stdint.h for it.
2013-04-26 18:48:29 +00:00
pulkitg@google.com 19161dd6d7 Don't issue fallback values pcache lookup for blink cohort as there is no property in BlinkCohort which can used fallback values. 2013-04-26 18:40:09 +00:00
anupama@google.com 6e8997c8a2 Adding Obigo as a mobile useragent. 2013-04-26 16:47:43 +00:00
Matt Atterbury 4236225a34 Add third_party/pagespeed/kernel/base/callback.h with MemberCallback0_1
specialization, a curry'd version for member functions.  This seems the
most direly needed version in PSOL, which has an explosion of pure virtual
"Callback" inner classes which need a single argument.
2013-04-26 16:42:28 +00:00
Josh Marantz 6c5ff85048 Use type-safe mechanism for thread IDs (don't cast pthread_t to an int64). (jmarantz)
user-agent matcher string-table cleanup (anupama)
2013-04-26 14:18:25 +00:00
Matt Atterbury 9606bd9f91 1. Log whether the request is XHR.
2. Use the min of small screen quality and desktop quality for mobile UA
   when both the values are set.
2013-04-26 13:28:49 +00:00
Jan-Willem Maessen 443942b078 Make sure prioritize_critical_css doesn't cause repeated runs of
apache_debug_status_logging_test to fail - by only running the test when cache
flush occurs, effectively excluding it entirely from the logging test.
2013-04-25 23:03:17 +00:00
ksimbili@google.com f241121c98 This fixes two issues.
1) Fixing bug with flushing critical css early.
Issue: We were flushing critical css as well as the external css file.
2) Removing the small optimization which doesn't defer inline scripts
until an external script is encountered.
Reason: There are few sites where the inline scripts at the start
create a blocking external script using document.write.
2013-04-25 22:08:52 +00:00
Josh Marantz bf33d60bc6 Add NullThreadSystem for making testing easier. 2013-04-25 18:31:47 +00:00
Maks Orlovich 326d00182d More test deflaking: whether the mock time gets advanced by page rewrite
or not is non-deterministic now, so make sure to compare using the time before
(which is guaranteed to be time of resource), not after.
2013-04-25 14:40:35 +00:00
Matt Atterbury 0b44bd5b54 Add iOS agent matching to user_agent_matcher. 2013-04-25 13:29:32 +00:00
Jan-Willem Maessen 3652fbe0d8 kEmptyValuePlaceholder means we don't need to check state of protobuf after
PopulateCriticalImagesFromPropertyValue call succeeds (we distinguish "no data
yet" from "no critical images" there).
2013-04-25 13:18:16 +00:00
Josh Karlin a531481e69 Fix for issue 675 in which wordpress wp-admin pages would break due to
the javascript minifier incorrectly lexing the start of a regex as a
divide.
2013-04-25 10:45:26 +00:00
Matt Welsh 44c0326c8c Add kVia to meta_data.h (mdw)
Add additional mobile user agents to whitelist.
2013-04-24 21:10:25 +00:00
Jan-Willem Maessen 820b79d8d4 [Retrying due to submit problems earlier.]
Enable required filters when critical_css is enabled on mod_pagespeed.  Also,
enable rewrite_css when FlattenCssImports is enabled, since the latter is
otherwise meaningless.  Note that we do NOT enable filters if they've explicitly
been forbidden - so it's possible to run the critical css filter chain in
isolation (without import flattening and css rewriting) if you want to by
forbidding css rewriting.
2013-04-24 19:52:05 +00:00
anupama@google.com c98cb16ac9 Adding tablet user agent detection to user_agent_matcher.cc. 2013-04-24 19:33:09 +00:00
Jan-Willem Maessen 680188af80 Turn on critical image beaconing by default, on systems where it is supported
(ie not PSS).

Fix knock-on bugs related to the treatment of missing critical image data.  We
experimented with various settings (including having no data mean "everything
critical" regardless of whether data was pending or not).  We are for now going
with the PSS behavior, where if critical image data just hasn't arrived yet we
assume that images are NOT critical.
2013-04-24 18:26:46 +00:00
Jan-Willem Maessen 19ca84ac21 Enable required filters when critical_css is enabled on mod_pagespeed. Also,
enable rewrite_css when FlattenCssImports is enabled, since the latter is
otherwise meaningless.  Note that we do NOT enable filters if they've explicitly
been forbidden - so it's possible to run the critical css filter chain in
isolation (without import flattening and css rewriting) if you want to by
forbidding css rewriting.
2013-04-24 17:27:52 +00:00
Jud Porter a98b10e885 Move call to filter's DetermineEnabled from StartParseId to ParseTextInternal to resolve property cache not being available in DetermineEnabled. 2013-04-24 15:51:24 +00:00
Maks Orlovich dc4926cd90 Don't leave around empty <style> blocks in critical_selector_filter 2013-04-24 15:06:27 +00:00
Matt Atterbury c3aa68e7c9 Handle the beacon like we handle static content, not with a location
directive but with hard-wired code in instaweb_handler(). The reason
for this is so that we work even with WordPress's mod_rewrite rules
that send it into a rewrite loop unless they are disabled for the
beacon location; hard-wiring it means we don't have to ask all WP
admins to modify their pagespeed.conf.
2013-04-24 14:44:18 +00:00
Josh Marantz 7bc78376e2 Remove a few dead options that we had converted into filters and then
left dangling.
2013-04-24 02:58:28 +00:00
Maks Orlovich 62fc668f78 Fix handling of alternate stylesheets in critical css beacon/
critical selector family:
- For beacons, we don't want to include alternates in the computation
- For critical-selector, we want to omit alternates from the
  critical portion, but keep them in the lazy-load portion.

Also replace just-added IsStylesheetNotAlternate with semantically clearer
IsAlternateStylesheet.
2013-04-23 20:30:29 +00:00
Maks Orlovich 275dfc0081 Update a bunch of variable names for the ResourceManager->ServerContext
change
2013-04-23 19:12:48 +00:00
Maks Orlovich 614859ca8d Change by rahulbansal:
Noscript nodes are present in cache html body. Fixing the xpath
  computation.

Also wildcard the ignore for build system gunk in pagespeed/,
so it doesn't have to be updated every time.
2013-04-23 18:59:09 +00:00
Josh Karlin b2292e38fc Moving js keywords into the kernel/js directory. 2013-04-23 18:36:41 +00:00
anupama@google.com 7ba30a7d9a Improve Mobile User-Agent detection whitelist to cover more UAs. 2013-04-23 14:24:35 +00:00
Maks Orlovich 8519c28bd1 Fix IsStylesheetOrAlternate not ignoring extra keywords; unit-test it,
and add IsStylesheetNotAlternate which will be useful for making critical
css beacon stuff ignore alternates properly.
2013-04-23 14:16:38 +00:00
Maks Orlovich c7fe318214 Follow up fixes to lastchange.sh:
- Stop using functions in what's supposed to be plain sh code
- Pass in LASTCHANGE.in in install.gyp as well, to make that also work
  from tarball build
2013-04-23 13:58:39 +00:00
Josh Karlin a38ad9b724 Moved the js minify library. 2013-04-23 11:20:10 +00:00
Shawn Ligocki 3706d53375 Change by mpalem:
Make CriticalCss work with CacheHtml filter.
  Done by setting the critical css rules in the cache_html driver.
2013-04-22 22:24:23 +00:00
Shawn Ligocki 3f3fbed33d genfile update 2013-04-22 22:22:56 +00:00
Maks Orlovich 8749103578 Replace Chromium's lastchange.py with out own lastchange.sh which
does not report last revision of repo but rather last changed revision
in a path, which should make release building immune to changes to other
branches.
2013-04-22 20:31:51 +00:00
Maks Orlovich 2ad6968db7 Change by gee:
Added RequestContext::TimingInfo, which PSOL code should use to
    	communicate timing events.  Use for fetch and request start/end events.

Change by jmaessen:
	Fix webp output image quality test to use a webp-capable user agent.  
	Looking through the version history, it appears that this test *never*
	worked as described -- none of the images on the page were being converted 
        to webp, and the file wildcard at the end was matching the fetched *html*
	file, whose size (for these purposes) we don't care about at all.
2013-04-22 20:22:15 +00:00
Josh Marantz 59448b1d77 Put the 'Cache' back in the debug-name for 'WriteThroughCache'. 2013-04-22 19:29:57 +00:00
Josh Marantz f334d3d7a4 Add cache Purge API and infrastructure to load-test the impact of its support.
Non-wildcard cache-purges should be surgical (not cause an
entire MD-cache puge) and fast (should not involve iteration
or wildcards).
2013-04-22 18:54:54 +00:00
Josh Marantz 526d86d523 Restructure the way cache names are are composed to make testing
easier & more readable.
 
Clamp memcached threads to 1.

Fixes Issue 672
2013-04-22 15:30:01 +00:00
Maks Orlovich a583334034 Cleanup segments here, to avoid valgrind warnings. 2013-04-21 20:40:50 +00:00
Josh Marantz 623fb16762 Put a Hasher directly in RewriteOptions to simplify the calling
sequence for computing signatures.
2013-04-20 03:21:06 +00:00
Maks Orlovich 57538065e9 Update docs and class names that still referred to ResourceManager,
along with a few variable names (plenty of the latter still remain,
however).
2013-04-19 13:34:27 +00:00
Maks Orlovich 0929663420 Change by gee:
Remove unused "success" parameter.
2013-04-19 13:17:14 +00:00
Josh Marantz 1573428847 If the kKnownScreenDimensions does not include the UA's screen resolution,
use the IsMobile property to determine whether to use small screen
quality for image compression. (mpalem)

Put the explicit dependency on gtest.gyp back into
pagespeed_automatic_test and mod_pagespeed_test.  That change caused thoses
tests binaries to run no tests. (jmarantz)
2013-04-18 21:51:26 +00:00
Josh Marantz 6eb8f595c4 Move sparsehash dependency to pagespeed/kernel.gyp so it can be used
from there.  Eliminate superfluous direct dependencies to gtest.gyp in
net/instaweb/test.gyp. Declaring missing dependencies from the gperf
targets.
2013-04-18 19:36:30 +00:00
Josh Marantz c4612885de Consolidate/simplfy all cache ownership decisions and rename the factory method to
TakeOwnership
2013-04-18 16:52:35 +00:00
Shawn Ligocki 80a6a1df32 Fix statistics_graphs and attach them to a handler in debug.conf so that we can access them. The eventual plan is to merge this functionality into the main console, but I'm still debugging. 2013-04-18 15:34:50 +00:00
Maks Orlovich 5147b1d13f Remove ResourceManagerTestingPeer. I was first going to rename it to
ServerContextTestingPeer, but it turns out it's basically unneeded.
2013-04-18 14:27:48 +00:00
Maks Orlovich f2f1c19081 Deflake RewriteContextTest (which likely became flakey because
RewriteDriver is overholding rewrite_mutex slightly less)

There were 2 kinds of failures:
- In TrimRepeatedOptimizableDelayed, whether we hit a repeated
  rewrite or just 2 cache hits is non-deterministic, so relax the
  test to reflect that.
- In a bunch of invalidation tests, whether the re-fetch of input
  would be reported as an insert of indentical reinsert depended on
  the extent to which the mock clock moved, as that could change the
  Date: header. Ensure the clock moves to produce determinism.
2013-04-18 13:39:06 +00:00
Maks Orlovich 0bd62bdb59 Change by hujie:
Reduce unnecessary cohort lookup:
  1. Remove blink cohort lookup for FlushEarlyFlow
  2. Only do kBeaconCohort for ServerContext::HandleBeacon

Change by ksimbili:
  Fixing the bug with flushing critical css early.
  Issue:
  <link> tags are written inside <script> tags which makes the bytes
    	 flushed useless.
2013-04-18 13:29:56 +00:00
Maks Orlovich 332d679a4e Fix interaction of critical selector filter and combine css by making
CssSummarizerBase understand slots getting canceled due to earlier 
filters using disable_further_processing()
2013-04-17 17:15:18 +00:00
Maks Orlovich 9819f365c5 Change by sligocki:
Add DCHECK on range after SharedMemHistogram is loaded from SHM. 
  I was getting a problem where ChildInit() was called for a stat 
  that we apparently hadn't set in the parent init. I think this 
  check will help to make sure it is noticed ASAP at least in debug.
2013-04-17 17:00:53 +00:00
Maks Orlovich 81024b8b04 Don't generate "load whole CSS" trailer in critical_selector_filter
when we haven't made any changes.
2013-04-17 14:45:37 +00:00
Josh Marantz 2642b22bed Get test file for MapProxyDomain from gstatic.com rather than ref.pssdemos.com. 2013-04-17 13:30:21 +00:00
sriharis@google.com 3d98971bdf Add fix reflow option. 2013-04-17 01:16:34 +00:00
Josh Marantz a6032b5d92 Move string_util and dependencies to third_party/pagespeed. 2013-04-16 23:24:45 +00:00
Josh Marantz c53634a12b Disable lazyload and inlining for the google plus user agent. (nikhilmadan)
Bringing cache html diff to the same state as in current Blink (rahulbansal)

Nomenclature changes in class FallbackPropertyPage; Added more
documentation to explain the option added for usage of fallback
properties values. (pulkitg)

Change cache ownership model so the factory/server-context etc is responsible
for deleting everything.  This allows more complex sharing models without
needing to make CacheCopy, which actually had a (small) per-lookup overhead,
and another layer of annoying nested callbacks in the debugger.
2013-04-16 23:17:12 +00:00
Maks Orlovich 99971cbe97 Fix the delay-load of all CSS by critical_selector_filter loading the unoptimized
version, by making sure to capture the state of CSS after the filter preceeding us
has had a chance to run.

This also tightens a ridiculously long lock hold of rewrite_mutex; which has some
risks and kills a tiny bit of dead code.
2013-04-16 15:07:28 +00:00
nikhilmadan@google.com c35702abb2 Switch the critical line finder to populate the same property for critical images as the finder.
When the critical css filter is enabled, flush the critical css rules early so they can be downloaded early and applied to the document as 	needed.
2013-04-16 01:34:57 +00:00
Jan-Willem Maessen 605c1dcc71 Beacon even if there's erroneous CSS on the page; that CSS will be
skipped over by the critical CSS filter, and it shouldn't prevent us
from extracting the *rest* of the critical CSS.
2013-04-15 22:10:02 +00:00
slamm@google.com c2c1f5a9e4 Adding Cache Html request counts varz.
Also, fixing number of cohorts for tests.
2013-04-15 21:35:13 +00:00
rahulbansal@google.com e12e7375aa Start using non_cacheables_for_cache_partial_html. 2013-04-15 21:15:33 +00:00
slamm@google.com 906410ba3b Disable the non-beacon based critical CSS filter for IE clients
until we have a means of dealing with conditional comments.
2013-04-15 17:44:11 +00:00
Maks Orlovich f6b97366ad Fix a couple latent bugs in RewriteContextTestBase that
were found by a testcase I hence dropped.
2013-04-15 15:40:02 +00:00
Maks Orlovich 6bfdf79469 Change by sligocki:
Re-enable testing apache_debug_stats_logging_test in checkin tests now that it works again.
2013-04-15 15:29:57 +00:00
ksimbili@google.com b3cc9c6330 Fix the issue where we were deferJs was double downloaded. 2013-04-13 01:19:50 +00:00
satyanarayana@google.com 000931e9d1 1) Refactor reject blocking code to rewrite options.
2) Add pagespeed-no-defer attribute on script added by critical css.
2013-04-13 00:01:54 +00:00
nikhilmadan@google.com bd18d200b8 Don't inline preview images inside a noscript tag. 2013-04-12 22:37:20 +00:00
Shawn Ligocki 21bf5c8eb0 Fix apache_debug_stats_logging_test and JSON statistics in general. 2013-04-12 20:41:06 +00:00
nikhilmadan@google.com 75c35f024a Flush defer js code as early as possibl.
Modified the lazyload filter to not remove pagespeed_no_defer, since a down stream
filter may some day rely on it being present.
2013-04-12 18:45:28 +00:00
Jan-Willem Maessen 97dd87b285 Don't parse CSS if it's inside a <noscript> block. No functional changes, just reduces work. 2013-04-12 18:07:15 +00:00
Jeff Kaufman d149c81450 Fix typo introduced in r2241 2013-04-12 14:33:34 +00:00
rahulbansal@google.com 77b8085f24 Adding an option for non cacheables to be used in cache partial html. 2013-04-11 23:25:13 +00:00
Maks Orlovich bdaa295814 Disable the beacon-based critical css filters for IE clients, since
we do not understand IE comments well enough to handle them right.
2013-04-11 19:59:19 +00:00
Matt Atterbury 7be45f44c0 Flag to stop prioritize_critical_css from running its fixup JS at end of the
document; useful for testing that the inserted critical CSS works as expected.
2013-04-11 17:17:29 +00:00
Josh Karlin daafe3ee7a Statistics for keeping track of distributed rewrites. 2013-04-11 16:48:10 +00:00
Josh Karlin a267682937 Distributed rewriting infrastructure for fetch paths. 2013-04-11 16:32:54 +00:00
Josh Marantz 908c18430b Remove accidently-committed .mk file. 2013-04-11 15:10:00 +00:00
Josh Marantz 3715efcaf1 Move wildcard classes from src/third_party/instaweb/util to src/pagespeed/kernel/util. 2013-04-11 15:09:07 +00:00
Josh Marantz 25c9642c23 Add experimental flag to configure a compressed metadata cache. Note:
this flag may disappear in an future release.
2013-04-11 13:13:09 +00:00
pulkitg@google.com f218cd8f5c Fixed the crash in flush early flow.
Reason: This crash happens because of the race between Collector::AddPostLookupTask() and Collector::Done(). PostLookupTasks can be called even before fallback_property_page is not set.
2013-04-11 06:47:17 +00:00
Jan-Willem Maessen d6c864e9cf Don't process non-screen-applicable CSS in critical_css_beacon_filter or critical_selector_filter 2013-04-10 22:43:12 +00:00
Jan-Willem Maessen 2e89b9a724 Handle multiple keywords in link rel= 2013-04-10 22:30:26 +00:00
Maks Orlovich 0306121451 critical_selector_filter:
Properly deal with CSS inside <noscript> blocks, by not keeping it in summaries,
 and splitting it into separate portions in the load-everything trailer; with 
 the loader JS adjusted to understand that.
2013-04-10 20:22:04 +00:00
pulkitg@google.com 9d7b896cb9 Using FallbackPropertyPage if use_fallback_property_cache_value is turned on. Currently, only critical images will use the fallback values. All other properties will be retrieved only from actual page. 2013-04-10 20:00:21 +00:00
Josh Marantz 8a86f718ee Provide infrastructure to change which site hosts the content used for testing
proxied fetches/rewrites.
2013-04-10 16:29:56 +00:00
Matt Atterbury 50f03b5872 1. Fix cases where status counts in RewriterStats were not being set. The idea
is to avoid calling NewRewriterInfo() except in SetRewriterLoggingStatus().
2. LogImageBackgroundRewriteActivity() still calls NewRewriterInfo() but it
   should not be updating the application status anyway so that is unchanged.
3. Set status to ACTIVE in ImageRewriteFilter so that we can start using its
   status counts.
2013-04-10 14:14:47 +00:00
nikhilmadan@google.com 04c4cc2624 Log time from start of request uptil time to start processing and end of pcache lookup.
Replace LogRecord with pure abstract AbstractLogRecord.
2013-04-10 05:16:14 +00:00
nikhilmadan@google.com 94a5004073 Fix the local storage filter to only remove attributes when it is enabled. Also, don't delete pagespeed_no_defer in this case. 2013-04-09 20:27:13 +00:00
Shawn Ligocki 26c310d313 Prototype mod_pagespeed console. Draws suggestions from statistics only, thus we cannot tell users (for example) which CSS files couldn't be parsed, just the percentage that couldn't be parsed.
Sample results after load test:

    	1. Cache miss rate: 55.69%
    	2. Resource fetch failure rate: 21.00%
    	3. CSS parser failure rate: 1.03%
    	4. Javascript minification failure rate: 0.05%
    	5. Fetch failure rate: 0.00%
2013-04-09 19:37:25 +00:00
Josh Marantz 69d8c0459a Prior to this change, thread_system.cc contained factory methods for
creating thread-systems.

This change moves the implementation to platform.cc and contrives to
include that cc files only in testing libraries, and not in production
code.

Remove ThreadSystem::CreateThreadSystem, changing many call-sites to
reference Platfrom::CreateThreadSystem.
2013-04-09 18:29:47 +00:00
Maks Orlovich ab996bb2c7 Refactor critical_selector_filter to avoid needing a roundtrip
via property cache; by just rewriting in per-slot rendering. This
should make the full CSS and partial CSS use the same images
(except in weird corner cases involving on-demand reconstruction of
full CSS); but does make this a lot more sensitive to expiration of
original CSS.

Unfortunately it doesn't fully fix the <noscript>/IE-comment behavior
(which I was hoping it would), as the delayed version still doesn't
distinguish them; but Jan has suggested a solution that can be done
in a follow up.
2013-04-09 16:47:42 +00:00
Josh Marantz 824cec46b8 Add compressed cache adapter & tests. 2013-04-09 16:35:36 +00:00
Jud Porter 2fe56c879c Fix potential infinite loop in the POST body parser. 2013-04-09 13:52:39 +00:00
pulkitg@google.com fd0739b227 Clear last_n_fetch_latency and average_fetch_latency if html is cacheable otherwise we might end up flushing extra resource. 2013-04-08 23:28:21 +00:00
Matt Atterbury f455729f90 Fixed a compilation error on older gccs (4.1.2 and 4.2.4). 2013-04-08 19:38:01 +00:00
Jan-Willem Maessen b15d7927fd Add system testing for critical_css_beacon_filter and critical_selectors_filter. Slightly re-factor property_cache_util to separate non-templated boilerplate from templated code. Fix naming in rewrite_driver. 2013-04-08 18:31:29 +00:00
nikhilmadan@google.com d588167646 Delete references to the device cohort. 2013-04-08 16:59:19 +00:00
rahulbansal@google.com 941928961d Disable Split in Blink since it doesn't work there. 2013-04-08 16:41:34 +00:00
Josh Marantz d01dbc1a63 Reorganize how platform-specific timers & thread-systems are created. 2013-04-08 03:01:16 +00:00
Matt Atterbury a37f3a2f88 Refactor and fix the local_storage_cache filter:
a) Separate hashes in the cookie using '!' not ',' since our test framework
   treats commas as field separators.
b) Removed the 'has_url' parameter because it turns out that CSS that
   needed the pagespeed_lsc_* attributes added already had them but
   they were removed when copying attributes from the link to the style
   and it seems silly to delete them re-add (and it eliminated the code
   wart that was 'has_url').
2013-04-07 11:22:52 +00:00
Josh Marantz aab111ecae Add some comments to HtmlParse and related classes. 2013-04-06 17:02:48 +00:00
Matt Atterbury 17bfa8c7e2 Unescape the critical beacon payloads since the JS has escaped them. 2013-04-05 19:44:14 +00:00
Maks Orlovich 50e2a33842 Properly resolve external URLs when critical_selector_filter inlines CSS. 2013-04-05 19:20:21 +00:00
Jud Porter 3aa71c98d7 Handle and aggregate multiple critical css beacons. 2013-04-05 18:01:45 +00:00
slamm@google.com c369005328 For prioritize_critical_css, report "no link rules" as ACTIVE
instead of PROPERTY_CACHE_MISS.
2013-04-05 16:19:09 +00:00
Maks Orlovich b044f3238d Change by gee:
Move RewriterStats::RewriterHtmlStatus into enums.proto as
  RewriterHtmlApplication::Status.

Also update pagespeed_libraries.conf, and a re-compile 
of optimized version of mod_pagespeed_console.js with newer
closure compiler.
2013-04-05 14:03:56 +00:00
Maks Orlovich 4f9f4b9e68 text/xhtml isn't a valid XHTML mimetype, so don't treat it as one. 2013-04-05 14:00:46 +00:00
Jan-Willem Maessen 34043afe65 Don't throw away the result of check operations, use quiet grep instead. 2013-04-04 20:00:05 +00:00
Shawn Ligocki e0301ab2b2 Save verbatim text for numbers we parse. This guarantees that both integer and decimal numbers are passed through to the same precision that they were input and also protects us from some odd rounding issues and use of +e notation in CSS (not allowed).
In addition I cleaned up font minifying to use CssMinify methods rather than ToString() methods and fixed a bug where we weren't setting bytes_from_original_buffer_ in copy constructor and assignment operator for Css::Value.

Fixes Issue 508.
2013-04-04 19:47:52 +00:00
pulkitg@google.com 8867b7199e Introduces a class FallbackPropertyPage which contains actual property page and returns the fallback values only if value is missing in actual property page. 2013-04-04 19:24:47 +00:00
Maks Orlovich 665da6127d Do some small cleanups + a test addition suggested
by sligocki to MetaTagFilterTest, along with a few more 
tests of my own.
2013-04-04 18:02:09 +00:00
Josh Marantz 444939ac3d Put VectorDeque into the net_instaweb:: namespace. 2013-04-04 17:52:11 +00:00
Maks Orlovich 01af0f9905 Change by gee:
Move RewriterInfo::RewriterApplicationStatus to new file, enums.proto,
  as RewriterApplication:Status.

Change by wmatthews:
  Replace calls to scoped_ptr(NULL) with calls to scoped_ptr()
2013-04-04 14:52:12 +00:00
Maks Orlovich 8193e983dd Merge jkarlin's fix to make this beacon test run against
1.4.26 servers: they no longer 204 on a beacon without
required arguments.
2013-04-04 14:48:50 +00:00
Maks Orlovich e6cc9187b4 Don't propagate XHTML mimetypes from meta's to headers, that's
not supposed to happen; and don't even try to do charset propagation,
for XHTML either, as any XHTML mimetypes are forced to utf-8 anyway.
2013-04-03 21:26:59 +00:00
Jan-Willem Maessen dab222e71e Revert unintended rollback due to bad repo sync. 2013-04-03 20:29:12 +00:00
Jan-Willem Maessen 8320e4fa04 Critical CSS beacon should send back an empty beacon result if there weren't any critical selectors found. Remove buggy three-arg write_handler_response that was only used in one place. 2013-04-03 20:25:36 +00:00
Shawn Ligocki fc9665b01c Allow Blacklisted and disallowed resources to be flushed early if they are public cacheable. (poojatandon)
Remove buggy 3-arg implementation of write_handler_response() that is only used in one place. Just used the 4-arg version there to simplify things. (sligocki)
2013-04-03 20:01:52 +00:00
Huibao Lin a88d428efe Add logging for background image rewriting. 2013-04-03 17:15:50 +00:00
satyanarayana@google.com f709474cb9 Adding the nagivation type bit to the csi beacon. 2013-04-03 03:55:14 +00:00
Josh Marantz 7d3f6ed733 Allow proxy fetches to set content-length if it is known before
we send out headers.  This allows http 1.0 fetches to work with
keep-alive.
2013-04-03 03:54:40 +00:00
nikhilmadan@google.com 117eb3a5fe Set default value as -1 for original_resource_url_index. 2013-04-03 02:34:14 +00:00
rahulbansal@google.com 2122939fda Moving the check of XHR requests to DeterminEnabled for Lazyload
filter. All the other filters will be moved in a subsequent CL.
2013-04-03 00:06:08 +00:00
sriharis@google.com 87d02f9531 Log the blink blacklist case. Also make persist_blink_blacklist a
gperf'd option.
2013-04-02 23:55:03 +00:00
nikhilmadan@google.com d7ea0c3e87 Replace IsMobileUserAgent/IsMobileRequest with GetDeviceType* methods
Log user agent type and device properties.
2013-04-02 23:15:54 +00:00
Matt Atterbury f31637f2a5 1. Added utility function to get the number of filters so we can iterate them.
2. Set the base property value for log_url_indices to false.
2013-04-02 18:10:12 +00:00
satyanarayana@google.com cf84fef532 Fixing the absolutification error for collect_flush_early_content_filter and logging in blink_critical_line_data_finder.cc 2013-04-02 00:48:15 +00:00
sriharis@google.com e4e67cf101 Disable blink if there is a blacklist. 2013-04-01 22:57:07 +00:00
nikhilmadan@google.com 2e77ebc106 Add more nav timings to the instrumentation beacon.
Property cache is no longer friend class of PropertyPage.
Handle pagespeed_no_defer attributes in Split HTML filter.
2013-04-01 21:34:38 +00:00
Maks Orlovich 96aff4448b Another batch of critical selector -> critical css fixes:
- Don't enable ourselves if there is no critical selector info
  yet.
- Make sure to ask rewrite_driver to write out the DOM cohort
  if we're on.
- Keep track of media, base URL (will be needed to fix absolufication
  in cases that flattening/CSS filter somehow failed).
- Encode media in the output correctly.
2013-04-01 17:51:08 +00:00
Maks Orlovich 8a35ef5994 Cleanup unused and never documented pseudo-filter. 2013-04-01 17:43:53 +00:00
Shawn Ligocki 7faac53571 Fix open-source build due to namespace change. 2013-04-01 17:30:56 +00:00
Shawn Ligocki 0d43c9333b Test update. 2013-04-01 17:30:19 +00:00
Shawn Ligocki 33dc1eac6d Don't store history if maximum history size for critical image beacons is 1, as is the case when using webkit headless. Otherwise, the size of pcache entries is doubled. (jud) 2013-04-01 17:29:56 +00:00
bolian@google.com 5d958fa905 Support setting image quality table for client options.
The CL completes the previous previous X-PSA-Client-Options CL to override default image qualities.
2013-03-29 22:36:35 +00:00
Josh Marantz d41029cc98 Use bitset rather than std::set for enabled/disabled/forbidden filters.
This speeds up a new speed-test by >2x.

                                          Time(ns)    CPU(ns) Iterations
before: BM_RewriteOptionsMergeAllDisabled  13300      13200      50000  
after:  BM_RewriteOptionsMergeAllDisabled   5623       5600     100000
2013-03-29 22:13:38 +00:00
Jeff Kaufman bdcc08443c Accidentally reverted several changes. Reverting the reversion! 2013-03-29 21:04:34 +00:00
Jeff Kaufman eca91c1d9e A sample html file for critical_css beacon testing purposes, and eventually a
system test.
2013-03-29 20:52:11 +00:00
Jeff Kaufman 6587b211e5 Add ImageJpegNumProgressiveScansForSmallScreens. 2013-03-29 20:51:19 +00:00
Jeff Kaufman bc9f9e05ab Fix windows compilation of sparsehash. 2013-03-29 20:48:50 +00:00
Jeff Kaufman c1504cf257 Don't set the protocol number, that's Apache's job.
We were setting the protocol number of the response headers to 1.1
even though the request was for 1.0.  This caused Apache to chunk
encode the output when it should not have for a 1.0 request. This
caused old versions of wget that did not support chunk encoding to not
close a keep-alive connection. So now we don't set the protocol number
at all, as we have no reason to.
2013-03-29 20:47:17 +00:00
Jeff Kaufman e43aa77c64 Move cache flushing into SystemRewriteContext. 2013-03-29 20:45:40 +00:00
Maks Orlovich b3cbdad038 Trying to fix Windows build, take 2: I didn't notice that it was using
a path to name a file, not just the base name.
--Ths line, and those below, will be ignored--

M    third_party/google-sparsehash/google-sparsehash.gyp
2013-03-29 19:21:51 +00:00
Maks Orlovich 49e40e85aa Change by vchudnov:
Add ImageJpegNumProgressiveScansForSmallScreens setting

Change by jmaessen:
  A sample html file for critical_css beacon testing purposes, and eventually a system test.

Change by nikhilmadan:
  Fix new rewriter HTML logging to really log if logging_info() is overriden.

Change by bmcquade:
  Make IsLiteralTag static since it doesn't depend on member data and I want to call it 
  in a context where I don't have an HtmlParse instance.
2013-03-29 19:16:11 +00:00
Maks Orlovich 30bb3be057 Try to fix sparsehash-using build on Windows buildbots. 2013-03-29 18:54:35 +00:00
Josh Karlin 8f601140b4 Don't change HTTP protocol version in the response.
We were setting 1.1 which caused Apache to use chunked encoding, even if the client was 1.0.
chunked encoding.  --This line, and those below, will be ignored--

M    header_util.cc
M    header_util.h
2013-03-29 15:34:41 +00:00
Jan-Willem Maessen 6f776a4bd1 Enable prioritize_critical_css in mod_pagespeed. 2013-03-28 20:13:26 +00:00
Jud Porter f1e0da0dcf Handle multiple critical image responses from the beacon. 2013-03-28 19:29:47 +00:00
Jud Porter 92526d96dd Fixes for critical selector based critical CSS computation:
- Move CacheKeySuffix implementation from CssSummarizerBase to 
  subclasses, so the beacon filter get the empty suffix it needs,
  and have CriticalSelectorFilter provide a proper implementation 
  that works for it.
- Fix case where JsDetectableSelector() is empty
- Fix handling on unparseable regions.
(from morlovich)
2013-03-28 19:28:06 +00:00
Jud Porter 31fedc1d3d Update the list of 'literal tags' to reflect what's in the HTML5 spec and add an API to ask if a tag is a literal tag. (from bmcquade) 2013-03-28 19:25:33 +00:00
Josh Karlin 2010c98d9e Allow an environment variable (VIRTUALBOX_TEST) to bypass some system tests in virtualbox. 2013-03-28 13:35:38 +00:00
bolian@google.com f5ae72bbd4 Make "X-PSA-Client-Options" case insensitive. 2013-03-28 06:25:38 +00:00
Jan-Willem Maessen aaa505cee6 Fix minor bug in critical css beacon script. 2013-03-27 23:16:51 +00:00
Michael Piatek b5abfb6bf1 Improve test robustness by doing PSNR checks on inlined images. 2013-03-27 23:01:49 +00:00
anupama@google.com 3c14710c42 Changing default value of log_url_indices_ to false.
Adding some missing tests for log_url_indices.

Integrate Split HTML Filter with Cache HTML Flow.
2013-03-27 19:58:34 +00:00
Josh Karlin 003f41345c Fixed a bug in stop_apache where it relied on bash but only sh was available. 2013-03-27 19:26:34 +00:00
Josh Karlin 5bd43fd287 Improved logging. 2013-03-27 19:25:17 +00:00
Josh Karlin 8c1cbf2570 Temporarily reverting logging change from previous commit. 2013-03-27 17:43:59 +00:00
Josh Karlin aca2eb7e15 * Fixed a bug with compute_statistics filter usage.
* Removed some serf fetching tests when run in Virtualbox.
* Logging improvements.
2013-03-27 16:40:50 +00:00
Josh Karlin 9c744d84cf Fixing 32-bit builds. 2013-03-27 13:29:49 +00:00
Josh Karlin 72149f800f Bug fixes to installer and memcached test. 2013-03-27 11:46:42 +00:00
ksimbili@google.com 834d0a9805 -Add DetermineEnabled logging for lazyload and disable javascript filters.(rahulbansal)
-Add DetermineEnabled for InlinePreview Images.(rahulbansal)
-Log stats for prioritize_critical_css filter.(slamm)
2013-03-27 00:24:21 +00:00
Jeff Kaufman 1763fc9fbc Remove referer stats. It has been hard-disabled in code since at least 2011-09-20 (r1013) and was never performant to where it could be used. It doesn't look like anyone is going to make this useful, and for now it makes the code more complex. If we were to add it back we would use the property cache. 2013-03-26 21:45:16 +00:00
Jan-Willem Maessen 10d196ef89 Check the property cache, and don't insert critical css beacon if there's data
there.  Also, make the criteria for including the beacon match the (much more
stringent) criteria for actually extracting the critical CSS.
2013-03-26 21:11:27 +00:00
Josh Marantz 568c0b52f7 Add sparse/dense hash map/set to our repertoire and use them for
HTML keyword analysis, offering a modest speed improvement.  There more
interesting speed improvements elsewhere int the code base.  (jmarantz)

Track the number of img tags in a HTML page. (bharathbhushan)
2013-03-26 19:12:36 +00:00
Josh Marantz 1aa78ab433 Just use the beacon cohort for critical_selector_..._test, rather than
rolling a testing cohort.  Also, remove unused (and unmet) decl from
beacon_critical_images_finder.h.  This looks like it was omitted from
old CL by mistake. (jmaessen)

Re-use ApacheProxyFetch for in-place-resource-optimization in mod_pagepseed.  This
will help resolve a corner-case we spun printing a 'waiting' message under some
conditions. (jmarantz)

  --This line, and those below, will be ignored--

M    net/instaweb/rewriter/critical_selector_finder_test.cc
M    net/instaweb/rewriter/public/beacon_critical_images_finder.h
M    net/instaweb/rewriter/critical_selector_filter_test.cc
M    net/instaweb/apache/instaweb_handler.cc
2013-03-26 18:50:26 +00:00
Jud Porter 7e7bab74e9 Update HandleBeacon to handle responses from the critical CSS js and write to property cache. 2013-03-26 17:11:34 +00:00
Jud Porter 10abd70357 Rate limit injection of the beacon. We inject a beacon if the property cache is enabled and we don't have any data in the property cache, or if the pcache value is expired, or past the new option beacon_reinstrument_time_sec. 2013-03-26 14:26:20 +00:00
Jan-Willem Maessen 38ede49aee Inject the actual critical CSS beaconing script. 2013-03-26 00:20:32 +00:00
pulkitg@google.com 7df5b1b882 Remove unused variable. 2013-03-25 21:28:42 +00:00
Jan-Willem Maessen c034d201ca Pre-reserve space for unescaped string. 2013-03-25 21:04:26 +00:00
nikhilmadan@google.com 11409df21c Switch condition around in cache_extender.cc to construct a GoogleUrl only when cache extend PDFs is enabled. 2013-03-25 17:06:05 +00:00
anupama@google.com 6024b19c3e Fixing relative urls in URL logging code in image_rewrite_filter. 2013-03-25 16:39:52 +00:00
pulkitg@google.com 4418f2050d Moved UpdateValue & WriteCohort function from class PropertyCache to class PropertyPage. This cl does not add or remove any functionality. 2013-03-25 15:39:09 +00:00
Jeff Kaufman c318e73481 Add SystemRewriteDriverFactory and SystemServerContext. The goal is to limit
code duplication between ApacheRewriteDriverFactory and NgxRewriteDriverFactory,
and between ApacheServerContext and NgxServerContext.  This should also help a
lot with future ports.  Empty for now; in several followups I'll start moving
functionality in.
2013-03-25 15:08:00 +00:00
nikhilmadan@google.com 784ce32e71 Move creation of GoogleUrl into the block of ImageRewriteFilter::TryInline where it should be used 2013-03-22 20:31:35 +00:00
Maks Orlovich e256ca428c Initial mostly-working version of the critical css-from-critical-selectors filter. 2013-03-22 20:12:22 +00:00
Maks Orlovich 8dd3513c09 Direct self-fetches to the IP we got the connection from, not to
127.0.0.1, to better deal with configurations that do Listen external_ip:80

(Idea by jefftk@)
2013-03-22 19:10:03 +00:00
Josh Marantz 5bcd596a4a #if out a flaky test. 2013-03-22 18:59:30 +00:00
nikhilmadan@google.com de0b8f1b07 Construct the RE2 pattern for known_devices_pattern_string just once, instead of creating a new one for every use. 2013-03-22 18:20:13 +00:00
Matt Atterbury ad63171e12 Refactor: replace hand-rolled tests for data URL with utility function.
Also added a new utility function for future use.
2013-03-22 17:33:11 +00:00
Maks Orlovich dc7496bfff Fix potentially unsafe DOM access from SummariesDone called from partition failing
by delaying it until Render(); which also fixes SummariesDone not being called on
a cache hit case(!).

Add some state information it can use (which can help the main filter know
when to invalidate pcache entries), and expose it to the subclasses, tweaking
the access API to results as well, to use status rather than NULLness to denote
success/failure.

Add some +debug output.
2013-03-22 15:28:11 +00:00
Josh Karlin 3d9bb9d1d4 Adds distributed rewriting options to select which filters should be distributed. 2013-03-22 15:13:16 +00:00
Jud Porter c1b3cc7abb Change the representation of the critical image information in the pcache to use a protobuf. 2013-03-22 14:04:39 +00:00
Josh Karlin a597fed0db Testing support for a distributed fetcher. 2013-03-22 14:00:40 +00:00
Jud Porter 59ecf4ed61 On Mobile, do not flush the lazy load js gif image early. (commit from mpalem) 2013-03-21 20:29:51 +00:00
Jud Porter f7b08261f4 Comment fix. 2013-03-21 20:27:58 +00:00
Jud Porter 0dba824f2d Critical CSS js. 2013-03-21 17:48:26 +00:00
Maks Orlovich ac2f3c809c Factor out some common boilerplate used to store/read protos
from the property cache tied to a rewrite driver.
2013-03-21 15:27:47 +00:00
Maks Orlovich e87b156928 Change by jkarlin:
Typo fix.
2013-03-21 15:21:42 +00:00
Shawn Ligocki b2b2e422a8 Remove mod_pagespeed_console config from pagespeed.conf.template until we have a working version. 2013-03-20 21:39:25 +00:00
Jan-Willem Maessen efb7fe45bd First cut at identifying CSS selectors and injecting them (as a comment) into the html. 2013-03-20 20:02:27 +00:00
bolian@google.com fcaa8ecabe Support request header X-PSA-Client-Options. 2013-03-20 19:32:07 +00:00
bolian@google.com 050574602b Add RewriteOptions::DisableAllFilters. 2013-03-20 19:21:40 +00:00
rahulbansal@google.com db1fde0176 Don't time out WebP conversions after first output byte has been emitted, as that signals we're almost finished,
Fix flakiness in blink flow critical line tests.
2013-03-20 16:13:09 +00:00
rahulbansal@google.com 6d342c6940 When prioritize_critical_css applies, inline images consistenly for inline CSS and external CSS
Log applications of css filter only for external files.
2013-03-19 21:34:35 +00:00
Jan-Willem Maessen 18f2e6a625 Refactor to make code insertion simpler. 2013-03-19 15:49:08 +00:00
Jan-Willem Maessen f11a8c607a Generalize Join operations on collections of stringlike things. 2013-03-19 14:34:52 +00:00
Jud Porter 41ae9399a8 Disable lazyload filter for bots and BlackBerry 5. Resolves issue #641. 2013-03-18 22:38:30 +00:00
ksimbili@google.com 157f451ee5 Serve deferjs file with protocol-relative URL.
Log number of critical images.
2013-03-18 21:14:48 +00:00
nikhilmadan@google.com 466c7703e5 Fix bug where we were only considering the url leaf when re-encoding to fix cache corruption.
Bug: https://code.google.com/p/modpagespeed/issues/detail?id=648
2013-03-18 18:20:25 +00:00
Josh Marantz 6008291057 ModPagespeedEnableAggressiveRewritersForMobile should (a) available as a switch
and (b) default to 'on'.

This allows defer_javascript and defer_iframe to work on mobile.
2013-03-18 18:10:24 +00:00
Jud Porter 40980d6c4d Update CriticalImagesInfo to use StringSets values for critical images, rather than scoped_ptrs. 2013-03-18 16:56:34 +00:00
Maks Orlovich cae4562350 Provide accessor for getting the critical selectors info. 2013-03-18 15:54:16 +00:00
rahulbansal@google.com 6825cecfb6 Change the logging url map to have GoogleString as the key. 2013-03-16 23:54:38 +00:00
Shawn Ligocki 0066bccf29 Preserve original quirks-mode color strings, even if we are not parsing in quirks-mode. It is very difficult to tell whether browsers will parse CSS files in quirks-mode or not, so in preservation-mode we want to preserve both interpretations for the file.
This was causing us to transform:

color: 0000ff

to

color: 0ff

and change links from blue to cyan on the page.

Fixes open-source issue 639.
2013-03-15 23:37:36 +00:00
Shawn Ligocki 74435e7ae1 Stop logging (for now) images rewritten inside css since they mess up
the ic counts in the line of the request due to async rewriting. (rahulbansal)
2013-03-15 23:36:34 +00:00
Shawn Ligocki a1bf20e98c Report errors for invalid !-statements in declarations.
We noticed !ie in the wild (presumably a browser hack). While fixing it I also noticed that we would parse things like: "prop: foo !important bar" as "prop:foo !important; bar", so added checks as well that each declaration explicitly ends in ';' or '}'.
2013-03-15 22:48:22 +00:00
Shawn Ligocki 6c8b511f05 Extensive monitoring of WebP conversion characteristics.
Track number of WebP conversion timeouts, as well as duration/count of WebP successes and failures, broken down separately by source image type and by transparency status. (vchudnov)
2013-03-15 22:47:55 +00:00
Josh Marantz b2bd020d24 Add option for setting the lazyload blank image file. 2013-03-15 18:41:26 +00:00
Maks Orlovich f684148721 Very early initial protos + marshallers for the new critical CSS
approach for mod_pagespeed. Likely to be wrong in some ways, but I
want us to have some common ground for how components communicate.
(So probably this should have a ServerContext hookup as well...)
2013-03-15 16:15:26 +00:00
Maks Orlovich b0c1610922 Change by mpalpem:
In an effort to enable flush early filter on mobile, do NOT flush any preconnects in the flush early filter if the user agent is mobile.
2013-03-15 15:31:18 +00:00
Josh Marantz 98f89b16ba Partially address Issue 647 -- expose option ModPagespeedLazyloadImagesAfterOnload 2013-03-14 21:54:18 +00:00
Jan-Willem Maessen 1303e660bb Move various css functionality (media testing, selector normalization) to css_util. 2013-03-14 19:29:44 +00:00
Jud Porter 976cc7a0a0 Avoid deref of null pointer in CriticalImagesFinder. 2013-03-14 17:47:12 +00:00
Jud Porter 6bd6fb609d Cleanup CriticalImageFinder interface. Rather than accessing the critical image set from RewriteDriver, CriticalImageFinder::Get*CriticalImages can be called. 2013-03-13 21:42:00 +00:00
Jud Porter 7c143fcd0b Generated js file updates due to js compiler change. 2013-03-13 21:38:48 +00:00
Josh Marantz 0653eb8fac Blacklist wp-admin. Split out the blacklist for proxied resources
and as they are not needed for most mod_pagespeed instances that act
as reverse proxies or at origin.
2013-03-13 21:36:25 +00:00
Maks Orlovich 6586f87fe3 New base class which will serve as foundation for both css critical
selector instrumentation and for its use to produce actual critical CSS.

The data encoding is still rough, and it will likely need some refinement
to get HaveSummaries() to be actually able to render.
2013-03-13 20:34:12 +00:00
Josh Marantz 4d77eb4256 Add new stat for failed/succeeded resource fetches. 2013-03-13 20:24:32 +00:00
Matt Atterbury 25986457ed 1. Added StringMultiMap::Lookup1.
2. Fix build-from-source issues people are having with <unistd.h> being missing.
2013-03-13 17:42:49 +00:00
Huibao Lin 65f9d583d7 Share image type enum between c code and logging code. 2013-03-13 17:19:41 +00:00
rahulbansal@google.com 5e7aee4d21 Change lazyload logging not to populate NOT_APPLIED when the image is
inlined, doesn't have url or has pagespeed_no_defer
2013-03-13 17:16:04 +00:00
Josh Marantz 70160f9a34 Remove TestAtime which fails (naturally) when run on file-systems that
are mounted as noatime.
2013-03-13 17:01:50 +00:00
Josh Marantz fcbc096cee Logging for Cache Html flow and added some more tests. (pooja)
webp regold (jmarantz)
2013-03-13 16:34:33 +00:00
bolian@google.com 74d16085b3 Sorts of changes including
Added StringMultiMap::AddFromNameValuePairs;
Removing redundant property page cache lookups which was added for all
device types;
etc.
2013-03-13 01:48:11 +00:00
Josh Karlin 96c516fe18 Distributed rewrite options, this is for testing purposes only. 2013-03-12 18:10:30 +00:00
Jud Porter a1a84fee3a Don't add a dns-prefetch tag for the current domain. 2013-03-12 03:20:18 +00:00
bolian@google.com 1c3d3d4681 Disabling blink for mobile user agents for now even if
EnableAggressiveRewritersForMobile is turned on.
Also, Fixed a typo.
2013-03-11 23:48:06 +00:00
bolian@google.com 0316420813 Change WebP compression method from 4 to 3. And, only add dimensions to img and input elements (other elements ignore / are harmed by the extra attributes). 2013-03-11 20:30:13 +00:00
Jan-Willem Maessen 4a65731cc1 Reorder filters slightly to separate CSS and JS processing. Fix some imports and tests. 2013-03-09 15:32:23 +00:00
Josh Karlin 250a9916ed Adds plumbing for a distributed rewrite fetcher in RewriteDriver. 2013-03-09 00:38:41 +00:00
Josh Marantz b32e479a5b Simplify shm metadata cache configuration somewhat: key it off
the file cache path as well, rather than using a separate namespace.  (morlovich)

Fix a broken path in automatic/Makefile.
2013-03-08 21:55:43 +00:00
Josh Marantz a913ef382f Move wildcard class files from net/instaweb/... to third_party/instaweb/... 2013-03-07 22:12:29 +00:00
bolian@google.com ece7869f0c Add option to compress images to a different webp quality for small screens. 2013-03-07 22:02:47 +00:00
Josh Marantz 11d20dd6d5 Enable Flush subresources for mobile devices. (ksimbili)
Don't attempt to rebuild mod_pagespeed.so in between every system
test. Just stop, wait for Apache to relinquish the port, and start. (jmarantz)

Add possibility to update a statistic from waveform. (vagababov)
2013-03-07 21:22:16 +00:00
rahulbansal@google.com e4d6039a8b Permit optimization of uncacheable/private-only cacheable resources in PSOL in the IPRO mode.
First attempt to add urls in LogRecords.LogRecord api exposes a different method in case urls need to be logged.
2013-03-06 03:03:05 +00:00
Michael Piatek 53ff921458 Refactor user-agent checking util into user_agent_matcher. 2013-03-05 23:27:15 +00:00
Josh Marantz 18123b5cbd Remove extraneous file. 2013-03-05 21:57:05 +00:00
Jud Porter c01820a867 Use POST instead of GET for critical image beacons. 2013-03-05 21:18:50 +00:00
Josh Marantz 4df532924f Fix Issue 609
Proxy non-pagespeed resources reference from ModPagespeedMapProxyDomain.
2013-03-05 20:10:56 +00:00
Maks Orlovich 80c0275647 Rename SystemRewriteOptions::add_option -> AddSystemProperty
to match its cousins in other classes, and fix up comments
still mentionning add_option in various spots.
2013-03-05 19:27:06 +00:00
Maks Orlovich 1edef1c7d6 Add unit tests for SystemCaches class. Fix a couple of
memory leaks in error cases they expose, as well as the
API awkwardness of CreateShmMetadataCache.

Also add a very basic integration test for ShmCache.
2013-03-05 18:18:58 +00:00
Jan-Willem Maessen 93fe009737 Update filters to use IsHtmlSpace where sensible. 2013-03-04 19:00:42 +00:00
rahulbansal@google.com 28fbcad77b Deleting a couple of unused options. 2013-03-02 01:20:27 +00:00
rahulbansal@google.com 12a225d078 Changing the conditions for logging in js_disable_filter. 2013-03-01 23:38:22 +00:00
nikhilmadan@google.com f9977df835 Set the user-agent in the resource fetch flow. 2013-03-01 22:31:05 +00:00
Shawn Ligocki e067566a9e Stop parsing "1." as number. CSS spec requires that number tokens have at least one digit after the dot.
For example, "1.em" should be tokenized as:

INT(1) DELIM(.) IDENT(em)

not:

DIM(1,em)

Fixes issue 630.
2013-03-01 21:17:51 +00:00
Shawn Ligocki 23e66a2168 genfile 2013-03-01 21:17:11 +00:00
ksimbili@google.com b9d757df0f Delay replacing low res images with their high res versions until
the user starts interacting with the page. This is enabled only on mobile.
Example - on user touch, click etc.(mpalem)
2013-03-01 19:52:43 +00:00
Matt Atterbury 4eb967aa20 Use tag.setAttribute('attr', 'value') rather than tag['attr'] = 'value' because
the former sets the HTML element attribute as we need, whereas the latter does
not always.

Also cleanup the JS code to cater for data being missing unexpectedly, and the
C++ code to cater for an element not having been processed when we expected.
2013-03-01 18:17:21 +00:00
Josh Marantz efd80d629b js library update
Rename various add_option methods to Add*Property methods for
readability & consistency & style.
2013-03-01 15:29:01 +00:00
Josh Karlin 96ecb04052 Add metadata to response headers on request.
Add cache deletion propagation to cache html flow.
2013-03-01 13:36:09 +00:00
Maks Orlovich 22f1d07cf8 Factor out the cache configuration code from
ApacheRewriteDriverFactory into a new class, SystemCaches, 
so it can re-used by ngx_pagespeed and can be unit tested. 
(Tests will be in a follow up change, mostly done).
2013-02-28 20:06:51 +00:00
Maks Orlovich 5e6871a341 Change by mmohabey:
Remove unnecessary LOG(INFO)s from Cache Html Flow.
2013-02-28 17:49:06 +00:00
Matt Atterbury e3767816d7 Set the panel loader debug IP for the cache HTML flow. 2013-02-27 20:56:12 +00:00
Josh Marantz 643e13296b Automate the table setup for mod_pagespeed directives that
expose options declared in rewrite_options.cc and apache_config.cc.

Adds new 'help' and 'scope' fields to the Property.
2013-02-27 17:53:32 +00:00
Jan-Willem Maessen 442a103d24 Permit CSS media queries in CSS inliner and elsewhere. Refactor space removal to respect http / css specs. 2013-02-27 16:46:24 +00:00
sriharis@google.com 16e8afc976 Enhanced metadata logging.
Remove redundant string conversions.

Set cache states (for each cohort) in property page.
2013-02-26 22:59:58 +00:00
rahulbansal@google.com 162ad239b8 Make webp_conversion_timeout_ms apply to jpeg-to-webp conversions.
Fix crash in javascript_filter due to logging.
2013-02-26 01:06:31 +00:00
Maks Orlovich 824e578dd1 Don't spam logs of people using SSL just because
they don't have an unreleased mod_spdy version installed.
2013-02-25 20:50:33 +00:00
Maks Orlovich 813f0945e4 Change by hujie:
Multiple cohort property cache read improvements.
2013-02-25 20:41:07 +00:00
rahulbansal@google.com 7ac0c3780d Refactoring the log record interfaces based on the usage patterns. 2013-02-25 19:28:29 +00:00
sriharis@google.com 90d7795ea6 Add a blink auto blacklist option. 2013-02-25 03:51:28 +00:00
bolian@google.com a9f1bd094d Count image_norewrites_high_resolution_ and url decoding errors as image_rewrites_dropped_intentionally. 2013-02-22 22:00:32 +00:00
Maks Orlovich 981c63b8a2 Move AprMemCache up to the system/ layer; needed to
extract the common cache management code there.
2013-02-22 19:58:12 +00:00
ksimbili@google.com dc8551cf4f Insert all style nodes through js, so that look ahead parser doesn't detect them.
Also decode the urls while storting into pcache.
2013-02-22 19:45:36 +00:00
mmohabey@google.com fe9a5c870c Property cache initialization to make InlinePreviewImages filter work with
CacheHtmlFlow.
2013-02-22 18:07:22 +00:00
Shawn Ligocki 394af40bbd Add failing CSS parsing test cases from Shane's investigations.
Some of these could be recovered from, others are probably too obscure and bizzare to wory about (like the Unicode zero-width space in CSS :/).
2013-02-21 22:03:56 +00:00
Shawn Ligocki 75b30cc810 Avoid repeatedly recording resources that we know we can't cache in IPRO flow.
Requires distinguishing Cache misses from kRememberNotCacheable in CacheUrlAsyncFetcher response. I do this by passing back a 501 status code for cache misses. Only if that status code is seen do we record the resource.
2013-02-21 21:23:15 +00:00
sriharis@google.com 0ed96b3896 Add WebP timeout options to pagespeed.conf.template and mod_instaweb.cc.
Fix blink logging.  Blink needs to log even after the main log record is
written out.  Hence have a separate log record for blink.
2013-02-21 20:09:28 +00:00
Shawn Ligocki c7d98bfb26 Add stats on FileCache eviction (via Cleanup()).
We already track cache insertions, so this should tell us what our eviction percentage is (over some time period).
2013-02-20 22:50:51 +00:00
sriharis@google.com be2ddde905 Add a NewSubordinateLogRecord API to RequestContext. 2013-02-20 22:26:58 +00:00
Maks Orlovich 40431f8e76 Actually cleanup the lock manager stuff (Shawn noticed the
method was declared but not used); this not happening
probably explains the segment table leaks Josh started noticing
at some point.
2013-02-20 21:36:02 +00:00
Maks Orlovich 7f82a62490 Change by vagababov:
Simplify some STL usage.
2013-02-20 21:33:18 +00:00
Maks Orlovich 36d1b9a728 memcached expects a -u user when run as root (during
in VM integration tests --- probably not a good idea for 
actual use); give it to it.
2013-02-20 21:17:00 +00:00
Matt Atterbury 6b0342c90f 1. Fix for TimingInfo bugs.
2. Remove no-longer-used code.
3. Add config option for metadata_cache_staleness_threshold_ms.
4. Logging for decode rewritten urls filter.
5. Tweaks to Logging for LazyloadImages filter.
6. Add X-UA-Compatible header to Flush Early Flow Response Headers, so that
   it doesn't break in the defer JS code for IE9.
2013-02-20 19:58:35 +00:00
sriharis@google.com df744d20d5 Changes to allow InsertElementBeforeCurrent in EndDocument. Also made changes in critical_css_filter.cc to use insertElementBeforeCurrent in EndDocument. This is needed because filters like split_html_filter, clear their state in EndDocument and so inserting any nodes after EndDocument will cause unknown problems(it causes crash with split_html). (ksimbili)
Deprecate the use of this.nextScriptIndexInHtml_ in js_defer.js as this no longer needed as same functionality is achieved by opt_last_index.  Each high priority and normal priority of defer javascript execution will have different psa_not_processed nodes.  (pulkitg)

Log more metadata cache and rewriting related fields.  (sriharis)
2013-02-19 23:29:48 +00:00
rahulbansal@google.com 87b1ca040d Adding logging for LazyloadImages Filter 2013-02-19 21:29:14 +00:00
Maks Orlovich d19bc7250d Fix regression: actually pass in the slow worker thread to
file cache; we were capturing it before it was created.

DCHECK for it as a regression test.
2013-02-16 16:45:00 +00:00
nikhilmadan@google.com 25a9eef9db Log whether a request is for a pagespeed resource or not 2013-02-16 02:52:30 +00:00
Michael Piatek 3c7c2affc2 DCHECK request context != NULL in AsyncFetch ctor. 2013-02-16 00:42:20 +00:00
mmohabey@google.com a04e425f08 Not flushing early stale rewritten urls in FlushEarlyFlow. 2013-02-15 22:42:18 +00:00
Matt Atterbury dd8f4af859 Added some local storage cache statistics. 2013-02-15 19:26:00 +00:00
Jud Porter 25e1bc7e94 Add property cache hash to the critical image beacon, so that the beacon handler can construct the correct key for the property cache. 2013-02-15 18:50:12 +00:00
Matt Atterbury 008346a6fb Log reason phrase along with response code. 2013-02-15 14:17:57 +00:00
Maks Orlovich 12fa51aebc Change by jkarlin:
Added an optional third argument for MapProxyDomain that rewrites optimized resources to the third argument's location (such as a CDN).

  This is in response to Issue 599.
2013-02-14 19:22:07 +00:00
Josh Marantz 68cff445e5 Echo correct command for check_from, check_not_from. 2013-02-14 19:02:43 +00:00
Maks Orlovich a2a8c425a9 Change by slamm:
- Some of the glue code needed for compute critical css.
2013-02-14 18:58:55 +00:00
Maks Orlovich b07f5baf79 Give trunk version 1.4. It's confusing to have it at
1.1 when there are a 1.2 release, and a 1.3 branch
around.
2013-02-14 14:21:00 +00:00
rahulbansal@google.com 91898f9128 Add logging for JsDisable Filter
Add ability to retrieve .pagespeed. resources instead of decoding and retrieving original.
2013-02-14 04:30:45 +00:00
Maks Orlovich 2f5b52e7cb Sync libpagespeed up to r2439 which should fix
problems doing mod_pagespeed builds on systems w/o
zlib headers installed.
2013-02-13 22:29:41 +00:00
Maks Orlovich 3b236ab4db Change by mpalem:
Change the delay images filter in the non inplace path to use
 the image map and add each image in a separate script tag. This
 is enabled by default when aggressive mobile rewriters are enabled
 and the request is from a mobile user agent.

Also revert accidental premature export of cache_html
2013-02-13 22:28:48 +00:00
Maks Orlovich 667f34d884 Unbreak CentOS test launcher script, and pass an
actual stop command (graceful is a restart, not stop,
and the init script doesn't support graceful-stop)

Also don't use popen -c, it's not available on Centos5.

Stoping is still flakey with this, but seems manageable
with manual intervention.
2013-02-13 22:13:54 +00:00
mmohabey@google.com cb6bb4aaf3 1. Disabling conflicting filters for cache html flow. Namely:
combine css, combine js, move css to head.
2. Enabling disable_javascript filter for cache html flow and pass through
case.
3. Making strip comments filter to retain the panel comment while
rewriting the cached html.
2013-02-13 20:06:22 +00:00
Maks Orlovich 843a8a6862 Don't hardcode the htdocs path here, but rather use the proper
variable.
2013-02-13 18:23:40 +00:00
Maks Orlovich e9b4b1ca62 - Load mod_proxy in test config template when it's
not compiled into Apache.
- Fix the revision detection script picking up Chromium
revision rather than ours
2013-02-13 15:56:07 +00:00
Josh Marantz 31937f11ac Allow timeouts in webp conversions (vchudnov)
Don't spew the contents of detached RewriteContexts during the
shutdown report of leaked drivers; that seems to crash intermittently.

That needs to be investigated; left a TODO.
2013-02-13 04:14:36 +00:00
bolian@google.com 2c35e744d9 Add histogram varz for image rewrite delay and logging for inline preview images. 2013-02-13 00:23:35 +00:00
bolian@google.com 4ec9edc394 Rename Ajax -> InPlace Step three, flags. 2013-02-12 22:45:16 +00:00
Maks Orlovich 391683f351 More fixes for packaging:
- Avoid temporary GoogleUrls (older gcc's view these 
  as a copy).
- We need to have js_minify build by the packing step,
  so the packaging targets need a dependency on that.
2013-02-12 21:29:17 +00:00
Jud Porter 859ea64768 Rename StaticJavascriptManager to StaticAssetManager. 2013-02-12 20:05:09 +00:00
Maks Orlovich fedd061f2c Fixes for builds on older systems:
- Don't pass in a warning flag gcc < 4.5 doesn't
  understand on such versions
- Provide a wrapper script around 'ar' that can be 
  used on system with GNU binutils < 2.18 which do not
  have thin archive support.
2013-02-12 18:54:47 +00:00
Josh Marantz cbb1a1437c Fix shutdown crash during cleanup. 2013-02-12 17:17:30 +00:00
sriharis@google.com 255c3b255e Don't do stale rewrites in in-place flow, even if within metadata cache staleness threshold. 2013-02-12 16:04:44 +00:00
Josh Karlin c8bdd07403 Removing unused code 2013-02-12 11:53:19 +00:00
sriharis@google.com 64c1d4cc0b Add new property cache function to allow a single Read method which issues lookups for specified registered cohorts not for ALL registered cohorts. (hujie)
Fix the build.
2013-02-12 07:43:56 +00:00
ksimbili@google.com 6fb3d8c881 Change related to propagating cache deletes along with device type. 2013-02-12 01:34:21 +00:00
nikhilmadan@google.com b8072ea4a5 Fix metadata cache pollution issues due to incorrect encoding / query param escaping / experiment ids in urls. 2013-02-11 23:18:32 +00:00
Maks Orlovich 32e801d858 Up the limit on maximum number of buckets in SharedMemLockManager to
2^16, bump the setting to 512 from 256, and turn it on by default.
(Memory cost: ~300,000 bytes)
2013-02-11 21:54:00 +00:00
Maks Orlovich bde33ce121 Change by vchudnov:
Fix webp conversion: +lossless fallback, -global quality defaults, +small webp tweaks

 Have lossless webp fallback to other lossless conversions.
   If --convert_to_webp_lossless is set, the fallback logic is now:
    for pngs: webp->png->gif
    for gifs, if --convert_gif_to_png is also set: webp->png->gif

 No longer warn nor set defaults if global webp/jpeg quality are not set.

 Small webp tweaks

Change by (anonymized internal code improver):

 Fix return type of a method.
2013-02-11 21:45:46 +00:00
Maks Orlovich ef745a50f8 Generalize ApacheCache -> SystemCachePath. Only functional
change is that some things are injected rather than
looked up from ApacheRewriteDriverFactory.
2013-02-11 20:29:35 +00:00
Josh Marantz 4f48d55436 Integrate file-input loading with IPRO better.
Includes small refactor for looking at stat-patterns after a warm fetch in the ipro tests.

One unresolved issue: add user-settable option for how to set the TTL on the
IPRO-rewritten resources when the origin was loaded via file.
2013-02-11 19:23:38 +00:00
Jud Porter 532920f1be Serve lazyload blank gif from static path rather than using inlined data image. Also remove the inline user agent support check from lazyload, which will enable this filter for all browsers. 2013-02-11 18:34:36 +00:00
Michael Piatek a44f6081e1 Inhibit HTML parsing in ProxyFetch if max_html_parse_bytes == 0. 2013-02-11 18:21:58 +00:00
sriharis@google.com 169e0b5a0b An early pre-render filter to decode rewritten URLs (in origin html). 2013-02-09 04:45:28 +00:00
Shawn Ligocki 935f2eca54 genfiles 2013-02-08 23:16:59 +00:00
bolian@google.com 3da998e002 Rename Ajax -> InPlace Step two, options. 2013-02-08 22:55:50 +00:00
Jeff Kaufman 8a83570bcf Provide clang for OSX builds. 2013-02-08 15:52:52 +00:00
sriharis@google.com 851d42c547 Remove the propagate_blink_cache_deletes option. 2013-02-08 02:06:34 +00:00
Matt Atterbury f3148fab05 Check for valid RewriterInfo before using it for flush early records. 2013-02-07 20:54:33 +00:00
Matt Atterbury d1a4224d37 1. Initial implementation of HTML flow caching.
2. Consolidate the semantics of the rewriters header so that is always just a
   reflection of the contents of the applied rewriters string in the log record.
2013-02-07 20:49:39 +00:00
nikhilmadan@google.com 471f387760 Added an attribute pagespeed_prioritize, so that all scripts which have this attribute are prioritize over other scripts
Add an option to limit the number of rewrite info's logged.
2013-02-06 22:02:01 +00:00
Jeff Kaufman cf65253d11 Get the Apache2.4 genfiles for mac.
To generate these files I used a mac running 10.8:

    $ cd httpd-2.4.3/
    $ sudo ln -s
       /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
       /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain
    $ ./configure

This generated include/ap_config_auto.h and include/ap_config_layout.h which
I've copied here with no changes.
2013-02-05 23:34:20 +00:00
Matt Atterbury a2cc463a1d 1. Added header timing method for logging.
2. Added finder and filter to inline the CSS rules critical for initial load.
2013-02-05 17:09:36 +00:00
Shawn Ligocki e52d328ca7 logging. 2013-02-04 22:24:38 +00:00
Shawn Ligocki 8845f96c54 Stop inlining defaults for system colors in preservation_mode.
Ex: before this CL, we'd rewrite:

a{color:WindowText}  ->  a{color:#000}
2013-02-04 22:24:27 +00:00
Shawn Ligocki c77a5378a8 CSS Optimization: Strip leading 0s in decimal numbers.
"0.25" -> ".25"
"-0.4" -> "-.4"

Fixes issue 614.
2013-02-04 18:25:29 +00:00
Shawn Ligocki 7306e7eea4 STL. 2013-02-04 18:24:58 +00:00
Josh Marantz 20b98f5d0a Add related-options & filters for CSS. Note that the CSS options inherit
all the Image options via merge. (jmarantz)

Remove automatic creation and logging of 'applied rewriters' logging string. (marq)
2013-02-01 22:25:32 +00:00
Matt Welsh 96fa30cd94 Specifying the hash as "0" for stale cacheable resources (anupama)
Adding processing time to logging proto (mdw)
Set image compression quality for OpenCV (huibao)
2013-02-01 20:55:47 +00:00
Maks Orlovich 17cef20f0a Fix build on lucid. 2013-02-01 20:16:06 +00:00
Maks Orlovich 3b9eface0d Centralize parsing of common PSOL options that could not
be set via just setting option values, with possibility
of extensibility via subclasses.

Add unit test coverage.

(Not touching enum extensibility here, but it should be mainly a matter
 of virtualizing the convertors).
2013-02-01 19:02:31 +00:00
Jud Porter 3cecc71e7a Refactor interface to StaticJavascriptManager. 2013-02-01 17:42:13 +00:00
Maks Orlovich bab9d910cf Update to far more recent Chromium + gyp, as well
as the libpagespeed that's synced to them.
2013-02-01 16:40:01 +00:00
Maks Orlovich 70ef700e48 Re-apply accidental reverts. 2013-02-01 16:25:57 +00:00
sriharis@google.com 47f220c2dc Make timeout during ipro-fetch non-fatal. (jmarantz)
Cleanup compiler warnings.
Fix the regression where we were not updating computed hashes in blink
cache miss case.
2013-02-01 00:49:59 +00:00
Josh Marantz 31f6e0f51f Make timeout during ipro-fetch non-fatal. 2013-01-31 22:25:28 +00:00
Maks Orlovich 63e85fe70a - Changes by jmarantz:
- Don't write a cache invalidation timestamp of '0'.  The transmission of
    invalidation timestamp from Statistic to Option was problematic as
    stats self-init to 0 and don't have an unset case.
  - Add some CHECKs for valid InputInfo timestamps on LoadFromFile resources.

- Changes by alexfh:
  - With a clang fallthrough warning
  - Fix the fallthrough_intended macro
2013-01-31 21:59:26 +00:00
bmcquade@google.com 866a723450 Increase libpagespeed revision number to pick up some recent image processing changes there. 2013-01-31 19:21:10 +00:00
Josh Marantz 5aaa073000 Avoid HTTP cache lookups for FileInputResources. They can be Harmful if
we happen to have some cache data because we'll populate the FileInputResource
contents & headers, but leave the timestamp unedited.

Also put in some backup code to try to grab the timestamp on demand, but
it should never be reached.

Removed inconsistent (& hard-to-search-for) virtual methods on
Resource: IsCacheable and IsCacheableTypeOfResource in favor of
UseHttpCache.

Fix a case in ReadAsync where a callback would not be called.
2013-01-31 19:01:51 +00:00
Josh Marantz 3e18de01c5 one more include-what-you-use fix. 2013-01-31 17:51:51 +00:00
Josh Marantz edf700943b include-what-you-use fixes. 2013-01-31 17:44:26 +00:00
bmcquade@google.com 65c07fc394 Move hostname_util.cc out of util_core. 2013-01-31 15:41:03 +00:00
Maks Orlovich a642e22343 Change by poojatandon:
Refactoring css url encoding, Legacy decoder understands the Non-legacy encoding and Non-Legacy decoder understands the Legacy encoding.
2013-01-31 15:35:21 +00:00
Maks Orlovich 51be1e664e Fix problem with MSVC debug build reported by Bryan. 2013-01-31 15:20:30 +00:00
nikhilmadan@google.com a4bdb953e3 Reduce log verbosity for image rewriting. 2013-01-31 00:10:56 +00:00
Matt Atterbury b62b6802e1 Issue 601: point url_ at the GoogleUrl member copy of the URL argument
rather than the argument itself as it could be a stack local.
2013-01-30 17:42:13 +00:00
Matt Atterbury 17829900a8 1. Factor out some of the css testing functionality into some helper methods
to facility re-use.
2. Added ability to report error codes.
2013-01-30 14:38:22 +00:00
Michael Piatek 6c2bf81899 Add flags to control preemptive rewriting for all resource type. 2013-01-29 21:39:53 +00:00
Maks Orlovich 2f6dcd9473 Include system/ in libpagespeed_automatic.a 2013-01-29 20:04:34 +00:00
Matt Atterbury 713bf07827 1. Issue 610: check for a NULL filename before we dereference it.
Also refactored the unplugged code so that we determine the server
   context only if we need it and only once.
2. Documentation for the PreserveURLs flags.
2013-01-29 19:49:52 +00:00
Maks Orlovich bcacb28703 Properly cleanup segments in SHMCache tests. 2013-01-29 19:27:18 +00:00
Maks Orlovich c91b9d3655 Include info on whether we were enabled or not in the logging
protos.
2013-01-29 19:26:43 +00:00
pulkitg@google.com 0e4f9c8f09 Added cache lookup state in PropertyCohortInfo to store whether cache service returns a hit, miss, overloaded or network error. 2013-01-29 19:06:25 +00:00
bolian@google.com 9a47218256 DeviceProperties update for screen resolution. 2013-01-29 18:56:58 +00:00
Maks Orlovich 0ecb7d9a5f Split out the settings that can be shared between
mod_pagespeed and ngx_pagespeed into a separate class.

This is step 1 out of ??? of refactors to reduce code dupe
between mod_pagespeed and ngx_pagespeed and make some
things more testable.

(Step 2 will be to share some of the configuration parsing
 code).
2013-01-29 16:20:45 +00:00
Maks Orlovich b5e1c3035c Change by pulkitg:
- Some refactors of blink/critical image computations

Change by jmarantz:
- Turn off 'extend_cache' for the embed-config tests.  This was causing some
  flakiness in the system-test looking for .ic. and .cf. resources when depending
  on timing we can get .ce. resources.
2013-01-29 16:15:25 +00:00
Jan-Willem Maessen 3e2cb06c3b Simplify control and data flow in javascript_filter by doing most work at the moment the relevant data arrives. 2013-01-29 00:00:02 +00:00
Maks Orlovich 1cd2b86e37 Some comment fixes/tweaks. 2013-01-28 21:53:44 +00:00
Maks Orlovich b204aa02c8 Change by jmarantz:
In the embed_config test, wait for the actual rewrite we were looking
for.  Just looking for two .pagespeed. instances can lead to flakiness
because we might successfully cache-extend but not yet have the image
rewrite done.
2013-01-28 21:46:21 +00:00
Maks Orlovich e8b0a87fc9 Change by pulkitg:
Store hash of option's singature in logging protos
2013-01-28 21:33:29 +00:00
Jan-Willem Maessen 4d8313b050 Simplify deadline alarm control flow. 2013-01-28 21:02:17 +00:00
nikhilmadan@google.com 02a625aa66 Add device type to property cache logs. 2013-01-28 19:48:45 +00:00
nikhilmadan@google.com c7b1920ba5 Disable lazyload_images for classes with "lazy" in the class name.
Don't resize images to 1x1 or less
2013-01-28 18:42:08 +00:00
Maks Orlovich 9b18bf34a9 Reapply Huibao's change again, now it got re-instated in
internal repo.
2013-01-28 16:34:40 +00:00
Maks Orlovich 36361882c2 Huibao reverted r2432 believing it to have caused a test failure.
Push the rollback to public SVN as well, as haivng an external/internal 
mismatch on DEPS file can cause trouble for the build system.
2013-01-28 15:16:30 +00:00
Huibao Lin 320fece486 Change the inputs of GetImageQualityFromImage() to void*/size_t. 2013-01-26 16:42:42 +00:00
Josh Marantz 3060c0f37d Embed options in URL syntax rather than in query-params. 2013-01-26 15:36:51 +00:00
Josh Marantz 2155be5a78 Allow encoding of options in ResourceNamer, as an alternative to the
experiment-id.
2013-01-26 15:31:48 +00:00
Michael Piatek 1555d3f1f1 Enforce a requirement that RTTI not be used for functional behavior on the apache serving path. 2013-01-25 22:08:01 +00:00
Maks Orlovich c2cc4253f6 Initial integration of shm metadata cache with the module.
Will need refactoring to improve testability and improve
code sharing with ngx_pagespeed (split over multiple 
changes for reviewability.)
2013-01-25 21:33:08 +00:00
Maks Orlovich 0a4b91ac1a Change by Srihari:
Make the blink diff computation condition more explicit and prevent unnecessary rewriting for change detection in cache miss case.  
Also remove the use of propagate_blink_cache_deletes option -- we always do it.
2013-01-25 21:26:44 +00:00
Jud Porter df26e58917 Change BeaconCriticalImagesFinder::IsMeaningful to return true when the critical images beacon option is enabled. 2013-01-25 19:26:38 +00:00
Maks Orlovich cf0b85c2a1 Unbreak 32-bit build. 2013-01-25 16:48:14 +00:00
Matt Atterbury 2dbe11183e 1. Don't attempt to optimize a 0x0 gif.
2. Make switch fallthrough explicit.
2013-01-25 14:46:33 +00:00
Maks Orlovich b416dbd8a7 Initial shared memory cache implementation.
Not yet hooked up with the module as of this revision.
2013-01-24 22:51:26 +00:00
Maks Orlovich 04dee84a05 Change by buettner:
Factor user agent related functions out of RewriteDriver, into a separate class.
2013-01-24 21:54:31 +00:00
Maks Orlovich 9573f722b5 Change by vagababov:
Add possibility of not inflating unknown content types.
2013-01-24 21:13:57 +00:00
Maks Orlovich ac8b2d7cd4 Update libpng to latest 1.2.x version. 2013-01-24 18:53:22 +00:00
Jeff Kaufman b8ac4a341c use PageSpeed in place of mod_pagespeed where possible 2013-01-24 18:46:23 +00:00
bolian@google.com 924ff21d94 Add image/jpg as image/jpeg synonym. This fixes the problem that some JPEGs in IRPO are not optimized. 2013-01-24 18:35:34 +00:00
Jud Porter 311510de91 Prevent file cache cleaning from removing stdio's lock directories, which includes the directory used to prevent cache cleaning from running twice. This is to address issue #591. 2013-01-24 16:39:58 +00:00
bolian@google.com 8ac0f7bb79 Add varz for kSquashImagesForMobileScreen. 2013-01-24 01:06:06 +00:00
Maks Orlovich 07ef929e2c Disable more WebP-compressing tests from running under vg. This is why:
cat /tmp/valgrind.test.out.30149.pagespeed_automatic_test.*|egrep "[[:digit:]]{6} ms"|grep -v "tests from"
[       OK ] CssFilterTest.WebpRewriting (143202 ms)
[       OK ] CssFilterTest.WebpLaRewriting (143277 ms)
[       OK ] CssFilterTest.WebpRewritingFromJpgWithWebpFlagWebpLaUa (141819 ms)
[       OK ] CssRecompressImagesInStyleAttributes.RecompressAndWebpAndStyleEnabled (141627 ms)
[       OK ] ImageRewriteTest.CacheControlHeaderCheckForNonWebpUA (141048 ms)
[       OK ] CssFilterTest.WebpLaWithFlagRewriting (142531 ms)
[       OK ] CssFilterTest.WebpRewritingFromJpgWithWebpFlagWebpUa (141534 ms)
[       OK ] CssRecompressImagesInStyleAttributes.RecompressAndWebpLosslessAndStyleEnabled (141874 ms)
2013-01-23 23:32:11 +00:00
Shawn Ligocki 3d25b74f9f Downgrade non-error to info 2013-01-23 23:00:30 +00:00
Maks Orlovich 76c880defe Change by gee:
Allow specifying a CacheInterface when adding cohorts to the
PropertyCache, so that different cohorts may be backed by different
cache implementations.
2013-01-23 22:27:48 +00:00
Josh Marantz 34f70068ee JS libraries update.
Fix flaky valgrind system test.
2013-01-23 17:39:58 +00:00
Josh Karlin 72f946ab9f Adds a ModPagespeed unplugged option.
ModPagespeed off disable HTML rewriting but still serves .pagespeed. resources and can be turned on via query parameters.  Modpagespeed unplugged returns from all Apache handlers as soon as possible and therefore .pagespeed. resources are no longer served and query parameters are not parsed.
2013-01-23 16:24:39 +00:00
rahulbansal@google.com a588030150 Fixing flakiness in flush early flow tests and adding more bits to logging. 2013-01-23 02:11:05 +00:00
Maks Orlovich 727a497d2f Avoid triggering fetch deadline fallbacks when fetches are
done on nested drivers on behalf on other rewrite, as it causes
two problems:
1) In HTML path, can end up with CombineJs failing to apply and
caching that it got a private input, making it there for not
apply for a while.

2) In Fetch path, it can get variable names to get out of sync(!)
which is a correctness issue.
2013-01-22 23:29:18 +00:00
Matt Welsh 8a3e97eaf9 Adding kProxyDnsLookupFailure error code. 2013-01-22 21:13:40 +00:00
bolian@google.com bc2eae423a Add regex-based fallback for GetDeviceScreenSize. 2013-01-22 20:07:23 +00:00
Josh Marantz 5b37c52650 Collect relevant options and make query-params for rewritten resources. 2013-01-22 19:23:57 +00:00
Matt Atterbury 06a5c678fa Extended filter logging capabilities to use a submessage for each application
of a filter. Preserves the existing semantics of the applied_rewriter string
field, maintaining it in parallel with the rewriter_info message array.
An example of using this new structure is provided in the JavaScript filter.
2013-01-22 16:20:09 +00:00
Michael Piatek e660eceb15 Implement {png,gif}-to-webp-{lossy,lossless}-{with,without}-alpha 2013-01-19 03:29:55 +00:00
Shawn Ligocki 3ce60afa07 Second half of IPRO in mod_pagespeed change. Records resources and inserts them into the cache in the Apache output filter flow if they were not in cache in the handle_as_inplace() handler.
Major TODOs:
1) We don't distinguish between cache misses and RememberNotCacheable in handle_as_inplace(), thus non-cacheable resources will be recorded (extra string copy) every time they are loaded in Apache (with IPRO on).
2) We should initiate IPRO rewrite immediately after storing input in cache (currently it takes 3 loads to get a resource IPRO rewritten).
2013-01-18 21:01:39 +00:00
Maks Orlovich 86e8994f9d Fully separate out RefCounted<T> from Chromium's
scoped_refptr<T> for portability reasons.
2013-01-18 20:27:40 +00:00
Maks Orlovich 4e8b227d1f Make it easier to hook in a ServerContext subclass
for CreateServerContext()-using platforms that need 
to override ApplySessionFetchers.
2013-01-18 19:06:37 +00:00
Josh Marantz 603ef22d60 Avoid lifetime issues with the request_rec* which is a concern for
cloned drivers.
2013-01-18 18:10:43 +00:00
Maks Orlovich 69e0914f36 Detangle the RefCounted<T> impl from Chromium guts,
making it use AtomicInt32 directly. This makes it 
easier to port to other platforms.

Cleanup some of the AtomicInt32 API: making the naming
more compliant with the style guide, and make the barrier
semantics explicit. Fix a couple spots that needed barriers
as a result.
2013-01-18 16:52:19 +00:00
Josh Marantz 6cc8156b98 Fixed leaked_drivers failure found in system testing. The URL of the
leaked driver was:
http://domain_hyperlinks_off.example.com/mod_pagespeed_test/rewrite_domains.html,
which had a detached rewrite with partition key
rname/ce_1jfHXnFYzU_EA9cv6iin/http://src.example.com/image.png@@_

Of course there is no such thing as src.example.com/image.png but were
trying to fetch it from the live internet and failing.  Based on the
normally-stable behavior of our system I think we were doing that
properly, but we must have been doing that too slowly on some test
machines, and therefore leaking the driver due to our time-bound
shutdown flow.  So I added a debug.conf.template change to PassThrough
mode to avoid attempting to fetch the resource in the first place.

Also fixes races because were not setting psatest as the blocking-rewrite key
for some VirtualHosts that need it.
2013-01-18 16:21:54 +00:00
Josh Marantz d62d3d2187 Fix race-condition found in event/2.4 valgrind system tests.
In the absence of this fix, I get failures on about 1/3 of valgrind
tests.

Adds debug scaffolding to rewrite_driver/rewrite_context.
2013-01-18 15:58:17 +00:00
Josh Marantz 8bcdc1006d Fix test-race by using a sync-point on the Fetch Done() callback. 2013-01-18 15:32:21 +00:00
nikhilmadan@google.com 34b71c05d1 Rewrite JS in Characters() hook. Since we are guaranteed by HtmlParse that we will always get only one Characters() block in a <style> element, we can rewrite that inline script immediately. 2013-01-17 21:03:57 +00:00
Josh Karlin 81fcb6d24e ModPagespeed can now be on, off, and unplugged.
Unplugged doesn't yet do anything.
2013-01-17 18:33:35 +00:00
bolian@google.com c16b730dac IPRO metadata cache changes. See doc for InPlaceRewriteContext::EncodeUserAgentIntoResourceContext for details. 2013-01-17 01:41:53 +00:00
bolian@google.com 1e069e7ec5 Fix split_html problem on IE9. 2013-01-17 01:18:50 +00:00
bolian@google.com 15f865c2cb Make GetScreenResolution return default values if device_cache does not exist. 2013-01-16 21:26:39 +00:00
Josh Marantz 41706ec840 Centralizing/simplifying the way that RewriteDrivers are created,
which take into account both query-params & the spdy-ness of a
request.

Add using_spdy to RequestContext, and add request_rec* to a new
ApacheRequestContext subclass so we don't have to squirrel that around
as much.

This is all supportive to a later change to centralizing handling of
query-param processing and enable us to use
ResourceFetch::BlockingFetch in unit-tests to get it to better
correlate with the way things work in mod_pagespeed.
2013-01-16 00:53:31 +00:00
Jud Porter e9c4edc4c4 Initial critical image beaconing implementation. This CL provides the critical_images_beacon filter to inject the beacon JS, and an option, ModPagespeedCriticalImagesBeaconEnabled, to control this behavior. By default, adding the critical image beaconing is currently disabled. 2013-01-15 21:14:37 +00:00
mmohabey@google.com a944a70878 Moving flush early flow tests out of proxy_interface_test.cc (mmohabey)
Adding inline-images-logic within blink flow (anupama)
2013-01-15 21:03:20 +00:00
Maks Orlovich ee8e450442 Add an apparent missing dependency that sometimes cause
trouble with parallel builds. We need any included protos
to be compiled in advance as the build target also does the
sed'ing of the .proto -- and the processed result in genfiles/
is what's needed for the include, not the original.
2013-01-15 18:07:17 +00:00
Michael Piatek f74289e210 Rename Ajax -> InPlace Step one. File and class names. 2013-01-15 00:03:23 +00:00
Michael Piatek a2dda9de89 New trace infrastructure to distinguish IPRO from preemptive rewrites. 2013-01-14 19:23:33 +00:00
Maks Orlovich 9c6d5d81e4 Add some helpers to make it possible to inspect
metadata cache state
2013-01-11 20:58:41 +00:00
Michael Piatek bd7d060fbd Logging refactoring and bug fixes. 2013-01-11 19:34:53 +00:00
Maks Orlovich 2b16c0d505 Change by rahulbansal:
Remove unused code from the first version of Blink.
2013-01-11 19:02:36 +00:00
Michael Piatek de4ed1bf66 image_preserve_urls should not disable all image resizing. 2013-01-10 21:11:07 +00:00
Maks Orlovich 3403bbf3c3 Don't add in default blacklist entries in ::RewriteOptions, but
rather in DisallowTroublesomeResources(), as otherwise the entries
get duplicated every time there is a new merge level.
2013-01-10 18:57:55 +00:00
Josh Karlin a337306e61 Combine MapProxyDomain resources with others from the same target domain.
Addresses issue 600.
2013-01-10 18:55:34 +00:00
Maks Orlovich bb75fff6b3 Give threads names, to help debugability
a bit.
2013-01-10 18:37:41 +00:00
Maks Orlovich c92b80bdf2 Re-apply the rollback of "Update client and device property pages for all resource types."
--- looks like there was a syncing error on export so it got 
accidentally reverted...
2013-01-10 18:16:46 +00:00
rahulbansal@google.com 31a2ebb668 Not updating client and device property pages for all resource types. 2013-01-10 03:47:58 +00:00
nikhilmadan@google.com f45248058f Rollback change to update client and device property pages for all resource types. 2013-01-10 02:54:51 +00:00
Josh Marantz 91131a4213 Move ResourceContesxt from automatic/ to rewriter/ 2013-01-09 22:20:20 +00:00
Jud Porter 29dad159f7 Use ServerContext::GetPagePropertyCacheKey for mod_pagespeed property cache lookups. 2013-01-09 20:17:48 +00:00
Josh Marantz a871744d8b Add APIs to support manipulating options by id-string.
Add a new option (to be used in a future change) for adding relevant options to
generated URLs as query params.
2013-01-09 19:27:14 +00:00
Josh Marantz 314a35980d Refactor ServerContext::Rewrite, moving to RewriteDriver::Write to enable
a future change to support appending the options to the query-params.
2013-01-09 14:43:42 +00:00
sriharis@google.com 13152519f2 Factor out the proxy_interface page property cache key construction. 2013-01-09 09:42:18 +00:00
ksimbili@google.com bc47cd30a7 Copies all the attributes from defered script to new script node. 2013-01-09 07:01:29 +00:00
Michael Piatek 5ff58deb6a Update client and device property pages for all resource types. 2013-01-08 22:59:32 +00:00
Michael Piatek 7b36e25164 Disable preemptive image rewrites for IPRO CSS rewrites. Flag protected. 2013-01-08 22:49:40 +00:00
Maks Orlovich a16adc037a Remove unused CreateInputResourceFromOutputResource, and port
some tests that used it to cover the APIs that replaced it.
2013-01-08 18:05:29 +00:00
sriharis@google.com dbf4d655ca Change the BlinkCriticalLineDataFinder::PropagateCacheDeletes interface. 2013-01-08 10:00:27 +00:00
Jud Porter 01318541c4 A) Use a short timeout for tests that we expect to fail.
B) Document why fetch_until needs a 100s timeout and that timeout is in seconds.
2013-01-08 00:08:23 +00:00
Michael Piatek 586b82a559 Encode screen size in MD cache key for kSquashImagesForMobileScreen. This is for HTML path only for now. 2013-01-07 18:59:28 +00:00
mmohabey@google.com cb2579cabf Send defer_js javascript only if flush_more resources_if_time_permits is
enabled else the javacript delays rendering any content that follows the
script tag until that script has been downloaded, parsed and
executed.
2013-01-06 17:46:49 +00:00
Michael Piatek 14ba75e5f0 Separate tracing for request processing and fetch time.
URLs in annotations.
Traces are distinguished by content type.
2013-01-05 01:51:11 +00:00
Josh Marantz 06a369682d Add memcached timeout accounting for Puts and Deletes.
Add 'dojo' canonical js libraries to configuration.
2013-01-04 15:23:11 +00:00
Matt Atterbury a35e2dd080 1. Include the UA in the key for property cache entries.
2. Add mod_pagespeed_prefetch_start script for the cases where no resources
   get flushed early.
3. Issue 582: do nothing in our Apache map-to-storage handler if we are in
   proxy mode as it causes all requests for pagespeed URLs to fail with a 403
   Forbidden status.
2013-01-04 14:23:56 +00:00
Matt Atterbury eafe66a8fd Fix a crash caused by trying to process an invalid URL. 2013-01-03 21:07:39 +00:00
Matt Atterbury 886f7dbf12 Add support for getting mobile device capabilities from MDL based on user-agent. 2013-01-03 20:48:01 +00:00
Josh Marantz 3e95fb9b1a Allow 64-bit specification of in-memory cache size. 2013-01-03 18:13:05 +00:00
nikhilmadan@google.com 9706e59030 Fix wrong mime-type in IPRO when a rewriting changes the mime-type
Add logging for property cache lookup information. This includes whether each
each cohort was a hit/miss and the properties found while looking up cohorts.
2013-01-03 17:43:41 +00:00
nikhilmadan@google.com 22b8adcd04 Fix a bug that not checking ipro cases when setting resource context. 2013-01-03 01:20:18 +00:00
Michael Piatek 582792433c Add a separate IPRO rewrite deadline. 2013-01-02 20:53:16 +00:00
nikhilmadan@google.com 71fc852c37 Add a flag for TTL to refresh finder properties at 2012-12-29 02:32:05 +00:00
Matt Atterbury 1a5baaa5ec Another attempt at getting hostname_util.cc to compile under Windows. 2012-12-28 18:37:05 +00:00
Matt Atterbury 9741fa1860 1. Remove User Agent specific encoding from image_url_encoder, keeping it
backward compatible for Legacy decoder to understand Non-legacy encoding
   and Non-Legacy decoder to understand the Legacy encoding.
2. Add User Agent related information to Metadata cache keys.
3. Fix portability problems in hostname_util.cc.
2012-12-28 16:46:00 +00:00
nikhilmadan@google.com 9e7aa6a887 Track cache metrics for every cohort of the property cache. 2012-12-27 23:56:12 +00:00
sriharis@google.com 98f12bfb7e Blacklisting for blink diff mismatch. 2012-12-27 18:00:03 +00:00
Jud Porter f465383588 Get rid of compiler warnings for EXPECT_EQ(true/false) (nikhilmadan) 2012-12-27 16:48:27 +00:00
Jud Porter 01594f96a2 Don't lazyload images for class elements containing slider. (nikhilmadan) 2012-12-27 16:47:32 +00:00
Jud Porter ec99d02ecd Clear critical_line_info in rewrite_driver's Clear(). (rahulbansal) 2012-12-27 16:46:00 +00:00
Jud Porter 765895c015 Consolidate some logging operations into log_record classes, making calling code simpler and logging code easier to test. (marq) 2012-12-27 16:44:51 +00:00
Jud Porter f3cc7c5823 Comment out flaky test. (rahulbansal) 2012-12-27 16:44:20 +00:00
Jud Porter ec391b94c9 Consolidate some logging operations into log_record classes, making calling code simpler and logging code easier to test. (marq) 2012-12-27 16:43:05 +00:00
rahulbansal@google.com cf10a8663f Handle the scenarios when we've flushed the wrong status code in flush early flow 2012-12-27 02:27:12 +00:00
Jud Porter 93ef70fcd9 Updated optimized statis JS files. 2012-12-26 15:36:00 +00:00
Michael Piatek 512d9b9479 DCHECK for non-NULL request context in proxy_fetch. 2012-12-22 00:47:37 +00:00
Josh Marantz 294e6b7afa More uses of FALLTHROUGH_INTENDED. (sligocki)
Add HTTPS fetching support in Serf.  Note that the Serf support is
dependent on OpenSSL, which is large and has a complex license.  We do
not include it in our open-source distribution by default, and it must
be compiled form source after some small patches to source & config
files. (jmarantz)
2012-12-21 23:56:01 +00:00
Shawn Ligocki c1b76f2546 Get FALLTHROUGH_INTENDED working in open-source for webutil/css. 2012-12-21 21:52:48 +00:00
Jan-Willem Maessen 5fb008f375 Make sure we include what we use, and fix lint infelicities. 2012-12-21 20:15:05 +00:00
Michael Piatek 973b18f5cf DCHECK for non-NULL request context in write_through_http_cache and fix tests. 2012-12-20 23:55:42 +00:00
satyanarayana@google.com 4c3731c501 Remembering that we tried rewriting on a image to avoid processing it
multiple times.
2012-12-20 21:56:54 +00:00
Michael Piatek 69f3fc301d Require a request context for interacting with the http cache.
The main change is to add a DCHECK that the request_context is non-NULL in the HTTP cache callback (SetTimingMs())

The rest of the CL fixes tests by synthesizing test request contexts or propagating request contexts as appropriate.
2012-12-20 20:35:08 +00:00
Shawn Ligocki c0a85d12dc De-flake many system tests by converting the pattern:
fetch_until $URL
wget $URL > foo

to

fetch_until -save $URL

I have only seen a couple of these flake, but decided to fix them all at once. Also did a lot more cleanup in system tests like consistently cleaning up the OUTDIR before each fetch_until to avoid getting index.html.1 files and "set -u" to avoid really annoying failure modes from typos in variable names.
2012-12-20 18:36:47 +00:00
Josh Karlin 61da95a7fd Refactored the Preserve URLs directives.
The directives now work by forbidding filters that modify URLs.  Image, CSS, and javascript minification still take place, but they are prevented from rewriting the URL.
2012-12-20 18:24:10 +00:00
Michael Piatek 20af210e72 Comments discouraging complex finalization for reference counted objects. 2012-12-19 22:49:40 +00:00
Michael Piatek ba3e678463 Remove conditional for log_record use in cache_url_async_fetcher. 2012-12-19 21:49:51 +00:00
Shawn Ligocki 33639f7719 Be much more disiplined about @media query parsing. Make sure it contains 'and's in the appropriate places and that there is something between the 'and' tokens and the following '('.
See http://lists.w3.org/Archives/Public/www-style/2012Dec/0263.html for some context.
2012-12-19 20:35:45 +00:00
Josh Marantz 61767f12d2 Don't convert to progressive if the resized image is expected to be
less than the progressive-byte threshold.
2012-12-19 19:30:18 +00:00
mmohabey@google.com dbb15a2a55 Merging two heads into 1 in flush early flow. 2012-12-18 22:41:04 +00:00
Maks Orlovich 43b956508f Virtualize RequestContext creation in RewriteTestBase, so
implementations that need an own subclass can use it in their
test fixtures w/o worrying about the base substituting in 
the vanilla version.
2012-12-18 22:00:37 +00:00
Michael Piatek b9c7753494 Additional trace annotations. 2012-12-18 20:53:31 +00:00
Shawn Ligocki b5859bd764 Escape strings and URLs closer to the CSS spec requirements. The specific motivation for this is b/7695370, where we discovered that spaces need to be escaped in unquoted strings.
Changes:

No longer escaped: ,
Newly escaped: []{} and SPACE (in URLs)
2012-12-18 20:27:23 +00:00
Shawn Ligocki b55ed3fe64 Cleanup for the new Clang -Wimplicit-fallthrough warning. It replaces trivial comment annotations of switch label fall-through with compiler-verified annotations ("FALLTHROUGH_INTENDED;"). 2012-12-18 18:29:02 +00:00
Maks Orlovich 7f26642f48 Add a mode that lets testproxy serve from slurp
(needed for mps+mod_spdy loadtest), and clarify
the testproxy vs. slurp mode distinction.
2012-12-18 17:53:55 +00:00
Maks Orlovich 00303e2abc Change by vagababov:
Adds stats that report number of profitable JS rewrites.
2012-12-18 17:41:30 +00:00
Maks Orlovich fffe9bc623 Enable warnings on 4.6 as well, making sure to
provide -Wno-unused-but-set-variable when gcc supports
it even when the Chromium libraries we build against 
don't.
2012-12-18 16:24:04 +00:00
Michael Piatek 34f5547f65 Initial support for webp lossless and alpha: test UA, enums, URL encoder. 2012-12-18 02:09:23 +00:00
rahulbansal@google.com 3264919a19 Don't flush early when user agent is mobile. For mobile sites which have a 302, we'll end up flushing 200 status code early and will break them. 2012-12-17 23:11:53 +00:00
Maks Orlovich 92b245ca9f Bump our libpagespeed dependency to newest version, to
make some ultra-nice WebP optimization opportunities 
available to us.
2012-12-17 21:50:23 +00:00
Maks Orlovich 6c85a96d09 Change by jmarantz:
Remove broken type= attribute that was breaking CSS application 
in Firefox.
2012-12-17 21:46:44 +00:00
Shawn Ligocki b9a6504452 De-flake a system test that flaked for me just now. 2012-12-17 20:41:04 +00:00
ksimbili@google.com fb71e7476d Avoid IE quirks mode when deferJs is enabled.
Allow parallel downloads if deferJs scripts with firefox and IE.
2012-12-17 19:46:53 +00:00
Jud Porter ea5d1b2bc6 Remove the ?ets= query param from the end of custom beacon URLs and insert it with the JS instead. 2012-12-17 18:53:19 +00:00
nikhilmadan@google.com e10e7b06e0 Disable lazyload for nivo slider images. 2012-12-17 18:43:58 +00:00
Josh Marantz 5ca9cea438 Skip SCRIPT/NOSCRIPT/STYLE/LINK nodes while computing critical line
xpaths. Do the same in split_html filter while matching xpaths. (bharathbhushan)

Fix memory-leak in in-place resource optimization system test (jmarantz)
2012-12-17 16:43:31 +00:00
Shawn Ligocki b165eefc3d Enable serving rewritten resources in mod_pagespeed in the in-place resource optimization (IPRO, previously named AJAX) flow. As of this CL, we only serve rewritten versions if they are already in cache. Next step is actually doing the rewriting to stick them in cache. 2012-12-14 23:52:32 +00:00
Maks Orlovich c8a1bb3ede Harmonize creation of other_rewrite_driver_ in the test
harmess with that in rewrite_driver_ --- in particular 
I want it happening inside ::SetUp and not from the ctor 
to make virtuals overridable.
2012-12-14 22:53:01 +00:00
Michael Piatek f92ecb942d Purge some instances of synthetic RequestContext creation. 2012-12-14 21:58:44 +00:00
anupama@google.com 8c7aceb686 Adding pagespeed_low_res_src only for elements with img or input keyword.
We currently add pagespeed_low_res_src (and increment num_inline_preview_images)
        for anything that belongs the Image semantic category and this might be a
        link href in some extreme cases.
        
        This change fixes the bug that occurs due to the mismatch in expected number of
        inline_preview_images and the number of low res images acted upon by delay_image_filter.
        Previously, in such cases, we used to end up placing the delay-images-js and the low-res-data-maps
        only at the end of the body and not at the end of every flush window.
2012-12-14 18:06:29 +00:00
Josh Karlin 24ba0c950d Adds support for Cache-Control: no-transform.
Response headers containing no-transform on non-html resources will be obeyed.  The resources may still be cached, but they won't be optimized.  This addresses issue 587.
2012-12-14 13:32:35 +00:00
Shawn Ligocki ce9bdff4eb Change SkipPastDelimiter() from recursive implementation to directly manage it's stack of delims. 2012-12-13 21:35:43 +00:00
Shawn Ligocki 381fb3d258 Fix typo with use of shell variable in a Makefile. (matterbury) 2012-12-13 21:35:04 +00:00
Shawn Ligocki d59fa1b4ad Fix typo with use of shell variable in a Makefile. (matterbury) 2012-12-13 21:34:08 +00:00
nikhilmadan@google.com c0d13a5eae Don't lazyload images which have a data-src attribute. 2012-12-13 06:02:31 +00:00
Maks Orlovich d83be1bc19 Use proper locking even during tests for log records.
This should fix periodic failures of blink_flow_critical_line_test
and server_context_test, though unfortunately does mean we lose a
DCheck in LogRecord::log_system()

Also add AbstractMutex::DCheckUnlocked() and implement it in the
debugging CheckingThreadSystem::Mutex wrapper, to cleanup
the test in ~LogRecord.
2012-12-12 23:07:08 +00:00
Michael Piatek 17cd00084a Move trace context wrappers to util/. 2012-12-12 22:38:06 +00:00
Maks Orlovich 85322e2b16 Change by marq:
Include cleanup of logging refactor.
2012-12-12 21:40:54 +00:00
Maks Orlovich 0285d644df Change by vagababov:
Some code reordering for better readability and a few log statements.
2012-12-12 20:53:04 +00:00
Josh Marantz 961be84ebb Move DCHECK after a lock that protects a variable we were checking. 2012-12-12 18:31:08 +00:00
nikhilmadan@google.com 18caebd78a Add support to pre-emptively refresh finder properties at 80% of expiry. 2012-12-11 23:24:09 +00:00
Josh Marantz 40ffbf1a51 Update global_options->cache_invalidation_timestamp_ms by looking at
the copy in shared-memory statistics.  That is updated when the
cache.flush timestamp change is polled by another child process.
2012-12-11 20:42:50 +00:00
Michael Piatek 7ede683049 Hardening of the logging system and addition of logging to resource rewrites. 2012-12-11 20:23:05 +00:00
nikhilmadan@google.com 7a156532c7 Edit the Name() functions for CacheStats and CacheCopy. 2012-12-11 19:20:02 +00:00
Maks Orlovich 7f746fd3ac Change by bharathbhushan:
Log the short name for Flush Subresources in the response header.
2012-12-11 18:08:08 +00:00
Maks Orlovich 62bb7c9cc2 Add RefCountedPtr<T>::StaticCast to allow downcasts.
Also add upcasting assignment operators as well, to match
corresponding constructors.
2012-12-11 18:07:34 +00:00
Maks Orlovich 4612874f3f Change by nikhilmadan:
Use DetermineEnabled to disable lazyload and defer_iframe when appropriate.
2012-12-11 16:41:27 +00:00
Jud Porter 168276468c Use http protocol for opencv repository. 2012-12-11 15:57:47 +00:00
Maks Orlovich 1b271b45fd Convert some tests to use named virtual hosts,
rather than custom configuration files.
2012-12-11 15:11:16 +00:00
Josh Marantz a4dcb0fc37 Added statistic for HTTPCache "fallbacks", when an stale value is handed
back along with a cache miss.  The intent of this change is to add
monitoring to investigate whether a better cache "freshening" policy would
increase the cache hit rate. (gee)

Remove non-compliant optional-args and non-const last-args. (jmarantz)
2012-12-10 21:17:46 +00:00
Shawn Ligocki f2d5938a82 Stop parsing all sorts of non-sense as identifiers and instead let preservation of non-standard syntax be taken care of by preserving unparsed regions.
This means that we can correctly escape all identifiers in css_minify.cc, getting rid of a lot of TODOs.
2012-12-10 19:54:37 +00:00
Maks Orlovich fdd9d0cb78 Add scheduling/threading for mod_spdy fetches (so they
no longer just block whenever invoked!), though the
thread/queue setup is very coarse.

Also fix a dangling memory access to message body --- the
Apache -> MPS filter was getting the AsyncFetch deleted by
calling ::Done a bit earlier than MPS -> Apache filter
was run for the last time and was accessing that.
2012-12-09 22:30:52 +00:00
Josh Marantz cceba559c1 Make 'rewrite_images' and 'recompress_images' imply
convert_jpeg_to_progressive, now that it's in the core set.

Changed some 'furious' experiment test infrastructure, which was
exploiting the difference between explicitly setting progressive-jpeg
and not, to explicitly *disable* progressive_jpeg in the opposite
experiment so the test results come out the same.
2012-12-08 00:25:55 +00:00
Shawn Ligocki fdc71d709f Stop failing CSS combine just because there are unparsable regions in CSS. In order to make this safe, I go through and tighten up CSS parsing to make sure that it does not allow us to pass through unparsable sections which would cause an error in one stylesheet to invalidate later stylesheets that were combined with it. For example, I make sure that we appropriately match (){}[] and quotes when skipping to the end of unparsable sections.
Fixes issue 565 and static_file_rewriter_test.
2012-12-07 23:44:08 +00:00
Jeff Kaufman b4d09330bb Make system test less flaky 2012-12-07 22:58:45 +00:00
Shawn Ligocki 3181aeb3ed Fix broken test 2012-12-07 21:20:03 +00:00
Josh Marantz 31ac8d05f9 Fix compiler warnings found in g++ 4.6 2012-12-07 19:08:09 +00:00
Jud Porter cb6ab22841 Fix shutdown segfaults during WriteDomCohortIntoPropertyCache. 2012-12-07 18:43:15 +00:00
Josh Marantz 8b52f7132b Add convert_jpeg_to_progress to the core-filter set. 2012-12-07 18:28:28 +00:00
Josh Marantz f4bb391064 Fix 'debug' filter issue found load-test. 2012-12-07 17:00:12 +00:00
Josh Marantz ae606d5520 Don't run the timeout test by default as it's inherently flaky. Require developers
set an env var to run it.
2012-12-07 14:56:09 +00:00
ksimbili@google.com 1d207195e5 Move all deferJs code to one place.(ksimbili) 2012-12-07 01:09:15 +00:00
Michael Piatek 0de9a46c98 Improve Chrome detection in UA matcher. 2012-12-06 18:11:03 +00:00
Jan-Willem Maessen 23e39d932f Fix PWD bug in install Makefile 2012-12-05 23:49:28 +00:00
Michael Piatek 5632646b1f Use the unmodified rewrite_deadline_ms for IPRO, update docs.
Do not lazyload images inside marquee tags since they scroll and hence the
position determined may be wrong.

Handle a couple of TODOs for split_html.

Moving sync creation before the critical section in Detach so that it is
created before the collector is deleted.
2012-12-05 23:43:45 +00:00
Jud Porter 23b3bbe909 Purge system test shell scripts of the "<(foo)" pattern to make tests easier to debug. 2012-12-05 21:11:42 +00:00
Jud Porter 3149bb43af Add insert_dns_prefetch. 2012-12-05 21:10:56 +00:00
Shawn Ligocki 545a2b0b07 Never use "quirks-mode" parsing for CSS. We don't want quirks-mode because:
A) Our guess of when to use quirks mode is != to the browsers and if we "fix" something from quirks-mode format to actual CSS format, we could change the look of site (oy) and
 B) Our logic for when we decide to use quirks-mode isn't even consistent. We do it for CSS found in HTML, but if we get a request for the same CSS from the same UA, but don't have the result in cache, we will redo the parse, this time in quirks-mode (just to be safe).

I think the only reason that we originally used quirks-mode parsing was that it allowed us to parse more stylesheets, but now with "unparsed section" handling, we can still parse these stylesheets, just ignoring the quirky sections.
2012-12-05 21:01:00 +00:00
Shawn Ligocki 452f0bf6b4 Remove the check for critical line info present.
Always send blink js in split instead of falling back to deferjs-js when xpaths are absent.
Support logging for split_html rewriter.
    	    	
This fixes broken pages on WPT benchmarks when critical line info was
absent but critical images are present. It might fix other issues too. (bharathbhushan)
2012-12-05 20:58:00 +00:00
Jud Porter 97a7e0efeb Enable property cache by default, allowing the insert_dns_prefetch filter to work. 2012-12-04 21:36:14 +00:00
Josh Marantz bbc3a45386 Disable adding of GA code to iframe html pages.
In sites like www.lifed.com, ad iframes are loaded from the same domain (lifed)
and our addition of the GA snippet (in case of live experiments) causes extra pageviews
to be recorded for these pages, causing analytics data to be distorted. (anupama)

Run 'apache_release_test' without symlinks so we see whether testdata
is complete. (jmarantz)

Don't fail AprMemCache* tests when memcached is not running and the
port is unspecified. (jmarantz)
2012-12-04 19:03:00 +00:00
Maks Orlovich 6707b41b0e Rename tests.mk -> Makefile.tests to unconfuse some internal
tools.
2012-12-04 18:02:36 +00:00
Josh Marantz a0d175579f Adds an option ModPagespeedMemcachedTimeoutUs to specify the memcached I/O
timeout in microseconds.
2012-12-04 16:58:36 +00:00
Josh Marantz 466a0b2487 Only disable downstream headers for resource requests & HTML requests where we have
ModifyCachingHeaders on.  When ModifyCachingHeaders is turned off, we should let the
downstream header filters. run.

Fixes Issue 367
2012-12-04 16:08:51 +00:00
Maks Orlovich 63da8a77e3 Fix typo in integration test resulting in this:
Image doesn't get rewritten when we turn it off with headers.
wget: missing URL
Usage: wget [OPTION]... [URL]...
Try `wget --help' for more options.
install/system_test.sh: line 103: --header=ModPagespeedFilters:-rewrite_images: command not found
2012-12-04 15:58:20 +00:00
Maks Orlovich 1d503e98c8 (Change by anupama):
Add to our advanced beacon, the following blink timing metrics (with the mentioned query parameters):
CRITICAL_DATA_RECEIVED (b_cdr)
CRITICAL_IMAGES_INLINED (b_cii)
CRITICAL_IMAGES_LOW_RES_LOADED (b_cilrl)
CRITICAL_IMAGES_HI_RES_LOADED (b_cihrl)
NON_CACHEABLE_DATA_LOADED (b_ncdl)
NON_CRITICAL_LOADED (b_ncl)

Also, change the recorded start time to use window.performance.timing.navigationStart whenever available.
2012-12-04 15:36:49 +00:00
Shawn Ligocki bee019d5c5 genfile update: increase chars in library identification hash 2012-12-03 21:29:49 +00:00
Shawn Ligocki 37b4d6da4f Make CSS tests much easier to debug by only printing the inline CSS text diff if there is one (not all the subsequent stat diffs and then the external CSS HTML diff, etc.) 2012-12-03 21:28:23 +00:00
Jan-Willem Maessen ee3e69b42e Config & package generation changes for Canonicalize JavaScript Libraries 2012-12-03 19:14:11 +00:00
mmohabey@google.com 367c49bf95 Undo some of the reverts in previous commit. 2012-12-03 19:07:52 +00:00
mmohabey@google.com 12c65b9791 Adding a stability function in property cache which tells whether the last
n writes were for the same value. This will be used to determine wheather 
the status code stayed the same in previous n requests. (mmohabey)
2012-12-03 18:59:38 +00:00
Jeff Kaufman aa3e79c7c1 pagespeed_automatic.a was missing libassert 2012-12-03 18:36:36 +00:00
Josh Karlin 0be0683f88 Adds directive ModPagespeedRewriteDeadlinePerFlushMs.
This directive provides control over how long mod_pagespeed will wait to optimize a resource per flush window before putting the optimization task in the background (for future requests) and returning the unoptimized resource to the user.
2012-12-03 16:13:25 +00:00
Maks Orlovich 99a385ea85 Fix behavior of in-place resource optimization when it's asked to
deliver an https resource with a fetcher that doesn't do https.

It used to basically just drop the request on the floor, not calling 
the callback. The resulted in 5-second freezes until time out and 
leaked rewrite driver on apache_debug_smoke_test with the not-quite-
done-yet change to add the feature to mod_pagespeed.
2012-12-03 00:24:59 +00:00
Maks Orlovich efa6445c4d Add a simple set of links to permit getting to config
pages from the statistics page, and also stop showing
statistics on config pages.
2012-12-02 23:30:23 +00:00
Jan-Willem Maessen 7dc3b4536d Increase hash size for library recognition 2012-12-02 21:32:41 +00:00
Jeff Kaufman 4f7194f174 support PAGESPEED_EXPECTED_FAILURES; mark tests with start_test 2012-11-30 21:57:18 +00:00
Josh Marantz f6472fcfb5 Update the bail-out-on-huge HTML test so that we don't have to pick a
low limit (50k is annoying for other tests) or make huge files to put
in people's clients.
2012-11-30 21:02:26 +00:00
Shawn Ligocki f1d49fc108 Quote attribute selectors values. Values do not technically need to be quoted (it appears), but they are basically string matching and can contain spaces, so seems reasonable to always quote them.
Fixes issue 575.
2012-11-30 20:43:23 +00:00
Josh Karlin faed48dfd1 Fixed a bug in in-place flow in which simultaneous requests for the same resource could cause a check failure. 2012-11-30 19:53:31 +00:00
Jud Porter 2b789a6858 Move add_instrumentation js to static_js_manager. 2012-11-30 19:50:58 +00:00
mmohabey@google.com e17b19d53b Store status code in property cache. 2012-11-30 19:33:04 +00:00
Shawn Ligocki e453553465 More aggressively escape identifiers.
For example: #MyForm\.myfield { ... } should not be re-serialized as #MyForm.myfield { ... } (which has different semantic meaning).

I also separated identifier escaping from string escaping to avoid making that so strict.

Make SimpleSelector::ToString() always return an escaped identifier and don't double escape it.

Fixes issue 574.
2012-11-30 19:32:46 +00:00
Michael Piatek 3251a03fcc Rename many params resource_manager -> server_context. 2012-11-30 18:37:06 +00:00
Matt Atterbury 9ec1b33be9 Implement a new directive ModPagespeedForbidAllDisabledFilters that
prevents the turning on of filters using query parameters or headers
if the filter is not already enabled. This is to allow site admins to
lock off filters that they never want to run, for example for
performance or security reasons.
2012-11-30 17:46:44 +00:00
Josh Marantz 602bd9420e Add a virtual-host under #SLURP on port 8082 that allows 1M bytes
of HTML, authorizes all domains, and is in slurp-write mode.
2012-11-30 14:40:47 +00:00
Josh Marantz a6a3af235d Make SplitStringUsingSubstr use stringpieces. 2012-11-30 04:10:58 +00:00
Josh Marantz 9f9984d5b5 Changes needed for blink/deferJs to work with mobile user agents.
- Added mobile user agents for deferJs and mobile.
- Added a flag 'enable_aggressive_rewriters_for_mobile'  (ksimbili)
2012-11-30 03:40:19 +00:00
Maks Orlovich 6c193fc844 Generate Conflicts: and Replaces: headers towards other channels
for .deb's to make it easier for people to switch between 
beta & stable.
2012-11-28 22:32:08 +00:00
Maks Orlovich 5f60bdcc31 Verify caching headers of constructed CSS across many
tests, including CssImageCombineTest.SpritesImagesExternal
2012-11-28 21:23:10 +00:00
Maks Orlovich 13715df678 Drop the executable bit. 2012-11-28 21:19:15 +00:00
Michael Piatek 9bef5b84b0 Add request_context and a scaffold for tracing. 2012-11-28 21:09:04 +00:00
Jan-Willem Maessen bd7684a638 Add configuration for library identification that by default identifies the libraries hosted on ajax.googleapis.com. Document library identification flags in the configuration better. 2012-11-28 20:50:26 +00:00
Matt Atterbury 703e2260fe 1. Report IP address and user-agent in statistics.
2. Fixed local_storage_cache filter (again, and hopefully finally, sigh).
2012-11-28 19:55:48 +00:00
Maks Orlovich 51beab54be Attempt to fix Oom tests crashing on 64-bit packaging
machines.

Believed to fix issue 564
2012-11-28 17:37:59 +00:00
Josh Marantz 44a924278c Add a Debug filter implementation which annotates timing in HTML
comments.  Note that we already had a filter named 'debug' but it
only enabled debugging features in other filters.

Adjust the testing of css_combine_filter's debug mode and fix its
custom Flush messages (which were wrong at end-of-doc).
2012-11-28 13:50:08 +00:00
Michael Piatek 86ac4bb08c Support for video content types. 2012-11-28 00:53:38 +00:00
Josh Marantz 3e9116c21f Remove the old scheduler in MockTimeCache and port all the
tests in mock_timer_test.cc into mock_scheduler_test.

Make mock_time_cache always-active in TestRewriteDriver, though it's
dormant unless awakened by RewriteTestBase::SetCacheDelayUs.

Remove direct access to the MockTimer, as time should now only be
adjusted via the scheduler.  Add helper methods to advance time in the
scheduler to RewriteTestBase and TestRewriteDriverFactory.
2012-11-27 22:29:48 +00:00
nikhilmadan@google.com b8c0427dc2 Add statistics to keep track of the number of hits / misses / expiries for critical images. 2012-11-27 18:41:42 +00:00
sriharis@google.com f0664d287a Fix blink info logging when we have a cache hit with diff enabled. 2012-11-27 07:04:47 +00:00
Michael Piatek 37d2a40389 Add test case for Chrome iPhone webp test (to make sure webp not supported) 2012-11-26 22:19:51 +00:00
Michael Piatek 4068a70c7d Rename several ApacheResourceManager methods to ApacheServerContext. 2012-11-26 20:54:58 +00:00
Huibao Lin ab1faa6fc0 Remove temporary files. 2012-11-26 16:04:22 +00:00
Huibao Lin f2ec6ba3cd Add option for controlling maximum cacheable response content length. 2012-11-26 16:01:21 +00:00
Josh Karlin ab36cf800d Support for pagespeed_no_transform attribute in img tags. 2012-11-26 14:25:43 +00:00
sriharis@google.com 38f62863ac Add an option to set non-cacheables that apply for all blink families.
Partial includes change for util/utf8/public/...
2012-11-22 09:27:58 +00:00
Josh Karlin 6651cdff93 Adds the option InPlaceWaitForOptimized so that the in-place path returns an optimized resource on first request if the rewrite deadline is not exceeded. 2012-11-21 19:50:41 +00:00
Michael Piatek 06b6d11d1f Rename ApacheResourceManager -> ApacheServerContext. 2012-11-21 19:34:19 +00:00
Jan-Willem Maessen 49066dff94 Remove trademarked and copyrighted logo from repository (it should never have been there in the first place). 2012-11-21 19:29:59 +00:00
Maks Orlovich 34cd58f448 Fix 3 bugs affecting mod_spdy_fetcher (undetected since I was
"testing" with a MapOriginDomain http://localhost:8080 https://localhost:8443!)

- It's insufficient to check whether connections are using SSL since 
with actual SPDY connection slave connections won't (but they'll still 
have handy SPDY version info)

- Teach LoopbackRouterFetcher to deal with different schemas, now that 
https is a possibility. Also run it after mod_spdy_fetcher since we don't 
want to be messing with the hostname, and mod_spdy_fetcher has its own
"talk to ourselves!" mechanism.

- Produce the EOS bucket separately, batching it with the data seems to 
upset the header reader in Apache, and doing it together is problematic in
cases the last data read is speculative.
2012-11-21 18:54:50 +00:00
sriharis@google.com 816598c564 Integrate critical line and critical image computation. 2012-11-21 16:12:25 +00:00
pulkitg@google.com 88738244d7 Flush more resources in IE and firefox.
- Images are flushed using inline script and this inline script is first thing in the flush head section so that this script will not get blocked because of other resources.
- Scripts will be flushed only if defer_javascript is disabled.
2012-11-21 12:15:15 +00:00
ksimbili@google.com 588fbb605f - Move DeferJs code to the end of the HTML.
- Giving an ability for filters to bail themselves out when they don't
      want to be enabled for certain requests based on user agent etc.(rahulbansal)
2012-11-21 01:24:09 +00:00
Josh Marantz 58aceedfaa Eliminate unused variables and always-true conditionals. Test/fix a
case where MultiGet is called with no servers available, which SEGVd
in apr due to strange handling of that corner case.
2012-11-20 22:51:44 +00:00
Maks Orlovich 1683903f5b Fix version number of trunk to not be way lower
than releases.
2012-11-20 21:11:17 +00:00
Maks Orlovich 858c03efa9 A very early prototype of a mod_spdy fetcher. This is not
ready for any real use, as it's blocking, and lacks any
thread/queue management. However, it is a first reviewable
step.
2012-11-20 18:53:09 +00:00
Maks Orlovich 132e840d87 Deal correctly with libraries identified during AJAX rewriting.
Added a test, and a slightly better error message for cases like this one.  
These were yielding DFATALs during a load test.
(jmaessen)
2012-11-20 18:23:56 +00:00
Maks Orlovich 106a010e2e - Fixing firefox double requests issue in lazyload_images (ksimbili) 2012-11-20 18:22:38 +00:00
nikhilmadan@google.com f2ca679d1b Log time to start parse and time to fetch for html pages.
Extend the cache lifetime of metadata for resources which are 4xx errors / private.
Make split_html support the same browsers as deferjs.
2012-11-20 02:42:45 +00:00
Matt Atterbury d71f80ddbf 1. Removed unused method IsMachineLocal().
2. Invoke value-initializing constructor.
2012-11-16 21:07:39 +00:00
Shawn Ligocki 2a049ef721 De-flake "TEST: Query params and headers are recognized in resource flow." test. 2012-11-16 20:00:29 +00:00
Shawn Ligocki 1cf6832fc9 genfile 2012-11-16 19:59:47 +00:00
Josh Marantz 12972f8c0e Remove redundant string conversions: calls of GoogleString::c_str(),
StringPiece::ToString(), and StringPiece::as_string() made in
contexts where it is more efficient to use the original string
directly.

Factor out some stats collection hacks unto a helper function.  Add
a TEST: message where one was missing.  (jmarantz)
2012-11-16 16:43:39 +00:00
Josh Marantz 523de56058 onloads in HTML elements are deferred using an extra attribute on the
element.  This is needed for a subsequent change, which moves the
deferJs/blinkJs code to bottom of the HTML rather than in the <head>.  (ksimbili)

Make cache_url_async_fetcher_test.cc compile on g++ 4.1 by avoiding the passing
of empty-constructed class instances with private copy-ctors.
2012-11-16 15:46:31 +00:00
Matt Atterbury cf4a941c9c Stop scary message when installing on Debian, caused by a config file
not being marked as such.
2012-11-14 21:33:19 +00:00
Matt Atterbury bc9fbe601c mplement a new ModPagespeedForbidFilters to disallow the enablement of
disabled filters via headers or query parameters.
2012-11-14 21:32:05 +00:00
Josh Marantz f3f5f7db64 Move the smart "apachectl stop" functionality from a development
Makefile rule to a script so it can be re-used in installation tests
etc.
2012-11-14 19:19:29 +00:00
Josh Marantz ba76f7a208 Revert a change to the 'ico' file that was accidentally committed 2 revs ago. 2012-11-14 00:34:10 +00:00
Josh Marantz 6f5bcaf854 Address http://code.google.com/p/modpagespeed/issues/detail?id=567 --
downgrade "shutting down child" from Error to Info so this will happen
silently.

Address http://code.google.com/p/modpagespeed/issues/detail?id=568 --
Keep track of which process first noticed a cache.flush and only
print the message once.
2012-11-14 00:27:42 +00:00
Josh Marantz 6776d9e2a4 Not triggering flush early flow if the previous response has HttpOnly cookie
set in reponse headers.  (mmohabey)
2012-11-14 00:21:21 +00:00
Maks Orlovich a07d3e65b7 Update mod_pagespeed to be able to build against newer Chromium libraries
(r161115), but don't flip over the switch yet, as we also need libpagespeed
to be updated, which it should be able to do after this is in.

The bulk of the change is in needing to indirect to scoped_ptr.h as it's
now in a new place; with an addition of a version check for stl_util.h
rename and some build system adjustments, most notable of which is passing
of Chromium version from gclient to gyp to a #define.

Most of the work for this change was done by Libo Song (lsong@)
2012-11-13 23:05:48 +00:00
Josh Marantz 020a9ff691 Serve HEAD requests from cache. Do *not* cache fetched HEAD results,
as they should not be used to serve subsequent GET requests. (gee)

Stop running 'atime' tests under valgrind. (jmarantz)
2012-11-13 16:14:40 +00:00
Maks Orlovich bdbb649dba Update WebP version, in advance of updating the Chromium version.
This requires tweaking the minimum recognizable file size threshold
again.
2012-11-12 21:18:24 +00:00
Maks Orlovich 397bd6c968 Update the shim layer under the CSS parser to permit
building under newer Chromium versions.
2012-11-12 21:14:20 +00:00
Maks Orlovich 9756ef08c5 - Uncomment canonicalization in system tests which is not flaky
for me anymore.  Will revisit. (jmarantz)
- scoped_ptr API use cleanup (dcheng)
2012-11-12 20:30:50 +00:00
Michael Piatek 50f06a83e9 Break down the number dropped image rewritters for various reasons.
htmlcolor CSS tweaks.
2012-11-10 01:53:08 +00:00
Josh Karlin b285319f6b A fix to response header directive processing to handle Apache's err_headers out and headers_out. 2012-11-09 19:03:01 +00:00
Josh Marantz f381428425 Add new feature to proxy external resources from a domain not controlled by mod_pagespeed.
Fixes Issue 557
2012-11-09 14:57:11 +00:00
Josh Marantz 379c9f955e Add & run cache_url_async_fetcher_test.cc. (gee) 2012-11-09 12:48:39 +00:00
Michael Piatek cb37f64d8b Per-page rewrite timeout. 2012-11-08 18:48:22 +00:00
Jud Porter aa0ddad108 Fix system test related errors. 2012-11-08 16:25:25 +00:00
Josh Marantz 318fac8c8f Re-arrange resource-handling logic for defer-js to make it resilient
to mod_rewrite mangling.  Rather than looking at the path in the request
(which might be affected by mod_rewrite), we look at the full URL we
stored in the note, which we must then decompose with GoogleUrl.  To
avoid adding an extra url-parsing step, we do that only in the logic
that handles the url from the note after we failed to parse it as a
.pagespeed. resource. (jmarantz)

Update RewriteDriver method documentation to reflect reality (matterbury)
2012-11-08 16:22:43 +00:00
Matt Atterbury 4acd9f7c5f Updated method comment to reflect reality. 2012-11-08 14:48:24 +00:00
Josh Marantz e2992f4be0 Fix some testing glitches that prevent testing binary builds on VMs. 2012-11-08 00:58:39 +00:00
rahulbansal@google.com 037b32498a Making flush early checks more consistent 2012-11-07 23:01:26 +00:00
Jan-Willem Maessen e12a869ae2 Fix comment to document likely source of confusion. 2012-11-07 19:57:07 +00:00
Matt Atterbury da116055ff If we never kick off a fetch, fail the callback immediately since it will never be called otherwise. 2012-11-07 18:12:30 +00:00
Josh Karlin f757cafcd8 Add ImagePreserveURLs, CssPreserverURLs, and JsPreserverURLs parameters.
These parameters prevent filters from modifying URLs when rewriting
HTML documents. The filters are loaded into memory but not applied in
the HTML rewriting path.
2012-11-07 16:43:04 +00:00
Jeff Kaufman 8dac164ec2 minor typo 2012-11-07 16:12:59 +00:00
Jan-Willem Maessen 2dde269b71 Revise JS library identification to prevent subsequent filters from attempting to optimize identified libraries. 2012-11-06 23:58:27 +00:00
Jud Porter 8357d930c1 Fix build issues encountered during 1.1.23.1. release process. 2012-11-06 20:50:19 +00:00
Josh Marantz c74eca0683 Split off resource_update_test.cc from rewrite_context_test.cc,
merging a few test-classes together that only added helper methods.
Finish moving the non-trivial RewriteContextTestBase methods into the
cc file. (jmarantz)

Outlining defer_javascript code which will be served from the server
or GStatic (ksimbili)
2012-11-06 20:41:08 +00:00
Maks Orlovich e0656f3e4e Factor out guts of RateControllingUrlAsyncFetcher into a separate
RateController class, so that one RateController object can be used
with multiple (ModSpdyFetcher) fetcher objects.
2012-11-06 19:14:17 +00:00
Maks Orlovich 072c3c0f38 Grab mod_spdy into our tree, so I can access its headers. 2012-11-06 18:32:00 +00:00
anupama@google.com a007979ede - Set is_original_resource_cacheable set to false for non-Get requests.
- Moving GA js snippet to end of body and simplifying our furious snippet to not carry anything other than the setSiteSpeedSampleRate call and the custom variable setting for denoting the experiment.
2012-11-06 12:11:02 +00:00
Maks Orlovich f4a0004964 Fix build with older system OpenCV. 2012-11-05 20:24:56 +00:00
Josh Marantz 8688ce31e2 Don't delete metadata cache on a lock failure. 2012-11-05 19:50:31 +00:00
Shawn Ligocki b9763bc458 Respect X-Forwarded-Proto which is used by (at least) AWS load balancer to indicate the original URL protocol (https or http).
Fixes issue 546.
2012-11-05 19:42:01 +00:00
Josh Marantz f0d2a12e47 When panels are not present, only send defer js. (rahulbansal)
Break up rewrite_context_test.cc into multiple test files.  (jmarantz)
2012-11-05 18:26:19 +00:00
Josh Marantz 67fc71aac9 Bump up the max queue size to 2000 to avoid dropping cache writes the first time we see a page. 2012-11-02 20:28:31 +00:00
Maks Orlovich 3ac41ef799 Don't do quick (but potentially harmlessly leaky) shutdown
while leak-checking, and give processes more time to wrap 
under valgrind, too.
2012-11-02 19:05:55 +00:00
Josh Marantz 4608ebd5ac Don't print out a message when mod_pagespeed is shut down from the
root process; only the child.
2012-11-02 18:11:17 +00:00
Josh Marantz 71bc035396 Use thread-compatible pools in apr_mem_cache.cc, refactoring out
support code that was added to serf_url_async_fetcher.cc.
2012-11-02 17:25:58 +00:00
Maks Orlovich 76bc9877ef Fix race in ResourceFetch::BlockingFetch --- ResourceFetch was
Clean()ing up the driver while we were still waiting for it.

This in particular resulted in check failures of waiting != kNoWait
in CheckForCompletionAsync during load test w/worker MPM, as
a 2nd resource request would begin waiting for completion of a RewriteDriver
released by ResourceFetch of a first one, while first one was
still waiting on it.

Also make sure to capture the cleanup bool in FetchCompleteImpl 
properly within the critical section.
2012-11-02 16:44:31 +00:00
Josh Marantz 1fddb15831 Shut down memcached earlier in the shutdown flow, and move the
shutdown of the message-buffer later.

Make more options accessible in .htaccess, tweaking some doc bugs.

Fixes Issue 555.
2012-11-01 22:08:41 +00:00
Shawn Ligocki 7d71e8e7e3 Use DomainLawyer to map outlined resource URLs.
Fixes issue 416.
2012-11-01 21:38:40 +00:00
Maks Orlovich f3d8d365a3 Removing a test that breaks MPM worker apache_system_test.
(jkarlin)

This test will come back once issue 533 is resolved
http://code.google.com/p/modpagespeed/issues/detail?id=533
2012-11-01 20:16:46 +00:00
Josh Marantz af56d7ed58 Remove shutdown assertions when shutting down with detached rewrites pending. 2012-11-01 19:03:01 +00:00
Josh Marantz 6817eb686e Avoid wrapping malformed script tag contents beginning with
CDATA with another Cdata.  

Fixes Issue 542.
2012-11-01 17:56:11 +00:00
Josh Marantz ff5d7728a2 Encode key into value in mainline. 2012-11-01 17:51:35 +00:00
Josh Marantz 6c5e9971f9 Stop writing log statements when Deletes fail -- this happens a lot
with memcached.
2012-11-01 16:51:04 +00:00
Josh Marantz a8c41fddf4 Add polling & timeouts to apr_memcache. 2012-11-01 11:50:46 +00:00
sriharis@google.com 50a0e911c4 Add css critical images field to critical line proto. 2012-11-01 09:21:17 +00:00
Shawn Ligocki 07760a32d4 Remove strings/stringpiece.h from .gyp, that file doesn't even exist any more (I'm surprised we didn't get an error that it didn't exist). 2012-10-31 21:06:22 +00:00
Shawn Ligocki c8d9142bab Respect ModPagespeed query params and headers in the .pagespeed. resource flow. Previously, they were only respected in the HTML flow. 2012-10-31 19:38:06 +00:00
Josh Karlin 1c7413c4b6 Parse response headers for mod_pagespeed specific options.
This is similar to how mod_pagespeed parses query_parameters and request headers for options. The major difference is that response headers are only parsed for HTML pages, not resources.

Fixes issue 160.
2012-10-31 17:45:44 +00:00
Maks Orlovich d9b6494f20 Add a new API for filters to mark slots as unsafe for further
operation by later filters. Update existing filters with that
functionality, and add tests to show that we don't half-do cache
extending pointlessly like we used to before this change.

Also fix the cache extension count stat; it was counting up
when -any- filter optimized the slot, not just the cache extender.
(arguably justifiable, but less so given filter ID logging).

This does not yet attempt to deal with the case where we actually
want to run a filter even if some of its input slots are marked
as unsafe for further processing. (Will be needed for JS combiner
when library identification is on).
2012-10-31 14:36:28 +00:00
Josh Marantz 52739b7c0f One more try at de-flaking QueuedWorkerPoolTest. 2012-10-30 22:55:53 +00:00
Josh Marantz 57dfc20089 Use 20-char hashes for the memcache.
Provide the correct scale for the html rewrite time histogram.
2012-10-30 22:09:24 +00:00
Josh Marantz 30fed4aed0 Track health of memcached & resume operations. I decided to make the
timescale of health checks 30 seconds, and to revert the squelching of
log messages.  While the log messages may fill disks, eventually, at
~5 messages every 30 seconds it would take a long time, and it's very
nice to have the messages for forensic value.
2012-10-30 21:10:19 +00:00
Josh Marantz c418a03d9f Clean up mechanism for punting resource-rewrites on unhealthy cache
so we get a consistent view.

In most cases the canceling of RewriteContexts is done centrally in
RewriteDriver, deleting the contexts rather than adding them to the
queue.  The exception is CssFilter which holds onto a created
RewriteContext after attempting to initiate it, so in that case we
most proactively avoid adding the filter.

In all cases we unit-test the filters both for HTML-Rewrite & Fetch
with unhealthy caches.
2012-10-30 21:04:44 +00:00
Josh Marantz ee34ccaf3a Skip AprMemCache tests if MEMCACHED_PORT is not set.
Fixes Issue 549
2012-10-30 20:19:05 +00:00
Maks Orlovich a63ebc3be0 Optionally dump stack traces on crash. (Shame it's only for a single thread, though).
Turn this on in the load test config template.
2012-10-30 19:51:34 +00:00
Matt Atterbury cea5528074 1. Refactor the mapping of Filter enum values to id and name.
Added an id->enum lookup function for use by forthcoming directives.
2. More system-test tweaks to get better diags info.
3. Another attempt at making QueuedWorkerPoolTest less racy.
2012-10-30 17:52:34 +00:00
Josh Marantz a3aacb6d9e Make shutdown flow more robust. 2012-10-30 01:29:19 +00:00
Matt Atterbury 349eb9f1b9 Redo how the filesystem metadata cache works: store the per-host file
attributes (mtime timestamp + contents hash) in the metdata cache with
a key that includes the server hostname and the file path. This way we
don't have to configure anything special and there is no stomping of
each other's attributes by different hosts. This works if we're using
memcached or the file system for the metadata cache so there's no need
for configuring or enabling.
2012-10-29 20:17:53 +00:00
Matt Atterbury 641aec7da0 Add a method to ServerContext to get the server's hostname. 2012-10-29 19:58:45 +00:00
Maks Orlovich 8897d6c382 Implement missing StdioFileSystem::TryLockWithTimeout (mostly by stealing
the implementation from AprFileSystem). Make it testable in open-source.

Also make StdioFileSystem default for Apache. The Apr file system
accumuleaks memory into a pool, and fixing it would require allocating
a temporary pointless pool on just about every operation on top of existing
wasteful lock acquisitions, making it considerably less efficient than just
asking the OS.

(The bulk of the change is just injecting a new constructor argument to
StdioFileSystem all over the place).
2012-10-29 19:49:04 +00:00
Maks Orlovich 04cb0976d6 Flag code to to use new image_recompress_quality flag instead of
images_recompress_quality flag. (poojatandon)
2012-10-29 19:24:38 +00:00
Matt Welsh 9d9609aec7 Adding Furious spec ID to logging.proto (mdw) 2012-10-29 17:34:59 +00:00
Jan-Willem Maessen 80ea72377f Fix single-dimension image resizing to round rather than truncate the other dimension. This matches WebKit behavior. 2012-10-29 15:31:14 +00:00
Matt Atterbury f2e3d83883 1. Fixed typo in test script.
2. Added URL to assertion failure message.
2012-10-29 14:33:17 +00:00
Maks Orlovich a3535d86d0 Permit using the rate-limitting fetcher w/Serf in mod_pagespeed,
which may be useful for some high-traffic deployments.
2012-10-29 00:41:43 +00:00
Maks Orlovich 94e7f841ac Make system-test more debuggable by switching to check_from. (jmarantz) 2012-10-28 17:38:04 +00:00
Josh Marantz 1e6299b643 Don't attempt HTML resource rewrites with an unhealthy cache.
But make sure that we can still reconstruct rewritten resources when 
they are fetched, even though we will have to do the fetch from 
origin & re-run the optimization each time. 

Also adds in a CacheInterface ShutDown() method though it's not used yet.  This will be needed soon.
2012-10-26 22:19:58 +00:00
Josh Marantz a77de91298 Fixes another test race by delaying a check until after the pool has been shut down. 2012-10-26 20:08:19 +00:00
Josh Marantz 48a2934cdb Resolve test-race following direct calls to Delete(). 2012-10-26 18:23:54 +00:00
Josh Marantz 04b56975f4 Util support for robustness with unreliable caches. Adds a new CacheInterface
method for determining health.

Use a thread for all cache operations in AsyncCache, and simplify that
class and its testing to allow only one concurrent thread.
2012-10-25 22:16:02 +00:00
Maks Orlovich 59bb3c8679 Don't leak rewrite drivers on whitespace-only pages. 2012-10-25 18:38:55 +00:00
Matt Atterbury d144b8445a Implemented the FilesystemMetadataCache for use with memcached cache, to handle
differing file timestamps across servers.
2012-10-24 22:04:07 +00:00
Josh Marantz fe82b3562a Synchronize access to buffer_ to resolve a shutdown race that showed
up as a crash during a load test.  buffer_ was checked at the top of
ApacheMessageHandler::MessageVImpl but used later on without a lock.

Restore change 2090 which had accidentally gotten squashed:
    Unbreak the 2-server setup of load tests (morlovich)

    Switch from 'check' to 'check_from' in a few places to
    help debug some breakage. Fix that breakage -- In Apache 2.4 we are seeing
    W/"0-gzip" as the etag.  (jmarantz)
2012-10-24 20:33:26 +00:00
sriharis@google.com 26da8f6a96 Move GetQueryOptions and GetCustomOptions from proxy interface to server
context.  Also refactor mod_instaweb.cc to use GetQueryOptions from
ServerContext, and move the XmlHttpRequest check to request_headers.  (sriharis)

Make lazyload not load the images if they are hidden. Load them after onload. (ksimbili)
2012-10-24 11:34:12 +00:00
nikhilmadan@google.com 70c6278c5f Change the lazyload 1x1 gif to a transparent one. Also, add the option to gperf. 2012-10-23 23:15:42 +00:00
Josh Marantz 5635d1b7fe Unbreak the 2-server setup of load tests (morlovich)
Switch from 'check' to 'check_from' in a few places to
help debug some breakage. Fix that breakage -- In Apache 2.4 we are seeing
W/"0-gzip" as the etag.  (jmarantz)
2012-10-23 22:54:35 +00:00
Jan-Willem Maessen 75b042aa57 Apply dely_images to input elements with image type. 2012-10-23 20:47:30 +00:00
Josh Marantz 7c51262d01 Clone apr_memcache.c into apr_memcache2.c so we can fix the
hangs in it.

More ERROR downgrading. (sligocki)
2012-10-23 19:31:44 +00:00
Jan-Willem Maessen 0efeb07e1c Fix includes in net/instaweb/apache. 2012-10-23 19:02:07 +00:00
Jud Porter 2f63d1d250 Modify cache clean threshold. Cleaning will now be triggered if ModPagespeedFileCacheSizeKb or ModPagespeedFileCacheInodeLimit are exceeded, rather than 1.25x these values. The clean target of 0.75x is unchanged. 2012-10-23 18:39:29 +00:00
Shawn Ligocki 11fffbf03e More ERROR downgrading. 2012-10-23 18:13:02 +00:00
Shawn Ligocki 46181492f4 genfile up 2012-10-23 18:12:26 +00:00
Maks Orlovich 78e03ca3a7 Avoid bloating the metadata cache due to rewriting of styles inside
style= attributes (issue 535).

This changes how we construct the CacheKeySuffix(), which is used to
deal with possibility of relative URLs inside inline CSS getting resolved
differently in different contexts:

- We don't even need the suffix in case there is no url() in the style
  attr.
- In case there is a url(), use the absolufied version of the style=
  as the disambigator, rather than the directory itself. This way, absolute
  URLs, or relative URLs that resolve to the same thing will end up sharing
  a cache key.
2012-10-23 16:55:05 +00:00
Maks Orlovich 462e9c3405 Removing the unnecessary html tags for an error response body. (satyanarayana) 2012-10-23 15:11:29 +00:00
nikhilmadan@google.com 6b5fae2227 Respect url blacklists in the lazyload_images filter. 2012-10-22 20:39:18 +00:00
Matt Atterbury aa6a238206 Addition required for a forthcoming CL that needs to fetch from both
the 'real' and the 'other' driver in this class: added a SwapServer
method to swap between the many 'real' and 'other' variables, so that
we can fetch using either driver.
2012-10-22 19:35:02 +00:00
Josh Marantz 529a275043 Remove apache restart warning by moving the Messages directive into the base config.
Only query memcached if asked, to avoid blocking the request if memcached is hung.
2012-10-22 19:10:05 +00:00
Josh Marantz 3dbaf8d3d9 Change DCHECK into if-statement to guard against a URL pattern that actually does
seem to happen.
2012-10-22 17:48:26 +00:00
pulkitg@google.com a9839ca08e Log whether original request is cacheable or not. 2012-10-22 15:57:59 +00:00
Josh Marantz 60cdbf636d Include generic quality and jpeg/webp specific quality as rewite_query
and use for system tests.  (poojatandon)

Count squelched messages in apr_mem_cache.cc (jmarantz)
2012-10-19 18:58:07 +00:00
Jud Porter dc6a7a0a52 Modify StdioFileSystem::Size to return disk utilization of file, not size of contents. Also cleanup the file system tests in regards to varying file and directory sizes between FS implementations. 2012-10-19 17:49:49 +00:00
pulkitg@google.com 8cd208d339 Fixed Pre connect issues-"Removed disabled=true as with disabled=true chrome does not trigger pre connect requests."
Add applied filter logging to image rewrite filter.
2012-10-19 10:51:24 +00:00
Josh Marantz 3d3d0a9e4c Restore changes from r2071 which crossed mine in commit. 2012-10-18 20:30:59 +00:00
Josh Marantz a03e3203a9 Remove 32-bit version of Statistics:: Get/Set and rename 64-bit version
from Get64/Set64 to Get/Set.
2012-10-18 20:28:31 +00:00
Jud Porter d4cdbd2cf7 Fix unused-but-set-variable warnings on gcc 4.6 2012-10-18 20:16:35 +00:00
Matt Atterbury c5b40d1dd6 Removed redundant assignment. 2012-10-18 17:27:22 +00:00
Maks Orlovich 18b945136a Simplify the Fetcher API further by dropping the boolean return
from Fetch, which was only used in a few tests, and took extra
thought to get right.
2012-10-18 17:03:26 +00:00
Maks Orlovich f44f74874e Avoid rewriting admin pages. This change skips rewriting
pages that have /admin/ or /wpadmin/ anywhere in the URL.

Addresses issue 537
(slamm)
2012-10-18 16:40:49 +00:00
Maks Orlovich 34df795c7e pagespeed_automatic.a was missing libinstaweb_automatic.a which defines ProxyFetchFactory etc (jefftk) 2012-10-18 16:39:26 +00:00
sriharis@google.com 6e8aabbb50 Add critical images in critical_line_info. 2012-10-18 11:04:08 +00:00
Jud Porter 3a95512d8a Fix compiler warning introduced in r2063 2012-10-17 21:35:03 +00:00
Jud Porter 48e5001c8b Close meta tag with /> to prevent XHTML parsing error. 2012-10-17 19:42:14 +00:00
Jud Porter c70d2a536b Modify AprFileSystem::Size to return allocated on-disk size of file. Should address issue #536. 2012-10-17 19:17:50 +00:00
Jeff Kaufman 02db0877e7 Provide ProxyFetchFactory::CreateNewProxyFetch for callers who do not want StartFetch() called because they get data in from another source 2012-10-17 19:02:23 +00:00
Shawn Ligocki 16cea13a34 Minify and Cache-Extend CSS files with rel="alternate stylesheet". Also test that we deal with "preferred stylesheets" correctly and that we don't touch any of them for combining and inlining CSS.
Fixes issue 523.
2012-10-17 18:42:41 +00:00
Shawn Ligocki 2803bd43bc Stop throwing away extra attributes on <link> when inlining.
Previously: <link rel=stylesheet href=... title=foo> -> <style>...</style>
Now: We do not inline that style because it has unexpected attributes.

Other possibilities might be to transfer the extra attributes to the <style> tag, but I don't think we can do that for all of them (for example title seems to only be talked about for external CSS).

Exposed by testing for issue 523.
2012-10-17 17:01:16 +00:00
Shawn Ligocki bad5ce5c73 genfile update 2012-10-17 17:00:15 +00:00
pulkitg@google.com 5d0a296c5f - Use <link> tags instead of inline scripts for pre-connect urls because in IE and Firefox, download of other resources blocks pre-connect requests.
- Do Preconnect only if origin server latency is more than 100 ms.
2012-10-17 10:44:35 +00:00
pulkitg@google.com 145b66a47e Flush more resources(critical images from css and external javascript that is not present in the head) early if origin server is slow to respond and there is enough bandwidth. 2012-10-17 06:23:44 +00:00
Jud Porter c8ebf0b9a2 Add helper function to add ctype tags to inlined scripts if the page could possibly be XHTML. 2012-10-16 20:45:50 +00:00
Jud Porter e609483188 Prepend "./" to path in DomainLawyer lookups to avoid it being interpretted as an absolute URL. Also added in LOG(DFATAL) if the URL is absolute. 2012-10-16 20:45:12 +00:00
sriharis@google.com 3160183947 Fixed couple of comments. 2012-10-16 05:40:39 +00:00
Josh Marantz 8af65f26be Add 64-bit Statistics::Set interface. Make Add return the resultant value.
This required SimpleStats getting a mutex since there is no
atomic_int64.

Squelch excessive memcached server log messages from apache log.
2012-10-15 22:28:46 +00:00
Josh Marantz d9e181f9ac Don't lazyload images inside a noembed tag. (nikhilmadan)
Remove flaky sleep and use a sync-point to make a test more robust.
This required adding a small hook to QueuedWorkerPool. (jmarantz)
2012-10-15 20:22:04 +00:00
sriharis@google.com a767d8fc02 Implement ValidateCandidate check for metadata cache lookup. 2012-10-15 17:59:57 +00:00
satyanarayana@google.com 9e9b2a5974 Adding content type for responses that are terminated. Refer r2035, for more details. 2012-10-15 06:55:01 +00:00
Maks Orlovich 3f34968ec0 Make RewriteTestBase ctor take a pair of factory pointers rather than
two arguments, as it makes it easier to deal with initialization order
dependencies. This makes it possible for Srihari not to have to jump 
through hoops in the test portion of his L1-metadata shadowing
fix.
2012-10-12 17:15:57 +00:00
Josh Marantz 7edb86cd48 Domain-mapping logic should favor entries with longer matches.
Origin-mapping and Rewrite-mapping should allow inclusion of
subdirectories on both sides of the map.
2012-10-12 17:03:37 +00:00
pulkitg@google.com 0ea6634944 Fix the issue with CollectFlushEarlyContentFilter and put the size calculation behind a flag. 2012-10-12 11:42:47 +00:00
Shawn Ligocki ba499f7ac9 Fix SEGV from load tests. It was a deref NULL bug I introduced in earlier (D'oh). Charactors can be called *at most* once between StartElement() and EndElement() for a script/style. But it can also be called 0 times if there is no text between tags. 2012-10-11 20:50:58 +00:00
pulkitg@google.com 50fabbc93c - Calculated the size of the resources which are being flushed early. This is needed to predict how much resources we can flush using flush early flow based on fetch latency.
- Disable flush_subresources in blink flow.
2012-10-11 08:59:28 +00:00
Shawn Ligocki 443c98bdfd Remove deprecated UrlAsyncFetch::StreamingFetch() interface. 2012-10-10 18:36:27 +00:00
Jan-Willem Maessen 77e8d57a69 Include What We Use. Big pile of fixes. 2012-10-10 15:36:35 +00:00
satyanarayana@google.com 21a5d04561 Fixing the format used for weak etags for rewrittten resources. 2012-10-10 14:35:38 +00:00
sriharis@google.com 4a8408df8c Retain meta-tag in visible text, so that smart diff is more accurate. 2012-10-10 12:17:25 +00:00
Jud Porter f378576367 Add property cache lookup and update of critical images through the beacon URL. The beacon URL now supports a "critimg" query param that the beacon can send back with the encoded URLs of the detected critical images. The beacon handler will decode this param, lookup the property page for the originating page (indicated in the "url" query param of the beacon url), and update the critical images in the property cache. The update happens async in the Done callback of the property cache lookup. Currently, the property cache is disabled by default, so this shouldn't add any overhead. 2012-10-09 21:11:50 +00:00
Josh Marantz 0506764ccd Logging applied rewriters in blink-cache-miss case. (anupama)
Remove redundant string conversions: calls of string::c_str(), StringPiece::as_string() (qrczak)

Fix ajax rewriting always retrying and recomputing the result 
when sharding is on, by centralizing the domain-lawyer based 
normalization logic, and fixing a lookup in RewriteContext to use it. (morlovich)
2012-10-09 14:10:30 +00:00
Josh Marantz 99b67906d5 Make variants of bash functions 'check' and 'check_not' that print the input
text in case of failure.
2012-10-08 19:38:51 +00:00
satyanarayana@google.com 15033872c4 Submitting option for terminating requests if mod pagespeed is used as proxy. 2012-10-08 15:58:53 +00:00
pulkitg@google.com 493cc3d4bb Moved CollectFlushEarlyContentFilter at the end of pre-render filters chain. Also, changed CollectFlushEarlyContentFitler from HtmlwriterFilter to RewriteFilter. 2012-10-08 09:02:40 +00:00
Matt Atterbury 04b49c0e53 a) Added CacheInterface::IsBlocking so that we can tell if a call to
Get is guaranteed to return AFTER the callback has been invoked.
b) Added CacheInterface::IsMachineLocal so that we can tell if the
   cache is local (private) to the server [well, as best we can tell;
   with some implementations like AprMemCache it can be difficult or
   impossible to stop others from using your cache].
2012-10-05 19:22:09 +00:00
Matt Atterbury 0fed6b9dd6 Moved some hostname related functions to utility functions. 2012-10-05 15:52:45 +00:00
Matt Atterbury 2fb81d2e35 1. Use the same quality setting for webp and jpeg.
2. Guard against the scenario where inline preview images doesn't inline
   low res image in the src.
2012-10-04 20:43:00 +00:00
Jeff Kaufman e116754ef3 const is meaningless on an enum returned by value 2012-10-03 19:28:20 +00:00
rahulbansal@google.com 91cfe3254f Changes for better performance of Split HTML filter 2012-10-03 11:47:19 +00:00
Josh Karlin 49e4fa4509 Adding the Pedantic Filter
The pedantic filter is used to help prevent pagespeed from breaking HTML4 compliance.
Specifically, it adds default type attributes to script and style tags where they have been 
omitted.
2012-10-02 11:45:57 +00:00
Maks Orlovich 7f9c3267ca Hookup SPDY-specific configuration. Now <ModPagespeedIf spdy>
and <ModPagespeedIf !spdy> actually work.

Also make it possible to turn on spdy-configuration with a header,
X-PSA-Optimize-For-SPDY, so that people who use something other than
mod_spdy to terminate SPDY may be able to use this, and so I can test
this without requiring hard-to-build tools like spdycat.

This is the code part of issue 450.
2012-10-01 23:00:43 +00:00
Shawn Ligocki 518aa20009 Update all implemenations of deprecated UrlAsyncFetcher::StreamingFetch() to UrlAsyncFetcher::Fetch() and make that method purely abstract.
TODO-next: remove all calls to StreamingFetch() and get rid of that deprecated interface.
2012-10-01 21:14:58 +00:00
Jud Porter a9912d2b3d Make Unescape public for future use in decoding URLs passed in through query strings. Also fix IsHexDigit. 2012-10-01 17:04:30 +00:00
rahulbansal@google.com d5ab5707e1 - Adding an option to apply smart diff in Blink (rahulbansal)
- Stores last 10 fetch latencies and average fetch latency in flush_early.proto (pulkitg)
2012-10-01 13:21:23 +00:00
Josh Marantz 1de29f0bd7 Fix/exercise a mid-fetch shutdown flow. 2012-09-28 18:03:04 +00:00
Josh Marantz 2dfc4fb45a Canonicalize URLs based on MapRewriteDomain, and without sharding, prior to
looking them up in the HTTP Cache. 
         
This addresses 
http://code.google.com/p/modpagespeed/issues/detail?id=494 and 
also will (long term) improve HTTP cache hit rate across 
changes in sharding.
2012-09-28 14:52:28 +00:00
Josh Marantz 0db9c51205 Stop using partial URL match in Blink families. (rahulbansal)
Log cache-flush events.  Add newline before error message in system tests.
2012-09-28 13:40:21 +00:00
Shawn Ligocki 2845571662 Remove dead UrlAsyncFetcher::ConditionalFetch() interface that we didn't end up using. 2012-09-28 00:26:22 +00:00
Shawn Ligocki 1df0a9a7f9 Cleanup CSS and JS outline filters to stop buffering up charactor buffers and just depend upon the fact that they will come coalesced (like other filters do). 2012-09-27 22:12:29 +00:00
Shawn Ligocki 17181b6682 Remove apparent file-system related race by saving the output
from fetch_until and using it to extract out a sprited CSS filename
from html. (jmarantz)
2012-09-27 22:12:09 +00:00
Maks Orlovich f481ad915a Rename defer_delete -> defer_cleanup, since I want to use it to
shutdown stats, too. No functional changes.
2012-09-27 18:03:19 +00:00
Josh Marantz af67097989 Fix MultiGet error reporting flow, which was producing nonsense
error messages like: "AprMemCache::Get error: Success (0) on key ..."

Track timeouts with a mod_pagespeed_statistics variable.
2012-09-27 16:56:10 +00:00
Josh Marantz 27a0bcc7a6 Fixing IE9 onload firing issue. Document needs to be closed on iframe
created for prefetching js files.  (ksimbili)
2012-09-27 16:50:57 +00:00
rahulbansal@google.com 6c902db1ff Removing files in install/blink 2012-09-27 04:45:11 +00:00
rahulbansal@google.com 20c1ebdeb3 Adding back the rewrite option use_full_url_in_blink_families 2012-09-26 21:06:27 +00:00
Josh Marantz 587841308a Temporarily turn off js library canonicalization for load-tests by adding it
to the 'dangerous filters' list.
2012-09-26 20:21:59 +00:00
rahulbansal@google.com 3215a0b101 Removing the rewrite option use_full_url_in_blink_families 2012-09-26 19:20:44 +00:00
Maks Orlovich 3d66cd15ad Add a (dangerous/risky/potentially insecure) option to bypass the loopback URL routing,
for use on fancy proxy setups.
2012-09-26 15:38:55 +00:00
Maks Orlovich d750a4a2b3 - Restore the fetching optimizations; they're off
guarded by experimental flag, so not urgent to 
have them working, and IE fixes will follow (ksimbili)
2012-09-26 15:23:54 +00:00
Josh Marantz b0f83a4458 Add infrastructure to make it easier to load-test wtih memcached. 2012-09-26 02:08:41 +00:00
Michael Piatek d137e22574 Manager() -> FindServerContext().
Occurrences of "resource manager" in comments have been changed to "server context".
2012-09-25 22:49:57 +00:00
Maks Orlovich a51483f2de Permit inheriting configuration into VHosts,
via ModPagespeedInheritVHostConfig.

Addresses issue 495.
2012-09-25 14:27:59 +00:00
Maks Orlovich fc1bed7295 Properly install this Apache 2.4 module in this script as well
(part of issue 454).
2012-09-25 13:26:38 +00:00
Maks Orlovich e26321a369 Update the minified version with Nikhil's rollbacks, too. 2012-09-25 13:18:35 +00:00
sriharis@google.com ea6491f16c Fix the use of "should_insert_noscript_". Simplify the code in
IsAnyFilterRequiringScriptExecutionEnabled() to not use pointers to
member-functions.  (rmathew)

Rollback parallel download of js files in Firefox and IE using iframe
technique.  (nikhilmadan)
2012-09-25 09:59:43 +00:00
Josh Marantz 1c8233f848 Rename apr_mem_cache_servers to apr_mem_cache etc. 2012-09-24 20:12:23 +00:00
Matt Atterbury a724afb7ad Added test that we don't clear all headers if we receive a FLUSH event before
a REWRITE event.
2012-09-24 16:33:17 +00:00
Josh Marantz 852bad51ea Rearrange the way cache batcher, apr_memcache, etc. are hooked up, so
that the same memcached instance can be used with different file-cache
backing store.  This also mates the CacheBatcher with the
memcached-connection, so we can batch requests across different
vhosts.

Use the new key_value_codec and FallbackCache infrastructure in util
rather than having that functionality embedded in the memcache
interface code.

Eliminate apr_mem_cache layer, although its unit-test still lives.
After this CL a follow-up will 'g4 mv' apr_mem_cache_servers.* to
apr_mem_cache.*, but this incremental step will be easier to review.
2012-09-24 16:27:50 +00:00
Josh Marantz e539138eec Clean up system-test and valgrind spew. 2012-09-24 16:08:22 +00:00
Josh Marantz bbffb7b5a8 Use modpagespeed.com for a timeout fetcher test, rather than stevesouders.com. 2012-09-24 14:32:54 +00:00
Shawn Ligocki ef4b703dfb Remove unsafe use of StringPiece::data() without restriction to StringPiece::size() bytes. 2012-09-21 20:48:43 +00:00
Shawn Ligocki 504468f873 Downgrade most of our most prevalent LOG(ERROR)s (or handler->Error()s) to warnings (or info in one case). 2012-09-21 20:13:30 +00:00
Shawn Ligocki ad8fd76a99 Simplify save_url_hook to use IsPagespeedResource() and the GoogleUrl for checking handler (rather than Apache's parsed URL which is not used anywhere else).
Also remove ServerContext::decoding_driver() public accessor which seems to only be used for IsPagespeedResource() detection.
2012-09-21 17:46:24 +00:00
Maks Orlovich 0869c6b59f Generalize RewriteDriver recycling to be able to have multiple pools
(so I can add an another pool for spdy configuration)
2012-09-21 15:29:14 +00:00
Matt Atterbury 5ae035ee2c Do not insert a NOSCRIPT tag if none of the filters requiring JavaScript
are enabled or if they get disabled because of the User Agent.
2012-09-21 13:58:22 +00:00
Maks Orlovich 6e03196310 - Fix a small bug in defer_js parallel download (ksimbili)
- Added another multiple-imports-to-links test for completeness,
  replicating the originally reported problematic CSS. (matterbury)
2012-09-21 13:28:54 +00:00
nikhilmadan@google.com 03fd66de41 Buffer scroll events in lazlyload images filter. 2012-09-21 06:51:11 +00:00
nikhilmadan@google.com 8187fbda5b Add max_html_parse bytes to pagespeed.conf and add a system test. 2012-09-21 06:37:26 +00:00
Maks Orlovich 88ffffa4ca Fix a source of flakiness in this test --- sometimes we will
have already output the messages we're looking for by the time 
tail has started.
2012-09-20 19:43:56 +00:00
Maks Orlovich a54416ab5b Commit renaming of these files to not have php extension. Was meant to be part of matterbury's
r1958.
2012-09-20 19:20:10 +00:00
Josh Marantz 154211b1c5 Only add X-Original-Content-Length headers on 200 responses (mdw)
Add new fallback_cache implementation, abstracting out into a re-usable utility class
some of the infrastructured used routing large cache Puts away from memcached and to
the local file system.
2012-09-20 17:19:19 +00:00
Matt Atterbury 97fe72f279 Fixed PHP testin gto handle 2.2 worker MPM not just prefork. 2012-09-20 16:32:23 +00:00
Matt Atterbury 1517877ab8 Fix 'make apache_system_test' to handle users with restrictive umasks. 2012-09-20 15:35:35 +00:00
Matt Atterbury 1ea9f39c54 Redid how we stop/start/restart Apache to be more reliable:
* stop: wait until the pid file and all processes are gone.
* start: wait until the pid file exists.
* restart: use stop then start.
2012-09-20 15:06:53 +00:00
Matt Atterbury b9a6275451 1. Made RewriteOptions::LookupOption public.
2. Added a new test script for blink.
3. Fix a bug in the callback for blink cache delete propagation.
4. Update change detection hash in logging mode.
2012-09-20 13:55:05 +00:00
nikhilmadan@google.com fec45247ea Store whether the size of the html exceeds max_html_parse_bytes in pcache and use its value to decide whether to skip parsing. 2012-09-20 05:14:41 +00:00
Shawn Ligocki 17af2aa52b Move HTML rewrite count (total_rewrite_count) into RewriteDriver so that it is updated in mod_pagespeed as well as PSS. 2012-09-19 22:32:09 +00:00
Josh Marantz 6fad359277 Add/test key/value codec utility class for verified keys when
a cache supports only a hash.
2012-09-19 21:41:19 +00:00
Shawn Ligocki 00ef33df6e Add fallback_rewrite_css_urls to core filters. 2012-09-19 16:43:14 +00:00
Shawn Ligocki 2071b1b4ac Avoid using the same temp directory (/tmp/apr_file_sytem_test) for all runs of AprFileSystemTest (multiple clients can clobber each other). Cleaned up FileSystemTest while I was at it to all use the same test directory from gtest that has a pid in it. 2012-09-19 14:55:08 +00:00
Josh Marantz c81b59af14 Fixing parallel download of js files in Firefox and IE using iframe
technique (ksimbili)
2012-09-19 13:32:42 +00:00
Matt Welsh 59fe4bbbe0 Extract X-Original-Content-Length from Content-Length, if available (mdw)
Adding js_minify_main (jmaessen)
2012-09-19 00:05:30 +00:00
Shawn Ligocki ee2e197f58 Avoid buffer overflows in Css::Parser::ParseMediaQuery(). 2012-09-18 21:54:25 +00:00
Shawn Ligocki 4a03ef17e6 Use unix newlines. 2012-09-18 21:47:44 +00:00
Jan-Willem Maessen f213c07dbd Identify common JavaScript libraries by content hash, and redirect them to a
standard cdn.  Right now only a sample configuration is included; we are working
on documentation and a more thorough default configuration that can re-direct
all libraries hosted by ajax.googleapis.com.
2012-09-18 19:01:47 +00:00
Maks Orlovich f32a1ef5e2 Create a histogram for beacon results, because we can. 2012-09-18 17:34:51 +00:00
Jeff Kaufman f2e470c5ae default the channel to 'beta' but allow it to be overriden 2012-09-18 17:34:35 +00:00
Josh Marantz de6299d14b Oops -- earlier restoration was incorrect. Resyncing. 2012-09-18 17:25:11 +00:00
Josh Marantz 900933bc0e Re-apply IWYU fixes to delegating_cache_callback, which rahulbansal
accidently rolled back.
2012-09-18 16:37:28 +00:00
rahulbansal@google.com e8a5df1dbf Qualify calls to SplitStringUsingSubstr (rahulbansal)
Refactor delegating cache callbacks (jmarantz)
2012-09-18 14:54:58 +00:00
Josh Marantz 7ac4240ae1 Add/test removal of prefix/suffix to SharedString. Change from
RefCountedObj inheritance to containment to reign in direct uses of
the underlying GoogleString*.  All the ugly behavior is still existing
for performance reasons, but is a bit more structured in the way it's
called.
2012-09-18 13:42:38 +00:00
Maks Orlovich fedcaa1d22 Workaround our poor interaction with mod_negotiation,
and test it. It was crashing on accessing null request->filename.
2012-09-18 13:20:49 +00:00
pulkitg@google.com c5d3f123ef Jpeg images in the css should not be converted to webp images if ConvertJpegToWebp is disabled. 2012-09-18 11:23:01 +00:00
nikhilmadan@google.com d45deb6a17 Fix races between PropertyCacheCallbackCollector::Detach and FlushEarlyFlow. 2012-09-18 11:09:42 +00:00
sriharis@google.com 79dc878e26 Propagate blink cache deletion. (guptaa)
Log metadata cache hit/miss counts.  (sriharis)

Added kEnableLazyloadInBlink in rewrite_option_names.gperf.  (pulkitg)
2012-09-18 07:43:58 +00:00
Matt Atterbury 8cd59c25b3 Remove left_trim_urls from the core filter set to which it was INCORRECTLY
previously added.
2012-09-17 20:41:56 +00:00
Michael Piatek 7d67025fe0 Rename accessors, resource_manager() -> server_context(). 2012-09-17 18:04:12 +00:00
nikhilmadan@google.com b50dc5e47c Abort parsing if the HTML size is too large, and redirect to ?ModPagespeed=off 2012-09-17 14:50:39 +00:00
Maks Orlovich f74d123b00 Make cache flush configuration a proper option, so we can merge it.
Also bury yet-another dead field.
2012-09-17 13:08:28 +00:00
nikhilmadan@google.com 6dafff0962 Support disabling the caching of html content fetched over https. 2012-09-17 13:03:25 +00:00
mmohabey@google.com 9d68c6c207 Use Html escaping (instead of url escaping) for redirect URL in support noscript.
Fix a case where we were logging that the css filter applied even though it hadn't.
Support the lazyload blank image src being protocol independent.
2012-09-17 11:30:01 +00:00
ksimbili@google.com d015f1fad5 -Cookie handling in Flush Early Flow(mmohabey).
-Fixing multiple type attributes issue on script nodes(ksimbili).
2012-09-17 09:28:13 +00:00
pulkitg@google.com b57b9533c6 - Change in onload function which is added inline_preview_images fitler. Earlier, onload function is removed after src is changed to high_res_src which causes an infinite onload calls in IE8, if high_res is already present in browser cache. Now, order is reversed i.e. first onload function is removed, then src is changed to high_res_src.
- Extract critical images from css as well while extracting critical images in html.
2012-09-17 05:57:29 +00:00
Shawn Ligocki 5df4aef783 Test MediaAppliesToScreen(const StringPiece&) and fix bug. 2012-09-14 19:47:49 +00:00
Maks Orlovich a6f36feced Tiny cleanup: remove dead field. 2012-09-14 19:42:08 +00:00
Shawn Ligocki 3f90d169fe set_flattening_succeeded(false) when parsing complex CSS media queries (instead of claiming parse failed). 2012-09-14 18:45:06 +00:00
Shawn Ligocki daa0169543 Fixing an unsafe access where an element's attributes were getting accessed when it could have been flushed out. (rahulbansal) 2012-09-14 18:44:45 +00:00
Maks Orlovich f56afef35d Small cleanups after the parsing changes:
- Remove a comment that wasn't meant to be left in
  (but just to spark discussion during codereview)
- Extract out the statistics + console handlers into
  own routines.
2012-09-14 14:10:14 +00:00
Maks Orlovich 7a92e9546c Fix type annotation (nicksantos) 2012-09-14 14:09:28 +00:00
Maks Orlovich 6db96de985 Parse <ModPagespeedIf spdy> and <ModPagespeedIf !spdy> blocks,
and construct special spdy-specific configuration object.
(Not actually used during rewriting yet, however)

Also adds ?config and ?spdy_config modes for mod_pagesped_statistics,
as they are needed for testing.
2012-09-13 19:12:34 +00:00
Matt Welsh c6d9960f65 Fixed support for tracking X-Original-Content-Length in Serf (mdw). 2012-09-13 18:11:43 +00:00
nikhilmadan@google.com 84299a46e7 In lazyload images, override getAttribute to return pagespeed_lazy_src instead of src.
Disable blink for https urls.
Add fetch to the instrumentation beacon.
Background flow for split html filter.
2012-09-13 12:32:50 +00:00
Matt Atterbury f67434bb94 1. Add lazy load JS before non-critical content is sent in split_html.
2. Flush blink JS early if split_html is enabled.
3. Refactored ParseSingleImport into a new ParseNextImport function and
   reimplemented the former using the latter. Required for coming change.
2012-09-12 19:12:32 +00:00
Jan-Willem Maessen 687be18c06 Change default content type of javascript to application/javascript rather than
text/javascript to avoid confusing certain firewalls.
2012-09-12 18:23:46 +00:00
Maks Orlovich ab348fa197 Merge in fixes of CVE-2012-4001 and CVE-2012-4360. 2012-09-12 14:35:12 +00:00
pulkitg@google.com e17a983e85 - Fixed the issue with max_preconnect_attempt calculation.
- Enabled DeferIframe always if either defer_javascript or blink is enabled.
2012-09-12 12:12:51 +00:00
Maks Orlovich cb76e3948d Fix DCHECK with both ModPagespeedUsePerVHostStatistics and
ModPagespeedFetchWithGzip on.
2012-09-11 17:37:32 +00:00
Maks Orlovich 799e7ddba3 Add some configuration checking to split_html to avoid crashes,
and don't make it enableable just yet, as it's not quite ready.
2012-09-11 16:56:18 +00:00
Maks Orlovich 8de1154cf3 Remove redundant string conversions (qrczak) 2012-09-11 15:44:28 +00:00
Matt Atterbury 50c6d2ab72 1. Moving CollectFlushEarlyContentFilter further downstream as far as feasible.
2. Make flatten_css_imports a core filter. See mod_pagespeed issue 490.
2012-09-11 15:03:08 +00:00
nikhilmadan@google.com ae024675a2 Trigger the flush early flow in parallel with the proxy fetch flow. 2012-09-11 05:24:03 +00:00
Josh Marantz b4677e45b0 Add a mechanism to override the we use to test the fetcher. The default is still
modpagespeed.com.
2012-09-11 00:29:52 +00:00
Maks Orlovich 584973075d FIx crash on shutdown accessing
fetcher_->track_original_content_length()
2012-09-10 19:51:40 +00:00
Maks Orlovich ff51cd70ef 2 changes by rahulbansal:
- Fixing a bunch of integration issues:
  - Making panel_loader.js working with Split
  - Correcting the initializations of panelLoader.
- Cleanup: Remove panel_config.proto.
2012-09-10 19:21:02 +00:00
Josh Marantz a23bdf8eeb Added a support to pre connect a proxy servers so that connection is
already set up when actual request comes. (pulkitg)

Added a filter which is used to count the number of rewritten
resources in the page and write to property cache. This filter should
be first post render filter. This filter can be used for more
rewritten content scaning.

Remove html_parser_types.h as it has proven IWYU-unfriendly.
2012-09-10 15:02:29 +00:00
rahulbansal@google.com dc70d35140 2012-09-10 10:30:22 +00:00
Matt Atterbury 89aaf97bee 1. Add missing options to the ALL_DIRECTIVES test & cleanup deprecated options.
2. Replace bogus uses of $WGET_PREREQ with the correct shell function.
2012-09-07 20:47:33 +00:00
Shawn Ligocki 307d71dce4 Parse CSS media queries. Ex: @media screen and (max-width: 200px) {} 2012-09-07 20:23:14 +00:00
Jud Porter 92567ff995 Add option for property cache fetch on request. 2012-09-07 19:20:10 +00:00
Matt Atterbury 97d71f71cc Use the function rather than the raw command so that $WGET_ARGS is used. 2012-09-07 19:13:43 +00:00
Josh Marantz ea8d512137 Rename Initialize(Statistics*) to InitStats(Statistics*), leaving
Initialize() to pair with Terminate().
2012-09-07 17:23:17 +00:00
Josh Marantz dfc8d8bfc4 Keep track of approximate header sizes in UrlAsyncFetcherStats as well. (morlovich)
Setting charset from FlushEarlyInfoFinder if it is not set already. (mmohabey)

Add an experimental filter for applying smart-diff. Adding smart-diff
to the diff detection flow, only in logging mode. (guptaa)

Logging of extend_cache_*, *_combine, and minification filters for css and js. (anupama)
2012-09-07 12:34:05 +00:00
Josh Marantz 3cd9ee9a6b Factor out the static parts of Options into Properties, which
are initialized at process startup.
2012-09-05 20:02:26 +00:00
Maks Orlovich d8566153e2 Keep track of approximate header sizes in UrlAsyncFetcherStats as well. 2012-09-05 19:33:48 +00:00
Jeff Kaufman de4dcd8827 Add ModPagespeedCustomFetchHeader <name> <value> 2012-09-05 18:20:35 +00:00
Josh Marantz 0178ff3780 Fix the initialization of a new rewrite option. (ksimbili) 2012-09-05 17:23:16 +00:00
Josh Marantz 4a93039087 Fix an exit memory leak when running with memcached. Change the test
configuration template to set up a situation where two different
file-cache directories are connected to the same memcached.
2012-09-05 17:01:19 +00:00
Maks Orlovich 4d2c933900 Add a method for estimating response header sizes, so that
we can meter in FetcherStats a bit more accurately.
2012-09-05 16:37:57 +00:00
Maks Orlovich 58f0041dc7 - ResourceManager -> ServerContext in RewriteDriverFactory. (piatek)
- Rollback encoding changes for blink + IE9; further 
  testing shows problems. (rahulbansal)
2012-09-05 15:18:18 +00:00
Josh Marantz 2ad74c50db Flush private cacheable resources early in experimental flow too (mmohabey) 2012-09-05 12:24:05 +00:00
pulkitg@google.com e8f807aaa1 This patch contains following changes-
- Flush the defer javascript and lazy load script with flush early flow.
- Logging request url and user agent for the request that entered blink flow.
2012-09-05 06:52:00 +00:00
Matt Atterbury 7272a0db78 1. Adding FlushEarlyInfoFinder.
2. Resolve a character-set encoding issue with blink and IE9 with ISO-8859-1
   content: Strip out "content-type" META tags from original HTML, if any;
   insert an appropriate one. Send a UTF-8 BOM before the HTML content so that
   IE9 recognizes it as UTF-8.
3. Enable Lazyload images for blink.
4. Avoid pages going to quirks mode in IE if deferJs is enabled.
5. Fixing parallel downloads with firefox and IE.
6. Resolve issues with Blink and IE9. Fix below-the-fold table-layout in IE
   using a workaround. Undefine document.all in IE during DeferJs.
2012-09-04 16:33:54 +00:00
Josh Marantz c935e60a91 Add balanced explicit static initialization/termination of all options classes.
This adds no new functionality, but enforces a stack discipline for the 
explicit initialization of this data. 
         
This is in preparation for a future change where the static parts of Options will 
be moved into static structures so they don't have to be copied every time 
RewriteOptions are created, which can occur multiple times per request.
2012-09-01 01:40:41 +00:00
Maks Orlovich 0840feaeda Generic PSA code: Force flushing every n (default = 100k) bytes,
too, to reduce risk of running out of memory or hurting latency 
on large bursts.
2012-08-31 18:37:28 +00:00
Maks Orlovich e023cc6b0f Fix apparent typo in property cache construction when there is no LRU
--- l1_cache is NULL here!
2012-08-31 18:28:36 +00:00
Maks Orlovich 78b239f7d8 - Add testing of console functionality to system tests. (bvb)
- User Agent field added to the Blink Info proto. 
  Now, User Agent supports WhiteList and BlackList determination too.
  (poojatandon, snagori)
- Fix lazyload images for IE in quirks mode. (nikhilmadan)
2012-08-31 17:42:36 +00:00
Matt Atterbury acdea16fce 1. Refactor: rename resource_manager() method to server_context().
2. New version of the mod_pagespeed console.
3. If the flush-subresources filter is enabled, the DNS prefetch filter will
   flush the DNS prefetch calls in the flush early flow.
2012-08-30 18:23:13 +00:00
Shawn Ligocki 21af7e1499 Convert Css::Import to a class (from a struct). Protect member variables and add accessors so that we can change the implementation. 2012-08-29 19:36:18 +00:00
Jeff Kaufman 64875cfa7a Use reference counting for FileLoadMapping and FileLoadRule to reduce regexp compilations. 2012-08-29 19:16:10 +00:00
Shawn Ligocki f8e57eedf9 Providing the ability to set critical line config using options. This is needed so that we can easily test and iterate on the hit flow while the miss flow is being developed. (rahulbansal)
Adds applied-filter logging to Flywheel filters.

Deletes two unused typedefs from rewrite_driver.h (marq)
2012-08-29 19:15:03 +00:00
Josh Marantz daeb766f4a Upgrade Serf version to 1.1.0.
Add regex-based ModPagespeedLoadFromFile (jefftk)
2012-08-29 18:39:35 +00:00
Josh Marantz 0805a1dd62 Added missing files from prevoius commit, which also included:
Add support for ModPagespeedLoadFromFileRule and ModPagespeedLoadFromFileRuleMatch.  (jefftk)

First cut of Split Html Filter (rahulbansal)
2012-08-29 17:43:35 +00:00
Josh Marantz 3484b3e9cd Get the flush early flow working correctly in IE and firefox. (nikhilmadan)
Return the original size of an optimized resource in the
X-Original-Content-Length header. (mdw)

Rename ResourceManagerTestBase -> RewriteTestBase.  (piatek)
2012-08-29 17:37:43 +00:00
Shawn Ligocki e61a7bf8d3 rm old header 2012-08-28 19:02:47 +00:00
Shawn Ligocki 3a6dfcc224 header fix. 2012-08-28 19:02:07 +00:00
Josh Marantz 97c2014ae6 Adding support for furious experiments to blink-flow.
Moving furious-related "need_to_store_experiment_data" from
RewriteDriver to RewriteOptions. (Since furious id is anyways in
RewriteOptions, adding this related info here should be fine.)  (anupama)

Add flag to run html diff detection in logging mode - in this mode,
diff is computed, but if a mismatch is found, critical line is not
recomputed. This mode is used only for logging purposes. (guptaa)
2012-08-28 12:34:40 +00:00
nikhilmadan@google.com c2b792d471 Store last request time in dom cohort.
Handler for querying of console statistics - logfile reading, parsing, and translation into JSON, as well as tests for the new functionality.
2012-08-28 06:13:46 +00:00
Jud Porter 859853b021 Add base CriticalImagesFinder class. 2012-08-27 20:50:11 +00:00
Josh Marantz 4055d3d351 Add a regexp version of load from file: ModPagespeedLoadFromFileMatch,
fixing issue 377 (jefftk)

Rename resource_manager to server_context, per TODO (piatek)
2012-08-27 20:08:30 +00:00
Jeff Kaufman 24e5568b3c Add ModPagespeedLoadFromFileMatch support. Fixes issue 377. 2012-08-27 17:41:17 +00:00
Maks Orlovich 60712a97f8 Port the attribute list representation to InlineSlist from
vector, which saves exactly 2 pointers worth of storage per
element (as well as an allocation). This results in ~7.1% memory
savings on single-shot parsing of the giant HTML Nikhil
extracted (1007.7MiB -> 936.0MiB)
(real numbers likely smaller due to shedding stuff on flush, and 
 less pathological HTML)
2012-08-27 15:58:27 +00:00
Josh Marantz e38398c532 Adds page_property_cache() method in ResourceManagerTestBase and change
references in tests to use that rather than going through resource_manager_.
2012-08-27 15:44:00 +00:00
Josh Marantz ff6c4e0712 Remove obsolete files (rahulbansal) 2012-08-27 14:29:39 +00:00
Josh Marantz f1cbb6b076 Logging blink information in async mode as a separate log entry (guptaa)
Precursor to Split HTML filter (rahulbansal)

Remove dead method/member-vars for factory-global critical
images. (jmarantz)
2012-08-27 14:28:33 +00:00
Maks Orlovich b001f7d4de Add an intrusive singly-linked list, which will be used
for more memory-efficient storage of attributes.
2012-08-24 20:07:54 +00:00
Maks Orlovich cd62a4294b Rather than extending two outermost user-specified buckets out
to infinities add two extra buckets.

This is because extanding out the first bucket from [0, ...)
(a common case) to (-inf, ...) made it impossible to estimate
the median if it fell there, which is common for some timing
diagrams.
2012-08-24 19:23:40 +00:00
Jan-Willem Maessen 527b7373bb NEw Javascript Library Identifier, and code to actually use it to replace urls.
Configurability is currently under review (pending a bit more testing of the
configuration parameters).
2012-08-24 19:16:44 +00:00
Josh Marantz 81054bdacf Refactors cache-creation semantics and ownership into the ResourceManager.
In Apache, we can have distinct caches per VirtualHost
(ResourceManager), so all of the caches structures currently
owned and referenced in factories should really be held in the
ResourceManager instead.

This was earlier dealt with ad hoc with redundant pointers and
assertions and this has grown unmaintainable.

This CL enables the proper management of memcached connections, per vhost,
and independent from the file-caches.

I believe it also makes it easier to adopt property-cache capabilities
in mod_pagespeed properly, though that was not the original intent of
this change.
2012-08-24 14:38:40 +00:00
nikhilmadan@google.com 3da0ef2966 Enable flush early for IE and Firefox as well 2012-08-24 10:32:52 +00:00
Maks Orlovich 9c6a9b8ca1 Rename MaxBuckets -> NumBuckets, and SetMaxBuckets ->
SetSuggestedNumBuckets, since I want to make them
have different values in ShmStatistics, and as I feel
that MaxBuckets doesn't clearly communicate what it does.

Also some misc. cleanups of neighboring code and comments.
2012-08-23 21:00:53 +00:00
Matt Atterbury 98dcd01267 Don't reset the headers if we receive a flush but there's no content
yet as it means we've haven't started the rewrite yet, so we haven't
copied the Apache headers over yet, so we end up clearing all headers.
2012-08-23 18:14:51 +00:00
Josh Marantz 88fda79468 Fix a couple of races found in the async cache test, including a
shutdown race.
2012-08-23 16:47:33 +00:00
Matt Atterbury 9878cc9cae 1. Refactor URL fetching.
2. More flexible logging.
3. Quote url= in noscript redirect.
4. Making the content type charset meta tag detection logic common between
   meta_tag_filer and suppress_prehead_filter.
5. Provide the ability to directly set url of html slots as well as css slots.
2012-08-23 16:15:19 +00:00
Maks Orlovich 39ad0ad1e4 Rudimentary per-vhost fetcher stats. 2012-08-22 19:10:30 +00:00
Maks Orlovich cbd6bdc4f4 - SaveOriginalResponseHeader() call in proxy_fetch.cc forces the flush_early_info()
empty and dns prefetch info does not get populated. So, Insert Dns Prefetch filter 
  never gets applied. Moved SaveOriginalResponseHeader() call to 
  supress_prehead_filter's EndDocument. (pulkitg)

- Currently, defer_js, lazy_load and inline_preview_images filters remove the src 
  so insert dns filter does not get applied on those domains.
  Moved insert_dns_filter above all post render filter. (pulkitg)

- Fix wget version check to accept versions > 1.12 as well (jud)
2012-08-22 18:09:28 +00:00
Maks Orlovich 11bc47120d Add forgotten files, should have been part of jmarantz's
r1808: Split from apr_mem_cache the connection to the server, so that we can
have multiple distinct fallback configurations
2012-08-22 18:04:26 +00:00
Jan-Willem Maessen 4f2f9cadf5 Don't explicitly allocate a filter unless it's used in the test. 2012-08-21 22:09:03 +00:00
Jan-Willem Maessen 707ce19908 Make Options() const. 2012-08-21 15:13:55 +00:00
Josh Marantz 27a456753e Not updating the blink html mismatch statistics in case of a cache miss. (guptaa)
Split from apr_mem_cache the connection to the server, so that we can
have multiple distinct fallback configurations.  (jmarantz)
2012-08-21 14:39:49 +00:00
Matt Atterbury b179237526 Allow any media in a CSS link being inlined, by copying the media
attribute from the link element to the style element.
2012-08-20 19:55:01 +00:00
Maks Orlovich d6a8c83ab8 In SharedMemHistogram, dump statistics that fall outside
the configured range into extreme buckets, and print
their ranges with infinities on display, rather than losing
data.
2012-08-20 15:00:07 +00:00
Shawn Ligocki 1bddf8d311 Mark UnicodeText::empty() as const. 2012-08-20 14:36:24 +00:00
Josh Marantz 253420e4b4 Add option to mod_pagespeed to configure memcached thread count. 2012-08-17 20:16:30 +00:00
Matt Atterbury 4d37453971 1. More flexible logging.
2. Copy Google's favicon.ico and logo.gif to www.modpagespeed.com/do_not_modify/
   with content-hash so that we can make sure they do not change and can be
   used in serf_url_async_fetcher_test in perpetuity.
3. Add a utility method for getting an attribute's escaped value from
   an element.
2012-08-17 19:33:47 +00:00
Josh Marantz e673f160b6 Add framework to support more extensible & detailed logging (marq)
Add MultiGet support to memcached. (jmarantz)
2012-08-17 17:35:25 +00:00
Jeff Kaufman 255ea644d6 Add filter extend_cache_pdfs. Improve AtomicInt32 documentation. 2012-08-16 18:55:54 +00:00
Josh Marantz 9c4cae3635 Add/test cache batcher class. 2012-08-16 14:27:17 +00:00
Josh Marantz bf66348fdc Configure statistics logging via Apache directives instead of hard-coded constants. (bvb) 2012-08-16 13:16:56 +00:00
Shawn Ligocki cf06900a88 net/instaweb: Add tests that would have caught CHECK failures.
webutil/css: Allow at-rules to have media set.
2012-08-15 20:08:04 +00:00
Shawn Ligocki f2022dc6c7 Escape single quote chars. 2012-08-15 20:07:01 +00:00
Shawn Ligocki 9b44d9a836 Fix the add_option call for FetcherTimeOutMs. (sriharis) 2012-08-15 15:48:26 +00:00
Shawn Ligocki 6041554ae1 Fix CHECK failure. 2012-08-15 15:48:02 +00:00
Josh Marantz 3e32565ff1 Add test to verify we can recognize XML with a charset. 2012-08-15 01:19:35 +00:00
Josh Marantz 32b073f951 Add AsyncCache adapter (jmarantz):
Decoding url fails with urls like 1.js?a#12296;=en
Now we don't decode the url in src attribute. We just change the
attribute name to orig_src. (ksimbili)

Rollback updates to suppress_prehead_filter.cc pending further
investigation (morlovich)

Better URL sanitization. (jefftk)
2012-08-14 21:59:53 +00:00
Shawn Ligocki a458576f80 Fix production CHECK failures. 2012-08-14 21:40:49 +00:00
Jan-Willem Maessen f8fdb7a5a9 Fix concurrency bug in fast_wildcard_group that would lead to check-failures
when two concurrent matches attempted compilation at the same time.
2012-08-14 20:37:30 +00:00
Shawn Ligocki 023c00246a Preserve unknown @-rules as verbatim text.
This does not preserve unparseable @media/@import/@charset rules, including CSS3 media queries. A separate CL is coming for CSS3 media queries.
2012-08-14 18:42:15 +00:00
Shawn Ligocki 746f172821 Improve the noscript handling by redirecting to a custom query-param
(instead of ?ModPagedspeed=off) that disables js-inserting filters and
inserts a <link rel=canonical href=original_url> in head.  This also
sets the stage using cookies to prevent redirects on every request. (sriharis)

+others
2012-08-14 18:39:50 +00:00
Josh Marantz 505b977956 Change the expected favicon size since the favicon changed. 2012-08-13 18:35:56 +00:00
Shawn Ligocki 806b859571 Absolutify url()s in CSS when we fall back to serving original CSS file instead of rewritten one. This could happen because rewrite failed when required on fetch pathway. This in turn could happen on a multi-server environment, midway through a push, or if different servers are configured differently. 2012-08-13 17:13:15 +00:00
Shawn Ligocki 112d007f84 Still getting failures in blink running open-source tests under valgrind on ubiquity. (jmarantz)
Disable lazyload if the browser doesn't support inlining. Also, don't call ComputeCriticalImages if the user agent doesn't support inlining. (nikhilmadan)

Add an option to control the maximum size of an image in CSS that is converted to webp. (nikhilmadan)

Add new flush early tests to test.gyp. Missed this in the previous CL. (nikhilmadan)
2012-08-13 16:49:59 +00:00
nikhilmadan@google.com ae8fba0876 Add multi-browser support to the flush early rewriters by rewriting while flushing the new head. 2012-08-13 07:36:14 +00:00
Josh Marantz b382a84d0a Fix local storage filter (matterbury)
Send all arguments to Function::Cancel()
2012-08-11 11:52:27 +00:00
Josh Marantz e1ab785589 Add new CacheInterface method for MultiGet. This method has
a default implementation, which is to loop over the entries
and call Get, but it also has a more interesting implementation
for memcached, which supports multiget.
2012-08-10 21:37:28 +00:00
Maks Orlovich f5eb5a914b Improvements for global statistics support: make it possible
to view global stats if per-VHost is on. Fix HTML timing histogram.
Add some rudimentary testing for the per-vhost stats flag.
(Fetcher and cache stats still global only).
2012-08-10 20:10:34 +00:00
Josh Marantz 7c44dac650 Comment out flaky test
Include the key in the value for memcached so that hash collisions don't result in bogus data.
2012-08-10 18:22:43 +00:00
Matt Atterbury 110f481e6d Move/remove some methods as part of refactoring/future work. 2012-08-10 14:32:11 +00:00
nikhilmadan@google.com 9e017f6026 Allow the overriding of caching headers for resources based on a wildcard. 2012-08-10 10:42:15 +00:00
Maks Orlovich ae281d64cd Make these constants constier; and also move out the filter
names from option names blob.
2012-08-09 20:00:53 +00:00
Maks Orlovich 90a24105a0 Consistently use target : deps in Makefiles (i.e. consistent use of
spaces). (jefftk)
2012-08-09 19:31:43 +00:00
Josh Marantz bb2d467ded If meta tag has content type or charset information then copy it to
flush_early_info. 

Minor fixes to allow compilation on MacOS.
2012-08-09 18:09:33 +00:00
Jeff Kaufman a2723467a6 Cleaning up comments. 2012-08-09 15:25:36 +00:00
Maks Orlovich ff829955b4 - Making Chrome use Image tags in FlushEarlyFlow. Also make the Flush early
flow tests independent of browsers by introducing dummy user agent strings.
  (mmohabey)
- Flush all the css in the html early with flush subresources filter instead of flushing css only in the head.
  (pulkitg)
2012-08-09 15:14:55 +00:00
Maks Orlovich 1e116890a5 Initial cut at optionally per-vhost statistics, enabled via
ModPagespeedUsePerVHostStatistics. Setup works, and mod_pagespeed_statistics
prints the local data. Some stats are global-only for now, however,
and there is no way of viewing global stats if per-vhost is on
for this revision.
2012-08-08 21:32:56 +00:00
Maks Orlovich 6c939f3387 Fix us losing histogram data every time a new process is launched,
due to re-configuration of histogram with the same setting causing
a needless Clear().
2012-08-08 21:14:19 +00:00
Maks Orlovich 36653416fe - Adding params to beacon to track time to first byte of html, when flush
subresources early is enabled. (ksimbili)
- Dont update kSubresourcesPropertyName value in property cache if user 
  agent does not support flush_subresources. (pulkitg)
- blink: Splitting the StripNonCacheableFilter into 2 separate filters. 
  This is being done since just the stripping of non cacheable content is 
  required for the HTML diff detection part, but other things being done in 
  this filter are not. (guptaa)
- Blink logging improvements (poojatandon)
2012-08-08 18:26:00 +00:00
Maks Orlovich 24406783c4 Add detection for Amazon's EC2 linux images, based on info
from mod-pagespeed-discuss --- we should treat them like CentOS,
with yum.
2012-08-08 18:21:01 +00:00
Maks Orlovich 024b9d9cc4 - Add a few more bots to the BotChecker. (nikhilmadan)
- Disable insert_dns_prefetch for non-chrome browsers.
  The interaction between insert_dns_prefetch, which applies for all browsers and
  collect_subresources, which applies only for chrome, was causing FSE to not
  apply on WPT benchmark runs. (bharathbhushan)
- Use base CriticalImagesFinder by default in the resource manager instead of NULL pointer. 
  (jud)
- Supressing a LOG(DFATAL) in blink flow since the new html diff detection feature has scripts 
  which are not deferred. (guptaa).
- Remove stale dependency in automatic/Makefile; it's gone since we now use 
  our own url_to_filename_encoder.
- Do not report timings beacon in blink when doing testing, for better
  determinism. (rmathew)
- Introduce a flag to override the cache-time for cacheable resources in
  Blink. (rmathew)
- js_defer: Moving the following code out of experimental.
  * Parallel download of scripts.
  * Also not defering inline scripts until script with src is found.
  (rmathew)
2012-08-07 18:23:48 +00:00
Maks Orlovich 9e52ea923f Add a notion of a global statistics variable, and add
support for it to SplitStatistics. Make the variable
used by the ImageRewriteFilter for limitng concurrent
rewrites use one of these.
2012-08-06 20:17:28 +00:00
Shawn Ligocki 8e80132972 Stop canceling rewrites just because they produced an empty rewrite (from non-empty source).
This was originally added when the parser was young and had blanked a few CSS files simply because it could not parse them. Now it has grown to the point where I do not expect blanking the page to be a failure mode.
2012-08-06 19:25:30 +00:00
Maks Orlovich 37996a76dd Fix warning on release builds:
"‘hex_buffer[0]’ may be used uninitialized in this function"
The warning is false as hex_buffer[0] is only read in
case kFirstDigit and we transition to kFirstDigit only after writing
to hex_buffer[0] (but gcc can't prove that).
2012-08-06 17:55:51 +00:00
Maks Orlovich 045f612c4d Use our own version of url_to_filename_encoder instead of
the Chromium one.
2012-08-06 15:01:01 +00:00
Maks Orlovich 6c77d55640 - URL cache invalidation for property cache. (sriharis)
- blink: First attempt at automatically detecting when the publisher html has
changed. This is still experimental and the approach needs more 
experimentation and iteration. (rahulbansal)
2012-08-06 14:53:06 +00:00
Shawn Ligocki e5dd834e1e Rm unneeded file. 2012-08-03 21:28:20 +00:00
Maks Orlovich 104e759a2d Add SplitStatistics, which will be used as a part of
a per-vhost statistics implementation.
2012-08-03 15:47:29 +00:00
Maks Orlovich dd05b9966e Do not populate FlushEarlyResource in Render() if it is already populated in
RewriteSingle().

This introduced a race condition where the RewriteDriver() which was used to
fetch the resource is deleted by the time we call Render(). Thus the
RewriteOptions are also deleted and resource->url() uses old RewriteOptions
which are already deleted.

It also fixes another race condition where SaveOriginalHeaders might be
getting modified in another thread while getting coped in one thread.
(mmohabey)
2012-08-03 15:40:22 +00:00
Maks Orlovich 4ad79864ad Rollback "Rewrite JS in Characters() hook", it caused crashes during load testing.
(mmohabey)
2012-08-03 15:39:09 +00:00
Maks Orlovich 17b23ed962 Make deferJS not wait until the prefetch request is done.
- If the resource is cacheable, then second request is doesn't download
  anything extra.
- If the resource is not cacheable, then it is better to place the
  script request as soon as possible. Many ad requests are of this
  kind. (ksimbili)
2012-08-03 15:38:09 +00:00
Shawn Ligocki e205134dff Rewrite JS in Characters() hook. Since we are guaranteed by HtmlParse that we will always get only one Characters() block in a <style> element, we can rewrite that inline script immediately. 2012-08-02 23:20:57 +00:00
Matt Atterbury e99f543f20 Instrument CSS import flattening by adding varz statistics variables
for the various failure cases.
2012-08-02 18:46:30 +00:00
Shawn Ligocki fa3963aa1d Check that the parent's ResourceContext is not NULL before copying it over. (nikhilmadan)
Only onload should be waitiing for async scripts to finish and nothing
else need to wait.
- So far we were delaying DOMContentLoaded event, which was delaying
  the browser onload for few sites. (ksimbili)

Adding the limit on combined resource size.
This is being added to do experiments to figure out the optimal size for the combined resource. (ksimbili)
2012-08-02 17:05:43 +00:00
Maks Orlovich ae6aab6d21 Add a pseudo-implementation of shared memory APIs that's usable
within a single process only (so not within multi-process servers
like Apache). This is mostly so that existing shared-memory histogram 
implementation can be used inside tests, but could also be potentially 
a useful way of bootstrapping deployments.
2012-08-01 20:45:13 +00:00
Maks Orlovich 4d1bb9c105 - Statistics Logger now only opens the log file when writing to it, rather than keeping it open for the life of the object.
[bvb]
2012-08-01 20:37:12 +00:00
Maks Orlovich 35b4942253 Bump libwebp version to that roughly matching
Chrome 21, has some important fixes.
2012-08-01 14:23:29 +00:00
Maks Orlovich c8287f21a5 - Adding headers fetch time in beacon to simplify debugging with Flush Early
Flow. (mmohabey)
2012-08-01 14:11:43 +00:00
Maks Orlovich 3ddf668491 - Disable lazyload_images when class contains nivoSlider. [nikhilmadan] 2012-08-01 14:10:03 +00:00
Shawn Ligocki 05b8a68f8b Open-source css_minify_main and tweek it so that it just dumps all parsing errors to stderr (rather than with VLOG). This should make it much easier for folks to diagnose the problems in their CSS. 2012-07-31 21:35:38 +00:00
Shawn Ligocki 26d31dd632 Use TryLock for statistics logger. Fix bug in TryLock implementation. (Logging is still disabled by default.) (bvb) 2012-07-31 21:32:25 +00:00
Jud Porter e4404f975f Enforce maximum number of inodes in file cache. 2012-07-31 15:45:23 +00:00
Maks Orlovich b5f6b684ce - Allow the lazyload images blank image url to be configurable.
(framework only, no user option yet)  [nikhilmadan]
- Some slight markup fixes in statistics.
- Adding gflag for report unload time. [satyanarayana]
- Ensure that the client domain rewriter script gets 
  appended even when body spans multiple flush windows.
  [rahulbansal]
- Keep track of applied rewriters. [mmohabey]
2012-07-30 18:34:34 +00:00
Shawn Ligocki 9324e82329 Standardize apache dir with others.
Subchanges:
* std::string -> GoogleString in apache dir.
* #ifndef out references to LogMessageHandler which doesn't seem to work in Google3
* RewriteOptions::ToString() -> RewriteOptions::OptionsToString() because it was originally named the same as static RewriteOptions::ToString(Foo foo) methods which caused "shadowing error" when trying to compile ApacheConfig.
2012-07-27 17:58:54 +00:00
Shawn Ligocki 0ca09ff18a HTTPCache invalidation of URL patterns.
This CL contains the actual changes for HTTPCache invalidation of URL
patterns and also the rewrite options changes for this.  I can split
the latter into a separate CL. (sriharis)

Adding a comment in rewrite_query.cc indicating that the current logic
causes css inlining-threshold to change when only
ModPagespeedImageInlineMaxBytes header is specified. (anupama)
2012-07-27 17:49:45 +00:00
Josh Marantz 84b67367a0 Add generic cache statistics module and use it for apr_mem_cache. 2012-07-26 23:17:59 +00:00
Maks Orlovich 4c15083264 Try to fix problem with Win32 build of util_core (which is
used by libpagespeed).
2012-07-26 20:27:59 +00:00
Jeff Kaufman c51ed59baa Make the url-attribute test less flaky 2012-07-26 19:32:57 +00:00
Maks Orlovich fc2cfb4f34 Give httpd2.4 includes .gyp file a different name than the
httpd2.2 one, as having them the same seems to be giving
the gyp generator problems. Should hopefully fix the xcode
build.
2012-07-26 19:27:55 +00:00
Maks Orlovich 844eba752d Added SharedMemTimestamp for logging statistics. This will eventually be integrated with the front-end console.
Done by bvb working with sarahdw, divided roughly as follows:
bvb: tests, integration with Statistics constructor, SharedMemVariable changes, UpdateAndDumpIfRequired, Logger ctor/dtor, responding to CL comments
sarahdw: DumpConsoleVarsToWriter, IsIgnoredVariable
2012-07-26 18:53:42 +00:00
Jeff Kaufman 3d44cc1d64 When in xhtml and not enclosing the instrumentation script in a CDATA, escape *all* the ampersands. 2012-07-26 17:54:40 +00:00
Jan-Willem Maessen 11cdacf01c Switch to using fast_wildcard_group rather than wildcard_group. 2012-07-26 17:16:12 +00:00
Josh Marantz d7bb16b43f Do not lazyload images inside noscript tags. (nikhilmadan)
Corrects thread-safety issue for printing histogram stats. (jmarantz)
2012-07-26 16:45:55 +00:00
Josh Marantz 0b725eabb1 Collect the stats from all memcached servers and show those
in /mod_pagespeed_statistics.
2012-07-26 13:31:43 +00:00
Josh Marantz 9b0674f688 Improve UX for histograms, showing the collected stats as a table and
selecting a row in the table to just show one histogram at a time.
2012-07-26 02:05:56 +00:00
Jud Porter 77835d3651 Remove empty directories from cache during clean. 2012-07-25 20:33:44 +00:00
Josh Marantz 7b114d42b9 Turn off cache extension of kOtherResource until we make it more configurable. (jefftk)
Turn memcached tests back on.  apr_memcache was not
initializing properly because the thread_count being passed in
w as negative.  This was due to AutoDetectThreadCount not
being called until after the cache was initialized.  I moved
that init to the ctor to make it work properly.
2012-07-25 20:10:23 +00:00
Jeff Kaufman 32c0d313b7 Turn off cache extension of kOtherResource. 2012-07-25 19:49:06 +00:00
Jeff Kaufman 99f4786947 Use strrchr instead of reimplementing it; describe the complexity and tradeoffs of resource specific options. 2012-07-25 17:37:32 +00:00
Maks Orlovich f0cbcbe706 Get OpenCV from git. http://code.opencv.org/projects/opencv/wiki
now confirms that's the proper source.

Fixes issue #478
2012-07-25 17:24:12 +00:00
Jeff Kaufman c09bb4f4ae Rename ContentType::Category to semantic_type::Category 2012-07-25 15:02:22 +00:00
Maks Orlovich bc9b1c0a94 Clarify when these methods are invoked. 2012-07-25 15:01:44 +00:00
Maks Orlovich b515d59933 - First cut implementation of Insert DNS prefetch tags filter. (bharathbhushan)
- First cut of url rewriting on the client side. (rahulbansal)
- Move the lazyload JS to before the first image instead of always putting it in
  the head. The other side effect is that we don't insert the JS code when the
  page doesn't have any images. Also, do stricter checking for dfcg slideshows. 
  (nikhilmadan).
- Initialize in ctors suspiciously uninitialized member variables. (piatek)
- Comment out memcached system test till we get to the bottom of it. (jmarantz)
- Rewrite CSS in the Characters() hook. Since we are guaranteed by HtmlParse that 
  we will always get only one Characters() block in a <style> element, we can 
  rewrite that inline script immediately. 

  Obviates the need for css_filter_across_flush variable, since we no longer fail 
  to rewrite CSS which spans across a flush boundary. (sligocki)
- Switch apache_furious_test to using fetch_until, avoiding potential future flakiness 
  (jefftk)
- Fixing cache_extender counter for number of cache extended resources on
  a page. (anupama)
- Adding an option to disable blink dashboard which'll be used for
  validation.
- Added a log DFATAL to find out if any script found with out
  pagespeed_no_defer. (ksimbili)
- Make Furious extendable; added Merge to Furious to make Clone easier to 
  override in subclasses (mukerjee)
2012-07-25 14:54:12 +00:00
Maks Orlovich 2badd03aa4 First iteration of mod_pagespeed_console
Done by bvb working with sarahdw, divided roughly as follows:
bvb: tests, scraping and parsing data, responding to CL comments
sarahdw: tests, DOM manipulation, Charts API.
2012-07-25 14:42:37 +00:00
Jan-Willem Maessen c102b3a251 Don't serve webp to Chrome on Android versions where webp display is broken 2012-07-24 22:35:27 +00:00
Jeff Kaufman 7c9c69f18b make furious (experiment-framework) more extensible 2012-07-24 14:38:55 +00:00
Jeff Kaufman 8ee6ca8648 Use $HOSTNAME instead of $1 because system_test_helpers.sh deals with argument parsing 2012-07-24 14:11:25 +00:00
Josh Marantz 978a089480 Always test memcached by starting a new memcached, running one or more
programs, and then closing down the memcached.
2012-07-24 03:44:39 +00:00
Jeff Kaufman c40066ceed Move RewriteOptionsTest to namespace net_instaweb to be a little less verbose 2012-07-23 21:25:57 +00:00
Josh Marantz 7706cdf90b Add ModPagespeedMemcachedServers as an option, removing the ifdefs to
allow easier experimentation.

Add a system-test for memcached.
2012-07-23 18:51:43 +00:00
Jeff Kaufman 1b4339f1de Respect custom options when regenerating resources. Fixes Issue 457. 2012-07-23 15:23:23 +00:00
Jeff Kaufman 13f86a9de1 Changes to url valued attributes, experiment_spdy, cache extension,
inline_only_critical_images, defer_js, and blink.

 - Decisions about cache extension for resources happen in about two places:
   first we have to decide which urls to consider and then once we've fetched
   them we have to make sure that it's really ok to cache it.  Previously the
   code only fetched resources for further consideration from urls found in
   attributes that are supposed to contain images, stylesheets, and scripts.
   This change expands consideration to all attributes that are expected to
   indicate resources.  

   This is only an intermediate step, however, because once we fetch the
   resource one of our checks is that the content type is an image, css, or
   javascript.  Which means that while we will now identify <audio src=...> and
   fetch the url, we won't actually cache-extend it because it's not on the
   whitelist.  In standard usage this change won't make any changes to what
   resources end up being cache extended, though more resources will be fetched
   from the origin server, potentially large audio and video files. After this
   change is in, I'll be coming back to change
   CacheExtender::RewriteLoadedResource to have a more complete whitelist for
   what should be considered for cache extension.

 - Expanded system testing for url-valued attribute detection and pulled it into
   its own script.

 - Add an experimental filter, experiment_spdy, for forcing some resources onto
   https and hence, for a capable client, SPDY.  This is temporary and will be
   removed after more testing.
2012-07-23 14:11:50 +00:00
Josh Marantz 172c3d86ed Add rudimentary memcached support to mod_pagespeed. The calls to
memcached are blocking, and the server name is hardcoded and it
is all hidden in a default-off ifdef for now as I experiment.
2012-07-20 20:22:05 +00:00
Jeff Kaufman cb3050ec1e Add a check that Analytics javascript is added for the experimental group and not for the no-experiment group, and that it is only added when ModPagespeedAnalyticsID is set. Also check that we're including the experiment ID in the beacon. 2012-07-20 19:26:41 +00:00
Maks Orlovich 765a4dd00c Flush early flow: If defer_js enabled : flush only css early.
Else flush both css and js. (mmohabey)
2012-07-20 14:30:11 +00:00
Maks Orlovich 5def274b45 Bump the number of buckets here; load testing suggests
the current setting is insufficient.

Also tweak comments to be properly parametrized
by constants.
2012-07-20 14:25:48 +00:00
Jud Porter cfb34efa37 Add RemoveDir to file system interface. 2012-07-19 22:06:28 +00:00
Maks Orlovich 9f6282a589 Split RewriteDriver creation and use into two steps
in the new BlockingFetch stuff; I'll need the driver pointer
in instaweb_handler to apply connection/specific tweaks.
2012-07-18 20:54:39 +00:00
Jan-Willem Maessen c384336941 Add fast wildcard group. Permit set of required filters for furious tests to be modified. 2012-07-18 19:56:58 +00:00
Shawn Ligocki ac27800818 Some basic cleanup and comments added to instaweb_handler.{cc,h}. 2012-07-18 18:05:24 +00:00
Shawn Ligocki 0ba6fc3d7f Make a const version of ResourceManager::global_options() and make ResourceManager::ComputeSignature() const so ResourceFetch::ApplyFuriousOptions can take a const ResourceManager* (jefftk)
Include the index of the active furious spec in resource urls, and
when handling a resource request parse it out and use it to apply
experiment settings.

This changes the pagespeed resource url format from:

LEAF.pagespeed.FILTER.HASH.EXT

to

LEAF.pagespeed.EXPT.FILTER.HASH.EXT
... change too long to be displayed here ... (jefftk)
2012-07-18 18:03:35 +00:00
Jan-Willem Maessen d1e1f42879 Add TryLock methods to all mutex classes. This will enable us to reduce lock contention in some new code. 2012-07-18 14:53:44 +00:00
Shawn Ligocki c3be01383b Move collapse_whitespace from middle of pre-render filters to end of post-render filters so that it can collapse any whitespace left behind by rendering other rewrites.
Also moved remove_quotes after other post-render filters to have similarly maximal affect.
    	
Fixes issue 463.
2012-07-16 22:43:03 +00:00
Shawn Ligocki 7621dd45da Add a ResourceFetch::BlockingFetch() interface and move all the blocking code from instaweb_handler:handle_as_resource() there. 2012-07-16 18:05:47 +00:00
Josh Marantz d782c7d399 Correct the logging for Non 200 status code. (snagori)
Experimental code to measure the preview-images gain.  Always inplace
low quality data uri's in the image tag itself.  Replace low quality
data uri with high quality images only after onload of that image is
triggered.  (pulkitg)

Blocking-rewrite cleanup (bharathbhushan)
2012-07-16 13:38:52 +00:00
Josh Marantz 2cacddefbb Tighten the condition for rendering: check that enabled_fix_reflow is
true and that it is not a blink request.  Also move
serve_blink_non_critical_ from options to driver, since it is a
request specific flag.  (sriharis)
2012-07-13 13:19:38 +00:00
Shawn Ligocki 492f13cf8c Use PSA's ResourceFetch in mod_pagespeed handle_as_resource() flow. 2012-07-12 19:46:13 +00:00
Shawn Ligocki 92fc1b07a1 Blink updates. 2012-07-12 19:45:04 +00:00
Maks Orlovich 4bc0c8b892 Remove attempt at randomization of cache checking
offsets. It did not actually work, as it was done
when creating the cache in the parent process anyway,
before any forking, and it makes the unit tests
fail on some newer Linux distributions.
(See issue 453)
2012-07-11 20:48:31 +00:00
Maks Orlovich e4333c4b22 Store inlined image URLs in the property cache when configured. (piatek) 2012-07-11 20:47:56 +00:00
Matt Atterbury 1ec9183ddc 1) Don't inline a CSS file with a different charset from that of the
containing HTML.
2) Strip the BOM of an inlined CSS file with a compatible charset.
2012-07-11 18:17:52 +00:00
Josh Marantz d6b9a8a220 Annotate why CSS Combining did not work if the 'debug' filter is on. 2012-07-11 13:36:59 +00:00
Josh Marantz 2624bf542e Adds/tests a helper function to insert a comment near the current node. 2012-07-10 21:52:29 +00:00
Maks Orlovich 1fa8ba769d Fixes for builds on newer systems.
(See issue 420 and issue 453).
2012-07-10 17:04:22 +00:00
Matt Atterbury f5738b897e 1. Helper function changes for flush-early logic.
2. Improve matching behavior by exiting early when a match is found.
3. Robustify the local storage cache test as it was flakey.
2012-07-10 14:58:58 +00:00
Josh Marantz 6e245b465d Add a test showing that "//domain/path" works when resolved
against a base, and not resolved in the absense of a base.
2012-07-09 17:30:51 +00:00
Maks Orlovich 40049f4dcd Make sure not to build with std=gnu++0x for those
libpagespeed versions that have it on for chromium_code,
as it can cause binary compatibility problems (showing up
as crashes in serf tests with gcc >= 4.7 --- see MPS
issue 453).
2012-07-09 16:27:33 +00:00
Josh Marantz 462ccd7cfb Clean up the api IsAnyMobileUserAgent. (rahulbansal)
Place js request for all js files for now. (ksimbili)

Clean up superfluous conditional and comment out a racy test (jmarantz)
2012-07-09 14:05:02 +00:00
sriharis@google.com 93b06ef2c9 1) Add a new scriptsAreDone() function that returns "true" when all deferred
scripts are done executing. Also cleans up "psanode" elements from the DOM at
the end.
2) Flush Subresource Early Filter.
3) Trigger onload only if browser onload is triggered. Else wait for browser.
4) Remove the old prioritize visible content options.
5) Place js request for all js files for now. We will need to do some marking
of nodes to indicate a resource is cacheable or not by the browser.
2012-07-08 04:15:56 +00:00
Shawn Ligocki e3e2478fc5 Remove all reference type member variables (Like const GoogleString& foo_;).
Converted "GoogleString& foo_;" -> "GoogleString foo_;" because I think most cases do not guarantee that the string reference they are initialized with will live long enough.
Converted "Foo& foo_;" -> "Foo* foo_;", which acts identically, but makes it much more clear from the call that a pointer is being saved and must be valid for some lifetime.
2012-07-04 19:12:13 +00:00
Shawn Ligocki 62d4ece07e Simplify X-Mod-Pagespeed/X-Page-Speed header code.
Use RewriteOptions::x_header_value() instead of the extra version parameter in ProxyInterface.
    	
Set default mod_pagespeed header value in ApacheConfig constructor instead of using "__VERSION__" dummy value and requiring user to replace.
2012-07-04 16:37:33 +00:00
Shawn Ligocki 93cdb1aa97 Open source blink filter and blink_critical_line_test. (poojatandon) 2012-07-04 16:16:49 +00:00
Matt Atterbury 818190b3fe Pass a resource to the ShouldInline method in preparation for using
headers to determine a CSS resource's charset when deciding.
2012-07-03 16:30:51 +00:00
Matt Atterbury 0ddf4d49a3 1. Added utility function to get initial @charset rule from CSS.
2. timing.proto deprecated and placed inside logging.proto.
3. Use full URL based matching for blink.
4. Set a limit on the max HTML rewritten by blink.
5. Option to apply blink on all URLs if families is empty.
6. Fixed memory leak in proxy_fetch.cc
7. Added utility function to determine the charset of a CSS resource.
2012-07-03 16:26:08 +00:00
Jeff Kaufman 1ec5873be8 Support a new ModPagespeedUrlValuedAttribute directive that allows configuration
of the resource tag scanner to identify other element attributes as being
url-valued in addition to the default set from the html4 and html5 specs.

Fixes issue 437
2012-06-29 20:31:11 +00:00
Maks Orlovich 7a004166bc Add an enum for 'data' as well. 2012-06-27 18:39:37 +00:00
Maks Orlovich 253fa5bfdd - Disable js inserted filters in the options for XmlHttpRequests (pulkitg)
- Rewrote the client/session -> experiment interface for furious to be 
  extensible (mukerjee)
- Changed /mod_pagespeed_statistics handler to print all variables with space padding.
  (sarahdw, bvb)
- delay_images: fix problems with multiple flush windows (pulkitg)
2012-06-27 18:29:46 +00:00
Jeff Kaufman ab3852803f Rewrite all links, not the most-commonly-used subsey we were rewriting before.
This is a partial fix to issue 437; we still need to add support for specifying
additional tag attributes to rewrite in the configuration.
2012-06-25 15:36:40 +00:00
Jeff Kaufman b3be055cff Remove ModPagespeedDisableForBots. It was undocumented, might have been seen as
cloaking [1] if used, and was more effort that it was worth to continue
supporting given changes elsewhere.

[1] http://support.google.com/webmasters/bin/answer.py?hl=en&answer=66355
2012-06-22 17:20:51 +00:00
Josh Marantz 9d61d775de Change the blink families merge logic. If src has non-empty blank
families then we replace this' blink families with src's. (sriharis)

getElementById() should return node which is already processed by
defer_js, not the node which is not yet processed. (pulkitg)

Make blink option parsing tolerant of extraneous whitespaces. (sriharis)

Freshen modpagespeed.com, giving it some logos & links to other project docs (jmarantz)
2012-06-19 13:42:10 +00:00
Shawn Ligocki 420a3cf85f Follow up to r1654.
Mostly get rid of check [ $? = 0 ] and convert `...` to $(...).
2012-06-15 19:23:40 +00:00
Maks Orlovich 1caebb47a0 Prerequisites towards using RateControllingUrlAsyncFetcher
in Apache: as with prefork we can't really have too many
concurrent corrections, we will need to drop things far
more aggressively. With that, remembering failure for 5
minutes will clearly be too much, so mark those drops
with a header and give it a separate 10 second TTL.
2012-06-15 19:04:54 +00:00
Josh Marantz a5da8e760e Reinterpret + and - to provide incremental query-param processing, so you can modify a config without resetting it. 2012-06-15 18:27:07 +00:00
Maks Orlovich 0ca2cfe99c - Set max limit for image optimization's based on resolution
(poojatandon)
- add_instrumentation: Add tail script only once even if 
there are more than one body tags present. (satyanarayana)
- add_instrumentation: Support incorporating experiment ID 
  into the beacon (31066430)
- lazyload_images: While replacing the image src create a new 
element and replace, instead of setting the src, since that 
doesn't seem to always work in chrome. Also, change the setTimeout 
to 0 since we just want to make sure we don't block. (nikhilmadan)
- defer_js: Fix handling of some additions of listeners
after firing of deferJs.Dom_Ready (pulkitg)
- defer_js: Fix bug with async scripts in IE (pulkitg)
- blink: Make the default blink behaviour be to apply on all urls 
(with default cache time). (sriharis)
2012-06-15 17:12:22 +00:00
Josh Marantz 7b8ee512a2 Use mimetype rather than doctype for selected xhtml decisions. As we don't
always know the final mimetype, we employ conservative strategies (e.g. //[CDATA hack)
when we don't think we know for sure.  We can also be sure to close <link>
tags.

Fixes Issue 439
2012-06-14 03:07:58 +00:00
Josh Marantz e147991431 Adding request header checks for mobile detection in blink. (guptaa) 2012-06-14 03:01:45 +00:00
Shawn Ligocki 467e172e30 Don't try to lazily load images that are critical or have a pagespeed_no_defer attribute. (nikhilmadan) 2012-06-12 20:26:55 +00:00
Shawn Ligocki ded4671b58 Cleanup system tests a bit.
1) Make check() call ["$@"] instead of [eval "$@"] so that we don't need double quoting or other tricks.
2) Make apache_system_test.sh source system_test.sh so that (A) we only need to run one executable to test do testing and (B) we can share the shell function definitions (which had started to skew).
3) Other minor cleanup like grep -> fgrep or egrep where I noticed it to make it clear what we were testing for.
2012-06-12 20:23:01 +00:00
Jan-Willem Maessen 867f0d38ef Don't strip inlined image dimensions when desired_dimensions are absent. This avoids stripping dimensions of enlarged images, but also neglects to strip dimensions from images that have not been resized. 2012-06-12 01:18:11 +00:00
Maks Orlovich 41a5ab65b2 Fix inlining images into CSS when we're handling CSS
through the fallback path.
2012-06-11 22:17:20 +00:00
Maks Orlovich 2c3cd1c387 In preparation for using the rate limiting fetcher,
drop the requirement for using pollable fetchers inside
Apache, as we should no longer be relying on the poll
functionality anyway (instead using RewriteDriver
to block while resource fetches happen in an another
thread).
2012-06-11 14:35:03 +00:00
Maks Orlovich 7807b53311 - blink: Improve non-cacheable element attribute value matching. (rahulbansal)
- blink: Force disable inline preview images in Blink flow. (rahulbansal)
- js_defer: Use image downlaod technique for rewritten resources. (ksimbili)
- js_defer: fix minification issue (ksimbili)
- Fix typo in WPT UA constant (pradnya)
2012-06-11 14:06:21 +00:00
Matt Atterbury 87765d268e Redid the system tests for the CSS flattening limit since the use of '&'s in
URLs broke subsequent tests.
2012-06-08 19:54:15 +00:00
Matt Atterbury 42b109f0cd Added facility to limit the how big flattened CSS can get. 2012-06-07 15:37:58 +00:00
Shawn Ligocki f89e041342 Fix updating of response code property value. 2012-06-07 15:24:44 +00:00
Shawn Ligocki 18ff4a5305 Alphabetize mod_pagespeed_example/index.html. 2012-06-07 15:23:40 +00:00
Shawn Ligocki bc0b310bed Document fallback_rewrite_css_urls. 2012-06-06 17:32:52 +00:00
Shawn Ligocki 956eef5478 Stop cache extending things that aren't CSS/JS/images. Before this CL, we would allow extending some things (content types we recognized), but only changing the Content-Type to text/plain.
So .ttf files would not be cache extended, because they were not a recognized content type, but .html (or .swf, etc.) files would be cache extended as .txt.

This came up because when CssFilter falls back to CssTagScanner, it no longer knows the context of URLs it is trying to rewrite, so it passes all to image rewrite filter and cache extender. We don't want to cache extend non-CSS/JS/images.
2012-06-06 15:50:47 +00:00
Jeff Kaufman 949219cb2e Fixes issue 373:
- Change the default for ModPagespeedFileCachePath from
   /var/mod_pagespeed/cache/ to /var/cache/mod_pagespeed
 - Remove ModPagespeedGeneratedFilePrefix, which we had reserved
   for future use and now don't intend to use.
2012-06-06 15:28:53 +00:00
Josh Marantz a7232ca752 Parallel Downloading of external scripts (both inline and dynamically
generated using document.write). (ksimbili)

Moving some of the image paremters from options to rewriters, as this
causing lot of confusion in the bridge code.  (satyanarayana)

Rename blocking-rewrite prefix used for testing to "psatest".
2012-06-06 14:00:55 +00:00
Shawn Ligocki 00a405a008 Wire up fallback_rewrite_css_urls to Apache directive and gflags.
Add system_tests as well.
2012-06-05 22:40:49 +00:00
Shawn Ligocki c397fb23d9 Blacklist js files that many sites obtain from a single source with a backing CDN. (jmaessen)
Various Blink updates. (sriharis)
2012-06-05 22:37:30 +00:00
Josh Marantz 3505408029 Fix handling of cacheability when authorization: is set.
Strip authorization: on the proxy host.  (morlovich)

Make RewriteDriver's fully_rewrite_on_flush controllable by a HTTP header.  If
X-PSA-Blocking-Rewrite request header's value matches the flag configured value,
fully_rewrite_on_flush will be set to true. (bharathbhushan)

/mod_pagespeed_message should display timestamp in local time, not GMT.
Fixes Issue 448.
2012-06-05 16:43:37 +00:00
Jan-Willem Maessen d44da9d8ad Authorize domain remapping in https as well as http. 2012-06-05 04:17:59 +00:00
Shawn Ligocki 706330b213 Rewrite images in CSS even if the CSS parser failed.
Falls back to using CSS Tag Scanner on two passes. First to collect the set of links, second to replace them after all images have been rewritten.
2012-06-01 20:18:29 +00:00
Shawn Ligocki 48ecb15a9d Change to update the current location in DOM accurately.
- Issue:
when body.innerHTML is set in js, the old references to the dom
becomes invalid.
This change will evalute the current location every time. (ksimbili)
2012-06-01 20:17:55 +00:00
Josh Marantz 2aa24fd479 System testing changes to make it easier to run the full testsuite on
the virtual machines used to build binaries.
2012-05-31 21:07:19 +00:00
Shawn Ligocki 9638824143 Spell check. 2012-05-31 20:27:14 +00:00
Maks Orlovich 9e849eaeb3 Add ReflectingTestFetcher, which is useful for the unit tests
for some of the fixes I am working on.
2012-05-31 16:46:41 +00:00
Josh Marantz e72bb4bee2 Avoid running dangerous fork-based test. 2012-05-31 13:47:27 +00:00
Josh Marantz 50ead03720 Comment clean-up. 2012-05-31 12:50:09 +00:00
Josh Marantz f2a0aaddf3 DeferIframe filter defers the iframe present in html page. Currently,
defer_iframe should be turned on in conjuction of defer_javascript.
(pulkitg)
2012-05-30 19:06:17 +00:00
Josh Marantz 9ccab61460 Make blink sensitive to origin server errors. (sriharis) 2012-05-30 14:19:53 +00:00
Josh Marantz 74a01b3f12 Get full system-test suite running from open-source svn tree. 2012-05-29 18:22:25 +00:00
Maks Orlovich 2aebc67d3f - Permit generic PSA proxy implementation to optionally reject
blacklisted status codes with a status code rather than 
pass them through.
2012-05-29 13:09:17 +00:00
Maks Orlovich a60db6ed41 - Added convert_gif_to_png, recompress_jpeg/png/webp as rewrite_options,
backward compatibility for kRecompressImages (poojatandon)

- Make sure all async scripts are executed before window.onload when 
  doing defer_js (pulkitg)
2012-05-29 11:50:11 +00:00
Shawn Ligocki 146d750088 Add .htc to content types. 2012-05-26 00:13:04 +00:00
Shawn Ligocki e1d1f468d5 Remove kNoOtherContexts from most places it was used. It was unneeded. We should only restrict ourselves to kNoOtherContexts when fetching the resource from another server (which did not rewrite that resource) does not make sense (For example, if we are testing that it is loaded from cache, etc.). 2012-05-25 22:52:24 +00:00
Shawn Ligocki 94532a0baa Record Css::Parser error when trying to add an invalid unicode char found by CSS escaping (eg: "\0").
Stop emitting Warning: "Unicode value 0x0 is not valid for interchange" since we are now handling the error.

In preservation mode, allow ruleset to be passed through verbatim if there was an error parsing values.

Also added a lot more tests for non-UTF8 character encodings.

Fixes issue 426.
2012-05-25 19:32:50 +00:00
Jan-Willem Maessen 787d972c07 Fix ambiguous method naming / accidental overloading in subclass. 2012-05-25 17:12:42 +00:00
Jan-Willem Maessen 9e9e048363 Include fix missed in previous commit. 2012-05-25 16:38:38 +00:00
Jan-Willem Maessen 56d62c5ff0 Do webp->webp optimization in YUV space and avoid upsample. Tweak js deferral
script.  Improve doc of ascii_ctype.h.
2012-05-25 14:13:29 +00:00
Shawn Ligocki 164bedb75f Remove trim_urls from CoreFilters. 2012-05-24 23:46:48 +00:00
Shawn Ligocki d2a474cff1 Add move_css_above_scripts system test. 2012-05-24 21:53:32 +00:00
Josh Marantz ea9f77930b Fix load-tests for 2.4 by adding the shm support as needed. 2012-05-24 16:42:19 +00:00
Josh Marantz a9399bb9bb Make sure beacon uses https if original request did so. (jmaessen)
Update modpagespeed.com documentation links.  (sligocki)

Expose UniLib::IsInterchangeValid(char32 codepoint) in UnicodeText to
help us remove spurious warnings from sites using \0 in CSS files as
an IE targeting hack.  (sligocki)
2012-05-24 13:58:09 +00:00
Josh Marantz ad39ae737a Fix stale comment in pagespeed.conf.template.
Fix debug.conf.template to switch default for 
AvoidRenamingIntrospectiveJavascript back to off for our tests so they work again.
2012-05-23 14:58:25 +00:00
Josh Marantz 2869fd4dd8 Turn on ModPagespeedAvoidRenamingIntrospectiveJavascript 2012-05-23 02:43:39 +00:00
Maks Orlovich ea209808d1 Use more than 1 thread per kind per process when
running with a threaded MPM, as it can significantly
improve the performance.

Also make threading settings configurable.
2012-05-23 00:48:38 +00:00
Josh Marantz 6af8ae3618 Tests unload time options handling for mod_pagespeed (satyanarayana+jmarantz) 2012-05-22 19:48:46 +00:00
Josh Marantz f4e4f9ab83 Add report unload time options handling for mod_pagespeed. (satyanarayana)
Trigger property cache lookup after we have rewrite options.  This
enables us to use rewrite options signature in the key and allows
cache invalidation when the options change.  (guptaa)
2012-05-22 19:11:44 +00:00
Maks Orlovich 309bce5616 Make our libpng.gyp set -DPNG_FREE_ME_SUPPORTED for the
appropriate versions of system libpng (just like
libpagespeed's does for its bundled version --- it'll
probably make sense at some point to only have one
libpng.gyp/libpng copy between us and libpagespeed).
2012-05-22 15:00:11 +00:00
Maks Orlovich 70166b6bc1 Some changes in how the JS file got compiled. 2012-05-22 14:59:23 +00:00
Matt Atterbury 0a8cd45254 Handle BOMs better when combining JS. In particular, determine the
charset of the JS and only combine candidates that have the same
charset as the current combination.
2012-05-22 14:40:31 +00:00
nikhilmadan@google.com 6024b955e2 Fix issue with javascript minification when multiple filters are enabled together. 2012-05-22 13:42:09 +00:00
Josh Marantz 038bd40fed Fixed //net/instaweb/automatic:blink_flow_critical_line_test flakiness. (pulkitg)
Just use "</body>" to detect the end of critical HTML in Blink Critical
Line. Avoids "Marker not found" errors (and non-application of Blink)
when the HTML is even slightly malformed.  (rmathew)
2012-05-22 13:17:42 +00:00
Shawn Ligocki 4eb01d9dfb Simplify kExpect* states a bit in preparation for fallback rewrites.
Now each CSS ValidateRewrite() should be of one of 4 types:

kExpectSuccess  <- Successfully rewrote and changed URL.
kExpectNoChange <- Successfully rewrite, left URL alone.
kExpectFallback <- Parsing failed, fallback rewrite succeeded.
kExpectFailure  <- Parsing failed, fallback rewrite failed (or was disabled).
2012-05-21 21:05:40 +00:00
Josh Marantz 9a3985e28d Get 'http -X' shutdown working with multiple VirtualHosts. 2012-05-21 20:38:22 +00:00
Josh Marantz cb5ef22943 remove unused temp variable. 2012-05-21 20:34:28 +00:00
Josh Marantz 0b682a04d8 Remove webp alpha-channel processing for now. (jmaessen)
Remove reading and writing the status code to pcache from blink
(rahulbansal)
2012-05-21 19:34:27 +00:00
Josh Marantz 0d2207ae6e Do not cache-extend URLs resources that were rewritten by prior
filters in the rewrite thread.

This might also address:
   http://code.google.com/p/modpagespeed/issues/detail?id=401
   http://code.google.com/p/modpagespeed/issues/detail?id=406
2012-05-18 20:44:48 +00:00
Maks Orlovich e69cc742c5 Apparently gyp files are supposed to use type: 'none'
where we're using type: 'settings' per
http://code.google.com/p/chromium/issues/detail?id=96629
... and in fact gyp r1176 removes support for 'settings':
http://code.google.com/p/gyp/source/detail?r=1176

Accordingly, this updates our gyp files to use 'none',
and drops the gyp version to before the support for
'settings' was removed, so that libpagespeed can be
updated w/o unreasonable hurry.
2012-05-18 15:21:25 +00:00
Josh Marantz 69f632d345 Add options for controlling cache-flushing filename and polling interval. (jmarantz)
CSS cleanup. (sligocki)
2012-05-18 14:37:15 +00:00
Jan-Willem Maessen befd81c405 Make Apache locking less noisy. Simplify property cache interaction slightly. 2012-05-18 14:14:56 +00:00
Maks Orlovich d0c2572673 Upgrade our gyp dependency to a version that's new enough
to recognize Linux3 (and FreeBSD!) as platforms that want
make, but not new enough that it removes features used
in .gyp files of our dependencies. Note that this change
also removes the indirection of gyp version via Chrome's
DEPS since I think it would be too risky to touch base/
2012-05-17 21:07:54 +00:00
Josh Marantz bf7aead61e Use CDATA for mod_pagespeed since we don't really know if we are
seeing HTML or XHTML.  Keep using the explicit "&amp;" in proxy
applications, where we have the accurate mimetype in the response
headers.
2012-05-17 20:13:41 +00:00
Shawn Ligocki e56b600d50 More CssFilter cleanup.
Move several CssFilter methods into CssFilter::Context to avoid the spegetti of calls going back and forth between the two classes.
Moved css_image_rewriter_async.cc -> css_image_rewriter.cc.
2012-05-17 14:37:41 +00:00
Josh Marantz 07ebec72f0 Detect XHTML documents via heades content_type and adjust add_instrumentation
script syntax accordingly.

Note that in this change, mod_pagespeed will not work quite right yet because
it doesn't generally have accurate content-type when it runs.
2012-05-17 00:26:48 +00:00
Jan-Willem Maessen e8b54ddd63 Improve comments in image_rewrite_filter, get rid of timedbool in css_filter. 2012-05-16 18:35:25 +00:00
Jan-Willem Maessen 57abe360e8 Add calls to domain_lawyer to permit http and https domains to be redirected together. Clean up timed_bool in css_filter, where it was no longer being used. 2012-05-16 17:28:49 +00:00
Shawn Ligocki 6045fb05e7 lazyload and blink updates 2012-05-16 15:28:29 +00:00
Shawn Ligocki 6f977f748d Some cleanup.
TimedBool -> bool - We don't used the timed part any more in async flow.
Removed undefined RewriteContext::Initialize().
2012-05-16 15:26:58 +00:00
Maks Orlovich 8f0b24b1ca Add an enum for an attribute used by libpagespeed, so I
can port it away from iterating over attributes by
textual name (where both the iterating and textual name
stand in the way of reducing memory use).
2012-05-15 17:04:33 +00:00
Maks Orlovich 82f0a901f6 - Fix a build issue with system OpenCv 2.0,
- Give jsoncpp dir a README file to make it clearer
  what it provides the .gyp files for.
2012-05-15 15:04:21 +00:00
Maks Orlovich b0c5a56f69 - Force invalidate blink cache based on a response header. (sriharis)
- Add ability in instrumentation filter to report unload time. (satyanarayana)
- Adding option to allow blink for mobile devices. If allowed for a site, blink 
  will get applied to all mobile devices for that site (guptaa).
- Adding ability to use fixed desktop user agent for fetches in blink critical line in case of cache misses.
  (rahulbansal)
- Fix the crashes on the loadtest in ProxyFetch. original_content_fetch_ is not guaranteed to exist once HandleDone() 
  is called, so NULL the pointer since we may call HandleWrite() after calling HandleDone(). (nikhilmadan)
2012-05-15 14:40:14 +00:00
Shawn Ligocki dfc9b09aa5 Re-alphabetize mod_instaweb.cc 2012-05-14 18:33:35 +00:00
Shawn Ligocki a396cf2ab5 JS optimization updated 2012-05-14 18:30:21 +00:00
Matt Atterbury e35d697cab 1. Handle CSS having a BOM when being rewritten. Previously this would
result in the initial rule being treated as unparseable, which in the
   case of @import resulted in the import not being absolutified and so
   breaking the CSS when in proxy mode.
   LATER: It turns out that the underlying problem is that CssMinify::
   AbsolutifyUrls wasn't absolutifying URLs in unparseable *selectors*,
   it was only handling declarations. Fixing that resulted in the @import
   being absolutied but not minified, so I've left in the BOM stripping
   and reinserting so that we ignore it (the BOM) for parsing purposes.
2. Fixed a bug where POST request parameter were getting lost when using
   custom options using headers or query options.
2012-05-14 15:22:30 +00:00
Matt Atterbury f4387d5a12 1. Moved BOM/charset handling routines into a utility file.
2. Corrected the overriding of addEventListener in js-Defer.js.
2012-05-14 13:54:19 +00:00
Shawn Ligocki 898bc25fbd Actually test parsing all ModPagespeed* Apache directives. Doing so turned up several bugs:
MaxSegmentLength was misnamed MaxUrlSegmentSize in rewrite_option_names.gperf
IncreaseSpeedTracking was missing from rewrite_option_names.gperf
Deprecated Img directives actually no longer work.

Fixes issue 431.
2012-05-11 22:04:29 +00:00
Josh Marantz 999f388881 Show detail in serf connection-refused errors if the user wants it. This
will help diagnose

   http://code.google.com/p/modpagespeed/issues/detail?id=349
2012-05-11 20:26:06 +00:00
Josh Marantz d5db28228f Add a fetcher that sheds background requests if more than a specified
number of requests are active for that domain. It first queues up
requests upto a limit, triggering them when possible, and then starts
dropping them on the floor.  (nikhilmadan)

Fixed an issue with JsonFetch (pulkitg)

reflow detection tweaks (sriharis)

Added a DeleteProperty() function in PropertyCache to delete the
PropertyValue from PropertyValue map.  (pulkitg)
2012-05-11 20:18:33 +00:00
Shawn Ligocki eb2aece5b5 Remove absolutification versions of CssMinify::Stylesheet and CssMinify::WriteUrls. We do not actually appear to be using them, instead we're using CssMinify::AbsolutifyUrls. 2012-05-09 20:20:07 +00:00
Shawn Ligocki 6783d70a82 JS compile change 2012-05-09 20:19:43 +00:00
Matt Atterbury 845bc7c9dd 1. Move the determination of the HTML page's character set into a single
filter (scan_filter.cc) with the value saved in the RewriteDriver so
   that's available to other filters. scan_filter.cc was chosen because
   it is guaranteed to run and runs first (currently at least).
2. Fixed the experiment code to instantiate a RewriteOptions on each request.
2012-05-09 19:40:44 +00:00
Matt Atterbury bd473dbf84 Removed dead ResourceCombinerTemplate class since no-one uses its features. 2012-05-08 21:56:07 +00:00
Shawn Ligocki 58278a58d8 Absolutify all URLs, not just ones from declarations we expect to have url() values. 2012-05-08 19:30:41 +00:00
Shawn Ligocki 649f11883e cleanup 2012-05-08 19:30:04 +00:00
Josh Marantz b62498596a Centralize our handling of content-types and charsets by forcing
filters to explicitly specify both to Write, rather than giving it at
construction for only -some- spots and scattering SetType's to
cleanup.  Make sure we get the content-type right for all filters (the
combiners got it wrong before) and charset for single-resource ones
(nothing got it right before).  This does, however, require some
conservatism in length checking as we don't know extension length at
OutputResource construction time.  This helps avoids extension
corruption in metadata cache when a request has a valid and known
extension.  (This is in response to MPS issue 412, remembering issue
192.)  (morlovich)

Rewrite domains of hyperlinks, but do not shard them.  Fixes
http://code.google.com/p/modpagespeed/issues/detail?id=428 (jmarantz)
2012-05-08 00:49:57 +00:00
Josh Marantz f78de35730 Free contents of string-nodes on Flush. 2012-05-08 00:24:03 +00:00
Maks Orlovich 68b4ec09ff - Furious needs to instantiate a RewriteOptions on each request,
and the existing code was only working in cases where one was 
being instantiated anyway because there was an .htaccess file
(jefftk)
2012-05-07 18:21:10 +00:00
Maks Orlovich 8a427d7e72 - Don't lazily load images with a position:relative style attribute (in sprites usually) since
getBoundingClientRect() seems to calculate them incorrectly. (nikhilmadan)
- defer_js: Pass event to the event handlers. Now we try to pass only the load event to all
onload event handlers. (ksimbili)
- Export preScriptHeights_ in detect_reflow.js since this is needed in 
detect_reflow_extension.js (sriharis)
- Adding unit tests for blink critical line. (rahulbansal)
2012-05-07 14:23:51 +00:00
Josh Marantz 59192fd5c4 Lazy-decode HTML attribute values. 2012-05-05 00:02:25 +00:00
Josh Marantz 0b9a45da38 Strip closed HtmlElements of most of their memory use after every Flush. 2012-05-04 20:44:20 +00:00
Josh Marantz a3d1485ace Rename deque_vector as vector_deque, per CONCRETE_ABSTRACT convention
established with hash_map.
2012-05-04 17:28:19 +00:00
Maks Orlovich 586cfcea97 Woops, rollback my accidentally committed hacked up version of this benchmark. 2012-05-04 15:06:34 +00:00
Maks Orlovich 4c14bbc123 Some shallow optimizations of our parser memory use ---
pack things tighter, store quotes more efficiently, and avoid
one debugging field that's not really needed (as one can just
use a pointer instead).

On one gigantinormous HTML document of doom it reduces our parser memory
use (335.2MB -> 313.9MB, or about 6%), though less if you
consider fragmentation.

More mechanically, it makes HTMLElement go 96->80 bytes,
and HTMLElement::Attribute go 48 -> 40.
2012-05-04 15:01:50 +00:00
Josh Marantz b69eb8be08 Add limited re-implementation of std::deque using a flat vector with
a potential gap in the middle.  This has less memory overhead than the
default std::deque.
2012-05-03 18:13:46 +00:00
Josh Marantz 3a243125a9 Fix Issue 133: Provide easier mechanism to flush server cache.
Support Flush from mod_pagespeed by touching a file in the cache
directory.
2012-05-02 17:25:46 +00:00
Shawn Ligocki 7a0360a84b Allow decoding valid URLs where original leaf was empty.
Ex: http://test.com/style/I..pagespeed.cf.Hash.css. Original URL was http://test.com/style/.

Fixes issue 427.
2012-05-02 15:40:24 +00:00
Josh Marantz e1e3fed0d9 Cleanup statistics interface, improving type safety. (morlovich)
Report AprFileSystem::Mtime and Atime in seconds, as advertised.  (jmarantz)
2012-05-02 11:54:33 +00:00
Maks Orlovich 0e674c0765 Add SetSessionFetcher, as a replacement for now-dead SetOwnedFetcher
that tries to behave sanely both for memory management
and recycling
2012-05-01 19:06:08 +00:00
Maks Orlovich fc6a103956 jefftk:
We want to rewrite introspective javascript in the ajax flow.  

 We add a boolean 'relocatable' to the metadata cache, and set it to false in
 RewriteJavascript if we see introspective javascript.  In Propagate we only
 modify the urls for slots whose CachedResult has reclocateable=true.

jefftk:
 Fixing bad choice of sed separator in staging_except_module
2012-05-01 18:44:48 +00:00
Maks Orlovich d6c8181164 - If js code pulls out script tags we should leave it alone
because we're likely to break it. Adds
ModPagespeedAvoidRenamingIntrospectiveJavascript (jefftk)
- Allow users to choose which custom variable slot to use for furious.
Adds ModPagespeedExperimentVariable (nforman)
- Deterministic Js Filter for measurements (mmohabey)
- Add naming info to cache objects for debugging/logging (nikhilmadan)
- Fix updating of implicit cache ttl for a resource already cached in our
caches and the default implicit cache ttl for that domain has been changed
meanwhile. (pradnya)
- Mechanism to have Option<> that do not affect RewriteOptions signature
computation. (sriharis)
- Remove some useless string copies.
- Some stats for blink critical line (guptaa)
- Handle no-JS redirector directly in blink critical rite to avoid
  escaping (rahulbansal)
- Use user agent matcher from resource manager in proxy interface (ksimbili)
- Restore the AddBaseTag filter for some experimentation.
- Add ApplyPlatformSpecificConfiguration hook to RewriteDriverFactory (morlovich)
- defer_js: Set psa_not_processed attribute to node inserted through doc.write()
  (ksimbili)
- defer_js: SetAttribute only if the node is an element and not nodes like text,
  comment etc (ksimbili)
- Support per family non cacheable elements in blink flow critical line. (rahulbansal)
- Cleanup some dead (one use was a no-op, which was also killed) Set*Fetcher APIs
  in RewriteDriver (morlovich)
2012-04-30 20:48:37 +00:00
Jan-Willem Maessen af42cff7d7 Permit use of "px" in image dimensions for resizing, and do more spec-compliant
image dimension parsing (while respecting browser behavior).  Additional testing
and tweaking for insert_ga_filter.  Changes to js_defer script to allow more
scripts to be deferred safely (this filter is still far from safe).
2012-04-20 22:24:30 +00:00
Maks Orlovich b7fdbbc7f1 Code for debug dumping domain lawyers. 2012-04-18 19:47:21 +00:00
Maks Orlovich 38d220017f - Add Flash content-type detection (dgerman)
- Fix some missing calls to ComputeCaching (nikhilmadan)
- Blacklist IE8 for defer Js and blink (ksimbili)
- In Apache, only run the property cache on the L2,
  as otherwise it would have difficulty tracking stability. 
  (nikhilmadan)
- Using HtmlDetector for blink (guptaa)
- Adding charset to the blink response. (guptaa)
- Adding more mutexing to property cache. (rahulbansal)
- Document security implications of some code (morlovich).
2012-04-18 19:32:17 +00:00
Maks Orlovich 52036bd7b2 Compute charset for input resources (we don't do anything
with it on output yet). I've also de-virtualized
Resource::ComputeContentType since it's not overriden
anywhere, and given the virtualness of SetType it makes
for a confusing subclass API.

Also tweak DetermineContentTypeAndCharset to set sane output
when failing, as that makes my initial attempt at using
in Resource not crash, which suggest it's a more robust
API.
2012-04-13 20:38:44 +00:00
Maks Orlovich 8ea9efd159 Add a DetermineContentTypeAndCharset (in addition to
DetermineContentType and DetermineCharset) since I want
both in Resource. Also change the error-handling behavior
to match the mime sniffing spec.
2012-04-13 17:15:20 +00:00
Maks Orlovich 52a1391d38 (sriharis) Fix detect_reflow.js minification problem 2012-04-13 16:28:10 +00:00
Maks Orlovich c3ddda6981 Add support to CacheInterface for callbacks recognizing
valid/invalid values. This is intended to help fix
the problem of out-of-date data in metadata L1s
shadowing valid data in metadata L2s (and to eventually
replace the HTTP-specific solution for a similar issue).
2012-04-12 19:20:30 +00:00
Jan-Willem Maessen e7b69e7cfe If we successfully shrink an image, but the resulting file was larger than the
starting image, preserve the requested image dimensions when we inline the
original image file.
2012-04-12 18:56:24 +00:00
Maks Orlovich 196d964d0d Add some extra security paranoia to cache-extender to
prevent some XSS attacks with some insecure misconfigurations.
2012-04-12 17:33:40 +00:00
Maks Orlovich 5ae2e23158 (ksimbili) js_defer: Moving override code to one common place.
Fixes an IE issue. InIE, if a script has textContent set before src is set,
then src is downloaded and executed before adding script node to DOM. 
This results in wrong getElementsByTagName('script');

(sriharis) Two changes in detect_reflow.js:
1) Export the getReflowElementHeight function.
2) Expose a function that returns true when reflow detection is done.
2012-04-12 16:55:48 +00:00
Maks Orlovich b868f3f9a4 Reduce flakiness of this test.. 2012-04-11 20:54:09 +00:00
Josh Marantz 18e31344ae Add 'area' tag to the list of of tags enabled by ModPagespeeedDomainRewriteHyperlinks.
Fixes http://code.google.com/p/modpagespeed/issues/detail?id=414
2012-04-11 18:00:06 +00:00
Maks Orlovich 2a0d462842 - Better document.getElementsByTagName in defer_js (ksimbili)
- Handle non 200 status codes in Blink by storing last response code in
  Dom Cohort (rahulbansal,pulkitg)
2012-04-11 15:10:41 +00:00
Josh Marantz 07f722113b Inlining images in critical line (rahulbansal) 2012-04-09 12:37:05 +00:00
Shawn Ligocki e8a7907e01 Add info message about failure to combine CSS files because of parse failure. 2012-04-06 21:06:57 +00:00
Josh Marantz 0765fc1f71 Hook up & test the ModPagespeedRewriteAllTags option, renaming it to
ModPagespeeedDomainRewriteHyperlinks per popular demand.

Adding a LOG(INFO) while entering BlinkFlowCriticalLine temporarily
since this is super useful while debugging. (rahulbansal)

Use layout marker in blink critical line flow (rahulbansal)
2012-04-06 20:36:31 +00:00
Maks Orlovich d95ea5144e Make our package templates deal with/ship both the
2.2.x and 2.4.2+ versions of the module. Unfortunately
for the RPM the upgrade frequently can't add the new
loading sequence smoothly as the LoadModule is in a 
likely-customized file..
2012-04-05 21:00:16 +00:00
Maks Orlovich 769c49b480 Update development config file templates to permit
loading the Apache 2.4.x (where x>=2, which isn't released yet) 
version of the module.
2012-04-05 19:49:21 +00:00
Matt Atterbury b94041a9df Added the local storage cache filter. Doc to follow. 2012-04-05 19:04:37 +00:00
Josh Marantz 34804e8d47 Remove a dangerous CHECK that was breaking Apache startup in some MPMs. (jmarantz)
Rename response_headers_ptr to mutable_response_headers per protobuf convention.
Make it return NULL when the response-headers have been flushed.  Provide a new
const version response_headers() which is available forever.  (jmarantz)

Flush document.write buffer as soon as getElementById is encountered.
 - The change based on general observation. This doesn't fix all the
   scenarios though.
 - I have tested all the sites from popular sites, where getElementById was
   returning null due to document.write. This fix works with all those.
 - Also now, we maintain the state in which deferJs is currently in.  (ksimbili)
2012-04-05 17:54:24 +00:00
Shawn Ligocki 57c0b04b54 Do not combine CSS files that we can't parse.
It is a bit overzealous as it also prohibits us from combining perfectly good CSS3 constructs that we don't currently parse.
2012-04-05 17:11:20 +00:00
Maks Orlovich ac4b4ae553 (ksimbili) Flush document.write buffer as soon as getElementById is encountered.
- The change based on general observation. This doesn't fix all the scenarios though.
- I have tested all the sites from popular sites, where getElementById was returning null due to document.write. This fix works with all those.
- Also now, we maintain the state in which deferJs is currently in.
2012-04-05 14:45:39 +00:00
Josh Marantz 9e3540a7b4 Factor out guts of automatic/static_rewriter.cc and use as the basis of
a new speed test that can be used with any rewriter.
2012-04-04 21:59:28 +00:00
Maks Orlovich 2a2983d59c When we're not specifically asked to build against
specific apache headers, build both 2.2 and
2.4 versions of the module.
2012-04-04 18:03:36 +00:00
Maks Orlovich bf50c6ac1f Make Apache 2.4 headers available to our build. 2012-04-04 17:24:33 +00:00
Maks Orlovich dbfe2dc467 Support multiple parse event listeners (dgerman). 2012-04-04 17:11:53 +00:00
Shawn Ligocki 086916c45e Stop running all of our tests twice.
I think this is a relic of async-mode testing. But none of these tests were even reading the GetParam() any more so they were all running the same test twice.
2012-04-04 15:14:13 +00:00
Shawn Ligocki 6ebddd88ab Add optional error reporter callback to CSS parser.
Report individual errors and error contexts.
2012-04-04 15:11:57 +00:00
Shawn Ligocki 6d6796459b Add a new filter to detect reflow due to defer js. This filter uses before-defer and after_defer function hooks provided by js_defer.js. (cl/28849432). It should be used only from webkit_headless background render to determine reflows. (sriharis)
Fixing crash while inserting js script to Head (ksimbili)
2012-04-04 15:04:57 +00:00
Maks Orlovich 99632c43f8 Clarify the split between mod_pagespeed.gyp
and apache.gyp --- make the latter only
contain things that are common between the
module and unit tests, and rename it to
instaweb_apr.gyp accordingly. This is also
significant because it means things in mod_pagespeed.gyp
now are exactly the things that rely on httpd
headers (and hence need to be built separately
for Apache 2.2 and Apache 2.4)
2012-04-03 20:59:20 +00:00
Maks Orlovich 37e27ee719 Step 1 of Apache 2.4 build system support: copy over
apache/apr/aprutil build system support over
to us from mod_spdy (rather than importing it).
2012-04-03 19:35:54 +00:00
Maks Orlovich a3cf1aea8c Tweak the log message of blink-load-shed a bit. 2012-04-03 18:07:35 +00:00
Maks Orlovich 458595ef81 Run some blink computations at on a lower priority thread
pool, to try to avoid latency bubbles.
2012-04-03 16:55:26 +00:00
Maks Orlovich 54fa3bf613 - Move setting experimental flag js code to HEAD instead of BODY (ksimbili) 2012-04-03 14:14:21 +00:00
nikhilmadan@google.com 077800e12a Added varz for new BlinkCriticalLine flow.
Stripping out unprintable characters in panel_filter.
Add a maximum size limit for low res image generation in InlinePreviewImages.
Added a basic test to check that changing wildcard groups in rewrite_options changes the option signature.
2012-04-03 09:41:34 +00:00
Josh Marantz d29af11295 Remove deprecated method HtmlElement::Attribute::value(), replaced with
HtmlElement::Attribute::DecodedValueOrNull() (jmarantz)

onload attribute inside html tag were not deferred so far.  This
change fixes it by assuming only JS in all the onload attributes This
change also moves deferJs code to HEAD tag, so that onloads can be
added to deferJs queue. (ksimbili)
2012-04-02 20:01:35 +00:00
Matt Atterbury cf2c53b190 1. Copy the resource_manager_ data member into a local variable so that
we do not try to access 'this' once we have released the mutex.
2. Include allow_resources_ and retain_comments_ in RewriteOptions
   ComputeSignature.
3. onload attribute inside html tag were not deferred so far; fix that by
   assuming that only JS appears in all the onload attributes. Also move
   deferJs code to HEAD tag, so that onloads can be added to deferJs queue.
2012-04-02 13:22:17 +00:00
Shawn Ligocki 3e44c3fb58 Only use LeafSansQuery() to guess the content-type by extension so that /foo.css?version=2 will still be interpretted as CSS when served in corner-cases.
Fixes bug 405.
2012-03-30 22:00:47 +00:00
nforman@google.com 7a8db78c51 Make FuriousSpec more flexible, and fix js bug. 2012-03-30 19:46:28 +00:00
Maks Orlovich e75b819ea0 Sort the test files set, so different copies of it
gets merged in the same order.
2012-03-30 18:58:08 +00:00
Maks Orlovich 36b1aa2b0e Woops. Build system changes for the benchmarks as well. 2012-03-30 16:24:34 +00:00
Maks Orlovich 7004b6bd63 Open-source some microbenchmarks. 2012-03-30 16:17:38 +00:00
Maks Orlovich 31f1a90789 Handle unterminated '&' escapes followed by terminated '&' escapes (jmarantz). 2012-03-30 15:17:16 +00:00
Matt Atterbury 7ca8b99502 1. Adding blink js to head so that onloads in HTML can be deferred.
2. Insert DelayImages javascript at the end of the last modified image node
   instead of end of body. 
3. Start downloading high quality image just after all low quality images are
   transferred to client.
4. Fixed bug with failing to absolutify URLs in unparseable CSS, or in
   parseable CSS when image rewriting is disabled (that is, when all of
   recompress_images, left_trim_urls, extend_cache_images, & sprite_images
   are disabled).
2012-03-30 14:18:20 +00:00
Maks Orlovich 92b49d01a9 - Adding a runtime flag to disable/enable experimental defer js code;
added a new attribute pagespeed_no_defer for script node that should not be deferred 
  (ksimbili)
- Handling the scenario when BlinkCriticalLineData is present in the cache.
  (rahulbansal)
2012-03-29 19:25:20 +00:00
Maks Orlovich 5e317304f3 Update to libpng 1.2.47 2012-03-29 15:36:56 +00:00
nforman@google.com 032c63cf3e Experiment framework updates, increased speed sampling, blink updates. 2012-03-28 14:09:50 +00:00
Maks Orlovich 5b2a2678ad Update path to OpenCV repo. 2012-03-28 11:50:26 +00:00
Maks Orlovich ef58c6537b Improve naming on matterbury's suggestion. 2012-03-26 20:39:17 +00:00
Maks Orlovich 5b6480a097 Use the fetcher from rewrite driver for all resource
work. Should not be an extra dangling object risk since
preceeding code to fetcher use touches the
RewriteOptions, which are owned by the RewriteDriver.
2012-03-26 17:05:04 +00:00
Maks Orlovich 9b27f11bde - Add ability to size-limit HTTPCache (mmohabey)
- Some blink critial line work (pulkitg)
2012-03-26 16:35:13 +00:00
Shawn Ligocki 1fb8b9ae44 Report CSS parse errors.
TODO: Report individual CSS errors with error context (right now we are reporting only the final error mask and no error info).
2012-03-24 21:56:28 +00:00
Matt Atterbury f35549818c Refactor: rewrote the release logic to be clearer. 2012-03-23 16:51:37 +00:00
Matt Atterbury ebdcd42ec7 Encapsulate different paths to json.h in different build environments. 2012-03-23 15:26:52 +00:00
Maks Orlovich a5acc38ae6 Make SimpleStats thread-safe to reduce sources of
worries. (I don't think it actually broke anything
in practice..)
2012-03-22 21:32:12 +00:00
Maks Orlovich 5e1231ee36 Try to clean up a bit of a mess we have: RewriteDriver
had a CacheFetcher set on it, which was used only by AJAX
rewrites, while the corresponding ResourceManager had
the serf fetcher. This moves that cached rewriter
management to ajax rewriter. This revealed that we were
doing testing of ajax rewrites w/o HTTP caching
of inputs at non-resource level, which did not match
reality. The ajax test is therefore extensively
regolded (in some cases making expectations actually
match the comments!).
2012-03-22 20:05:37 +00:00
Jan-Willem Maessen 4561b679d6 Some browsers replace + by %20 in urls, even outside of query parameters. This
was causing 404s for those browsers, particularly when fetching concatenated JS
and CSS files.  We now decode these urls correctly.

Also, a bunch of fixit work to use push_back rather than append, since it is
(most importantly) more readable, and I am assured yields somewhat nicer code
with the GNU STL String library.
2012-03-22 19:52:10 +00:00
Jan-Willem Maessen 93de20242b Fix locking bug in mock_timer. Optimized version of js_defer script. 2012-03-22 17:52:49 +00:00
Maks Orlovich 9c0312befb - Take into account any meta tag charset tag when flattening CSS imports.
http://code.google.com/p/modpagespeed/issues/detail?id=398
  (matterbury)
- Enabling the code for overriding document.readyState in js_defer
  Now we'll throw an console error if can't override it.
  (ksimibili)
2012-03-22 16:55:35 +00:00
Matt Atterbury 1fb330d490 Added setter for unparseable bytes. 2012-03-21 21:11:43 +00:00
Maks Orlovich 0b8662aa84 Tweak our anti-</script> heuiristic in the inliner slightly
--- HTML parsers are somewhat more relaxed in what they accept
for script closing than what it expected.
2012-03-21 18:24:01 +00:00
Maks Orlovich 977bc5f355 - Fix the mutex usage in increment and decrement async event count. (nikhilmadan)
- Add UsageDataReporter to permit dashboard-like 
reporting of error messages in principle (not currently hooked up) (sligocki)
- IWYU fixes + some cleanups in blink (rahulbansal)
- Complete integration of ClientState into ProxyFetch flow. (mdw)
- Some experiment integration in insert_ga_filter (nforman)
- Fix js_defer.js to not use .id but more robust getAttribute("id") (ksimbili)
- Move js_defer test files from mod_pagespeed_example to mod_pagespeed_test (guptaa)
- Fix inappropriate escaping of attributes in lazyloadimages (nikhilmadan)
- Refinments to readyState, doScroll, document.{open,close} handling js_defer (ksimbili)
- Fixes in js_defer for multiple body/html tags.
2012-03-21 17:24:05 +00:00
nforman@google.com a7033f67df strip_non_cacheable filter.
Updates to experiment framework.
2012-03-15 01:52:34 +00:00
Matt Atterbury 182d8aa5dd * Change the ATF cacheable families Merge logic.
* Handle non-js script nodes inserted dynamically
* Factor out code from the meta tag filter for use by the css filter.
* HTML files for js_defer tests.
2012-03-14 13:04:40 +00:00
nikhilmadan@google.com 0b2bf6d58f In lazyload_images_filter, don't block parsing and add a setTimeout for element position computation.
In lazyload_images, re-check all visible elements after onload since some elements may have been moved around by re-flows / DOM manipulations. Also, on detecting the jquery slider, load all images loaded lazily before and disable rewriting.
2012-03-13 10:39:06 +00:00
nikhilmadan@google.com 6f5035a827 Make Freshens update the rewrite metadata. 2012-03-13 05:48:35 +00:00
Josh Marantz 68ac3e58f6 Cleanup thread interlock for property fetch callbacks & headers. 2012-03-13 04:38:55 +00:00
Josh Marantz 138b240b04 Add TimedWait & SloppyTermination to ThreadSynchronizer. 2012-03-13 04:28:40 +00:00
Josh Marantz 56fefd1ce3 Add ClientState classes to util. 2012-03-13 04:11:47 +00:00
Josh Marantz e9afb7b48a Reduce the number of times we copy the request-headers from Apache
structures into our own.
2012-03-13 03:38:51 +00:00
nikhilmadan@google.com 00da0c544a Made BlinkCriticalLineDataFinder accessible via ResourceManager 2012-03-12 12:27:01 +00:00
Josh Marantz dec32273fd Add new fail-after-body mode for MockUrlFetcher. 2012-03-09 22:48:28 +00:00
Josh Marantz 41782bb1cb Mutex-protect the cache delay infrastructure. 2012-03-09 22:08:28 +00:00
Josh Marantz 0bdd1449f3 Allow filters access to request_headers (dgerman)
+ A variety of other aggregated changes.
2012-03-09 16:04:24 +00:00
Maks Orlovich 6fd2263f14 Optimize header removal to not do crazy amount of
needless copying and rather modify the protos in place.
(It's also unclear as to whether the PopulateMap is a good
idea or not)
2012-03-07 18:23:22 +00:00
Maks Orlovich 4de68e74b6 Avoid needlessly creating RewriteOptions (and new query
and HTTP headers) just to check for control query or
headers; it's quite expensive.
2012-03-07 18:09:45 +00:00
Maks Orlovich 6c786cfe4a .. The rest of: Quick work-around to allow other filters to read
RewriteDriver::response_headers_ptr() after MetaTagFilter::Flush().
(sligocki)
2012-03-07 18:08:36 +00:00
Maks Orlovich ce33a3618a Quick work-around to allow other filters to read RewriteDriver::response_headers_ptr() after MetaTagFilter::Flush().
(sligocki)
2012-03-07 18:07:36 +00:00
Josh Marantz b2c8ff4ae4 Add prefix-matching into the thread synchronizer so we can have multiple
distinct tests employing synchronization, without needing to have
all tests control all sync-points.
2012-03-06 18:40:50 +00:00
Maks Orlovich b73af4d025 Optimize ScriptTagScanner construction. We make as many
as 5 of these for just about every RewriteDriver, so if we make
a set on every construction it's actually hot enough to be
worth a percentage point or so on a profile in case where 
we can't reuse the RewriteDriver.

This change results in a ~30% speed up in RewriteDriver
construction.
2012-03-06 18:24:27 +00:00
Maks Orlovich 24b446157d - Actually disable the property cache completely when it's turned off
(nikhilmadan)
- Add support for conditional refreshening resources in the UrlInputResource flow.
  (nikhilmadan)
- Get rid of UrlNamer::ConfigureCustomOptions which isn't used any more.
  (nikhilmadan)
- Store fallback_http_value() in a class variable in UrlResourceFetchCallback.
  (nikhilmadan)
- Add extra parmeter in the beacon to indicate if the request is originated from
  an iframe (satyanarayana)
- Do a redirect inside <noscript> for blink. (ksimbili, rahulbansal)
- In the blink flow, disable all rewriters if there is a json cache miss since the 
  same fetched content is used to compute the json. (nikhilmadan)
2012-03-06 18:10:50 +00:00
Maks Orlovich 85ebf731c8 Fix flakiness in queued_worker_pool_test. 2012-03-05 18:36:21 +00:00
Josh Marantz 6bde7ab01b create vars with idname only if the window.id corresponds to the DOM
node.  Fix the script ordering issues in IE9 as per
http://msdn.microsoft.com/en-us/library/hh180173(v=vs.85).aspx.  Create
id Vars only for IE.  (ksimbili)

Fix p-cache vs client-cache race.
2012-03-05 18:23:19 +00:00
Josh Marantz 6a632a3113 Reproduce races in ProxyFetch with property-cache lookup. 2012-03-05 15:36:36 +00:00
Josh Marantz d12f9b1433 Add support to AsyncFetch to distinguish user-facing requests from
background requests. (nikhilmadan)

Changed the constructor of ProxyFetch to accept RewriteDriver. New
RewriteDriver will be constructed in ProxyFetch if no RewriteDriver is
passed. This change is needed because blink flow requires
RewriteDriver to update the property cache and with current
implementation RewriteDriver is not present there. (nikhilmadan)

Some pending cleanup: removed dead code in BlinkFlow.  (rahulbansal)

Adding option for retaining the input image color sampling for jpeg
images.  (satyanarayana)

1. Basic plumbing for new BlinkCriticalLineFlow and BlinkFilter
2. Refactoring the old enable_blink flag and use it to guard the new flow.  (rahulbansal)

Don't apply lazyload images on <input> tags since the onload event is
not fired for them (nikhilmadan)
2012-03-05 15:32:07 +00:00
Shawn Ligocki e69c5e7554 Add HtmlParse::MoveCurrentBefore similar to MoveCurrentInto.
In tests, noticed a potential bug and fixed that as well (Don't allow moving current into or before a descendant of ourselves).
2012-03-05 07:06:42 +00:00
Josh Marantz d80e213a6a Add thread synchronizing class to help reproduce race conditions. 2012-03-02 22:25:00 +00:00
Josh Marantz 4efd715318 Eliminate race conditions in the Inhibit mechanism by consolidating critical
sections.  (dgerman)

Fix race found in delay_cache test. (jmarantz)
2012-03-02 22:15:38 +00:00
Josh Marantz c152b1ac59 AddAdd delivery of delayed cache callbacks on a different thread. 2012-03-02 18:00:07 +00:00
Matt Atterbury 634a03169d Fixed a race that could in result in double deletion or access to a deleted
object.
2012-03-02 17:31:34 +00:00
nikhilmadan@google.com dac3aad973 DeferJs fix to create vars with idname only if the window.id corresponds to the DOM node.
Compress jpeg's based on the input jpeg compression quality.
2012-03-02 12:18:20 +00:00
nikhilmadan@google.com dd5000f682 Link fallback value in WriteThroughHTTPCache
Add DebugPrintQueue
2012-03-02 12:11:36 +00:00
Maks Orlovich 13e0f80c66 Most minimal bit of mod_spdy integration possible: attach
to it and set a bit in rewrite_driver.
2012-03-01 20:25:42 +00:00
Maks Orlovich 612c6f9a7f - Fix WaitForShutdown not waiting for pending_async_events_ (piatek) 2012-03-01 19:59:20 +00:00
Maks Orlovich 6bfe0b0bad Adding test for num progressive scans, retaining of color profile data and
exif data (satyanarayana)
2012-03-01 19:07:21 +00:00
bmcquade@google.com 7bfd0857f4 Update mod_pagespeed to depend on Page Speed library 1.12.8. 2012-02-29 19:10:12 +00:00
Shawn Ligocki f7b4ccb352 Re-instrument JavascriptFilter.
Added tracking for total input resources size (for comparison with bytes saved) and number of uses of minified JS and standardized the meaning of blocks_minified_ (now a block does not have to actually get smaller, just be successfully minified).

Also added some testing for these stats.
2012-02-28 23:13:32 +00:00
Maks Orlovich 3f73fdd642 Fix + test CSS combinations stat, and remove some dead
code (including the ghost update to that very stat that
never ran anymore).
2012-02-28 20:13:50 +00:00
Maks Orlovich 3f5fae6445 - Fix + test on-demand cache invalidation machinery in
cases where SharedAsyncFetch'es are chained (nikhilmadan)
- Fix invalid memory access of request_headers in HandleWrite 
of fallback-value fetches since request_headers may already have
been deleted. Modified the test case and was able to reproduce the 
problem without the fix. (nikhilmadan)
2012-02-28 20:11:43 +00:00
Maks Orlovich 13193e9478 Don't hold the element inhibition lock too long (dgerman) 2012-02-28 20:09:12 +00:00
Maks Orlovich 498047439d Fix an embarassing bug: make FileCacheSizeKb actually be
interpeted as kb. Might explain some of recent problem
reports about rewrite deadlines, since we would rewrite
a lot more than needed...
2012-02-27 22:20:25 +00:00
Maks Orlovich d992bb7fc6 - Add support for distinguishing desktop, mobile and unsupported user
agents for blink. Now the the UA matcher is created in the factory
  and is re-used in the drivers (rather than making a new one for each driver).
  (sriharis)

- Remove FF blacklist ofr deferjs now the bug in its handling is fixed.
  (rahulbansal)

- Correct the use of StartParse in BlinkFlow to check if the call succeeded
  before doing anything further. (nikhilmadan)
2012-02-27 22:19:35 +00:00
Maks Orlovich 95c6d61a67 Initial support for compiling with Apache 2.4. Note that
it requires using -Duse_system_apache_dev=1 (and perhaps
-Dsystem_include_path_httpd) as our own headers are for
2.2.x.

Not 100% stable yet -- have a server crash on one 
of our integration tests to chase down, still.
(And we will likely want to tweak our logging, since now 
 Apache includes some of the things we were adding ourselves)

Also remove the old/unused APR statistics class rather
than porting it.
2012-02-24 15:56:36 +00:00
Maks Orlovich ad258789d2 Fix defer JS breaking some ad scripts under Firefox (ksimbili) 2012-02-24 15:54:23 +00:00
nikhilmadan@google.com 9f3cbf8a7a Fixed firefox ad issue with DeferJs.
Added new constructor to RewriteGflags.
Change order of initialization of caches in RewriteDriverFactory.
2012-02-24 13:33:13 +00:00
Matt Atterbury 29f9a21fc6 Set the rewrite driver's cookies field in mod_pagespeed. 2012-02-23 21:47:31 +00:00
Maks Orlovich c424d9483e ProxyFetch cannot own the CachedUrlAsyncFetcher since asynchronous
rewrites continuing on in background may need the fetcher
yet outlast ProxyFetch, so provide a way to hand over ownership
to rewrite_driver.
2012-02-23 19:32:40 +00:00
Matt Atterbury 9487443617 Added the ability to set the X-Mod-Pagespeed header value to a non-blank value. 2012-02-23 16:11:04 +00:00
nikhilmadan@google.com c04fcb87e8 Fix a race between RewriteDriver::DeleteRewriteContext and other cleanup points caused by causing Signal()
Refactoring to serve javascript strings using javascript_url_manager.
Fixed Property cache lookup if url contains query params.
Added a support to use the property cache results even before the proxy_fetch is set.
Don't let CacheUrlAsyncFetcher store responses into the cache if HandleDone is called with false.
2012-02-23 14:18:02 +00:00
Maks Orlovich 20ed7fb63d Follow up fix to scheduler alarm memory management: if we decided to
have an alarm cleaned up by Signal(), 'this' could get deleted from
under Scheduler::CondVarCallbackTimeout::RunAlarm if the user callback
relinquished the mutex.
(detected by asan)
2012-02-22 14:31:38 +00:00
nikhilmadan@google.com 3818790371 Don't trigger ajax rewrites if HandleDone is called with false.
Change the constructor of ProxyFetch to accept RewriteDriver.
Blacklist DeferJavascript on firefox again.
Per-domain browser blacklist pattern for blink.
Add check on url blacklist in Blink flow.
2012-02-22 13:01:45 +00:00
Maks Orlovich a2c2bedede - Add missing proxy_fetch_test.cc
- Changes to blink UA handling (moving towards finer granularity)
+ a logging header. (rahulbansal, mmohabey, sriharis).
2012-02-21 14:22:44 +00:00
Jan-Willem Maessen e7a5f1823a Extend property cache to deal with non-url-based keys 2012-02-21 00:13:09 +00:00
Shawn Ligocki 8009c3e7d0 Start cleanup of filename_encoder which will probably soon be moved into our codebase. 2012-02-17 22:49:40 +00:00
Maks Orlovich 76accc9930 Fix regressions with new option handling:
- Don't warn about options we handle inside mod_pagespeed,
  and not with generic option handling
- Proper error message when the value is incorrect
- Fix confusion surrounding MessageBufferSize -- the code
  was setting an inactive option in ApacheConfig that didn't do
  anything, rather than the proper ApacheRewriteDriverFactory one.
  To reduce confusion, remove the still-unused ApacheConfig one.
2012-02-16 20:39:16 +00:00
pradnya@google.com 39d58d0f1a Adding psa index to script tags for prepone js. 2012-02-16 11:45:28 +00:00
nikhilmadan@google.com 0af82950bf Disable blink and DeferJs in firefox.
Add support for handling HEAD requests for pagespeed resources.
2012-02-16 08:10:56 +00:00
Maks Orlovich a22662fcd4 Fix a race/memory bug in scheduler where an Alarm in
waiting_alarms_to_dispatch list got deleted in a timeout
from a different thread, by giving the responsibility to
delete the object to ::Signal in that scenario.
2012-02-15 23:26:50 +00:00
nforman@google.com a53b09dec6 Use knowledge of scheme to pre-determine analytics snippet scheme. 2012-02-15 23:16:56 +00:00
Matt Atterbury 18bed70307 Copy unparseable text rather than reference the original buffer,
to eliminate dangling reference problems where the original text
is no longer valid. This is comparable to current behavior with
parseable text, which is copied into UnicodeText objects.
2012-02-15 18:24:09 +00:00
Josh Marantz e1deedb6f6 Fix DCHECK parsing some unbalanced tags by removing the tag-bag map
which, it turns out, doesn't add any value for any of our existing
testcases.

When I had added the tag-bag I added a functional testcase, but that
testcase was solved in a better way since then, rendering the tag-bag
obsolete.
2012-02-15 17:57:12 +00:00
nikhilmadan@google.com 8d500020a4 Change the freshening logic to freshen when time to expiry = min(20% of original ttl, 5 minutes) 2012-02-15 14:35:58 +00:00
nikhilmadan@google.com c1a77ef4a5 Keep the RewriteDriver alive until all freshens are completed. 2012-02-15 14:09:57 +00:00
pradnya@google.com ae54e14453 Add Above The Fold cacheable families to options.
Using AboveTheFold options in blink flow.
Force disabling some of the rewriters non compatible with Blink.
2012-02-15 13:41:17 +00:00
Shawn Ligocki d9dcc96fe9 Instrument CssFilter similarly to ImageRewriteFilter.
Added tracking for # rewrites dropped, total input resources size (for comparison with bytes saved) and number of uses of rewritten CSS.
2012-02-14 21:53:24 +00:00
nforman@google.com 7045ea5b6d Increase number of hits that have GA site speed tracking. 2012-02-14 21:12:42 +00:00
Josh Marantz c2210c09bd Clean up legacy synchronous interface in rewrite_driver & HTTPCache. 2012-02-14 20:08:54 +00:00
nforman@google.com 69e7e0cbdd Add testing for cookie-removal into svn. 2012-02-14 18:15:44 +00:00
Shawn Ligocki adec5ebf5f Making implicit caching time configurable. (pradnya) 2012-02-14 15:42:40 +00:00
Shawn Ligocki bb7418419f Adding a basic NullStatistics test. 2012-02-14 15:35:54 +00:00
nforman@google.com cd369cbc6a Refactor cookie-removal to avoid code duplication. 2012-02-13 21:28:47 +00:00
Shawn Ligocki 0f04e28921 Remove a lot of stats != NULL checks. We no longer allow the statistics object passed to be NULL, instead there is an explicit NullStatistics object.
The code was sort of a mixure of allowing and not allowing NULL statistics or variables such that if NULL was actually ever passed in for statistics it would cause spurious failures in unexpected places, now it clearly fails immediately.
2012-02-13 21:11:52 +00:00
Josh Marantz 656ad21c00 Reproduce & fix a property-cache crash seen when doing a lookup for a
jpg file that does not have an extension that allows us to recognize
it as such just by its name. (jmarantz)
2012-02-12 15:15:00 +00:00
Josh Marantz dd967af42e When there is a stale response in cache, use its Last-Modified and
Etag headers to update the outgoing request headers, so that we can
potentially get a quick 304 from the backend and avoid having to
download the entire response from the origin backend again. (nikhilmadan)

Add client-id infrastructure into meta_data constants & proxy_fetch.  (piatek)

Using the shiny new SetOptionFromName mechanism to set options in
mod_instaweb.cc.  (sriharis)
2012-02-12 15:10:33 +00:00
Maks Orlovich 98b69fad31 Use a thread-safe cache when testing, as that's expected of
the system. Not doing this appeared to have caused some
flakiness in css_flatten_imports_filter_test
2012-02-08 20:02:52 +00:00
Maks Orlovich 2ac5527d47 - Adding ability to serve cleartext or compiled javascript based on debug filter for the remaining javascript filters (guptaa)
- Undo accidental reverts of OpenCV and furious changes.
- Fix all rewrites running on main rewrite thread (and not
  low-priority one) when fetching, which could cause latency spikes
  on expensive external rewrites and cause deadlines not take effect.
- Implement load shedding in QueuedWorkerPool (at level of sequences).
  this is useful after the above, as otherwise it's easy to get us to make
  an ever-growing queue. Use this in RewriteContext.
  This is supported in PSA core now, but not yet hooked in in mod_pagespeed.
2012-02-08 19:57:01 +00:00
Josh Marantz 906cd84501 Add API for testing property-cache value expiration.
Rewrite Options and cookie setting for furious. (nforman)

OpenCV upgrade (morlovich)
2012-02-08 04:50:33 +00:00
Jan-Willem Maessen bcdd3606b7 Clarifying operation of testing script. 2012-02-07 23:35:26 +00:00
nforman@google.com 2d6b8ab6b9 First part of A/B experiment framework. 2012-02-07 22:22:42 +00:00
Maks Orlovich 07bf868c29 Woops. Fix this improperly using system png.h instead of one provided us. 2012-02-07 22:16:41 +00:00
Maks Orlovich b63fa7170a Update to OpenCV2.3.1. This should help with compile problems
on newer systems (and as a bonus, no longer pulls in lapack).
2012-02-07 21:46:16 +00:00
Maks Orlovich 7518ee96d0 Two small build fixes based on feedback from FreeBSD port:
- Use ASSERT_DEATH_IF_SUPPORTED and not ASSERT_DEATH since
  googletest doesn't support death tests on FreeBSD.

- Don't build the dependency-check binary if we're building
  with external ICU, as the check purposefully hardcodes .a
  paths.
2012-02-07 20:04:28 +00:00
Maks Orlovich b1355dbab0 - Handle stale rewrites in the ajax flow and initiate Freshens if resources are close to / beyond expiry. (nikhilmadan)
- Rename Resource::ContentsValid() -> HttpStatusOk() (sligocki)
- Allow lazyload images filter to load images on onload instead of onscroll which is configurable via RewriteOptions
  (nikhilmadan)
- Make lazyload_images_filter less CPU intensive by re-using the position of previous elements in the page, and don't
  lazyload already inlined images. (nikhilmadan)
- Insert low res images at the end of body tag only if defer js and lazyload
  filters are enabled because low res images will be blocked by js and other
  images which are below the fold. If any one of the LazyLoadFilter of
  DeferJavascriptFilter is off, place low res images in the image tag itself.
  (pulkitg)
- Adding ability to serve blink.js via gstatic. (guptaa)
- Add CanFetchFallbackToOriginal() implemented in terms of new
  virtual OptimizationOnly() to centralize logic on
  whether we can discard rewrites (e.g. for load-shedding), and
  to make it possible to distinguish non-optimization filters
  for which we do not want to do this (morlovich)
- Make the cached_resource_fetches stat update properly again (morlovich)
2012-02-07 20:02:27 +00:00
Josh Marantz a1ad328b5b Link Property Cache into ProxyInterface, including a quasi-system-test
in ProxyInterfaceTest.

Note in particular that the property cache fetch starts as
soon as we see the URL, but we don't block our flow waiting
for it until it's time to start processing HTML events in
filters.  So any RewriteOptions lookup & HTTP fetch for content
happens in parallel with the cache.
2012-02-03 15:22:29 +00:00
Matt Atterbury f8e94235ae Reversed an old change that broke the Apache installation for one release. 2012-02-03 13:24:51 +00:00
Josh Marantz 033ffebb14 Refactor out a js hashing function out of js_combine_filter.cc so it
can be reused.  (marq)
2012-02-03 13:21:01 +00:00
Josh Marantz 9a52f9b547 Provide a handy way to access mod_pagespeed_test/ on the rewritten domain. (dgerman)
Remove some dead Fetch methods from tests that no longer override anything. (morlovich)
2012-02-02 21:13:55 +00:00
Josh Marantz 0d4d5ee13a Rename mem_clean_up to process_context.
Also moved some calls to specific filter Terminate methods into RewriteDriver to
centralize knowledge of the filter-suite there.
2012-02-02 19:49:56 +00:00
Shawn Ligocki 2165f21455 Remove some dead Fetch methods from tests that no longer override anything. (morlovich)
Make blink support cache invalidation. (nikhilmadan)
2012-02-02 18:58:32 +00:00
Josh Marantz 253090e526 Generates low res images only if images are above certain threshold and only
first N images in the serialized dom. (pulkitg)

Link property-cache into rewriting framework.
2012-02-02 04:54:39 +00:00
Josh Marantz bb06b47a39 Add property cache utility class. 2012-02-01 20:37:51 +00:00
Matt Atterbury 6e6bde4a8b Renamed Initialize to StartInlining because Initialize hides a method
in the superclass with the same name, and changed StartInlining to
return a success/failure indicator for a pending CL.
2012-02-01 20:15:07 +00:00
Josh Marantz 57f1f87a41 Tweaked location of js_defer_opt.js to make it easier to auto-generate. 2012-02-01 19:12:14 +00:00
Josh Marantz 704af911e7 Copying compiled javascript into SVN, staring with js_defer.js (guptaa)
Changed the delay_images string to inline_preview_images and add
inline_preview_images flags to mod_instaweb.cc  (pulkitg)
2012-02-01 14:41:32 +00:00
Shawn Ligocki 4046a38b79 Strip out lots of dead code (found through code coverage check).
All removed code was untested and aparently unused in the rest of the code as well.
2012-01-31 22:28:26 +00:00
Maks Orlovich c44562bfdc Fix a race between RewriteContext::FetchContext::HandleDeadline
calling OutputResource::UrlEvenIfHashNotSet in normal rewrite thread
and a filter calling OutputResource::BeginWrite via ResourceManager::Write
in a low-priority rewrite thread by removing some logging.
This is hard to trigger now, but will be more common once fetches
use low-priority rewrite thread.
2012-01-31 21:30:04 +00:00
Maks Orlovich 1d571da777 Some style guide compliance cleanups in convert_meta_tags filter and insert_ga_filter (nforman) 2012-01-31 21:29:33 +00:00
Josh Marantz 8da419c462 Blacklist defer Js for IE7 and below and other non tested browsers. (ksimbili)
s/webinstant/psajs for serving blink (guptaa)

Don't record Connection:close in the slurp.  (jmarantz)
2012-01-31 18:52:40 +00:00
Josh Marantz 089862e7eb Add delay cache. Like MockTimeCache except the delivery of
cache callbacks is controlled via direct API calls rather than
advancement of time.
2012-01-30 15:44:56 +00:00
Josh Marantz 6b91a53b1e Remove obsolete js_defer_filter (atulvasu)
Remove start_time_ms and user_ip from rewrite_driver since we no longer
need it there. We can use them directly in blink_flow. (rahulbansal)
2012-01-30 15:07:38 +00:00
Shawn Ligocki 535716116c Do not allow GoogleUrl methods to CHECK-fail in opt-mode.
Fixed a bug where not finding a LeafPostion would send a negative number to StringPiece's length argument.

Rework them to instead return NULL if the URL is invalid or the method doesn't make sense for this URL type (Ex: PathSansQuery() for data URL).

Also reworked DCHECKs to LOG(DFATAL) so that we log ERRORs if we hit this in production (should never happen).
2012-01-26 22:18:12 +00:00
Shawn Ligocki ae4bf31d91 Assortment. 2012-01-26 22:17:25 +00:00
Jan-Willem Maessen bb28f7d00e Fix crash bug in rewrite_driver due to empty data: urls in css. 2012-01-24 19:08:36 +00:00
Maks Orlovich 64d7bc5a89 - Allow resource with empty contents (nikhilmadan) 2012-01-24 17:37:43 +00:00
Maks Orlovich aec7bde69b Change store_outputs_in_file_system into a debug/testing flag that
merely causes resource dumps to be saved but does not make them loadable
from disk. This way we do not have to worry about it affecting behavior,
while the command-line tests can still snoop around on the output.
2012-01-24 17:27:49 +00:00
nforman@google.com 158b41b105 Fix rewrite_option_names.gperf. 2012-01-24 16:32:42 +00:00
nforman@google.com 17d537e215 Change rewrite-option structure.
Fix issue 372.
2012-01-24 16:12:48 +00:00
Shawn Ligocki b5d335b039 Several function renames to clarify code.
Specifically:
s/UrlEvenIfLeafInvalid/UrlEvenIfHashNotSet/g
s/InitResponseHeaders/SetResponseWithDefaultHeaders/g
s/ServeResource(/FetchResource(/g
s/ServeResourceUrl/FetchResourceUrl/g
2012-01-23 21:27:22 +00:00
Shawn Ligocki 317e829b6e Blink stuff. 2012-01-23 21:12:09 +00:00
Josh Marantz 83f76c0717 Add 'debug' filter, currently used just by js_defer_filter. Turn on
JS minification if debug is not enabled.
2012-01-23 14:30:02 +00:00
Josh Marantz cb05738986 RewriteOptions change to permit setting an option from name/value string pair. (sriharis)
Separate AddPlatformSpecificDecodingPasses from AddPlatformSpecificRewritePasses. (dgerman)

CssFilter::RewriteLoadedResource is dead (morlovich)
2012-01-23 14:24:55 +00:00
Shawn Ligocki 6b006d9b50 Allow clearing explicit enable and disable lists. 2012-01-20 20:38:23 +00:00
Shawn Ligocki c11d754402 Simplify 2012-01-20 20:37:59 +00:00
Maks Orlovich ea8861f30e Now that RewriteLoadedResource isn't overriding anything, stop
marking it as virtual, and remove a needless compat override in js filter.
2012-01-20 16:20:45 +00:00
Maks Orlovich f3f071efc7 Kill RewriteSingleResourceFilter, now it doesn't do anything,
and liberate RewriteResult from its grip.
(There are still quite a few spots that have virtual RewriteLoadedResource
 though).
2012-01-20 14:48:57 +00:00
Maks Orlovich ff05a1da03 Fixing undefined variables with same name as ids issue. (ksimbili) 2012-01-20 14:47:38 +00:00
Jan-Willem Maessen f1fc938465 Permit encoding and decoding of a single specified image dimension. This
permits image resize when only one dimension is provided, but that is not yet
implemented.
2012-01-19 22:41:15 +00:00
Maks Orlovich fc5cc91291 Remove most of old metadata expiration tracking stuff:
- The timestamp argument to ResourceManager::Write (which had
   no effect any more but people still took effort to implement)
 - Proto fields that are no longer used.
 - The old sync implementation of RewriteSingleResourceFilter --- it's
   now basically a stub class.
2012-01-19 21:12:56 +00:00
Maks Orlovich 6b23754bf1 - Link to RE2 (gagansingh)
- Use RE2 in blink templates (gagansingh)
- insert_ga examples (nforman)
- Cleanup tests to not rely on store_outputs_in_file_system (morlovich)
- Avoid doing full PNG optimization when we just want to read in
  a gif for spriting. This can be a huge gain in some pathological
  cases (morlovich)
2012-01-19 20:30:13 +00:00
Matt Atterbury b8f8fa37a4 * Add domain field to RewriteOptions.
* Renamed rewrite_option_names.gperf to rewrite_filter_names.gperf.
* Added user_agent argument to CriticalImageFinder methods.
2012-01-18 14:05:49 +00:00
Matt Atterbury 6fd4a2c135 1. Added example for new flatten_css_imports filter.
2. Refactored CssHierarchy to improve code quality.
2012-01-17 21:13:58 +00:00
Shawn Ligocki f82cc5739e Use IsHtmlLike() instead of == kContentTypeHtml 2012-01-17 19:08:54 +00:00
nforman@google.com b4efb798cb Blink changes and a fix to style of insert_ga. 2012-01-17 18:27:43 +00:00
nforman@google.com 8b67bb23d1 Cache-control changes, on-the-fly resource changes. 2012-01-17 18:25:25 +00:00
Josh Marantz a4e66ff41c WebkitRenderClient which will connect to webkit render service to get the
render response and extract above the fold images information which will be
used by ajax rewrite context callback. (pulkitg)

Avoid caching privately-cacheable resources (morlovich)
2012-01-17 03:04:45 +00:00
Shawn Ligocki 761017e751 Add ModPagespeedModifyCachingHeaders to allow users to disable mod_pagespeed's caching header editing. Disabling our editing is not safe, but some people want to do it, so more power to them. 2012-01-13 22:39:08 +00:00
Shawn Ligocki 7844ef3dca cleanup 2012-01-13 18:55:05 +00:00
Josh Marantz 658c9bfa8e Allow mod_pagespeed resource fetches to use gzip from origin
based on a .conf file entry.  Regardless of that conf file
setting, resolve a bug where if the origin serves us gzipped
content when we didn't ask for it, inflate it as needed.  (jmarantz)

Fixing innerHTML with script tag bug in IE with a Hack which seem to
work well This solution is well explained in
http://allofetechnical.wordpress.com/2010/05/21/ies-innerhtml-method-with-script-and-style-tags/
(ksimbili)

In the ajax flow, set the Date header to now when serving rewritten
resources so that it looks cleaner. Previously, we were setting the
date header of the response to the time of fetch of the rewritten
resource. So, if you consider a resource with cache ttl 300 seconds,
which is rewritten and put into cache one day ago was served with a
Date set to 1 day ago and a Cache-Control max-age of 1 day + 300
seconds.  (nikhilmadan)

Call SetTransformToLowRes when resize mobile low quality images.
Error out in case of larger mobile delay images.  (bolian)
2012-01-13 15:02:51 +00:00
Shawn Ligocki 662c6bf418 Temporarily revert corruption test 2012-01-12 20:49:16 +00:00
Shawn Ligocki a16aeefc31 Add a Headers::Has(name) function to shortcut checking if there is a header with a specific name (rather than Headers::Lookup(name, &dummy_values)). 2012-01-12 18:27:53 +00:00
Shawn Ligocki b7d07c8ddf Put back the server side timings for Blink dashboard in the new flow. (rahulbansal)
Call SetTransformToLowRes when resize mobile low quality images. (bolian)

Add support for serving stale responses in the rewrite context flow if the fetch fails.
It took me ages to figure out that I need to set set_store_outputs_in_file_system(false). (nikhilmadan)
2012-01-12 18:22:12 +00:00
Shawn Ligocki 019bddd74c Add option to allow adding caching headers.
When enabled, HTML with no Cache-Control headers will have a 5min header added before choosing whether or not to cache it.
2012-01-11 22:32:54 +00:00
Shawn Ligocki 7651e8f2ca Remove erroneously added file 2012-01-11 21:07:30 +00:00
bmcquade@google.com c8d2436b83 Update to Page Speed 1.12.7. 2012-01-11 11:30:59 +00:00
Shawn Ligocki 234a04211f Absolutify CSS even if rewrite_css fails or takes longer than the deadline in the fetch path.
Previously, we just passed through the input contents, without absolutified URLs.
2012-01-11 03:49:58 +00:00
Matt Atterbury 1cf0408e63 Don't fail URL transformation of a CSS file just because there are
empty or non-standard URLs in there. Rather, leave them as-is and
;eave it up to the browser to handle. In particular, a data URL
was causing the entire process to abort.
2012-01-10 14:20:03 +00:00
Josh Marantz ea43fb8d71 delay_images for mobile with resized low quality images. (bolian)
js_defer IE compatibility (atulvasu)
2012-01-10 12:57:51 +00:00
Maks Orlovich 10d0cb77a9 Make sure our JS escaper does not produce </script> in output
(relevant if its output is ever used inline); and add some testing.
2012-01-09 20:30:55 +00:00
Matt Atterbury e21014035e Implement @import flattening. 2012-01-09 16:14:56 +00:00
Josh Marantz 53ebc01c97 Add proxy-related error codes & reason-phrases. 2012-01-09 13:22:20 +00:00
Josh Marantz 91fbe9427d Handle non 200 status codes gracefully by showing broken images for
uncacheable panels.  (gagansingh)

Added few DelayImageFilter flags in RewriteOptions and rewrite_gflags.cc (pulkitg)

Add missing 'check' calls to make sure we don't add X-Extra-Header twice. (jmarantz)
2012-01-09 13:07:26 +00:00
Josh Marantz f5a1707a27 Add missing data files for system test. 2012-01-06 21:47:50 +00:00
Josh Marantz a43f9bf51d Fix Issue 367: http://code.google.com/p/modpagespeed/issues/detail?id=367
Don't disable mod_headers and mod_expires for HTML.  Instead,
add a new output-filter to fixup headers after they run.
2012-01-06 21:47:01 +00:00
Josh Marantz 503c796c22 On a fetch, attempt to load and rewrite resources even if they are uncacheable. (dgerman) 2012-01-06 21:45:23 +00:00
nforman@google.com b274b93365 Add option for specifying Google Analytics ID in the pagespeed.conf file. 2012-01-06 16:22:24 +00:00
nikhilmadan@google.com acebb9e3d5 Submitting blink changes. 2012-01-06 14:48:28 +00:00
Shawn Ligocki 4decfa9054 Correctly skip over remainder of unexpected at-rule as per spec:
http://www.w3.org/TR/CSS2/syndata.html#parsing-errors

TODO(sligocki): We could expand this to save verbatim_bytes in preservation mode.
2012-01-05 21:10:16 +00:00
Shawn Ligocki 0c0a65b102 Update to pagespeed 1.12.6.0 (bmcquade) 2012-01-05 19:58:34 +00:00
nforman@google.com dd2d0b1447 Add insert google analytics rewriter. 2012-01-05 19:18:10 +00:00
Josh Marantz 4c1ca54982 Change InflatingFetch to be self-deleting. Set up infrastructure to
allow us to request gzipped content from origin, even if downstream usages
want cleartext.
2012-01-05 18:37:34 +00:00
bmcquade@google.com 91fc653efa Fix mac build. 2012-01-05 09:18:52 +00:00
Jan-Willem Maessen 2a5aeec62f Add missing cast whose absence caused us to use 32-bit arithmetic on ia32 during
testing (but not in the Apache module).
2012-01-04 23:18:32 +00:00
bmcquade@google.com 014a596416 Windows build fix: switch from std::snprintf to base::snprintf. 2012-01-04 20:22:19 +00:00
bmcquade@google.com 3325f707c5 Move RewriteOptions out of core. 2012-01-04 19:34:21 +00:00
Josh Marantz 3b9cbb3cc9 Remove the use of layout filter in blink flow. Json gets computed in
the background now. (rahulbansal)

Minor comment cleanups in rewrite_options (jmarantz).
2012-01-04 15:35:32 +00:00
Josh Marantz 88b295e6f2 Add gyp rule to compile json library (gagansingh)
Rework RewriteOptions::Merge to merge src into this, rather than one,two into
this.

This resolves a potential performance issue because of the way wildcards
are combined.  Because our basic mechanism for merging RewriteOptions
was dst=(one+two), we defined Clone in terms of CopyFrom, and CopyFrom
via Merge(one,one).  When 'one' has wildcards, they get doubled in
size.

The reason we used dst=one+two in the first place is that matches the .htaccess
semantics in Apache.  But it's easy to define that in terms of dst+=one,
dst+=two, so that's what this CL does, simplifying the Merge function.
2012-01-03 20:34:32 +00:00
Matt Atterbury 10e160a38e a) Add ability to determine the IP of where the request came from [gagansingh]
b) Eliminate a few checks/dchecks and a spammy log line [pradnya]
c) Log blink requests [rahulbansal]
d) Tidy up some of the blink flow [rahulbansal]
   * Don't store layout in cache if status code is not kOk
   * Change the order of sending cookies so that the ouput is consistent
2012-01-03 14:41:48 +00:00
Josh Marantz 63353eb2c3 Add PointerToString (jmarantz)
Rename IsCacheable to IsCacheableTypeOfResource to reduce confusion (dgerman)
2011-12-29 22:43:16 +00:00
Matt Atterbury c9edfa04e5 New CssHierarchy class that will be used to implement CSS @import flattening. 2011-12-29 14:41:58 +00:00
Josh Marantz 37a115262e Add mechanism in InflatingFetch to automatically add
accept-encoding:gzip if it's not already there, and inflate
content as its being streamed. (jmarantz)

Converted delay images javascript into js modules. (pulkitg)

Supporting gif and webp formats in ajax flow. (satyanarayana)

Cleaning up the output state. output_contents_ doesn't have any sense
if output_valid_ is set to false.  Also All image optimizer assume
that output buffer is empty.  Since we are not clearing the
output_contents_ server is failing in image_converter
DCHECK(out->empty()).  (satyanarayana)
2011-12-29 14:21:17 +00:00
bmcquade@google.com 52a0c49995 Make gyp files comply with gyp syntax checker. 2011-12-29 01:34:00 +00:00
Josh Marantz 4915f529f4 New blink flow to get the layout sent early. (nikhilmadan) 2011-12-28 19:18:04 +00:00
Josh Marantz e678036b45 Tracking timing data for fetches (mmohabey@google.com) 2011-12-28 16:31:39 +00:00
Matt Atterbury ab1ba97841 a) Fix infinite looping on proxy mode pagespeed resources who name encodes
a query.
b) When checking if an URL can be turned into an output resource by a
   proxy rewriter, also check that the decoded base url will be valid
   since that's used when processing/regenerating the resource and if
   it's invalid these will fail (or worse, crash). This can happen when
   we are given a corrupted URL. After this change we will simply
   forward the request to the back-end server.
2011-12-27 20:04:22 +00:00
Josh Marantz dd94858214 Only check the last non-empty encoding when inflating fetch results. 2011-12-27 15:01:57 +00:00
Josh Marantz 60a276d457 Handle gzipped responses from origin servers for resources. We
generally don't include accept-encoding:gzip in our requests but
some servers send gzipped content anyway.
2011-12-27 13:41:32 +00:00
Josh Marantz a4e3a5cfe1 Fix bug in cache ttl of response returned in the ajax rewrite flow. If
rewriting doesn't succeed, in FetchTryFallback we set the cache ttl to
5 minutes instead of leaving it as the original. (nikhilmadan)

Strip Last-Modified in ProxyFetch if we are rewriting
html. Conditional validation via If-Modified-Since is wrong since we
are rewriting the html. (nikhilmadan)
2011-12-27 13:36:01 +00:00
Josh Marantz db23334b77 Move the keyword tables into a functional initializer so we can add
more expressivity in fewer lines of code.
2011-12-23 01:18:20 +00:00
Josh Marantz 8b498aab5c Change SerfUrlAsyncFetcher to implement the Fetch interface rather than
the StreamingFetch interface so it gets access to a mutable AsyncFetcher
object.
2011-12-22 22:55:24 +00:00
Josh Marantz 2a07071bda Add InflatingFetch wrapper around AsyncFetch that will automatically
gunzip content for users that wanted cleartext but the origin gave
us gzip.  (jmarantz)

Add support to return stale values from cache in case a fetch fails in
the proxy flow. I'm hoping to incorporate this into the rewrite
context flow as well, but I'll do that later.  (nikhilmadan)
2011-12-22 21:41:20 +00:00
nforman@google.com eaef40a02d Remove unused external resource code. 2011-12-21 16:05:20 +00:00
Josh Marantz dc72dfdb8b Add NeedLowResImages method (ksimbili) 2011-12-21 13:11:56 +00:00
Josh Marantz b73c590c0d Automatically close open tags in the lexer on document close. 2011-12-21 02:46:01 +00:00
Josh Marantz 4f47919c1b Parse HTTP header first-lines where the reason-phrase is missing,
filling in the value from our table if any.  Consolidate our two
similar code-paths that were parsing this line.

Remove now-superfluous include of <cstdio>

Better DCHECK-fu for AsyncFetch::HeadersComplete, which should do a live
check and LOG(DFATAL) for double-calling it.

Remove DCHECK for non-success status code in AsyncFetch::Done because this make
it impossible to handle a timeout that happens during streaming.
2011-12-20 20:42:51 +00:00
Josh Marantz c71183c1af Add additional checking to pagespeed URLs we decide to handle locally,
so we don't end up failing MPS URLs originated from an incompatible
version on a site we're proxying. (morlovich)

add "cookie2" http headers constant (morlovich)

Parse HTTP header first-lines where the reason-phrase is missing,
filling in the value from our table if any.  Consolidate our two
similar code-paths that were parsing this line.  (jmarantz)
2011-12-20 14:11:56 +00:00
Jan-Willem Maessen 6d6f077219 No longer enable insert_image_dimensions by default.
Make additional properties of image rewriting configurable in Apache.
Minor fixes to caching to avoid string copies and extra closure creation.
2011-12-19 15:30:57 +00:00
Matt Atterbury ae5006d18d a) Separate out early_pre_render_filters_ from pre_render_filters_.
Provide an API to prepend to pre_render_filters_.
b) Fix bom stripping not happening on fetch. The problem was that 
   this was accessing resources() in WritePiece, and we don't
   actually set those up in async fetch flow. (ResourceCombiner
   likely need heavy refactoring at this point). So instead of relying
   on it, just pass in the index of the fragment to WritePiece.
c) Address regression of rewriting of multiply rewritten resources whereby
   we would to fetch rewritten resources from the ORIGINAL domain not the
   encoded domain, which wouldn't work when pagespeed then tried to fetch them
   rather than rewrite them on-the-fly like it ought to do.
2011-12-18 23:56:24 +00:00
Josh Marantz f0a9a5aa68 Improve & augment html-annotation testing. Include attr name/value/quotes
in the annotation text.  Remove the html & newline tags.  Add tests for
more cases, even ones that are not currently working like they should; which
are marked with TODOs.
2011-12-16 17:26:36 +00:00
Maks Orlovich c1b9f17a7e Don't register nested jobs for spriter prematurely, but only if needed.
This avoids creating jobs with 0 inputs.

This also incorporpate a small refactor of matterbury's that makes generic
AddNestedContext work properly in css_filter.
2011-12-16 16:42:13 +00:00
bmcquade@google.com 94039b3002 Add missing panel_config.proto. 2011-12-16 16:07:45 +00:00
bmcquade@google.com 2da833ffad Fix DEPS, add panel config proto, update BOM handling. 2011-12-16 16:03:52 +00:00
Shawn Ligocki 8f7ea9b528 Add errors for unparseable @-statements. 2011-12-15 19:16:11 +00:00
nforman@google.com a923202e6a Remove use_async_flow parameter from CreateOutputResource.
Allow filter-set specification via query prams.
2011-12-15 19:07:10 +00:00
nforman@google.com 71e8f373bb Remove sync OutputResources. 2011-12-15 16:53:06 +00:00
Maks Orlovich a5a8d74fac Do detection of whether we support inter-process mutexes
in our base .gypi, and export is as a .gyp variable and a define
so we can cleanly build without pthread shm and its tests if unsupported.
2011-12-14 20:35:53 +00:00
Maks Orlovich 3ef5f2ddd8 Remove some excessive logging. 2011-12-14 20:01:14 +00:00
Shawn Ligocki 517bee8165 Need <!doctype html> for test 2011-12-14 19:36:42 +00:00
Maks Orlovich 1d50d1cf8f Log an error on OpenCv exceptions. 2011-12-14 18:50:30 +00:00
Shawn Ligocki b185819bc1 Decode "%20" -> " " for all filenames.
Fixes issue 332.
2011-12-14 07:22:41 +00:00
Shawn Ligocki 781d7659ce Added tests for how GoogleUrl treats "..", "." and "%XX". 2011-12-13 22:50:45 +00:00
Josh Marantz c0b781b28f Cleanup of ajax rewriter (nikhilmadan)
mem_file_system thread cleanup (matterbury)
2011-12-13 20:52:02 +00:00
Josh Marantz 48e8ab7875 html attribute parsing compatible with Chrome on invalid syntax:
attr-value starting with "=".
2011-12-13 18:03:57 +00:00
Josh Marantz 2d37548495 Fix a few more corner-cases with unbalanced tags. (jmarantz)
Add NullSharedMem, to make it easier to build on non-Linux, and 
fix a bunch of fallback behavior bugs that are exposed with it:
  - Check whether SharedCircularBuffer init succeeded before setting
    it on ApacheMessageHandler. Also make CreateSegment failure fail
    SharedCirculerBuffer init.
  - Change how we handle fallback in SharedMemHistogram. We can't set 
    the mutex to NULL to signal it, as a bunch of Histogram methods 
    use it. So instead set it to a NullMutex, set buffer_ to NULL, and 
    make sure we check the buffer_ everywehre.  (morlovich)
2011-12-13 01:48:34 +00:00
Shawn Ligocki 313198146d Spelling 2011-12-12 19:42:30 +00:00
Shawn Ligocki 2233c0b72e Re-enable inline CSS for @import now that Maks improved the CssTagScanner. 2011-12-12 18:52:23 +00:00
Maks Orlovich 4522f22338 Remove trailing slashes, they confuse the xcode backend
to gyp.
2011-12-12 18:19:16 +00:00
Shawn Ligocki fd743e0cbf Re-disallow ckeditor after recent re-opening of bug on most recent version of ckeditor.
Fixes issue 186.
2011-12-12 18:11:19 +00:00
Shawn Ligocki a58ecd435d Fail CssTagScanner::TransformUrls if one of the URL transformation fails and fix various other things that came up.
Fix the (incorrect) reason it was failing.
2011-12-12 15:48:35 +00:00
Shawn Ligocki 9352ec44ed Fix the inner height function to work with all versions of IE. 2011-12-12 15:47:41 +00:00
Maks Orlovich 109dce7358 Make sure to apply the proper expiration policy to remembering failures
with Done(true) but a failed HTTP status.
2011-12-09 22:39:15 +00:00
Shawn Ligocki 947b735bb9 Allow redirects to be cached in PSA.
301 are cacheable by default. We do not allow caching 302 or 307s.
2011-12-09 22:29:46 +00:00
nforman@google.com 22c7889f13 Don't add charset to otherwise empty content type. 2011-12-09 22:06:59 +00:00
nforman@google.com b244406d84 Https fetcher testing framework. 2011-12-09 22:04:48 +00:00
Maks Orlovich e662c994ff OpenCV throws exceptions when its attempts to allocate memory fail. Handle them. 2011-12-09 16:42:44 +00:00
Matt Atterbury b10d59f3cc a) Add ability to control the log level output from message handler.
b) issue 356: Early detection of an unfetchable input resource to
   short-circuit wasteful rewriting attempt when we cannot fetch it.
   In particular, the serf fetcher cannot fetch https so give up early.
2011-12-09 14:37:33 +00:00
nforman@google.com d3dbe1e866 Remove HasAsyncFlow(). 2011-12-08 22:50:27 +00:00
Matt Atterbury e70fc389c5 Providing start_time_ms to rewrite driver. Will be used for latency debugging. 2011-12-08 19:50:58 +00:00
Josh Marantz e8e6b50d1b Add a new subclass SharedAsyncFetch which takes an AsyncFetch* in
its ctor, shares its header classes, and delegates to its Handle
methods.
2011-12-08 19:31:53 +00:00
Maks Orlovich 47f262c6d4 Fix us not actually setting the HTTP cache readonly on shutdown
in Apache (as there is no cache set on the factory); and limit
the scope of that operation, to disallow writes of failures but
still let successes through. This is important to at least make
/some/ progress on ITK, which likes to kill processes a lot
(as often as every single request on smoke tests.)
2011-12-08 19:04:10 +00:00
Matt Atterbury d7b1f3f036 a) Remove sync Getch()
b) Refactor:
   	Added second version of MapOrigin that takes a GoogleUrl to avoid
	redundant conversions of GoogleUrl -> StringPiece -> GoogleUrl.
	Also eliminated unnecessary initialization of return argument of
	MapOrigin since that guarantees to do this if it returns true.
2011-12-08 16:14:16 +00:00
nforman@google.com 5ca1d020e2 Bring svn up to date due to previous changes stomping on each other. 2011-12-08 15:55:38 +00:00
Josh Marantz 39bd104635 Move ownership of response/request headers to the AsyncFetch object. 2011-12-07 22:02:49 +00:00
Shawn Ligocki 4c8d89b778 Strip queries from URLs when loading them as static files.
Fixes issue 357.
2011-12-07 21:57:29 +00:00
Shawn Ligocki 87ba633cd5 Rip out workaround to carriage return handling bug in js minification
(since pagespeed library is now fixed everywhere).  Simplify handling of
    	script body elements, since there should now be at most one
    	HtmlCharactersNode in any rewritable script body.  Get rid of an
    	often-huge string copy after minification of an inline script by
    	swap()-ing the rewritten string into the DOM. (jmaessen)
2011-12-07 21:57:08 +00:00
Shawn Ligocki cf6b7e0a5b Simplify ResponseHeader::ComputeCaching to use the new pagespeed::ResourceCacheComputer. Prereq to allowing an option for whether to assume HTML is default cacheable or default non-cacheable. 2011-12-07 20:21:19 +00:00
Shawn Ligocki 35d7d95260 JS Defer stuff. 2011-12-07 20:18:52 +00:00
nforman@google.com bf0dbeb096 Even more sync removal. 2011-12-06 20:07:03 +00:00
nforman@google.com e2abf66c51 Continuing to rip out sync code. 2011-12-06 19:30:38 +00:00
Maks Orlovich 366ed4b175 Lazily start the serf thread to avoid breaking with the ITK MPM. 2011-12-06 18:41:43 +00:00
Shawn Ligocki ac9212652e Raise kImportError on @import parse failures.
Noticed by Matt in test case:

@import style.css; a { color: red }
2011-12-06 18:30:16 +00:00
Maks Orlovich 9b6a82d2da - More removal of deprecated sync flow (nforman)
- Add some forgotten blacklist test dummy files.
2011-12-06 18:24:11 +00:00
nforman@google.com 35c3dc500e More sync code path removal. 2011-12-06 15:04:33 +00:00
bmcquade@google.com 7c0bff6102 Update Page Speed library version, add new PNG->JPEG conversion. 2011-12-06 00:04:10 +00:00
Josh Marantz 7370474b17 Don't serialize explicit-close tags for optional tags that were auto-closed. 2011-12-05 22:14:43 +00:00
Josh Marantz 12cdbcb198 Added infrastructure to support convert_png_to_jpeg. This needs a
Page Speed update to be turned on.
2011-12-05 21:28:10 +00:00
nforman@google.com 3d5916b662 Start removing synchronous flow. 2011-12-05 19:21:12 +00:00
Josh Marantz e657904a8b Re-organize cache-key policy. Retain the original URL hiearchy for
single-resource filters & non-data-URLs.  Only data URLs &
combinations get hashed.  The hashes will then be divided into 64
buckets using the 1st characters to name a subdirectory, just in case
someone has large numbers of combined or minified files.
2011-12-05 14:36:18 +00:00
Shawn Ligocki 797e91b9e0 Allow parser to recover from parsing errors in selectors.
This reduced the number of unparseable CSS files in Alexa-100 from 25 to 12 (out of 177 total).
2011-12-02 22:22:32 +00:00
Shawn Ligocki 22180dfc2a Simplify CssMinify::EscapeString logic. 2011-12-02 22:08:43 +00:00
Maks Orlovich c2d509d8a1 Fix CssFilter being inappropriately case sensitive
on rel attributes of link, and add a bunch of testcases
to make sure we get it right elsewhere.

(Issue #354)
2011-12-02 18:24:55 +00:00
Josh Marantz cd86e139ba Keep a tag ownership map. E.g. tr is always inside a table, and
a close-tr should never close a table.  There are countless other forced
hierarchies that this CL does not yet address.

Avoid emitting auto-generated close tags for elements that do not
require them, such as <p> and <li>.

Retain the characters from misplaced close-tags.
2011-12-01 22:38:14 +00:00
Josh Marantz 0f620b1cbc Avoid rewriting html that is disallowed in proxy flow. (morlovich)
Add testcase for js minify bug.  (jmaessen)
2011-12-01 20:20:54 +00:00
Jan-Willem Maessen 24265d7ce7 Work around JS minification bug that misses the end of line comments terminated by \r.
A fix to the minifier is pending.
2011-11-30 23:23:26 +00:00
nforman@google.com da8818b77f Introduce directory structure to cache in order to avoid excessive numbers of files in the top level. 2011-11-30 19:45:23 +00:00
Shawn Ligocki fad5bbdf9d Stop running OpencvStackOverflow in Valgrind.
It was taking 70-90 sec and was the slowest test in valgrind. I added some comments for some of the other very slow tests as well.
2011-11-30 16:44:17 +00:00
Shawn Ligocki a71aee39f5 Added more utility functions for manipulating internal CSS objects,
plus added a const for the "all" media type rather than sprinkling it
    	about like pixie dust. (matterbury)
2011-11-30 16:42:39 +00:00
Maks Orlovich 6660097d09 - Some more CSS string utility functions (matterbury)
- Fix ETag handling in the ajax rewriting flow (nikhilmadan)
- Blacklist some further source-sensitive scripts (pradnya)
2011-11-30 15:28:57 +00:00
Maks Orlovich 7f4714c584 Export missing test data. 2011-11-30 14:22:01 +00:00
Maks Orlovich db72390eea Run gperf on demand; don't include pre-generated outputs which
sometimes got out of sync. The downside is that gperf is now 
required for trunk builds.
2011-11-29 22:04:24 +00:00
Shawn Ligocki 0669022fc3 Allow parser to recover from parse errors while parsing declarations by saving a dummy declaration to store verbatim skipped text.
This allows us to parse and re-serialize a ton of unparsable CSS from Alexa-100, see examples in css_filter_test.cc.

Specifically, it reduced the number of unparseable CSS files in Alexa-100 from 53 to 25 (out of 177 total).
2011-11-29 21:21:24 +00:00
Josh Marantz cf93d7a7d6 Disallow scriptalicious by default as it queries its own URL (sligocki)
Add "explicit_close_tags" as a query-param-enablable filter for debug usage.  (jmarantz)
Add "sprite_images" to the list of filters for automated load testing (jmarantz)
2011-11-29 19:41:11 +00:00
Josh Marantz f5b4d40c55 Add new filter for lazy-loading images (nikhilmadan)
Don't do ajax-rewriting if mod_pagespeed is off (morlovich)
2011-11-29 17:24:19 +00:00
Josh Marantz bfad5b3dfe When a tag-close is misplaced, e.g. <i><font></i></font>, we
will auto-close the <font> when we see the </i>.  When we
later see the </font>, we should squelch it because we are
already in "debt" one "</font>".  Keep track of this debt in a
Bag (map<string,int>).
2011-11-28 22:37:57 +00:00
Josh Marantz 4f7c42fb02 Proper handling & validation of unbalanced tags. 2011-11-28 20:33:21 +00:00
Josh Marantz 8a1e1edc46 Detect whether content is HTML or not before attempting to rewrite it (morlovich) 2011-11-28 20:32:03 +00:00
bmcquade@google.com d5ef03ec84 Update to page speed library 1.12.3.0 2011-11-28 19:43:43 +00:00
Josh Marantz 6eb2266559 Add explicit_close_tag filter to make document structure visible from
serialized html in unit tests.
2011-11-28 18:55:44 +00:00
Josh Marantz 3b391ba5f3 Reset the 'done_' state when retrying so we don't get an assert. 2011-11-28 16:30:45 +00:00
Maks Orlovich 931fb3cb0d Fix these being out-of-sync. 2011-11-28 14:51:43 +00:00
Maks Orlovich 6acbdfda41 Add missing null check (corresponding to a value-less style attribute
of an image).
2011-11-28 14:41:23 +00:00
Maks Orlovich 70c24e1562 - Add delay images filter (pulkitg)
- document.write() improvements in deferjs filter (atulvasu)
- Fix crash on in-place rewriting of URL in blacklist in generic 
proxy (nikhilmadan)
- Fix crash in generic ProxyInterface when having invalid 
ModPagespeed params (bharathbhushan)
- Factor out the "is it really HTML?" sanity-checker into 
a separate helper class in automatic/
2011-11-28 14:28:39 +00:00
Josh Marantz b327f8d6e4 Try to make the Serf tests a little less flaky with some retries. 2011-11-23 21:05:58 +00:00
Josh Marantz 74e07b39e9 Restore tear-down order which was significant, but was scrambled recently. 2011-11-23 21:03:15 +00:00
Josh Marantz 16dc7ae1ab Handle (deprecated) XMP tags per spec.
Finish partial tags left open at end of document.
2011-11-23 20:37:01 +00:00
Josh Marantz 20f6b052b3 Merge the lexical token enum & keywords into one to make it easier
to use in a grammar.
2011-11-23 20:02:54 +00:00
Josh Marantz 11bcf17528 Add query-param tweaks for inlining. (matterbury)
Remove special handling for <tag<foo and <tag attr<foo --- it bypasses
the literal mode handling for <script>, and doesn't match what
browsers do anyway.  (morlovich)

doc tweaks for SplitStringPieceToVector (jmaessen)
2011-11-23 15:30:05 +00:00
Josh Marantz c81d999f39 Make line-separators a distinct lexical token from whitespace. Like
whitespace, all adjacent line-sep tokens will be delivered in a single
StringPiece.  Unlike whitespace, line-separators can serve role in
evaluating the lexical stream against the language grammar.
2011-11-22 14:54:05 +00:00
Josh Marantz 7d59663252 js_defer.js error cases handled more correctly. Also adding exception
to logging API.  (atulvasu)

Allow unit-tests to use a managed rewrite_driver flow.
2011-11-22 14:44:58 +00:00
Maks Orlovich dc1196af41 - Fix deferjs executing some scripts out-of-order (atulvasu)
- Added overloaded version of CssMinify::Stylesheet that takes an URL
  for absolutifying relative URLs in the CSS being minified (matterbury).
- APIs for extracting charsets from headers (matterbury)
- Don't enable a dangeous transformation that's not usable 
standalone under AllFilters.
- Fix threading use when handling failures in ProxyFetch.
2011-11-21 21:58:34 +00:00
Shawn Ligocki 5b39b0e721 Escape identifiers in several places. 2011-11-21 18:10:17 +00:00
Shawn Ligocki 06e4d65bd1 Using addEventLister/attachEvent, to prevent overriding existing listeners. (atulvasu) 2011-11-21 18:09:50 +00:00
Josh Marantz 1439f4aa32 Refrain from push_back(NULL) when an HtmlElement* is needed, as g++ 4.3
is not too happy about that idiom.

Add a warning in the Makefile near the gperf files that anyone who adds
one should send a message to get other developers to run 'make svn_update'.

Add some relative URL tests for domain_rewrite_filter.
2011-11-21 16:47:22 +00:00
Josh Marantz ecfde89665 Make symbolic codes for RewriteOptions Option<> instances to stabilize
Signature across code changes.

Adds inlining-filter cleanups from previous filter-name
refactoring CL for consistency.
2011-11-21 15:53:26 +00:00
Maks Orlovich bc910e0998 Add missing file. 2011-11-21 15:33:11 +00:00
nforman@google.com 923badd5e4 Split extend_cache into three filters, one each for images, css and scripts. 2011-11-21 15:09:53 +00:00
Josh Marantz 998ef41e92 Log URL on serf test failure. (morlovich)
Filter to disable scripts by converting input html:
  <script src="1.js">var a = 1...</script>
to:
  <noscript disabled="true"><script src="1.js">var a = 1...</script></noscript>
(gagansingh)

Add parse error reporting in a few cases.  (sligocki)

JS Embedding in PSA. Attempt to import defer_js code in this fashion. (atulvasu)

Cleanup rewriter_gflags.cc a bit. 1) Error message was doubled. 2) We
were setting rewrite_level and rewriters.  (sligocki)
2011-11-21 14:59:20 +00:00
Josh Marantz f1e08f35c4 Cleanup rewriter_gflags.cc a bit. (sligocki)
Add parse error reporting in a few cases.  (sligocki)

Give the lexer an iterator interface rather than a callback interface.
2011-11-18 23:36:02 +00:00
Shawn Ligocki 492327d60d Cleanup rewriter_gflags.cc a bit.
1) Error message was doubled.
    	2) We were setting rewrite_level and rewriters twice.
2011-11-18 23:14:59 +00:00
Shawn Ligocki 3739b02739 Add parse error reporting in a few cases. 2011-11-18 22:23:40 +00:00
Shawn Ligocki 24580323db Add more failing tests for Alexa-100. 2011-11-18 19:42:19 +00:00
Shawn Ligocki 383eb066a7 Add a mutable accesssor for Ruleset.media 2011-11-18 19:41:38 +00:00
Maks Orlovich 9b921c659c Log URL on serf test failure. 2011-11-18 18:20:44 +00:00
Maks Orlovich 59ed888c34 Don't use an in-place temporary here; it causes problems for
older g++ (CentOS, FreeBSD).
2011-11-18 17:43:17 +00:00
Maks Orlovich a665a57931 Add an API to force enable a filter even if it was disabled earlier (rahulbansal) 2011-11-18 17:42:33 +00:00
Josh Marantz c5574988cd Add Javascript Lexing framework based on mdsteele's minify code. 2011-11-18 04:05:18 +00:00
Josh Marantz 0224cc3ac5 Centralize two-letter codes for each filter and use them in the
options signature, reducing the dependence on options-version.

Change the management/inheritance of those two-letter codes in
RewriteFilter and its derived classes to avoid duplicating those
string in each class.
2011-11-17 21:07:57 +00:00
Josh Marantz fe5a6cb281 Absolutify @imports when emitting rewritten CSS if required. (matterbury) 2011-11-17 14:02:08 +00:00
Maks Orlovich ec3216fff6 Fixes for OpenCV 2.3.1 2011-11-16 21:55:22 +00:00
Matt Atterbury 13fb87ec7e Wrap contiguous rulesets with the same media types in a single @media
rule rather than each having its own, to minify even further.
2011-11-16 19:01:40 +00:00
Shawn Ligocki 63d5193d3c Add Pragma 2011-11-16 18:23:04 +00:00
Shawn Ligocki 13e8d8aca5 Spelling. 2011-11-16 18:22:47 +00:00
Maks Orlovich 5225a76fb4 Add missing dependency that could result in build errors. 2011-11-16 15:38:48 +00:00
Maks Orlovich 6f934e4fc7 Some small cleanups + comment tweaks. 2011-11-16 15:38:27 +00:00
Josh Marantz 60ce6d5bb3 Added CSS utility functions, copied from css_import_inliner.cc, for
use by the new @import flattener. (matterbury)

"Fix" URLs whose paths start with double-slashes, which was seen on
the web and its cleaner if we canonicalize.
2011-11-15 23:26:47 +00:00
Jan-Willem Maessen fc638d6712 Allow images to be inlined in CSS. This relies on jmarantz's previous change to
CSS naming, which captures user-agent dependencies under different urls.
2011-11-15 22:38:00 +00:00
Maks Orlovich 956381efff Some FreeBSD portability fixes; based on patches from
Steve Wills (username swills at host freebsd tld org)
2011-11-15 19:23:53 +00:00
Maks Orlovich c5f23dfa9b Refine some asserts (dgerman) 2011-11-15 19:22:51 +00:00
Maks Orlovich fb1a4c1e61 Add missing files from nikhilmadan's on-the-fly resource rewriting
work.
2011-11-15 19:21:53 +00:00
Josh Marantz 227cad4bcf Add on-the-fly rewriting of resources as they are served. This occurs for
resources that are not statically discovered by parsing HTML & CSS.  (nikhilmadan)
2011-11-15 14:58:23 +00:00
Maks Orlovich de0639eabf - Refactor how we run protoc in gyp files.
- Infrastructure for holding off flushes (dgerman)
2011-11-14 20:46:04 +00:00
Josh Marantz 145a95e68a Encode CSS filenames to incorporate whether the user-agent supports
webp or inlining.
2011-11-14 15:59:43 +00:00
Josh Marantz 01a69804d3 Add defer_js filter (atulvasu)
Clean up some logging.
2011-11-14 15:57:55 +00:00
Maks Orlovich 8fd8f4a503 Make CssTagScanner understand @import's without url(), and be
slightly smarter about escapes.
2011-11-11 22:10:45 +00:00
Maks Orlovich 77e54e4896 Remove overnoisy and slow debug output. 2011-11-11 20:18:59 +00:00
Maks Orlovich f576c140c1 Optimize spriting code somewhat by taking advantage of the fact that
Image doesn't need to decode a file to get its format and dimensions;
so we can delay actual decompression until we actually need it.

As a bonus, this also makes us stop believing content-type's.
2011-11-10 20:36:43 +00:00
Maks Orlovich f174e099d0 Profiling suggests that UrlEscaper::EncodeToUrlSegment was pretty
hot, so make it ~2.5x faster.
2011-11-10 19:10:53 +00:00
Maks Orlovich 2a4bf9297d - Use a different image inlining threshold for standalone css files (which are cacheable) versus html content (which generally is not) (jmaessen)
- Various test filters for more complex Url namers (matterbury)
- Optimize data: URL creation a bit, also relevant for rewriting of 
style attributes (morlovich)
- Support offloading partioning to a different thread, and do it 
for the spriter, to avoid potential latency spikes. (morlovich)
2011-11-10 18:11:02 +00:00
Maks Orlovich 9d052f6e83 - Add deadlines for rewrites during fetches as well,
with the original served with shortened TTL and the rewrite
  going on in background when not met.
- Fix passing of RewriteOptions to AddPlatformSpecificRewritePasses (gagansingh)
- Add API hooks to disable standard HTML serialization output 
to permit filters that construct it fully (gagansingh)
2011-11-07 14:35:03 +00:00
Jan-Willem Maessen 5c5b18ce34 Enable image rewriting and inlining for 1x1 and smaller images. Marker images
ought to be marked uncacheable and thus won't be subject to optimization, but
spacer images are ripe for inlining.
2011-11-04 20:58:40 +00:00
nforman@google.com e42fa4c1a2 Clear out headers before adding them back in again in apache flow. 2011-11-04 14:27:55 +00:00
Josh Marantz 03e884d6ff Remove redundant "encoded_name" arg from TestRetainHeaders which has
ceased to be encoded anyway.
2011-11-03 23:23:40 +00:00
Shawn Ligocki 3a6f674afd Set default max_html_cache_time_ms back to 0 as per Ram's suggestion.
Stop forcing all resources we serve to be no-store. This is breaking back button cacheability.

    	We leave no-store in the Cache-Control if it was originally there for security reasons (the whole point of no-store is to protect sensitive information from being saved on disk), but if it wasn't in the original, we don't add it.
2011-11-03 20:16:03 +00:00
Shawn Ligocki 7cd1dcd25e Permit inlining of images in CSS files. This is controlled by a separate, unsafe flag for the moment, pending Josh's change to do user-agent-sensitive naming & rewriting of CSS files. At that point we should probably just get rid of the separate flag and control it using the usual image inlining flag.
An interesting question is whether we should set a separate inlining threshold for css vs html, and if so how we make sure to do the right thing for inline CSS (<style> tags). (jmaessen)
2011-11-03 20:14:48 +00:00
Maks Orlovich 47979e3b09 Don't crash if we have to report an error message early in startup. 2011-11-03 13:47:30 +00:00
Josh Marantz d5e7717055 Fix TestUrlNamer testing for CombineCss. 2011-11-03 03:01:23 +00:00
Josh Marantz 044a9fc032 Test infrastructure for Encode. Let it take a StringVector rather than
a +-encoded set of URLs for combinations.  Single-URL variant entry-points
are also exposed.

Use the native encoder for each filter in the test infrastructure.


Also, recovers from an unrelated SVN hiccup.
2011-11-02 19:44:30 +00:00
Shawn Ligocki f52e614806 Fix printing of newline chars:
Before this CL:

	content: "Special chars: \n\r\t\A \D \9" -> content: "Special chars: nrt\n\r\t"

	After this CL:

	content: "Special chars: \n\r\t\A \D \9" -> content: "Special chars: nrt\A \D \9 "
2011-11-02 19:27:25 +00:00
Matt Atterbury 0ef9503467 Added documentation for the rewrite_style_attributes[_with_url] filters. 2011-11-02 17:02:09 +00:00
Maks Orlovich b8739828c4 Fix spriter decoding some images more than once, due to the libraries
in a candidate combination and the one in combination_ being different
by killing combination_ and making the multiple candidates all share the
same library.
2011-11-02 15:15:33 +00:00
Josh Marantz 56321c57a8 Add Etags to responses before storing them into cache. (nikhilmadan) 2011-11-02 14:38:10 +00:00
Josh Marantz 0d0b771622 Change the default UrlNamer implementation of IsAuthorized
to check the DomainLawyer rather than always returning true.
2011-11-02 00:24:29 +00:00
Josh Marantz bf279ae936 Remove escaping of "," in URLs for css files. It harms ie8, which interprets the
backslashes as forward slashes.
2011-11-01 20:33:14 +00:00
Josh Marantz ca169a811d Fix corner-case (& crash) removing the last comma-separated entry. 2011-11-01 14:11:31 +00:00
Josh Marantz 3bafc15ab2 Avoid combining files from distinct source domains.
Make it easier to turn on testing with TestUrlNamer on a per-test basis
by allowing override of use_test_url_namer_ via set.
2011-11-01 14:05:26 +00:00
nforman@google.com 64b1a4c52f Add option for jpeg lossy compression. 2011-10-31 16:43:09 +00:00
Maks Orlovich e381153133 Upon reflection, QueuedWorkerPool::Sequence::AddFunction
is not usable to safely add alarms that can be cancelled
cannot recognize the window between
when the adapter got invoked as an alarm callback and
when the user-supplied function ran --- so it cannot cancel
things safely during that window (as it's already too late to
call CancelAlarm as the alarm object got deleted).

So instead add a QueuedAlarm helper, and use that for
ProxyFetch's idle input detection.
2011-10-28 20:42:58 +00:00
Matt Atterbury f937f7636d Added documentation for the new css_inline_import filter. 2011-10-28 19:08:52 +00:00
Maks Orlovich 1c60b82be6 Avoid needlessly computing hashes for on-the-fly resources ---
it can be quite expensive. Also omit it for inliners, where 
it seems  wasteful as well.
2011-10-28 18:58:49 +00:00
nforman@google.com b03d690c10 Allow gifs in sprites and multiple spriting partitions. 2011-10-28 18:41:03 +00:00
Matt Atterbury 42390a9e4f Convert a style element with just a single @import to a
link element with a href pointing to the imported file.
2011-10-28 18:34:28 +00:00
Josh Marantz a215fd3d88 Make UrlPartnership know about the rewrite_driver so that we can
make combining decisions taking into account the UrlNamer.

This is just a simple refactor with no functional changes.
2011-10-28 16:47:43 +00:00
Josh Marantz 37e2c90d77 Added a new TestUrlNamer and fixed all tests to not be dependent on
UrlNamer's encoding.  This does NOT fix any bugs in the code caused by
TestUrlNamer changing the URL's domain - these will come later.   (matterbury)
2011-10-28 15:40:41 +00:00
Josh Marantz 06c2acc7b5 Factor out absolutification of embedded CSS urls for use in
the 4 CSS filters, and always absolutify when using a proxying namer.
2011-10-25 22:55:48 +00:00
Josh Marantz a8d444db26 When storing HTTP input resources into the cache, correct the date headers. 2011-10-25 17:42:14 +00:00
Jan-Willem Maessen 668a9facfc Don't strip image dimension information if a non-resized image is inlined into a
resized context.
2011-10-24 16:58:41 +00:00
Josh Marantz a9d50cc86b Patch r1983 from SVN trunk into third_party/pagespeed. Needed by PSA
to do lossy JPEG compression. (bmcquade)
2011-10-21 20:08:00 +00:00
Josh Marantz ada927079a Rewiring HTTPCache (and WriteThroughHTTPCache) Put to implement header
modifications before cache put.   (sriharis)
2011-10-21 20:04:35 +00:00
Josh Marantz 8571099aa5 Apply custom options in the ResourceFetch path. 2011-10-20 18:51:02 +00:00
Josh Marantz c3e0dbdad5 Changed the semantics of NewHistogram() function to accept name as a parameter (pulkitg)
Add cache invalidation check for metadata (sriharis)
2011-10-20 18:49:46 +00:00
nforman@google.com 43fbb8446a Handle conflicts between content-type headers and meta tags in the convert meta tags filter. 2011-10-20 14:16:48 +00:00
Shawn Ligocki e71a1fd360 Make sure we absolutify URLs in CSS. 2011-10-19 20:57:50 +00:00
Shawn Ligocki eb920b8302 Set test start_time_ms() to non-zero value. In so doing, I found at least one bug (int instead of int64 used for time).
Make idle flush time configurable. (morlovich)

	Inject fetches at proxy_fetch level when the input connection
	is idle for 10ms. This is in particular helpful for getting the first
	congestion window worth of content out quickly when it doesn't
	have enough content for the flush_html_filter to suggest it's
	worth flusing ASAP. (morlovich)
2011-10-19 19:57:59 +00:00
Shawn Ligocki 28fe00acb5 Rename fetch_time_ms -> date_ms throughout code because it is really the time from the Date header, not necessarily the actual fetch time. 2011-10-18 18:39:06 +00:00
Shawn Ligocki 4a88f44930 Add a backend time-to-first-byte latency histogram, and
hook it up in CacheUrlAsyncFetcher. Unfortunately not doable
	cleanly for UrlInputResource until the sync path is dead. (morlovich)

	Eliminated all hard-wired absolute paths in tests, changing them to
	calls to Encode(), in preparation for a change to allow testing of
	non-standard UrlNamer encoding/decoding. (matterbury)
2011-10-18 18:30:09 +00:00
Shawn Ligocki de9137f94e Fix bug where we used the wrong base URL for rewrites done in the resource fetch flow.
I stumbled across this bug while trying to test for the absolutifying URLs in CSS issue.
2011-10-17 21:15:07 +00:00
Shawn Ligocki 66d9fe9f88 Set caching headers in case of implicit caching so that the browser caches the response for as long as we do.
I don't know if this is the right space to do it. Suggestions are welcome. (nikhilmadan)
2011-10-17 21:07:44 +00:00
Shawn Ligocki 1be1f87f5f Make the -flush_html option actually enable the flush-hinting
filter (and not just calls to FlushIfRequested in proxy_fetch) 
so that it actually makes a difference on its own. (morlovich)
2011-10-17 14:39:11 +00:00
Shawn Ligocki 5a36e3b37d Clean up ResponseHeaders a bit.
Remove redundant UpdateDateHeader, using SetTimeHeader (equivalent) instead.

Simplify IsDateLaterThan to just use fetch_time_ms() (depends on ComputeCaching() called first).
2011-10-17 14:38:28 +00:00
Josh Marantz 6cf5143c0c Add more statistics collection to proxy flow (pulkitg) 2011-10-14 17:45:14 +00:00
Josh Marantz 401511b61e Split off the setting of the rewriter-list and rewriter-level from flags into a
separate function.
2011-10-13 20:34:55 +00:00
Josh Marantz b0e24e92bf Made the various down/static casts of RewriteOptions to ApacheConfig
safe by checking the actual type (matterbury)

Take advantage of the metadata cache in the fetch reconstruct path
to be able to serve from cache when the request is given with the 
wrong hash or the rewrite failed. Provide a hook --- 
StartFetchReconstruction() which should hopefully enable this 
code to be usable for AJAX rewrites as well.  (morlovich)
2011-10-13 20:14:33 +00:00
Josh Marantz 1eed3d37e7 Add handling for parsing of URL params in beacon. Incorporate new
unit test for add_instrumentation_filter (satyanarayana)

Fix corner-case with empty values for html meta-tags (morlovich)
2011-10-13 13:04:16 +00:00
Josh Marantz 6e0a0a035a Add DomainLawyer::IsAuthorized call, which is lighter-weight than
MapRequestToDomain, and use it where we only need the bool return.
2011-10-12 20:25:31 +00:00
Shawn Ligocki 65d9ac8b37 Make blacklisted JS system_test.sh less flakey. 2011-10-12 17:56:29 +00:00
Josh Marantz 9bac4d8c20 Strip proxy-host from proxied but non-pagespeed-rewritten resources. 2011-10-12 14:51:27 +00:00
Josh Marantz 4bfda1bf62 Check CURL env var for path to curl (matterbury)
Add more cache expiration tests (atulvasu)
2011-10-12 12:33:37 +00:00
Shawn Ligocki 2d2e9b4ff6 revert bad change 2011-10-11 20:15:02 +00:00
Shawn Ligocki 88e9b94f85 Turn on cacheable HTML by default in PSA. 2011-10-11 20:11:05 +00:00
Maks Orlovich cb252deb8b Factor out some of the cache-handling code so that it can be used
on fetch path as well (not done in this change)
2011-10-11 18:58:30 +00:00
Maks Orlovich 0d394bf24f Fix (+test) a couple of regressions caused by writing out
metadata produced on the fetch path:
- CSS combiner crash due to trying to access empty
partition produced by it.
- Fetch path produced inconsistent partly filled-in input
tables if an input failed to fetch.
2011-10-11 18:27:04 +00:00
Shawn Ligocki 87faa050bb Automatically Disallow some troublesome JavaScript files. 2011-10-11 16:57:39 +00:00
Maks Orlovich dba7e1ac40 - Fix crash on handling <meta http-equiv> w/out a content
specified. Spotted by load-testing.
- Allow overriding curl binary used by the system test
2011-10-11 15:33:07 +00:00
Maks Orlovich 3503cc4ccb Add a notion of max path length file system, and make
file cache honor it. Should fix
http://code.google.com/p/modpagespeed/issues/detail?id=344
2011-10-11 14:58:53 +00:00
Maks Orlovich 246614a92e Factor out some of the common cache-validity testing code into
one base that can be reused, and defensively make the validity
method pure virtual, so that people who want to add more sites
that will access the cache (e.g. me) do not accidentally end
up missing it --- and with refactor have an easier way of getting
it right.

Also add the rewrite_options() override to FileInputResource;
it was not used with it for rather subtle reasons (which are in
fact no longer true past-refactor); add a unit test to exercise that.
2011-10-11 14:28:39 +00:00
Shawn Ligocki 8bad17a91e Respect vary headers when told to in PSA (and always for HTML). 2011-10-10 20:42:24 +00:00
Josh Marantz 8390d4539f Do not consider HTML as proxy cacheable if there is a Set-Cookie /
Set-Cookie2 header in the response.  (nikhilmadan)
2011-10-10 13:07:13 +00:00
Shawn Ligocki ca384a52c7 Add ResponseHeaders::DetermineContentType() function for reading Conentent-Type header. 2011-10-07 20:41:44 +00:00
Josh Marantz 4823ce4dda Put rewrite_style_attributes_with_url into the Core filters and add system test. 2011-10-07 20:33:52 +00:00
Maks Orlovich 062a5c3e0d Publicize Deleter<> inside RewriteDriverFactory, since it's useful
for all users of defer_delete, not just ApacheRewriteDriverFactory.
2011-10-07 16:30:22 +00:00
Maks Orlovich eaac7bb4e2 - Support cache invalidation of all urls for a domain (sriharis)
- Start returning 304s in generic Page Speed Automatic proxy flow (not Apache one)
  if the cached response has a Last-Modified / Etag header which matches the one in 
  the request. (nikhilmadan)
- Write metadata cache on reconstruction fetches as well.
2011-10-07 15:22:48 +00:00
Josh Marantz 31ea309738 Only put in the X-Page-Speed header for HTML and an active module. 2011-10-06 21:26:44 +00:00
nforman@google.com 10c96919cb Adds filter to convert meta http-equiv tags into response headers. 2011-10-06 18:57:42 +00:00
Josh Marantz 2e60f1a6f1 Removed now-defunct comment + fixed assignment to decoded_base_url_. (matterbury) 2011-10-06 18:17:06 +00:00
Maks Orlovich eafa86f1a8 Fix some changes to headers done by HttpDumpUrlFetcher, such as date adjustment,
getting lost when serving slurps via the AsyncFetch interface, as they were
happening after the first write, and hence after HeadersComplete().

This is done by buffering writes, since headers like content-length and gzip-content-length
simply cannot be computed until all bytes from the slurp have been produced.
2011-10-06 14:41:41 +00:00
Josh Marantz 8a2b0d509d Add testcase for bug 327, which was fixed in a r1050. 2011-10-06 01:34:10 +00:00
Josh Marantz 368d132baa Upgrade to latest version of Chromium & Page Speed. 2011-10-05 20:37:01 +00:00
Shawn Ligocki a5bd1d8317 Remove unused ValueValidator. 2011-10-05 18:10:45 +00:00
Shawn Ligocki efc02db950 Start tests at kStartTimeMs which is currently set to 0, because some tests are still failing when not.
Goal: Start tests at non-0 time.

	This should make tests more robust. It came up because I was comparing times in sec to times in ms. But they were turning out to be the same because both were 0!
2011-10-04 22:37:45 +00:00
Josh Marantz 9dccadc4d3 Fix memory leak that occurred as a result of cache ownership semantics. 2011-10-04 20:13:02 +00:00
nforman@google.com 63e9748638 Handle dimensions specified in style attributes of img tags. 2011-10-04 19:38:07 +00:00
Josh Marantz c87f18d684 Simplify cache ownership semantics (nikhilmadan)
Add lower-casing into domain-normalization & test.
2011-10-04 18:01:43 +00:00
Josh Marantz f7caf9348b Remove redundant call to RewriteOptions::CopyFrom. 2011-10-03 21:51:39 +00:00
Josh Marantz e8ab28ed3e Compute signature for RewriteOptions and use it to make metadata cache
keys sensitive to the option settings.
2011-10-03 20:22:06 +00:00
Shawn Ligocki 74bca61a5e Split --html_cache_time_ms into --max_html_cache_time_ms and --min_resource_cache_time_to_rewrite_ms. 2011-10-03 17:38:52 +00:00
Maks Orlovich e0e7f7e534 - Asynchronous options-for-name interface (pulkitg)
- GC unused test helper from MemFileSystem (morlovich)
2011-10-03 14:25:46 +00:00
Josh Marantz 5338b282f3 Move the base_options from google_rewrite_driver_factory to
rewrite_driver_factory, so we have a single place to put
default settings we want to bake into the binary.
2011-10-03 12:01:12 +00:00
Shawn Ligocki cc1c15e51f Move Histograms and TimedVariables from ProxyInterface to RewriteStats to simplify interface. 2011-09-30 19:23:00 +00:00
Shawn Ligocki a951a65545 Fix bug 295.
Do full domain rewriting for all CSS rewrites.

    	Trim URLs in those rewrites as well.

    	This replaced all users of AbsolutifyUrls which was removed.
2011-09-30 18:28:47 +00:00
Shawn Ligocki 7f0c1b2d6d Permit MemFileSystem to be created with any timer,
not just a mocktimer, at cost of requiring a redundant
    	mock timer setting in places that need auto-advance. (morlovich)

	Add mutex protection to the locking methods in MemFileSystem. (morlovich)
2011-09-30 18:27:50 +00:00
Josh Marantz 2f480d0588 Use header X-Page-Speed for PSA. Check for either htat or
X-Mod-Pagespeed in system tests.
2011-09-28 20:26:22 +00:00
Maks Orlovich d7e7b983ae - Use callback-based named lock interface rather than
blocking one. (mostly jmaessen, some morlovich)
- Reader/Writer Locks (pulkitg)
2011-09-28 13:39:40 +00:00
Josh Marantz 4481d269b5 Change ResourceManager::options() to ResourceManager::global_options()
per popular demand.
2011-09-27 21:05:36 +00:00
Josh Marantz 29c54f0247 Fix/test *Headers::RemoveAllWithPrefix to be case-insensitive (atulvasu).
Improve the flow with a custom URL decoder.
2011-09-27 18:35:18 +00:00
Josh Marantz 64fae45ce9 adds *Headers::RemoveAllWithPrefix (atulvasu)
Propagate globally set rewrite options as default
settings.  The merge order is:
           global options from command-line / defaults.
           domain-specific options
           query-param options
           RequestHeader options
Generally the later entries in this sequence win.

Start porting domain rewriting in CSS to filters other than
cache_extender (css_* filters).  Just break out the transformer and
put it in CssTagScanner for now. (sligocki)
2011-09-27 16:28:37 +00:00
Shawn Ligocki f5d0cbf00b Simplify ProxyInterface and ResourceFetch interfaces by getting most things from the ResourceManager. 2011-09-26 18:55:58 +00:00
Maks Orlovich aca8ecf662 Add a ::Held() method to NamedLock, and sync up OutputResource::has_lock()
to it, to make it always reflect reality. Doing so exposed that 
ResourceManager::LockForCreation in blocking mode lied and claimed that it
grabbed the lock when it actually timed out. So remove that bool return
and corresponding CHECK, and make this behavior explicit.
2011-09-26 18:45:23 +00:00
Shawn Ligocki 8d75493104 Cleanup DomainLawyer.
Add GoogleUrl::Reset(base_url, relative_url) methods.

Append a hash of the image files in a sprite to the cache key instead of the names themselves in order to keep the cache key down to a reasonable size. (nforman)
Make merge_libraries.sh work with thin libraries (used by newer gyp
    	versions) by using 'ar p' instead of 'ar x' (which doesn't work with
    	thin libs). (morlovich)
Remove redundant string::c_str() calls, in contexts which
    	expect a string or StringPiece. (qrczak)
2011-09-26 18:35:45 +00:00
Shawn Ligocki 514df2316b Include what you use. 2011-09-26 12:33:43 +00:00
Shawn Ligocki 6adb86bb82 Fix ProxyFetch::Options() to work after driver_ has been set. 2011-09-26 12:32:50 +00:00
Shawn Ligocki 9325f5aa58 Add Page Speed Automatic interface: ProxyInterface, ProxyFetch and ResoruceFetch.
This interface is in active development let us know if you are interested in using it.
2011-09-23 16:49:10 +00:00
Shawn Ligocki 66c9beddc1 Make ProxyInterface/ProxyFetch use RewriteDriver's asynchronous
flush interface, instead of blocking. (morlovich)

	UrlNamer update (matterbury)
2011-09-23 16:34:51 +00:00
Josh Marantz 60596f7871 Support modifying Config on using request-headers in addition to query-params.
Remove an assert that fired while debugging Apache -- it appears that
we can get an unitiated ResourceManager pool-initiated destruction after
the RM has already been initiated, or, perhaps, after the Factory has
been destroyed.  This occured with an "apachectl stop" so I think the
latter.
2011-09-23 03:49:51 +00:00
Josh Marantz 7948c23500 Factor out the apache-speciific statistics Initialize tree,
which was in two places.

Fix races between callback deletion and check of self-destruct
bit in Function::Can{Run,Cancel}. These were causing heavy crashing
on WIP async flush + scheduler thread setup. (morlovich)
2011-09-22 14:09:29 +00:00
Shawn Ligocki 221be0fd9c Delineating with TODOs where to merge code from apache/ directory into automatic/ directory. rm unused mod_instaweb.h. 2011-09-21 23:16:38 +00:00
Shawn Ligocki 9f1b0df5df Fix up comment 2011-09-21 23:15:07 +00:00
Josh Marantz 5bd27254dc Rid ourselves of ComputeResourceManager, as that implies an
idempotency we no longer want to support.  We can have multiple
ResourceManagers per Factory now.
2011-09-21 20:42:28 +00:00
Josh Marantz a27c35a707 Startup a separate thread for running the scheduler, via a utility
ScheduleThread class.  This will be required once we don't block, as
nothing will be able to advance scheduler timeouts otherwise.  (morlovich)

Use gperf table for rewrite_options filter names, eliminating the need
to construct a bunch of string-sets when constructing RewriteOptions.
2011-09-21 20:13:57 +00:00
Josh Marantz d82c2fab99 Add test ensuring that Level "All" does not imply "strip_scripts", which is dangerous. 2011-09-21 18:00:06 +00:00
Josh Marantz 7283bfe777 Remove apr_mutex* and apr_condvar*. We were mostly using the pthreads
versions directly, with one leftover usage in apr_file_system.cc.
2011-09-21 16:57:09 +00:00
Josh Marantz caa3c8fd39 Use StringAppendF rather than StringPrintf and then appending. 2011-09-20 19:56:36 +00:00
Maks Orlovich aa4c56ffbc Fix running on Ubuntu 11 in the new world by cleaning up the entire
factory once all resource managers get cleaned up on config-check ---
otherwise we end up with a factory with dangling statistics and pointers
to freed pools (on Ubuntu 10 and other system, the factory gets
destroyed as well as the .so is fully unloaded).
2011-09-20 18:54:07 +00:00
Josh Marantz 2ea9958776 Make just 1 RewriteDriverFactory per process, with multiple
ResourceManagers allowed in that factory.  This simplifies the
lifetime of many objects, particularly relating to shared memory
and statistics.

Add Apache-specific derivation of ResourceManager.

Add Apache Cache object, which owns the caching & locking mechanisms.
We will instantiate a new ApacheCache for each distinct file_cache_path.

Some mechanism will be created to ensure compatibility of other
configuration parameters that the cache is sensitive to, to make sure
they are consistent between multiple file-cache paths.
2011-09-20 16:48:43 +00:00
Josh Marantz 19335a6c99 Convert CHECK(false) << "message" to LOG(FATAL) << "message" etc.
Don't corrupt https urls during slurping.
2011-09-20 14:43:56 +00:00
Josh Marantz 28316f596f Add failure-stat for serf. 2011-09-19 19:27:25 +00:00
Jan-Willem Maessen 4100e45446 Remove timer_based blocking for named resource locks. 2011-09-19 18:57:05 +00:00
Maks Orlovich ae81888929 Fix RemoveAll[FromSet] not being entirely case insensitivite.
This was leading to crashes under load-test due to trying to
gzip already ungzip'd content.
2011-09-19 18:17:46 +00:00
Jan-Willem Maessen c60f2e15c0 Switch resource locking to use scheduler-based blocking rather than timer-based
blocking.
2011-09-19 17:44:35 +00:00
Josh Marantz ddbbd198e7 Add ShutDown base-class method so it can be called on a UrlAsyncFetcher
other than Serf.  Make FakeUrlAsyncFetcher pollable: implementation is
trival.
2011-09-16 17:23:40 +00:00
Josh Marantz ba5cf2bff5 Add system-test for shared-memory locks. 2011-09-16 16:44:46 +00:00
Josh Marantz 191db73137 Add UrlNamer option-decoding interface (pulkitg)
Fix merge array-indexing problem with a heterogenous merge.  The plan
is to eliminate this altogether by avoiding heterogenous merges.  But for
now fix it locally.
2011-09-16 14:05:25 +00:00
Maks Orlovich 6c111af657 Export this statistic, will be useful for checking.. 2011-09-15 21:23:46 +00:00
Maks Orlovich 5a09b795c9 Centralize Scheduler creation, and make TestRewriteDriverFactory
be responsible for making MockScheduler (and not ResourceManagerTestBase).

Note that this does introduce some contention issues in threaded servers;
but is a neccessary step as something has to run the scheduler...
2011-09-15 20:50:36 +00:00
Josh Marantz f467eab103 Remove constants which were earlier moved to a different file but not removed
from this one.

Make lazy-starting of worker-thread even lazier, exploiting the recent
update to Worker to make Start() behave correctly if already started.

The cost is an extra mutex lock/unlock every time we want to start
cleaning cache.  The benefit is simplifying the startup sequence.

Strip out unused functionality from timer_based_abstract_lock, and add
in callback-based functionality instead.  Write and test a prototype
replacement for timer_based_abstract_lock called
scheduler_based_abstract_lock.  Future revisions will transition uses
of timer_based_abstract_lock across to scheduler_based_abstract_lock,
and strip out the uses of the blocking calls.  I've run into enough
subtle hitches along the way that I'm trying to turn out small working
CLs.  (jmaessen)
2011-09-15 18:57:12 +00:00
Maks Orlovich f5b472653f - Fix us no longer defaulting to CoreFilters on directories
without .htaccess; and add a system test that does not 
have .htaccess to cover that.
- Fix missing wakeup spot.
2011-09-15 15:06:06 +00:00
Shawn Ligocki 26b3960b85 Add HasValue. 2011-09-14 22:35:37 +00:00
Shawn Ligocki 0ee02364a6 Fix strange behavior where comma-separated headers where expanded on RemoveAll.
For example:

Content-Encoding: gzip, even-better-compression
Vary: Accept-Encoding, User-Agent

RemoveAll("Content-Encoding");

Vary: Accept-Encoding
Vary: User-Agent


While I was at it, I added an optimization that the map_ doesn't need to be
NULLed after Remove*-ing.
2011-09-14 21:40:55 +00:00
Shawn Ligocki a7c1037b22 Allow spriting if only one alignment direction (horizontal or vertical) is specified. (morlovich)
Make Scheduler::BlockingTimedWait responsive to other unrelated scheduler actions, in line with Scheduler::AwaitWakeupUntilUs.  This was arguably a bug.
Decouple SchedulerBlockingFunction behavior from the scheduler mutex (except for the actual blocking waiting for something to happen part, which necessarily enters the scheduler mutex). (jmaessen)
2011-09-14 21:39:39 +00:00
Josh Marantz 72c3908171 Integrate Apache-specific options into RewriteOptions
infrastructure by subclassing.  This paves the way to
handle VirtualHosts config-merging the same way we do
for directory-scope & htaccess.
2011-09-13 18:38:22 +00:00
Josh Marantz 329828d598 Fix IsPagespeedResource detecting things as pagespeed-rewritten
incorrectly by factoring out URL decoding + filter code checking
code from DecodeOutputResource so it can be shared by
IsPagespeedResource, and do some cleanups as fallout: Change
DecodeOutputResource to take a GoogleUrl and use IsPagespeedResource
instead of DecodeOutputResource where appropriate.  (morlovich)
2011-09-13 18:31:40 +00:00
Josh Marantz 90ed6cbf19 declare char-constant using char-size values. 2011-09-13 18:08:56 +00:00
Maks Orlovich 91e1614bfc - Abstractify the URL naming scheme (matterbury)
- Split rewrite processing into two threads, so that
  expensive/time-consuming parts can be more easily cancelled
  for shutdown or (potentially) load-shedding, and to reduce
  convoy effects.

- Port RewriteContextTest.CombinationRewriteWithDelay to use
  scheduler alarms and not timer alarms; 
  GC RewriteDriver::BlockingTimedWait
2011-09-13 16:40:50 +00:00
Josh Marantz 5fc7abb4f8 Fix bugs in ProcessAlarms, and knock-on bug in SchedulerTest that
relied on this particular misbehavior.  Basically, we should block the
requested time if there are no outstanding alarms, and be woken up
when an alarm arrives.  Also fixed mistreatment of quiescence in
mock_scheduler.cc that was exposed by the other bug fixes.  Finally,
re-factor blocking class from rewrite_driver into scheduler as we need
to use it in various other places (including in tests).  (jmaessen)

Declare independence from the tyranny of Apache pool destruction semantics by 
passing NULL for the pool into the Serf constructor.
2011-09-09 22:41:37 +00:00
Shawn Ligocki 9e6cd64216 Check for absense of SAMEORIGIN on default test pages. 2011-09-09 18:28:36 +00:00
Shawn Ligocki f430be15a8 Allow SetDateAndCaching to add suffix to Cache-Control 2011-09-09 17:17:44 +00:00
Josh Marantz f2a112ca95 Allow multi resource managers one rewrite factory. This CL does not
exploit this feature yet, but it expands the data model and shutdown
flow to allow for multiple resource managers.
2011-09-09 16:41:43 +00:00
nforman@google.com dc5462ac2a Add spriting support for divs with center, righ and bottom alignments. 2011-09-09 14:34:11 +00:00
Matt Atterbury 55c4dfba0b Update for bugid 88, to allow rewriting and sharding to an https scheme, while
disallowing origin mapping to an https scheme because Apache cannot fetch
resources using https (a serf limitation).
2011-09-09 14:11:14 +00:00
Maks Orlovich 510efc3f05 Make the Render/WaitForCompletion style ops inside RewriteDriver
be implemented asynchronously internally, and use Scheduler to block
where needed.

Note that this required severe surgery to mock time to make it
far more deterministic, which in turn required making us use the
same deadline under Valgrind. Also adjusted the ProcessAlarms interface
slightly to prevent a race with checking of done flag.
2011-09-08 19:23:56 +00:00
Josh Marantz 9c2e3f9242 Add OptionBase* virtual base-class to RewriteOptions to clean up the
Merge implementation a little.

https system tests (matterbury)

Move QueuedWorkerPool creation & ownership to factory to allow specialization;
doesn't change shutdown yet.  (morlovich)
2011-09-08 18:42:49 +00:00
Josh Marantz 8391ee38c2 Allow SetStatistics to be called multiple times on the same factory,
as long as it's the same Statistics* object.

mod_pagespeed_create_server_config gets called only once with an https
configuration, so only one Factory is created.

But by the time pagespeed_post_config is called, there are two server_rec*
objects in the chain, and they both point to the same factory.  Another
possibly remedy is to make a temp set<ApacheRewriteDriverFactory*> to
avoid initializing the same factory twice.  But this fix is a little easier.
2011-09-08 13:10:33 +00:00
Josh Marantz 67837424df Use TestRewriteDriverFactory in unit tests.
Split off global statistics into rewrite_stats.cc -- previously they
were embedded in ResourceManager.

Factor out construction of a ResourceManager object into
RewriteDriver::CreateResourceManager() in anticipation of having more
than one per RewriteDriver.  At the moment, though, we still support
only one per driver.
2011-09-08 03:14:57 +00:00
Josh Marantz bcf7db6f7b Clarify FakeTimedVariable comment and rename FakeHistogram to
NullHistogram, to distinguish the FakeTimedVariable which actually
does something from the NullHistogram which does nothing. (sligocki)
2011-09-08 03:08:29 +00:00
Maks Orlovich bacf60535b - Support CSS rewriting on style attribute values (matterbury)
- Some infrastructure for cachability of HTML; not active in mod_pagespeed
yet (sligocki)
- Parsing of some more complex HTTP methods (atulvasu)
- Some small refactorings (jmaessen)
2011-09-07 21:30:05 +00:00
Maks Orlovich 69b78c3642 Protect against multiple concurrent calls to RunIfNeeded. This is
possible for the slow worker if we are using multiple vhosts +
a threaded MPM with Apache. description here>
2011-09-06 18:29:37 +00:00
Maks Orlovich 86cd2406f2 Rename AwaitWakeup -> AwakeWakeupUntilUs to emphasize both
the unit and absoluteness; the later of which revealed that
MockScheduler was parent-calling with relative and not absolute
values. Fixing that made tests slower, so I tweaked the sleep
time down to cut it back down again.
2011-09-06 16:55:25 +00:00
Josh Marantz 523ae4d082 Use asynchronous threaded fetches for slurping, with condition
variables, rather than synchronous fetches with polling.

This is a step toward getting rid of synchronous fetches altogether.
2011-09-06 15:22:20 +00:00
Maks Orlovich 5f74a8209b Fix a small leak in one of the histogram tests, and make some
test code not rely on implementation details.
2011-09-06 15:18:45 +00:00
Maks Orlovich 8abb5b7378 Reuse results of previous rewrites when inputs expired but did not actually change. 2011-09-06 13:40:49 +00:00
nforman@google.com 22fa387db5 Strip utf-8 BOM from combined css files. 2011-09-02 21:05:42 +00:00
Maks Orlovich 549e054b24 Fix invocations of Scheduler::TimedWait from a callback off
Scheduler::Signal potentially having their callback called instantly.
2011-09-02 19:50:29 +00:00
Josh Marantz ca97dd0de2 Mutex-protect resource_manager_ to eliminate ComputeResourceManager race
in Apache worker MPM.
2011-09-01 18:38:54 +00:00
Josh Marantz 5db21127a6 Let status escape from ReadOneByteFromBody as well. 2011-09-01 17:53:26 +00:00
Josh Marantz f61f572f72 Don't swallow the apr_status when read in the http status. This is at
least one of the causes of hanging load-tests.
2011-09-01 14:14:32 +00:00
Josh Marantz 776bd1c91f Don't delete the timer during shutdown, as we use the timer for messages
that might happen later in the shutdown process.
2011-09-01 11:36:59 +00:00
Josh Marantz 7d4aaa42c2 Move quit_requested_ object from Function into WorkerThread, to avoid
a race where Worker::ShutDown occurs as a task is completing.
2011-08-31 20:44:37 +00:00
Josh Marantz ee3133bc64 Add Transfer-Encoding to the list of headers that we do *not* want to copy for
resources from the Fetcher to our output.
2011-08-31 18:55:21 +00:00
Maks Orlovich 01f2d65f66 Make freshening happen in async when we hit in the
metadata cache (previously it would only happen if we
miss in metadata but hit in HTTP).
2011-08-31 16:33:08 +00:00
Maks Orlovich ea571da98f Fix a memory leak + index mismatch bug in FakedTimeVariable creation.
(The leak was since noone was owning the Variable).
2011-08-31 15:09:52 +00:00
Josh Marantz 84a8f2967f Add Lookup1 method for R*Headers classes, to look up an attribute
expecting exactly one value.

Add Checking thread system to add runtime debug/diags on mutex usage when
compiled for debug (jmaessen)
2011-08-31 03:08:39 +00:00
Maks Orlovich 0a77f7c6d7 Fix an incorrect assert.
It is incorrect to assume that the work_queue_ is empty at
this point. It's possible for a sequence to get some
jobs queued but not get a chance to run at the time
we get to shutdown. In that case, active_ = false, so
we skip the loop and hit the check with a non-empty queue.
2011-08-30 17:56:40 +00:00
Josh Marantz 94b00594c6 Allow AddDelta to still make sense after Clear() by retaining previous_value_. 2011-08-30 17:34:20 +00:00
Josh Marantz 030a6e2b0c Hook up Waveforms to QueuedWorkerPools. 2011-08-30 16:47:54 +00:00
Maks Orlovich 97acf3255e Make sure to cancel the Function (rather than delete it)
when Add'ing it after ShutDown.
2011-08-30 15:17:04 +00:00
Shawn Ligocki 2bcb27e8c4 Rename RememberFetchFailedOrNotCacheable variables and add default UrlAsyncFetcher::StreamingFetch which uses Fetch. 2011-08-29 18:52:52 +00:00
Josh Marantz f825a1f20d Add template functions to make Function* objects, without having to
specify all the template syntax.

Have Function enforce exactly one of Run or Cancel being called.

Move the decision about whether to delete the Function* object after
calling to the Function object itself, so anyone can decide whether
they want theirs to be auto-deleted or not.
2011-08-29 15:40:10 +00:00
Josh Marantz 581120b0cc Avoid constructing inline GoogleUrls as that doesn't compile so well
with older gcc due to less aggressive copy-ctor elimination, and the
lack of public copy-ctor for GoogleUrls.

This prevented compilation on the Mac.
2011-08-27 00:50:37 +00:00
Josh Marantz 4d667e68c9 Clean up Alarm data type and make it opaque. This allowed me to use a different
locking convention internally for Alarms and externally for the Functions that
we pass in as alarm callbacks, which made the locking much simpler overall.  So
overall a plus I think.  (morlovich)
2011-08-26 22:34:56 +00:00
Maks Orlovich 487c0ad25c Generalize the code we used to synchronize MockScheduler with
QueuedWorkerPool to be able to scale to multiple sequence and hence
multiple pools.
2011-08-26 19:38:29 +00:00
Maks Orlovich 2d7755d9f3 - Do not include the DivStructFilter in TestingCore set.
It's not ready for this yet.
- Cleanup & simplify some RewriteDriver making code.
2011-08-26 19:28:20 +00:00
Josh Marantz 958ea167ee Turn mod_pagespeed off when doing the implicit index.html checks. 2011-08-26 14:55:34 +00:00
Josh Marantz 150a834b38 Convert RewriteDriver & MockScheduler to use QueuedWorkerPool::Sequence
rather than be assigned a QueuedWorker. 

This required allowing for a 2-phase shutdown process in QueuedWorkerPool. 
In Phase 1 all threads are quiesced and the system goes into shutdown mode. 
In Phase 2 the data structures are deleted.
2011-08-26 14:48:45 +00:00
Josh Marantz 70016e7c6a Fix race in QueuedWorkerPool shutdown, which was resulting in a test
seg-fault 5% of the time.  We need to avoid referencing locals in
NextFunction() after signalling that seqeunce shutdown is OK.
         
Keep track of whether shutdown is currently occurring and thus we should 
not initiate handling of any new requests.
2011-08-26 00:42:24 +00:00
Josh Marantz 312ebf03f3 Make lines between the dots by setting lineWidth, and make the dots smaller for a crisper look. 2011-08-25 23:42:31 +00:00
Maks Orlovich c9baf941f1 Turn on asynchronous rewrites mode.
Bump version number family to 0.10.x.y to reflect the
extent of the change.
2011-08-25 16:47:49 +00:00
Maks Orlovich 331dd31c4a Get active rewrite drivers a chance to wrapup on shutdown. 2011-08-25 14:06:17 +00:00
Josh Marantz 036effed32 Re-vamped scheduler. Basically implements a mock-timer-esque deadline
scheduler.  We use the internal condition variable solely to orchestrate
deadline handling.  This also migrates the mock_scheduler to the new framework. 
This is the minimal drop-in replacement for the old scheduler.  Still TODO:
tests for the new functionality.  This is likely to reveal problems.  In
particular, I think I will need to change the locking assumptions for the
TimedWait, AddAlarm, and AddAlarmFunction callbacks to require that they hold
the scheduler lock for their entire execution (they'll be able to call scheduler
methods from within the callback as well).  (jmaessen)

Fix ResponseHeaders.ParseFirstLine to accept more than one word as part of the
reason phrase. Previously, a 301 Moved Permanently shows up as 301 Moved; 404
Not Found shows up as 404 Not etc.  (nikhilmadan)

Added a new field cache - invalidate timestamp in rewrite options.  (pulkitg)
2011-08-25 11:55:34 +00:00
nforman@google.com ed621415c1 Test image spriting to ensure it doesn't overflow url size. 2011-08-24 20:36:52 +00:00
Josh Marantz d62958c944 Add Cancel method for Function, and an optional mechanism to supply a
Cancel member function for the MemberFunction* helper classes.
2011-08-24 14:27:31 +00:00
Josh Marantz a43c3ca59c Make handling of rewrite drivers w/custom options be more consistent
with those without them by making them both go through ReleaseRewriteDriver;
this way they'll all be available in active_rewrite_drivers_ during
shutdown. This is also nice because at least one location was incorrectly
using ReleaseRewriteDriver on something that could have custom options;
luckily that code path was impossible to hit... (morlovich)

Make IsValidAndCacheable() const (possible now since
ResponseHeaders::VaryCacheable() no longer tries to ComputeCaching()).  (morlovich)
2011-08-24 14:26:18 +00:00
Josh Marantz f468d577e1 Add a new QueuedWorker variant with a pool of threads. Use it
to offload html parsing into its own thread(s) rather than
doing that in the fetcher thread.
2011-08-23 18:46:50 +00:00
Josh Marantz 072b5e69ac Remove idle-callback, and use an alarm wakeup in MockScheduler instead. 2011-08-23 15:58:34 +00:00
Josh Marantz f9a4767bfa Rename StringStarVector to ConstStringStarVector as that's what it is. 2011-08-22 18:24:29 +00:00
Josh Marantz 86c3a92a47 Don't run many slow webp tests in valgrind. (jmaessen) 2011-08-22 18:06:33 +00:00
Josh Marantz 745a3a0b70 move bot-test from apache_system_test.sh to system_test.sh 2011-08-20 01:51:07 +00:00
Maks Orlovich 332b12ce05 Provide hooks for gracefully shutting down Serf and cache
writes incrementally, to help fix some issues with async shutdown.
2011-08-19 21:21:14 +00:00
Shawn Ligocki 23d55e53f3 Cleanup our headers processing a bit. Strip Cookies appropriately.
Map Origin mapping and URL rewriting of https URLs work as expected.
    	Added some trivial test cases but system tests are still needed. (matterbury)
2011-08-19 20:04:50 +00:00
Josh Marantz fdc789c88d SharedMemHistogram with demo in Apache -- merge_time_us_histogram 2011-08-19 18:00:35 +00:00
Josh Marantz 5c88243c45 Add virtual dtor implementations to all class cc files that lacked them (jhoch)
Add referrer logging infrastructure (jhoch)
2011-08-19 12:32:12 +00:00
Shawn Ligocki 37036b1834 Remove unused CacheUrl*Fetchers 2011-08-19 02:11:18 +00:00
Josh Marantz fab9665cc5 Factor out query-param processing into common module. 2011-08-18 22:22:08 +00:00
Shawn Ligocki 8cc6a1037c Fix Serf fetcher error where callback was never called if serf failed to start (say bogus domain name). 2011-08-17 20:19:48 +00:00
Josh Marantz f064edb6a2 waveform cleanups. New html-name for gperf table. 2011-08-17 12:18:59 +00:00
Shawn Ligocki 5889d8ec24 Expose super-simple ProxyInterface for Page Speed Automatic. (sligocki)
Add support for keeping multiple workers in the resource manager.

    	This is dependent on cl/23240808 to aggregate the multiple workers into a single
    	Waveform.  Another option that would require more work is to allow a waveform per
    	worker.

    	The big change here was that I had to change the allocation-flow in unit tests
    	for rewrite drivers so they could get worker assignments at an appropriate time.
    	This had a bit of fallout but all of it was in tests. (jmarantz)
2011-08-16 21:41:34 +00:00
Shawn Ligocki 5f1d04fe3b Add support for delta-additions to waveforms so we can populate one data structure from multiple sources, aggregating incrementally. (jmarantz) 2011-08-16 21:40:07 +00:00
Shawn Ligocki 816a826901 Add HTML Attribute name 2011-08-16 21:39:28 +00:00
Shawn Ligocki acdf585e1d Added kError HTTP method. 2011-08-16 21:38:24 +00:00
Shawn Ligocki cfcbc21263 Abstract AsyncFetch interface. 2011-08-16 19:10:37 +00:00
Shawn Ligocki b97bdd0c45 Fix missing notification that could cause latency spikes under async in some cases. (morlovich) 2011-08-16 19:10:10 +00:00
Shawn Ligocki ebc2753f19 Added a test of fetching an https URL, which currently fails fast in SerfFetch::ParseUrl which returns fails if scheme == "https". (matterbury) 2011-08-16 19:06:39 +00:00
fangfei@google.com 15dd322da4 Add Histogram::Render() in base class. Move RenderHistograms() and RenderTimedVariables() to statistics.cc.
Add APIs in Histogram to allow negative values.
2011-08-15 20:14:34 +00:00
Shawn Ligocki 36baa73eca Allow origin mapping from http/https to http, and
allow URL rewriting from http/https to http. (matterbury)
2011-08-15 18:12:41 +00:00
Shawn Ligocki 5a8d470524 More tests. 2011-08-15 15:29:44 +00:00
Shawn Ligocki 9b78034176 Fix a check found by stress test in the spriter, as well as a few
minor logic errors spotted while trying to testcase it.

    	(Also, there is no need to call both .Clear() and .Reset() on ResourceCombiners
    	as Reset calls Clear --- see the comments...) (morlovich)
2011-08-15 15:29:23 +00:00
Shawn Ligocki 8e69fac06b Expanded the TODOs for the O(N) performance problems. Comments only. 2011-08-15 15:28:47 +00:00
Josh Marantz d316178f63 Cleanups from the pre_render/post_render revision. 2011-08-13 15:54:26 +00:00
jhoch@google.com 6a15f7b567 Adding a class that wraps SharedDynamicStringMap, converting page visits and referrals to map entries 2011-08-12 21:12:38 +00:00
Josh Marantz 50ba2a10c5 Split the pre-render filters from the post-render filters, so the
post-render filters can be run in a callback when the rendering is
done.
2011-08-12 20:01:17 +00:00
Maks Orlovich 0fa43c4bed Fix serf fetcher throwing an error on value-less headers. 2011-08-12 19:27:55 +00:00
Josh Marantz 4e1e7b490f Fix filter-ordering mistake in test, which hid a subtle js inline bug.
The filter ordering mistake was that we had the html-writer filter
before the js_inline filter.

The bug was that we were eliminating whitespace in a script tag when
the script-tag was in fact not rewritable due to a flush between the
opening and closing element tags.
2011-08-12 18:14:41 +00:00
Maks Orlovich 389e6c6129 Make async path more predictable by ensuring that
at least the cached rewrites always render.
2011-08-12 16:36:34 +00:00
Matt Atterbury 33ad3b5137 Handle rewriting of a domain to a domain plus a root path, such as
http://www.customer.com/ -> http://cdn.com/customer/
If combining mapped URLs then the destination domain+path must be the
same, not just the domain.
2011-08-12 15:15:10 +00:00
Maks Orlovich 291f668e0a Fix a log message escaping issue in a not-yet-active
code path.
2011-08-12 13:51:35 +00:00
Josh Marantz a253e1b256 Do not induce Flush from ParseText, but instead offer an alternative
entry-point ExecuteFlushIfRequested which must be called
externally.

This corrects a problem I had potentially introduced where
SerfUrlAsyncFetcher would -- due to an internal buffer limit in
serf -- call ParseText on 8k buffers repeatedly until EWOULDBLOCK,
and then call Flush.

So this change calls HtmlParse::ExecuteFlushIfRequested
from our Fetcher-flush rather than calling it directly from ParseText.

This ensures that we don't excessively flush when there are pending
bytes.
2011-08-10 23:46:34 +00:00
Josh Marantz 577b220df7 Add missing files from waveform revision.
Add + test MockTimeCache, which will be used to test various
rewrites with an async cache implementation using mock time.  (morlovich)
2011-08-10 23:39:13 +00:00
Josh Marantz 1b1bdb0168 Add waveform display mechanism to track rewrite thread queue depth. 2011-08-10 23:25:22 +00:00
Josh Marantz 6cbb0dcd19 Add & unit-test structure-driven Flush Filter. 2011-08-09 03:40:45 +00:00
jhoch@google.com 9b0283892d Adding shared memory data structure for referer logging 2011-08-08 18:19:37 +00:00
Maks Orlovich 7035ff1c77 Delay start of SlowWorker until ResourceManager creation
to avoid problems with ITK MPM forking between setup
and connection handling.

Fixes issue #330.
2011-08-05 19:46:47 +00:00
Maks Orlovich cecedd6d9d jmarantz: Use more inherited interfaces and reduce the duplication of boilerplate
code in our statistics classes.
2011-08-05 19:43:18 +00:00
Josh Marantz c398ddb77f morlovich: Fix asynchronous rewrites producing diagnostics with wrong
line numbers. This was because they'd call ::InfoHere, which depends
on the parser's position, from the rewrite thread.

Instead, add a RewriteDriver::InfoAt(RewriteContext, char*, ...),
implemented in terms of a new ResourceSlot::LocationString, which
prints location information for the input slots.
2011-08-05 19:26:34 +00:00
Josh Marantz 67b3daf778 Skip zero-byte writes to the Writer*. 2011-08-05 02:35:00 +00:00
Josh Marantz 02cede8e41 Read all the available bytes from serf on every wakeup. Issue Flush()
after all queued bytes have been read.
2011-08-03 20:08:04 +00:00
Shawn Ligocki fa3642d229 Enable more tests in system_test.sh 2011-08-03 19:13:12 +00:00
Maks Orlovich aa5a3cc9b7 Fix us locking ourselves out in case URLs repeat (under async flow),
but making the duplicates re-use the results of the original 
rewrite.
2011-08-03 18:11:36 +00:00
Josh Marantz 06c80b1016 Fix crash in js_inline_filter when there's a Flush in the middle of a
script tag.  We were failing to clear should_inline_.
2011-08-03 14:34:23 +00:00
Josh Marantz 3958f589b0 Add EffectiveIntPort interface & test. 2011-08-01 21:44:26 +00:00
Josh Marantz 6e0f6931ae Modify the serf fetcher's response handling loop to send headers
before data.  It was previously calling the fetched_content_writer
prior to having the headers established, which is bad for streaming
HTML -- we want to know that it's html before we start processing it.
2011-08-01 20:21:13 +00:00
Josh Marantz 9938daf5fb Fix 64-bit optimized-compile issues under some platforms due to lack of
string-aliasing.

Fix uninitialized variable issue in serf.
2011-08-01 20:14:18 +00:00
fangfei@google.com 4e595bde80 Added Class TimedVaraible -- a statistic class that returns the increased value in the last 10sec, 1min, 1hour and total value. 2011-08-01 18:50:40 +00:00
Maks Orlovich fdd8bfd49a Update to libpng 1.2.46 2011-08-01 17:14:43 +00:00
Shawn Ligocki 3c303fab3a Some small RewriteContext cleanups (morlovich) 2011-08-01 16:46:15 +00:00
Shawn Ligocki da31ace091 Get more tests working in system_test.sh. 2011-08-01 16:45:33 +00:00
nforman@google.com b697c18c79 Change css filter to use kRewrittenResource.
Fix base urls in css filter.
2011-07-29 15:36:04 +00:00
jhoch@google.com bb7bca8a14 Variable* should be Var* in statistics_template 2011-07-29 15:00:38 +00:00
Shawn Ligocki 8265e94496 update system_test.sh 2011-07-29 14:58:53 +00:00
Shawn Ligocki cb2ef69941 Fix JS filter not doing whitespace stripping in async, and
add a unit test for that. (rewriter_google_test was covering that,
    	but it's only in google3 flow, and its output is harder to read) (morlovich)

	Keep track of dependencies on nested rewrites
    	for figuring out cache validity. Generate additional
    	dependencies to force input re-check if I/O fails. (morlovich)
2011-07-29 14:40:27 +00:00
Josh Marantz 41348eca17 Use standard abstract interfaces for serf fetcher. 2011-07-28 18:06:58 +00:00
Shawn Ligocki a1edf5a5cd Fix LoadFromFile issues by setting a 5min cache TTL in sync mode. This is sub-optimal, but sync flow is deprecated anyway. 2011-07-27 22:52:50 +00:00
Shawn Ligocki 4a2cc02914 Add load_from_file_sync_test.cc to demonstrate the load_from_file issue. Commented out tests are the ones that should be passing. 2011-07-27 22:07:01 +00:00
Shawn Ligocki 31784c7b21 Fix a regression in //net/instaweb/latencylabs:static_file_rewriter_test
I introduced fixing Vary: handling for async -- we don't want to
	touch the headers if we might not even have a valid response.
	While at it, fix inconsistency in behavior of IsVaryCacheable, which
	could call ComputeCaching unlike every other method (IsCacheable in
	particular); and adjust a test what was missing a ComputeCaching call
	after manual header manipulation. (morlovich)
2011-07-27 21:31:47 +00:00
Shawn Ligocki 788455f038 Get rid of OutputPartition and extend CachedResult instead.
Preparation for allowing sync flow to see InputInfo.
2011-07-26 19:13:28 +00:00
Shawn Ligocki 897221e22f Fix a multi-faceted image rewriter test to work with async, by making it wait for all rewrites to complete before looking for the output, and not just one. 2011-07-26 19:11:42 +00:00
Shawn Ligocki e27ff04ced Lots of stuff. 2011-07-26 19:07:43 +00:00
nforman@google.com 318e832203 Fix handling of anchors and queries by trim_urls. 2011-07-26 13:46:18 +00:00
Shawn Ligocki f85616ba65 Split Apache-specific system_test.sh out into apache_system_test.sh. 2011-07-26 00:02:56 +00:00
Shawn Ligocki bd902c0407 Fixed bug that caused segfault, added corresponding test (jhoch) 2011-07-26 00:02:34 +00:00
fangfei@google.com d23ea8a53e Add Histogram API, Impl of VarzHistogram and NullHistogram 2011-07-25 16:58:39 +00:00
Shawn Ligocki d44d23c937 Fixed one "bug" noticed while investigating LoadFromFile issue. 2011-07-25 14:17:44 +00:00
Shawn Ligocki d603374a94 Fix crashes due to inliner trying to rewrite elements
combiners (in particular the JS one) already removed. (morlovich)
2011-07-25 14:17:10 +00:00
nforman@google.com b9d34f057f Remove sync spriting path. 2011-07-22 21:12:44 +00:00
Jan-Willem Maessen 2d833e4049 Fix for http://code.google.com/p/modpagespeed/issues/detail?id=326 2011-07-22 20:08:41 +00:00
Jan-Willem Maessen b4d02ac980 Don't include SSL support in serf build, as it doesn't build properly on CentOS or Ubuntu. 2011-07-22 18:53:42 +00:00
Jan-Willem Maessen fbae6d302c Use Functions for shared memory tests to permit parameter passing. 2011-07-22 18:51:23 +00:00
nforman@google.com 8fef9e282a Add async support for image spriting.
Disable sync path for image spriting.
2011-07-22 14:48:28 +00:00
Josh Marantz 8e62c7b624 Retain extra response-headers that do not conflict with caching in
single-resource rewriters.

Fixes http://code.google.com/p/modpagespeed/issues/detail?id=324
2011-07-21 17:42:23 +00:00
fangfei@google.com 508638e471 Record all debug/info messages from mod_pagespeed in a fixed-size circular buffer, which can be accessed from a running server via /mod_pagespeed_messages. 2011-07-21 17:31:37 +00:00
Shawn Ligocki 81a0a2ffca Add template conf for ModPagespeedLoadFromFile 2011-07-20 19:45:55 +00:00
Jan-Willem Maessen 6ea9bd260a Don't do bot detection by default, as it does not have the effect one might hope
on what the bots end up indexing.
2011-07-20 19:40:54 +00:00
Shawn Ligocki 85c4ce43bd Switch ModPagespeedLoadFromFile to only work from base config (not .htaccess). 2011-07-15 20:20:56 +00:00
Shawn Ligocki adec767d87 Export this data file needed for our tests. (morlovich) 2011-07-15 20:20:28 +00:00
Shawn Ligocki 82b035ad3c Add the dependency on libjpeg here so that if we use
system libjpeg we get the USE_SYSTEM_LIBJPEG define in
    	webp_optimizer.cpp (morlovich)
2011-07-15 20:19:58 +00:00
Shawn Ligocki b8206031c6 Turn off writing OutputResources to filesystem be default (already off for ApacheRewriteDriverFactory). 2011-07-15 16:50:32 +00:00
Shawn Ligocki 41a949ed00 update bot_checker 2011-07-15 16:49:25 +00:00
Josh Marantz db7331918a Make apache non-graceful shutdown less crashy by not having
the "delete everything" signal handler run in non-main threads.
This is done by providing an ApacheThreadSystem that does some
signal masking for work threads (and doing that manually for 
serf thread for now).  (morlovich)
2011-07-15 13:26:44 +00:00
fangfei@google.com 465d510fdf Committ after rollback -c 22498122. Get Josh function.h and function.cc back 2011-07-14 21:06:28 +00:00
Josh Marantz 96acc66756 Issue 306: combine_css output links should be properly closed in xhtml mode. 2011-07-14 18:15:12 +00:00
fangfei@google.com 069aa31988 commite opensource after submit CL for SharedCircularBuffer 2011-07-14 17:05:55 +00:00
Josh Marantz 73015f3d68 Rename Closure and DelayedFunction* to Function and MemberFunction*
to improve naming consistency.
2011-07-14 14:10:59 +00:00
Josh Marantz d031214499 Make Closure common between mock_timer alarms and workers.
Add some re-usable DelayedFunction* template classes to bind context (0
to 3 objects) to a closure.  This eliminates a whole suite of
cumbersome one-time-use classes.

In the future we can investigate doing this for Fetch callbacks and
Cache callbacks as well, but that would involve adding some templating
for Run arguments.
2011-07-13 18:43:41 +00:00
Josh Marantz 55bfd2c0a4 Remove mock_thread_system and mock_time_condvar in favor of a new abstraction
Scheduler with MockScheduler.

Note that this change should be non-functional -- it's just a
more intuitive (I hope) way to organize the mock time
abstraction.

Disable protocol trimming, since it causes IE8 to double-fetch all urls.
Fixes (or at least papers over)
http://code.google.com/p/modpagespeed/issues/detail?id=314. (jmaessen)
2011-07-12 22:19:30 +00:00
Josh Marantz 81b170368f CssCombiner and JavascriptCombiner both forgot to override
ResourceCombiner's UseAsyncFlow, which could lead to check
failures in obscure circumstances due to picking up old-style
cached results[1]. Since ResourceCombiner has a filter pointer,
just make it use the filter's asynchronous bit instead, to 
avoid the problem. Added a testcase, but it's rather brittle,
unfortunately.

[1] With ResourceCombiner thinking we're sync, it was picking up
a cached result Combine, which meant a call to it 
from Partition wasn't actually writing anything out, so 
::Rewrite would try to do work --- but the code in THAT is 
only prepared to handle single-partition things for fetches,
not multiple-partition ones. (morlovich)


Fix RewriteContextTest.CombinationRewriteWithDelay to not fail under
valgrind by explicitly setting the deadline in the RewriteContextTest
SetUp() method. (jmarantz)
2011-07-12 19:46:19 +00:00
Shawn Ligocki e4ddc5c91f Simple cleanups. 2011-07-08 20:36:15 +00:00
jhoch@google.com d104220b80 Adding div_structure_filter, which adds a special query param to URLs
indicating div structure position.
2011-07-08 16:51:06 +00:00
Shawn Ligocki a84e2be162 Add ParseFirstLine method. 2011-07-07 21:56:47 +00:00
Shawn Ligocki 7030436933 IWYU includes audit... (morlovich)
It's not safe to access ::CanRewrite from ::Partition as at this point
    	we may already be detached; so do the checking in Render()
    	(which might mean we may end up throwing out our work in some unfortunate
    	circumstances) (morlovich)

	Clean file cache in a background thread. Added Worker::IsBusy to
    	help test it.

    	Also adds a RefCountedOwner to help share SlowWorker between
    	ApacheRewriteDriverFactories. (morlovich)

	Fixing TestCricular() in SharedCricularBufferTestBase, with multiple processes. (fangfei)

	Add missing cleanup in this test (so we don't get valgrind
    	warnings about potential leaks in checkin tests) and adjust
    	comment to match reality --- this isn't really using multiple
    	processes at all. (morlovich)
2011-07-07 21:51:03 +00:00
Shawn Ligocki d43bc59903 Make tests robust to location.
Fixes Issue 265
2011-07-07 21:32:43 +00:00
Shawn Ligocki 7b85ddaaf0 Add bot agents to the script that generates the list of bots for pagespeed
service and mod_pagespeed. (pradnya)

	Detect actual webp-capable user agents.  Test handling of webp user-agents, and also do better unit testing of webp rewriting. (jmaessen)

	Adding AllExceptQuery() method to GoogleUrl

    	Also adding AllAfterQuery, CopyAndAddQueryParam.  Finally, added
    	unimplemented static methods. (jhoch)

	Group SupportsImageInlining and NotSupportImageInlining tests. (fangfei)
2011-07-04 18:22:48 +00:00
Jan-Willem Maessen 82b613b2f0 Webp rewriting, accounting for user agent. If the user-agent is webp-capable,
and it looks like the image might possibly be convertible to webp judging solely
from its url, we request conversion to webp.  This yields a resource_context
(and hence a rewritten url) distinct from any rewritten url that can be seen by
a non-webp-capable browser.  This is true even if, ultimately, we actually serve
a non-webp image.  Thus with the flag set we will attempt to rewrite every jpeg
twice, once for webp-capable browsers and once for non-webp-capable browsers.
That's mostly OK, but we pay the image resize cost twice for resized jpegs
rather than resizing once and recompressing the resulting bitmap using both
compression methods.

Note that the user agent matcher doesn't include webp-capable user agents yet.
That change is on its way.
2011-06-29 21:31:50 +00:00
Shawn Ligocki 63be1e3d72 Add --rewrite_level option to binaries.
Set system_test.sh up to work with proxies.
2011-06-29 16:55:14 +00:00
Shawn Ligocki 81c43341a8 Move js_combine_filter over to async. (nforman) 2011-06-29 16:53:22 +00:00
fangfei@google.com 09513c53b9 Class CircularBuffer and SharedCircularBuffer. 2011-06-29 14:32:12 +00:00
nforman@google.com 30916b02da Enable js combining to be done in the asyn cache flow. 2011-06-28 20:34:05 +00:00
Jan-Willem Maessen 5c0b61c13a Change the default image shrinking method to CV_INTER_AREA (see
http://code.google.com/p/modpagespeed/issues/detail?id=143).  This is now the
recommended technique for shrinking images on the OpenCV Wiki.  (The default,
bilinear interpolation, is recommended for *enlarging* images.)  Note that the
results look blurrier when magnified so that you can see the pixels, but are
less subject to moire effects for image details like hair, and slanted edges
look less jaggy.  As another plus, they compress slightly better.
2011-06-24 15:40:20 +00:00
Shawn Ligocki a2f7c723d3 Implement rewriting of nested resources inside inline CSS
by treating is largely as a data: URL, but skipping the
    	caching steps. Somewhat inefficient, however. (morlovich)

    	Remove these explicit Render-on-Flush calls.
    	Doesn't look like we'll be trying mixed async + sync
    	deployment, and they're making the testing less realistic. (morlovich)

    	Fix a crash in image rewriter in async flow when Rendering
    	when Partition() failed due to missing input. Add unit tests
    	for this in various filters. (Was covered by an integration test before). (morlovich)
2011-06-24 06:43:41 +00:00
Shawn Ligocki 5690163436 Remove unused CacheInterface::Query(). 2011-06-24 06:36:24 +00:00
Shawn Ligocki a703e0a18f Some cache cleanup 2011-06-23 15:38:02 +00:00
Shawn Ligocki 5e9e41f886 Make the destructor out-of-line, since we have member scoped_ptr's
to incomplete types in the header. (For some reason clangs warns
	about it under iwyu, but no under normal compilation). (morlovich)

    	Fix cached rewrite of inliner output CHECK'ing. (morlovich)
2011-06-23 15:35:50 +00:00
Josh Marantz 45f7ce7c13 Add rewrite test with simulated time.
Changed the time-advancement paradigm to request time-advancement from
the main thread, but do so by queuing a task to advance it.  This guarantees
that the outstanding tasks will run first.
2011-06-22 18:09:16 +00:00
Josh Marantz 39280f423d In async flow, for single-resource rewriters, serve original URL if
rewrite fails during fetch. (morlovich)

Add comment on alternative mechanism for helping maintain image-search rank,
and outline the implementation of that method.
2011-06-22 17:19:44 +00:00
Josh Marantz 9c586d8c96 Preserve order of wildcards across a merge. Note that wildcard order
is significant.
2011-06-21 22:04:35 +00:00
Shawn Ligocki 8102a56f75 Add Hasher::HashToUint64 for getting 64-bit summary of hash. 2011-06-21 21:59:11 +00:00
Shawn Ligocki 7a524544e1 Follow up to earlier CL: Early exit in RewriteContext::OutputPartitionIsValid and 2 other changes. 2011-06-21 21:55:33 +00:00
Josh Marantz 6bff06a10d rewrite_domains filter strips query-params from sharded URLs.
http://code.google.com/p/modpagespeed/issues/detail?id=311
2011-06-21 20:06:00 +00:00
Maks Orlovich e13018e328 Hopefully fully fix MSVC core build now. 2011-06-21 19:23:44 +00:00
Shawn Ligocki bf439844bb Get rid of FileSystem::Ctime.
Use Mtime instead in AprFileSystem::TryLockWithTimeout.
2011-06-21 16:58:39 +00:00
Shawn Ligocki 2002b410f1 Permit ReadAsync fetches to run in a thread, too, if the
target callback is OK with it, so we don't try to use
	Poll()-requiring blocking Serf fetches from async path. (morlovich)
2011-06-21 16:58:18 +00:00
Maks Orlovich 98b455c61e - Make sure to set async flow on alternate rewrite_driver
when testing the async mode, and wait on the proper driver.
- MSVC compilation fix.
2011-06-20 22:11:28 +00:00
bmcquade@google.com df277ff08b update windows DEPs to python 2.6. 2011-06-20 19:20:41 +00:00
nforman@google.com 3b48496d22 Allow comma-separated Content-Encoding fields. 2011-06-20 18:26:29 +00:00
Shawn Ligocki f36ceb6a77 rm expensive ComputeCaching() call 2011-06-20 14:43:42 +00:00
bmcquade@google.com f149c900d4 remove duplicate block from gyp file 2011-06-20 14:21:03 +00:00
Shawn Ligocki ef76690abe Fix OutputPartition validation when inputs are FileInputResources.
Previously FileInputResources were being arbitrarily cached for 5 minutes.

Now the files are statted each time we consider an OutputPartition. If any file has changed mtime, the OutputPartition is invalidated.

Fixes all XFAIL tests in rewrite_context_test.cc except ones for nested resources. Those are not being dealt with yet by our OutputPartition caching scheme. CLs to come.

This probably only affects the async flow :/
2011-06-17 21:52:41 +00:00
Shawn Ligocki 19c0489f4a Add and test FileSystem::Mtime.
Also moved AprFileSystem::Ctime up to FileSystem and added both to mem_file_system.
2011-06-17 21:06:54 +00:00
Shawn Ligocki 1aabfa5aba Implement some rewriting of resources inside CSS under async flow.
This is currently limited to external CSS only (not inline), and
    	might only rewrite a single instances of same URL when cold. (morlovich)

    	Add some additional tests for various rewrites inside CSS.
    	Fix the external CSS cache extender testcase to not clear the fetcher;
    	doing that made it rely on caching done by the inline portion to operate,
    	making it hard to diagnose failures independently. (morlovich)

    	Fix for hanging in chained + nested case --- we need to propagate
    	nested rewrites in order to start successors, so we can't
    	wait for all nested rewrites to finish to start propagating them,
    	as some nested rewrites may be successors. (morlovich)
2011-06-17 21:05:04 +00:00
nforman@google.com 8807903aaf Add a configurable option for respecting Vary: User-Agent headers. 2011-06-15 23:04:20 +00:00
Shawn Ligocki d0a21a6594 std::vector<StringPiece> -> StringPieceVector 2011-06-15 22:55:24 +00:00
Shawn Ligocki cac438db8b Add tests for update frequency of combined and nested resources.
Tweak the code a bit to help avoid spurious tsan warnings. (morlovich)

Rewire how we handle rewrites in asynchronous case so that we have
a place to hook in the starting of nested jobs and can run after them.

Nest step will be to change image_rewriter_ in Context to be a
CssImageRewriterAsync, invoking it from Context::RewriteImages,
and having it feed rewrite contexts from other filters to
Context::RegisterNested. (morlovich)

Do more careful error-checking of libjpeg results.  Most of these shouldn't fail according to the docs (they should only do that if we temporarily stop providing input, which we don't do), but pagespeed was seeing related failures and there's no actual harm in coding this more conservatively. (jmaessen)
2011-06-15 21:22:43 +00:00
Shawn Ligocki 6d29c4caa2 Do a minimal port of CSS filter to new flow disabling all the
nested functionality for now; and XFAIL all the tests that exercise it
    	via an easily greppable macro. (morlovich)
2011-06-14 15:41:43 +00:00
Shawn Ligocki 8561e3a2f0 Replace AdvanceTimeAndUpdateOriginHeaders with new FetcherUpdateDateHeaders. 2011-06-14 15:41:09 +00:00
Josh Marantz cb889d3aed Remove "set -x" from system_test.sh
Make unit-tests not crash on Mac (even if the shared-mem ones fail)
Add async flow for inlining filters (morlovich)
2011-06-13 23:36:47 +00:00
Josh Marantz af933501fa Fixed comment indicating that Bot-detection is "on" by default. 2011-06-13 23:23:18 +00:00
Josh Marantz e417fcf63b css_combine with async fow.
Infrastructure change for rewriting combined resources.
2011-06-13 20:18:04 +00:00
Josh Marantz 5327c8c43e Don't optimize images for BOTs, at least by default. (fangfei) 2011-06-13 20:12:50 +00:00
Shawn Ligocki 015531040c Push expiration setting into ResponseHeader::SetDateAndCaching.
Have to re-gold everything because of the response header re-ordering.
2011-06-13 18:17:42 +00:00
Josh Marantz 980e0f0280 Centralize the synthesis of link-tags in the css combine test, so
we can ensure they have a consistent attribute ordering and quoting
style.

Allow some test infrastructure methods to accept StringPiece.
2011-06-11 20:29:21 +00:00
Josh Marantz b96c84c7a4 Mutex-protect MockTimer. Add a NullMutex implementation for
use in single-threaded tests, which is most of them.  A
MockTimer will be constructed with one of those but a proper
mutex can be established after construction.

Move the ownership of the MockTimer out of the MemFileSystem (where
IMO it never belonged in the first place).
2011-06-11 04:11:49 +00:00
Shawn Ligocki 6b20706e3b Fix expiration handling for OutputPartitions and FileInputResources. 2011-06-10 22:30:38 +00:00
Shawn Ligocki ae5b8eee4a Fix missing WaitForCompletion in the image test.
Add Worker::ShutDown and use it to avoid idle callbacks potentially
    	referring to already deleted RewriteDrivers (likely cause of the
    	sporadic tap failure on image test (likely cause of the
    	sporadic tap failure on image test) (morlovich)
2011-06-10 22:30:08 +00:00
Shawn Ligocki f1a777f46e Fix missing WaitForCompletion in the image test.
Add Worker::ShutDown and use it to avoid idle callbacks potentially
	referring to already deleted RewriteDrivers (likely cause of the
	sporadic tap failure on image test (likely cause of the
	sporadic tap failure on image test) (morlovich)
2011-06-10 22:15:28 +00:00
Josh Marantz b0bbae10cf Layer a mock thread system over a real thread system, so that we can control
condition variables in mock time.

Two mechanisms are provided to work with mock time, though only one is used at
this point.

Method #1 is to use a new idle-callback provided by the Worker class.  Use that
to signal the condition-variable and allow the TimedWait in
RewriteDriver::Render to return.

Method #2, not in use yet, is to allow the various phases of RewriteContext and
MockUrlFetcher to advance time, and use new MockTimer alarms to signal the
condition-variable to complete the TimedWait as well.
2011-06-09 20:23:32 +00:00
Josh Marantz af0ae0fb54 Add support for chained alarms. 2011-06-09 19:34:45 +00:00
fangfei@google.com a067382825 script to generate bot list 2011-06-09 19:08:47 +00:00
Shawn Ligocki 350d600324 Add mock-time condition variables. (jmarantz) 2011-06-09 18:37:46 +00:00
Shawn Ligocki b1c16342ef Allow MockUrlFetcher to update expiration headers on responses so that we don't get IsAlreadyExpired for a resource we just fetched in tests. 2011-06-09 18:36:23 +00:00
Josh Marantz b9db1ff4f8 Remove filter_prefix from ResourceCombinerTemplate, and change
the filter type from CommonFilter to RewriteFilter.  This
thins the interface a little because the filter_prefix is
available as RewriteFilter::id().  There are no filters
suitable for combining that are CommonFilters but not
RewriteFilters.
2011-06-09 18:30:30 +00:00
Josh Marantz 2f7d370560 Provide control whether mem_file_system advances time by default,
as the scale at which it was advancing was way too large for the
rest of the tests.
2011-06-09 14:46:06 +00:00
Josh Marantz 306a824d2c Add Idle-callback mechanism. 2011-06-09 12:46:53 +00:00
Josh Marantz a40a98819c Add Alarm support in mock timer.
Change the time-setting methods in MockTimer to be non-inlined because
they are now non-trivial.  Changed references in code base.
2011-06-08 23:58:45 +00:00
Shawn Ligocki 3014318dae More testing for rewrite context 2011-06-08 15:15:42 +00:00
Josh Marantz e64355a7dd Centralize the memory-cleanup-on-static-destruct hacks. We were
doing this in multiple places and this could lead to hard-to-predict
ordering.
2011-06-07 20:58:28 +00:00
Shawn Ligocki ad40fd500b Test resources not expiring out of cache issue. 2011-06-07 20:05:46 +00:00
Josh Marantz f44389c679 Add a new virtual method to generate a RewriteContext from a
RewriteFilter.  What I'd found was that every new
RewriteFilter that I wrote had to have the exact same fetch
method which has to pass a number of arguments through to
RewriteContext::Fetch.  It's easier just to provide a
mechanism to generate a RewriteContext.
2011-06-07 16:41:27 +00:00
Josh Marantz bdf43c9310 Follow-ups form r750. 2011-06-07 14:18:16 +00:00
Josh Marantz 29c7c7b758 Use non-blocking flow for resource fetches, removing FetchExtantResource
APIs from rewrite_driver.
2011-06-06 21:23:11 +00:00
Josh Marantz 838c3e6dad Add testcase for Combining in async flow. 2011-06-06 18:18:56 +00:00
Josh Marantz 63a52c4bfb Add code for support of 'webp' -- off by default. (jmaessen)
Mutex-protect the population of 'initiated_rewrites' (jmarantz)
Change 'CanRewriteImages' to "ShouldNotRewriteImages'  (fangfei)
2011-06-04 19:03:46 +00:00
Josh Marantz 2bc8768d6e Resolve race conditions by:
- deferring slot update till Render(), which is either run in
  the HTML thread.
- inserting RewriteContext* into initiated_rewrites_ *before*
  initializing it
- mutex-protecting the wait_fetcher, and putting it in
  pass-through mode in
  ResourceManagerTestBase::CallFetcherCallbacks, so that
  chained rewrites work.
2011-06-02 23:29:48 +00:00
Maks Orlovich b459e2268a Make code for giving ourselves permissions for directories we
created more robust to various invocation scenarios such as explicit
config check and out paths defined before apache user/group.
2011-06-02 21:36:39 +00:00
nforman@google.com f07c141109 2011-06-02 19:41:47 +00:00
Josh Marantz 64ff46c42a Restore sligocki's change which I had accidently backed out. 2011-06-02 17:56:50 +00:00
Josh Marantz de38e4f0c8 Fix stray refs to apache/mem*.cc.
sligocki:
   Don't set 1 year cache lifetime for FileInputResources.
   Clarified ResourceManager::SetDefaultHeaders -> SetDefaultLongCacheHeaders.
2011-06-02 17:50:25 +00:00
Shawn Ligocki f40add0b7e Don't set 1 year cache lifetime for FileInputResources.
Clarified ResourceManager::SetDefaultHeaders -> SetDefaultLongCacheHeaders.
2011-06-02 17:34:07 +00:00
Shawn Ligocki 8444f315a8 Fix this:
[Thu Jun 02 11:33:39 2011] [warn] [mod_pagespeed 0.9.0.0-738 @18408] Invalid filter name in ModPagespeedFilters: extend_cache%5C

    	We don't want to escape arguments to fetch_until/fetch_fail since they get quoted already. So instead quote them in the
    	places we do need them --- direct wget invocation. (morlovich)
2011-06-02 17:33:46 +00:00
Josh Marantz 553e920004 Clean up memory in tests to make valgrind reports cleaner.
Move mem_debug.cc to util -- it's not apache-specific -- it's totally generic to C++.

Move mem_clean_up.cc to rewriter -- it's not apache-specific, it
applies to Pagespeed Automatic as well.

Add testing infrastructure for OpenSuse (morlovich)
2011-06-02 16:45:07 +00:00
Shawn Ligocki 6d5c221044 Add some load-from-file tests to rewrite_context_test and stats to MemFileSystem 2011-06-02 15:38:05 +00:00
fangfei@google.com 93263c70d2 RewriteImages()->CanRewriteImages(); CL 21637747 2011-06-02 14:57:44 +00:00
Josh Marantz 510db06073 Fix race-condition; don't notify the RewriteDriver that a
RewriteContext is done until its successors have been
initiated.

Adjust deadlines for valgrind runs and debug builds so that
our tests tend to pass.  Further adjustments may be needed.  E.g.
when running under a real debugger we may want to extend them
way out.
2011-06-01 22:46:06 +00:00
Josh Marantz 3a91f6c738 Move all Rewrite activities to a Worker thread. This
eliminates the need to synchronize within a RewriteContext.
Instead we give synchronization responsibility to the RewriteDriver.

The usage of the task-queueing has three benefits:
	1. Rewrites happen in a separate thread that can continue after
  	   HTML has been flushed.
	2. The mechanism to queue pending tasks offers a much more
	   debuggable implementation, at least in testing, than
	   when we were doing all the rewrite activity in mock
	   callbacks, which resulted in very deep call-trees.
	3. The memory management of RewriteContexts themselves is
	   now a strict ownership model where the RewriteDriver
	   stays alive at least as long as the longest-running Rewrite,
	   and deletes all the Rewrites on Cleanup.
2011-06-01 17:19:43 +00:00
Josh Marantz fd735815ab Make all member-variables in resource_manager_test_base.h private
per style guidelines, adding accessors at a few levels of abstraction. 
         
Factored out custom code in a few tests that set up counters and 
delayed fetchers; the class supports that with class methods now. 
         
Still at issue: the way that RewriteDrivers are externally managed; this 
CL does not attempt to change that.
2011-06-01 02:32:42 +00:00
Josh Marantz c5e315aa62 include-what-you-use fixups. 2011-06-01 02:27:18 +00:00
Shawn Ligocki 30f8adde69 Rename meta_data_ and metadata -> response_headers for Resource.
Move Validate methods out-of-line.  Virtualize ParseUrl method.  Add
    	'WaitForCompletion' method in RewriteDriver in anticipation of a CL
    	that implements it, and call it from the test infrastructure to
    	facilitate testing. (jmarantz)
2011-05-31 18:41:43 +00:00
Josh Marantz b1c204cebc Clean up RewriteDrivers after they are done. Add DCHECK to
make sure we don't leave any behind.
2011-05-27 20:31:09 +00:00
Josh Marantz 98c231d4b8 Add missing file from previous submit. 2011-05-27 20:25:28 +00:00
Josh Marantz 4119d848b7 Minor cleanups & refactoring from earlier review.
morlovich: reduce the number of iterations done in threadsafe_cache_test when
running under valgrind.
2011-05-27 20:25:02 +00:00
Shawn Ligocki 16e8c9dcce FileLoadPolicy for explicitly mapping URL paths to directories.
Lower the # of iterations of threadsafe cache test when running under
valgrind, as the test can otherwise easily take > 10 minutes. Use the
logic from dynamic_annotations.h to detect that case (adding a forwarding
header for it). (morlovich)
2011-05-27 20:07:43 +00:00
Josh Marantz 30b9c3157d Servicing technical debt: move toward clearer ownership of
private variables in ResourceManagerTestBase.  Remove no-longer-needed
infrastructure for making 2 specific mutexes in factories.  Use a
factory for instantiating the ThreadSystem.
2011-05-27 13:22:51 +00:00
Josh Marantz e529e083b2 Move content_type.* from util/ to http/ 2011-05-27 03:33:36 +00:00
Maks Orlovich 204da46100 Tweaks for better testability and builability on various platforms. 2011-05-26 20:53:45 +00:00
Josh Marantz 1e8316b32c Add HTML Rewriting capability to the Pagespeed Automatic demo cc file:
static_rewriter.cc.  It still cannot rewrite resources, because it
lacks a file-based fetcher.
2011-05-26 17:56:48 +00:00
Josh Marantz b0d747dba1 Add support for nested RewriteContexts and a test. Note that the RewriteContext
class has admittedly gotten too complex.  It needs to be simplified in various
ways, such as:

 - moving all the state held in boolean variables to a
   State enum
 - providing some Print() scaffolding to clearly see
   what's going on in the debugger
 - reducing the amount of recursion through callbacks and
   use a scheduler to queue up actions on the RewriteContext
   in response to Fetcher, Cache, and NestedContext callbacks.
2011-05-26 17:39:08 +00:00
Josh Marantz d8750ae21a Allow RewriteDrivers to live longer than the HTML-rewrite -- to enable
longer-running asynchronous Rewrites to continue after the HTML has
been committed.

Move user-agent parsing to http directory.
2011-05-26 00:51:41 +00:00
Shawn Ligocki e096cda41b Allow using FileInputResources to load static resources directly from files. Issue 274.
This is not finished yet, but is a start.
2011-05-25 20:07:07 +00:00
Josh Marantz a7523a0c96 Add Makefile to build Pagespeed Automatic on Mac & Linux. It is
tested by linking a sample implementation of the system, though the
resulting binary does not actually do rewriting yet.
2011-05-25 19:03:34 +00:00
Shawn Ligocki 4d74476f65 Resolve issue 247.
Document that HtmlElement::AttributeValue("foo") returns NULL if either:
 * no attribute "foo" exists or
 * attribute foo has no value.

And touch up various things along thee way while checking that that assumption was not missed.

In addition I solved a crash that would occur if you had a binary (value-less) attribute and called IntAttributeValue() on it.
2011-05-25 18:05:16 +00:00
fangfei@google.com 043950fd64 Make image-inlining conditional on a whitelist of known supported desktop &
mobile browsers, rather than just blacklisting IE6 and IE7. Some relative changes
class UserAgent and RewriteDriver.
2011-05-25 15:42:06 +00:00
Maks Orlovich a338851674 - Improve testability of installed version.
- Some additional checking of Thread use.
2011-05-24 19:13:39 +00:00
Josh Marantz 82082b411b Fix domain balancing on URLs embedded in cache-extended CSS files: Issue 295
Add script for generating bot-list table and sort bots (fangfei)
Tweak code for detecting XHTML (mdsteele)
Tweak slurping code to allow testing of domain sharding
2011-05-21 13:06:54 +00:00
Maks Orlovich 8488beed78 Fix issue #297. On Ubuntu 11, we don't get ~ApacheProcessContext called
between config check and actual startup, so we have to clear the statistics
object manually.

Fix CHECK "var != NULL. Variable not found: serf_fetch_request_count" when
no factory has us enabled by default, but statistics are on and we are enabled
via vhosts or query param, by making sure to initialize statistics if they are on
even if MPS itself is off...
2011-05-19 17:47:48 +00:00
Josh Marantz 11bca9538a Include file cleanups. 2011-05-18 23:23:49 +00:00
Josh Marantz 17a423e59a Refactor the URL-absolutifier so that we can apply any arbitrary
functor to transform URLs.  Use that to implement the URL absolutifier
without changing the interface to it, so we don't need to update
call-sites.  The test now fully covers the separate transformer
and absolutifier.
2011-05-18 23:17:05 +00:00
Maks Orlovich 51352be623 Fix crash when enabled on vhosts but not globally due to shared mem
runtime object getting cleaned up before the statistics SHM detach.

Likely addressess issue #296
2011-05-18 21:39:04 +00:00
Maks Orlovich 88df58456d Merge with Serf 0.7.2 2011-05-18 21:25:29 +00:00
fangfei@google.com e241d23add add ModPagespeedDisableForBots 2011-05-17 21:20:09 +00:00
Josh Marantz 9ff21a199d Fix ref to js_combine doc.
Make Rewrites async in the async flow, not just fetches & cache lookups.
2011-05-17 21:12:27 +00:00
fangfei@google.com 60c2c8fb2b robots.txt detection 2011-05-16 20:49:51 +00:00
Josh Marantz 693abb954d Add dependencies to serialize shared access to slots. 2011-05-13 20:17:12 +00:00
Josh Marantz c5eb518c5d Generally promote compile warnings to errors only on our 'development'
version of gcc which is gcc 4.4.  Other versions of gcc should not
get errors promoted.  (morlovich)

Re-interpret StringPieceToVector's delims arg as a set, rather than a
sequence, adding testcases to support that.  All our current usages were
single-character so this change has no current effect. (fangfei)
2011-05-13 20:16:07 +00:00
Josh Marantz 5800478b8b Add more tests and functionality around fetching with async flow. 2011-05-12 21:38:43 +00:00
Maks Orlovich 57b0b97b23 Re-add an include we need for older OpenCV 2011-05-12 20:04:05 +00:00
Jan-Willem Maessen c36b354df4 Refactor image.h to remove direct opencv dependency and isolate it to image.cc. 2011-05-12 18:20:55 +00:00
Josh Marantz e915731667 Make shared memory test helper methods more robust in the face of failure. 2011-05-11 22:42:45 +00:00
Josh Marantz 03751d9104 Implement generalized Fetching for async flow. 2011-05-11 22:36:55 +00:00
Josh Marantz 21b94d84cb Tweak formatting & comments for apache file-ownership tweaking code (morlovich) 2011-05-11 22:32:19 +00:00
Josh Marantz b34fd00186 Remove stale test.html file from examples. Add new css portability defines.
Turn off warning-promotion for css parser.
2011-05-11 22:21:46 +00:00
Maks Orlovich 986b42044e Fix some g++-4.6 warnings (part of #289). 2011-05-10 21:19:08 +00:00
Maks Orlovich c8be1f6c58 Exclude hostname from variable name creation when JS combining, so that
it stays stable accross shards.

Fixes issue #287
2011-05-10 20:32:26 +00:00
Maks Orlovich db7a88b092 When we create our cache directory ourselves when running as root,
make sure to hand it over to the httpd's process' ownership. 
(Not done if it already exists).

Addresses issue #285.
2011-05-10 13:54:10 +00:00
Maks Orlovich b04ff2ac65 Don't build v4l support in opencv if we are building it ourselves.
Sidesteps problems with its headers being different on some platforms.

Fixes issue #282.
2011-05-09 16:33:38 +00:00
abliss@google.com f3f8acf053 re-commit the libpng image library, this time with appropriate dependencies. 2011-05-06 16:55:03 +00:00
Josh Marantz ee00fda0f3 Turn off warnings when compiling anything that requires opencv. 2011-05-06 13:05:08 +00:00
Josh Marantz 2bc18328e6 Temporarily roll back spriting change, which has build issues with png.h.n 2011-05-06 11:54:25 +00:00
abliss@google.com 1ff95cfcf5 - libpng-based spriter library
- cleanup serf connections
- massive header/include fixups
2011-05-05 21:43:41 +00:00
Maks Orlovich 35b59e6473 Fix JS filter throwing CHECK failures when trying to rewrite things sent
with an unknown mimetype.
2011-05-05 19:13:08 +00:00
Josh Marantz 2da68acc8f Add Fetching support to SimpleTextFilter. Refactor javascript_filter
fetching tests so they can be re-used by other modules.
2011-05-05 03:08:38 +00:00
Shawn Ligocki 2dc432734e Update from webutil/css 2011-05-04 18:18:25 +00:00
Josh Marantz b1f2785a72 Remove an unsuccessful to build pagespeed_automatic as a library from gyp. 2011-05-04 14:59:53 +00:00
Jan-Willem Maessen 6d00a83a4c Fix includes in htmlparse. 2011-05-03 21:42:41 +00:00
Shawn Ligocki 4dd5d111a2 Enabled rewrite_css and rewrite_javascript in CoreFilters 2011-05-03 20:44:28 +00:00
Josh Marantz 3856d76b9e Fix serf crash when statistics is off (morlovich) 2011-05-03 20:24:16 +00:00
Josh Marantz 966a978c9d Add targets to build Page Speed Automatic: a C++ rewriting library that
does not require linking with Apache.
2011-05-03 15:20:53 +00:00
Josh Marantz 84eab2dc22 New thread system abstraction (morlovich)
Simple text transformer abstraction for async rewriters
2011-05-03 01:10:52 +00:00
Maks Orlovich 87d208df8f Some include cleanups. 2011-05-02 21:43:06 +00:00
Josh Marantz e7acbb48bc Add missing test file. 2011-05-02 18:56:33 +00:00
Maks Orlovich 393470f1e9 - Standalone domain sharding filter work --- not yet hooked up (jmarantz)
- Some API cleanups (jmarantz)
- Testing code for experimental async rewrite model paths (jmarantz)
- updated some library signatures for new pagespeed version's minifier.
- Thread APIs (morlovich)
- Thread safety fix in Serf fetcher (morlovich)
2011-05-02 15:29:16 +00:00
Josh Marantz 8abd9ebf86 spriting fix (abliss)
Add rewrite_domains filter, to support rewriting & sharding domains for resources
that are not otherwise modified by mod_pagespeed.
2011-04-29 19:50:20 +00:00
Josh Marantz 6dcee770a7 Fix Issue 237
Adds RetainComments directive, as a user-visible option, allowing users to
turn on the 'remove_comments' directive but keep intact comments that much
any of a set of wildcards.
2011-04-28 19:44:49 +00:00
Shawn Ligocki 422c521f15 Don't use quirks-mode for xhtml 2011-04-28 19:20:27 +00:00
Josh Marantz 09842835f7 Add asynchronous rewriting infrastructure based on cache callbacks.
This is enabled by a switch and off by default, but is unit-tested
and integrated into JavascriptFilter as a Proof Of Concept.
2011-04-28 18:53:06 +00:00
Jan-Willem Maessen 6a868106fb Include what you use fixup for /util. 2011-04-28 18:40:02 +00:00
Shawn Ligocki 300fa6f35b Add MockUrlFetcher::SetConditionalResponse() so that we are set up to be able to test conditional fetch behavior. 2011-04-27 17:30:26 +00:00
Josh Marantz bcfdd76fd7 Remove more detritus from abandoned 2-pass scan strategy. 2011-04-26 22:26:14 +00:00
Josh Marantz 524d6a5f17 update to-do. 2011-04-26 22:15:19 +00:00
Josh Marantz c8a7e3a082 Move lock creation code into ResourceManager, and simplify the
interface by removing superfluous resource_manager arg (that's 
already a member var).
2011-04-26 22:00:12 +00:00
Josh Marantz 78b4aea833 Only add filters to RewriteDriver once, using SetUp to factor out
the adding of filter in various tests.
2011-04-26 21:52:35 +00:00
Jan-Willem Maessen b1779cb175 Sub-flags to control image optimization. Version update of Pagespeed library, permitting better image optimization. 2011-04-26 20:19:57 +00:00
Josh Marantz 7e98966eda Move resource-creation method bodies to resource_manager, so that we
can create resources after the RewriteDriver is removed.

Notes that we still leave RewriteDriver entry-points which make it
simpler to call at existing call-sites, because it knows about the
RewriteOptions.

Move ReadAsync back to ResourceManager (where it was born) and let it
use the async cache interface, rather than the blocking wrapper.
2011-04-26 19:28:33 +00:00
Josh Marantz a05d21be83 Remove experimental scanning pass in favor of a strategy employing
pure async rewrites.
2011-04-26 19:12:43 +00:00
Shawn Ligocki 30837fbc31 Parse, store and serialize @charsets. 2011-04-25 21:52:43 +00:00
Shawn Ligocki d39eeb6f6c Logging errors in lots of places where CSS parser is skipping bytes it doesn't understand. 2011-04-25 21:26:19 +00:00
Shawn Ligocki 6ef6e59db7 Add ApacheRewriteDriverFactory::ChildInit/RootInit hooks for initializations that need to happen different in root and child processes. (morlovich) 2011-04-25 21:07:37 +00:00
Shawn Ligocki 3acb0e2164 Add ResponseHeaders::UpdateFrom to fascilitate updating headers when we recieve 304 Not Modified responses. 2011-04-25 21:04:21 +00:00
Maks Orlovich 9ba4c16d74 - Proper handling of duplicate images in spriting (abliss)
- Header file cleanups (jmarantz, jmaessen)
- Cleaner statistics init sequence (jmarantz)
- Avoid need for conditionals on statistics use by supplying a 
dummy object when real ones aren't available (jmarantz).
2011-04-25 15:18:00 +00:00
Maks Orlovich 3da1ef465d - Put lock files where they are documented as going.
- Fix a build failure with older gcc (e.g. on CentOS).
2011-04-22 14:10:56 +00:00
Josh Marantz 4e49220641 Move Dump() and Clear() to base Statistics class. Add Get64()
as a required Variable method.
2011-04-21 22:21:16 +00:00
Shawn Ligocki d22a5ec86d Rework ConditionalFetch interface.
More thorough tests for timer_based_abstract_lock.  The obvious properties were mostly being tested in subclasses, but Maks had run into issues with early / incorrect termination of the blocking methods.  Those are particularly tricky to test, and the code here is a bit delicate: we have to stand up a second thread, and have the main testing thread test that the second thread is blocking in the way we expect, then kill and clean up that second thread. (jmaessen)
2011-04-21 22:05:36 +00:00
Shawn Ligocki 0755ad3a2d Raise CSS parsing errors for ignored symbols for say '<' and '}}' 2011-04-20 21:41:54 +00:00
Shawn Ligocki da1ccfa52c Add SharedMemLockManagerTestBase::TearDown 2011-04-20 21:40:07 +00:00
Shawn Ligocki cd473deac1 Refactoring and commenting. 2011-04-20 19:51:37 +00:00
Shawn Ligocki 1d14ef1f32 Note parse error for nth-child(1d). 2011-04-19 21:54:11 +00:00
Shawn Ligocki 9e8ea6e828 rm unnecessary .c_str() and spriting changes 2011-04-19 21:36:35 +00:00
Josh Marantz 4fa1991440 Use ref-counted resources. 2011-04-16 03:19:36 +00:00
Josh Marantz 180c3d3cb0 Added url_async_fetcher_test
Provide a mechanism to upcast ref-counted pointers.  Disallow implicit
casts.
2011-04-16 03:13:27 +00:00
Josh Marantz 85dd9ac02e Static asserts (sligocki)
Conditional Get infrastructure (sligocki)
2011-04-16 03:09:12 +00:00
Maks Orlovich 29e63417e2 Add a shared memory lock service implementation. Not yet
in use.
2011-04-15 19:42:41 +00:00
Maks Orlovich b40d9158fe - Make sure that some things we think are compile-time constants really are
- Somewhat more efficient & simpler RefCountedPtr/Obj
- Fix up and benign lack of cleanup in pthread shm runtime.
2011-04-14 21:54:57 +00:00
Josh Marantz 9ad1163392 Add pointer-initialized RefCountedPtr and tests. 2011-04-14 15:29:56 +00:00
abliss@google.com 11ebb195fc Finish the img->image rename. 2011-04-14 14:36:27 +00:00
Josh Marantz cac3c6f6f2 Spriting background bug fix (abliss)
Add message handler to ResourceManager to enable async rewrites that complete after
RewriteDriver is released.
2011-04-13 23:48:35 +00:00
Shawn Ligocki 931d90f013 Add a failing test for \0/ hack. 2011-04-13 23:03:14 +00:00
Josh Marantz e0845051ba Separate ref-counted ptr implementation from shared_string so it bcan be used
for other objects.
2011-04-13 20:33:11 +00:00
Josh Marantz 82433f72a0 Add infrastructure to retain comments matching a wildcard pattern. This still
needs to be exposed as an Apache directive and doc'd.
2011-04-13 17:38:41 +00:00
Maks Orlovich 4ac5450edb Add GoogleUrl::Clear() which makes some code cleaner. 2011-04-13 15:39:07 +00:00
Jan-Willem Maessen 68110225ca Rename img to image for readability and consistency. This includes all
configuration options (though the old options remain in deprecated form for the
moment).  Also adds tests for long-fixed-by-refactoring bugs.
2011-04-13 15:00:59 +00:00
Maks Orlovich 595ed43d77 Fix a bug that occured when:
1) The server was handling multiple domains 
2) It got two consecutive resource fetches on the same process
3) They were both cache misses.

In such a case, the second request was erroneously denied by domain checks.
2011-04-12 21:25:25 +00:00
Josh Marantz 38659ebfc9 Use gettimeofday for Mac compatibility. clock_gettime does not
exist on MacOS.
2011-04-10 14:45:59 +00:00
Josh Marantz 66171d7d0a Add typedef wrapper for std::string. 2011-04-09 03:14:34 +00:00
Josh Marantz 385ca07c02 jsconcat code cleanup (morlovich)
css-parser code cleanup
2011-04-09 03:02:10 +00:00
Josh Marantz ed016f43f9 Back out a version-control accident. 2011-04-01 23:28:40 +00:00
Josh Marantz 8075762f6e Various changes to help get the system compiled on Mac. These are
necessary but not sufficient.  There are still promoted compilation
warnings in the css parser which need to be cleaned up.

The most basic change here is to upgrade the Chromium revision to
one that has a working Mac 'gclient' implementation.
2011-04-01 23:22:35 +00:00
Maks Orlovich 1b1a510a71 Avoid temporaries for which g++-4.1 produced copy checks, causing build errors. 2011-04-01 21:54:11 +00:00
Maks Orlovich 6f6cf73c6d Add missing testdata. 2011-04-01 21:43:21 +00:00
Maks Orlovich 8b4f0b54ce Two fixes to deal with crashing when running as root and dropping priviledges:
- Don't crash in statistics when attach in child process fails.
- Change how we do shared memory (using a shared anonymous mapping passed down 
to children) to avoid the permission problem in the first place.
2011-04-01 17:27:03 +00:00
Shawn Ligocki 7f9c34d034 Fixes (and adds unit- and system-tests for) a bug in image spriting caused by a caching irregularity in second-level dependent resources. Also introduces a new struct, the TimedBool, to simplify an oft-repeated pattern of passing a int64* into a bool-returning function. (abliss)
Use real data: URLs.
2011-03-31 15:42:21 +00:00
Maks Orlovich 8806494cc3 - Honor URL length limits via a uniform mechanism for all filters (sligocki)
- Fix parallel builds, add missing testcase.
2011-03-30 18:01:16 +00:00
Shawn Ligocki 2f1ff91e28 Getting system_test.sh working on localhost:80 2011-03-30 00:17:59 +00:00
Maks Orlovich 8876f424b9 Change the rewrite result metadata cache to go to a separate
lower-level value cache interface rather than the higher-level http one. 
This removes the overhead of packaging things up as http messages 
(which was also potentially confusing), and will make it possible to
use a different backend cache for it and http cache in the future.

Also add a forgotten file from the testcases from 597.
2011-03-28 15:02:41 +00:00
Shawn Ligocki cb6b5af039 Add some more CssImageRewriterTests. Especially, test for pathway where base URL is different directory than HTML's base URL. 2011-03-25 20:31:24 +00:00
Shawn Ligocki ccb2aa33f0 Quick fix for z-index error by just converting float -> double and increasing precision. 2011-03-25 20:07:00 +00:00
Josh Marantz 8fe32aa753 Remove the xhtml-sensitivity from the parser, so that content that
claims to be XHTML but really isn't still gets proper DOM created for
it.  The xhtml-sensitivity is still applied on filters such as
elide_attributes and remove_quotes that need to avoid breaking
xhtml-compliant pages.

Fixes Issue 252.
2011-03-25 19:55:02 +00:00
Jan-Willem Maessen 9d66db8cc0 Fix http://code.google.com/p/modpagespeed/issues/detail?id=251 and testing changes to css. 2011-03-25 17:34:33 +00:00
Maks Orlovich 472f486347 - Refactor the CSS tests to make it easier to reuse some
infrastructure (sligocki)
- Fix crash in spriter on unknown image types.
2011-03-25 14:43:18 +00:00
Maks Orlovich fe7c509e9f New statistics implementation, using our SHM infrastructure
(currently with a pthreads backend) rather than APR one. This version
doesn't use SysV resources so should hopefully avoid the global leak 
risks.
2011-03-24 19:17:11 +00:00
Maks Orlovich 7f6e7eec2f - Fix threadsafety wrapper around the small in-memory LRU
dropping value.
- Some test data tweak.
2011-03-24 17:29:51 +00:00
Josh Marantz bb32c0aa5e Add testcase for slurping of "/".
add abstract shared mem implementation (morlovich)
2011-03-23 21:01:40 +00:00
abliss@google.com 4074d0fa30 Fix build break 2011-03-23 18:52:04 +00:00
abliss@google.com 67b5b7922c introduces the Spriter library and a filter for combining css background images. 2011-03-23 00:37:39 +00:00
nforman@google.com 91a913e4c1 Avoid creating extra copies of data inside CacheExtender by introducing
concept of on-the-fly resources, and taking advantage of that. Now that
we have more than 2 kinds of resources, actually store the kind in 
OutputResource rather than a bool.

Add base_url validation to CreateInputResource*
2011-03-21 13:54:56 +00:00
Josh Marantz 52c15f9cdc Add http_response_parsaer_test to open-source testing. 2011-03-18 14:25:22 +00:00
Josh Marantz 4c48b087bb Change cache interface to be asynchronous. Added compatibility
blocking Find & Query implementations at HTTPCache level so that we
could check this in and start migrating to async cache usage.
2011-03-16 23:24:37 +00:00
nforman@google.com 99fe81c166 Disallow trimming of urls before the base tag. 2011-03-16 20:58:24 +00:00
Josh Marantz 6e814ad602 Move ImageDim to its own protobuf, instantiated by both ResourceContext
and CachedResult.

Moved the Encoder class into its own files.
2011-03-16 20:46:07 +00:00
Josh Marantz 0b2461ebdd Add js_combine_filter (morlovich)
Add shared memory abstract infrastructure & pthread implementation (morlovich)
2011-03-16 20:09:56 +00:00
Josh Marantz ee59e8783e Remove -Wtype-info flag which is not available on all supported platforms.
We still develop with this flag so we won't regress functionality.
2011-03-15 23:10:23 +00:00
Josh Marantz bf45f34450 Resolve left_trim/rewrite/htaccess conflict by following the
request->prev pointer to get the original URL.  Prefer following request->main
if it exists (nforman).
2011-03-15 21:29:42 +00:00
Josh Marantz c7d14d4b5b Update Scan interface to make the methods non-const, so that the methods can
write into caches & maps.
2011-03-15 20:08:20 +00:00
Josh Marantz 789f10b7b3 Add -Wtype-limits to all non-windows builds. 2011-03-15 18:17:06 +00:00
Shawn Ligocki 65b95f5857 Add small message if statistics is disabled. 2011-03-15 15:14:58 +00:00
Shawn Ligocki 140d7506a5 Put SSI fix back for patching. 2011-03-14 20:23:19 +00:00
Shawn Ligocki 83385acb41 Rollback SSI to make patch easier 2011-03-14 20:19:10 +00:00
Josh Marantz 3992a25c88 Support server-side includes by moving our output filter after
mod_include, solving Issue 182:

http://code.google.com/p/modpagespeed/issues/detail?id=182
2011-03-14 19:53:18 +00:00
Josh Marantz 834184c746 Change the encoder class hierarchy so that:
- No data needs to be stored in the encoder instance
	- The encoders read/write a protobuf 'ResourceContext'
	- The escaper is not part of the encoder hierarchy but is simply
	  used by it
	- The multipart encoder is part of the encoder hierarchy

Separate the 'encoder' implementation from the encoded data, passing
	explicit 'data' objects throught the RewriteSingleResource call-stack
	as needed.

	Collateral Damage:
		Made SimpleStats statistics_ available to all ResourceManagerTestBase
		subtests.

		Changed the initialization order in RewriteDriver so that
		the filters needed to decode rewritten resources are available
		after ResourceManagerTestBase::SetUp().

		Moved some bool option shadow fields out of img_rewrite_filter
		and instead get those option-values directly from the options
		as needed.  This was required due to

		Removed RewriteFilter::CreateOutputResourceFromResource which
		was tested but not otherwise used.
2011-03-14 19:45:39 +00:00
Shawn Ligocki 21d201cae4 Pass original url (not the re-written one) to mod_pagespeed so that we can make relative urls. (nforman) 2011-03-11 21:13:09 +00:00
Josh Marantz 9e2491e42d Make a shared StringStringMap definition in string_util.h and use it. 2011-03-11 21:07:53 +00:00
Shawn Ligocki 8a7c775654 Alphabetize mod_instaweb.cc 2011-03-11 20:42:02 +00:00
Josh Marantz 22fb9e8176 Modify testcase to confirm that javascript minification removes comments.
Alphabetize various lists & sequences in mod_instaweb.cc (sligocki)
2011-03-11 17:54:29 +00:00
Shawn Ligocki 23023c412b Remove unneeded .c_str() 2011-03-10 20:16:13 +00:00
Shawn Ligocki 9a5a63cc70 Register ModPagespeedLowercaseHtmlNames in Apache. Issue 235. 2011-03-10 19:44:42 +00:00
Shawn Ligocki d6149a46ac missed a file 2011-03-10 19:44:20 +00:00
Shawn Ligocki dae0a4a61d Replace CachedResult with a protobuf. 2011-03-10 19:43:46 +00:00
Shawn Ligocki ac42b7733c Fix typo in example 2011-03-10 19:42:54 +00:00
Shawn Ligocki 0bbf4b2fa4 Document which sorts of strings are and are not valid in google_url_test. 2011-03-10 19:42:07 +00:00
Shawn Ligocki c56f6ad2a9 Work around gcc-4.1 bug 2011-03-09 15:42:57 +00:00
Shawn Ligocki 15e6238a3c Support rewriting of gifs into pngs. (jmaessen)
Permit using the hashers in raw binary mode. (morlovich)
2011-03-09 15:40:15 +00:00
Shawn Ligocki 71433f39ae left_trim_urls -> trim_urls 2011-03-08 16:14:33 +00:00
Shawn Ligocki 4ba5e766c6 Clarify and quiet down minification failure message. 2011-03-08 15:54:33 +00:00
Josh Marantz b6a7bbb898 GoogleUrl string handling updates (nforman) 2011-03-08 00:11:15 +00:00
Josh Marantz fd838eacad Fix Issue 194: conflict with mod_speling
string handling tweaks in url_left_trim_filter (nforman)
2011-03-08 00:06:42 +00:00
Josh Marantz f80030b3b6 Make Resources know about the RewriteDriver in addition to the ResourceManager.
Add system test for slurping.

Add a speed test for the parser/filter-dispatch infrastructure.

Add names to lock manager interface.
2011-03-07 23:46:57 +00:00
Shawn Ligocki e269b8b9cb Start converting some locale stuff 2011-03-07 22:19:12 +00:00
Josh Marantz 3a4a6d211e Add scan filter infrastructure in preparation for transition to async caching
Another round of GURL -> GoogleUrl refactoring (nforman)

File-locking abstraction (morlovich)
2011-03-06 16:19:51 +00:00
Shawn Ligocki 87259cb2d9 Add ProxyPass test 2011-03-03 23:46:26 +00:00
Josh Marantz de58d66027 Fix slurping and its support of webpagetest. Factor out the logic for
decoding a URL from an Apache request so it's shared between slurping,
HTML rewriting, and resource handling.
2011-03-03 23:00:24 +00:00
Shawn Ligocki 82d4e0f66e rm ref to deprecated declaration 2011-03-03 21:20:02 +00:00
Shawn Ligocki 2256b432f4 Change <base>-tag behavior to conform to html5 spec: only first base-tag is looked at. Info messages are issued for subsequent non-matchinb base tags. hrefs prior to first base tag are undefined in HTML but our behavior will usually be that the base-tag applies retroactively (based on size of flush window) (jmarantz)
Change more things to use GoogleUrls (nforman)
2011-03-03 21:08:58 +00:00
Maks Orlovich c075b4eb6c Protect AprFileSystem with a mutex since some of the underlying
apr operations are not thread-safe.
2011-03-02 22:51:05 +00:00
Shawn Ligocki 179747f224 Remove URL hack that appears to be wrong. Appears to fix bug 74. 2011-03-02 22:00:57 +00:00
Shawn Ligocki 49137870ea Adding new class to do StringPiece methods for GURLs. (nforman)
Remove excessive info output from url_left_trim_filter. (nforman)
Fix a rare crash in CssCombiner. (morlovich)
Permit timed-out serf requests to continue to spew data. (jmaessen)
2011-03-02 21:59:04 +00:00
Maks Orlovich f279276828 Fix regression in query handling in slurp mode. 2011-03-01 21:55:36 +00:00
Josh Marantz 5206425338 Enable domain sharding using new directive ModPagespeedShardDomain 2011-03-01 18:29:45 +00:00
Josh Marantz 9fc584763c Virtualize HtmlParse class and FinishParse method for robustness
Change string_multi_map to allow embedded nul characters (abliss)
2011-03-01 18:26:43 +00:00
Maks Orlovich 2fc103b0ad - Avoid some useless cache ops with outline filters
- An additional CSS testcase (sligocki)
2011-02-28 21:03:40 +00:00
Shawn Ligocki df64d7c93c sync 2011-02-28 18:59:53 +00:00
Shawn Ligocki 0cd4882bb5 Add MakeGoogleAnalyticsAsnc example HTML page. 2011-02-28 18:59:18 +00:00
Maks Orlovich 836241406b When rewriting images inside the CSS, make sure to
incorprorate the expiration time of those images into 
the expiration time of the produced stylesheet.
2011-02-25 22:34:30 +00:00
Maks Orlovich 3e1908f5ed - Make test scripts more robust with respect to proxy settings --- issue #205 (nforman)
- Link the HandleResponse logging to the corresponding issue # (jmaessen)
2011-02-25 22:14:50 +00:00
Shawn Ligocki 27b415c010 Add CssImageRerwriter tests 2011-02-25 19:55:49 +00:00
Jan-Willem Maessen 1fa2d69b8a Additional testing and logging improvements for locking.
Fixes to url_left_trim_filter to make it useful once more.
2011-02-25 18:53:50 +00:00
Shawn Ligocki 072b505aff Remove base_tag_filter 2011-02-24 23:06:35 +00:00
Jan-Willem Maessen 6e5972e6ee Log an error when a lock blocks for a long time, as this is almost certainly a bug.
Add an example of the use of left_trim_filter and check its behavior.
2011-02-24 15:50:04 +00:00
Shawn Ligocki 0a8e8c950b rm deprecated file 2011-02-23 18:04:41 +00:00
Maks Orlovich 9e95ccb1f6 Add HtmlParse::CloneElement and ResourceCombinerTemplate<T>::RemoveLastElement
for future use.
2011-02-23 16:11:29 +00:00
Shawn Ligocki 206adc200c sync 2011-02-22 22:09:45 +00:00
Shawn Ligocki 50c99b46e3 Left-trim URLs in CSS 2011-02-22 22:08:22 +00:00
Shawn Ligocki 05ef2453a6 cleanup HTML examples 2011-02-22 17:44:16 +00:00
Shawn Ligocki 613424dff5 Add more test examples and fix misspelling 2011-02-22 17:40:04 +00:00
Shawn Ligocki a92b061b97 Parse Microsoft proprietary syntax like:
.foo { filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=80); }

See issue 108
2011-02-22 15:06:23 +00:00
Shawn Ligocki 2153b15b38 sync 2011-02-18 22:36:05 +00:00
Shawn Ligocki 107a52eb9c re-compress images in CSS 2011-02-18 22:35:28 +00:00
Shawn Ligocki a9c2fd48be Remove Css::Value::COUNTER special casing, issue 108 2011-02-18 19:41:08 +00:00
Shawn Ligocki 952f903b4f Fix bad pointer (morlovich) 2011-02-18 19:40:10 +00:00
Shawn Ligocki f007b2aa16 Support parsing arbitrary functions in CSS, see issue 108 2011-02-18 18:44:28 +00:00
Josh Marantz 075a4f4792 Add a new *Headers::Replace method to factor out the common pattern
of doing RemoveAll then Add.  At some point we could also implement
this more efficiently.
2011-02-18 00:41:53 +00:00
Shawn Ligocki fd38ba7327 Stop lowercasing unknown identifiers (like font names) 2011-02-17 21:21:55 +00:00
Maks Orlovich dd0238bd19 Permit filter results to be reused even if the input
resource has expired if its contents have not changed.

Enable it in the image rewriter, the JS minifier and the cache
extender.
2011-02-16 19:11:47 +00:00
abliss@google.com e1e5a9a79d Parse CSS identifiers starting with *, and change ResourceCombiner to use composition instead of inheritance. 2011-02-15 23:12:51 +00:00
Jan-Willem Maessen b076824f1b Avoid 100% CPU soaking under high load after fetch timeout by crashing the
affected apache processes.
Revive left trim filter
Refactor combine filter to delegate rather than inherit
2011-02-15 22:54:16 +00:00
Shawn Ligocki 7515f0eb4b Parse and distinguish CSS3-style pseudo-elements.
Ex: p::selection { background-color: red; color: white; }

See: http://www.w3.org/TR/css3-selectors/#pseudo-elements
2011-02-15 22:39:43 +00:00
Shawn Ligocki 9c03903442 Makes sure we don't print outside our allowed buffer. 2011-02-15 22:19:09 +00:00
Shawn Ligocki 9e26470826 Log context of parser failure so that it's easier to see what went wrong. 2011-02-15 00:10:51 +00:00
Shawn Ligocki ab3b5ef074 Allow values to start with * (star hack for IE). Supports issue 108. 2011-02-14 23:55:27 +00:00
Shawn Ligocki 6372dd600c Add tests for failing CSS parses 2011-02-14 23:13:25 +00:00
Maks Orlovich 77ec6b3ca2 - Permit manually managing lifetime of CachedResults (needed for
a future optimization)
- Cleanup the API to RewriteSingleResourceFilter a bit, so that 
the CSS filter can talk to image filter without knowing about its
encoder usage.
2011-02-14 23:05:25 +00:00
Josh Marantz 99a3e77bd7 Remove deprecated methods.
Allow logging VLOG(2) if we set "LogLevel debug".  Added TODOs about
logging as [info] and [debug] as well.  (sligocki)
2011-02-14 20:01:29 +00:00
Josh Marantz 165ab509df Follow-ups from previous symbol-table update to simplify the
implementation and improve testing functional coverage &
observability.
2011-02-12 01:09:52 +00:00
Maks Orlovich 90f0634b85 Remove some deprecated methods, tweak some comments
and tiny log format fix.
2011-02-11 21:04:35 +00:00
Josh Marantz 08c5a1c438 improve load-test framework to incorporate async request behavior
via a VirtualHost proxy (async)

Clean/optimize up SymbolTable and HtmlName.  Allocate SymbolTable
memory in its own pool.  We don't use 'arena' because we don't need
to call destructrors for char*.  Stop interning keywords expressed
in their canonical (lower-cased) form as we have a perma-string
available from html_name.gperf.  This will reduce the amount of
hashing and allocation done on many HTML files.
2011-02-11 20:25:49 +00:00
Josh Marantz d69480e40e Make the lexer case-sensitive. 2011-02-11 00:35:37 +00:00
Josh Marantz c77d934480 Add directive to enable lower-casing of HTML names.
Add a mode in which we act as a rewriting proxy without doing
slurp writing (morlovich)
2011-02-11 00:27:37 +00:00
Shawn Ligocki a456e4afc3 Get rid of StringNCaseCompare 2011-02-10 19:00:19 +00:00
Shawn Ligocki f31ab43bc2 Accept proprietary values in CSS rewriting. 2011-02-10 18:56:18 +00:00
Josh Marantz bdaccee162 Get rid of the str*casecmp calls in the apache/ subdir. 2011-02-10 18:35:06 +00:00
Maks Orlovich 10d1a4abfe Add some helper methods for doing [Set]Remembered of
int and int64 values, and use them; will have more
use sites in the future.
2011-02-10 15:50:13 +00:00
Maks Orlovich 42e0104496 MSVC fix, take 2. 2011-02-10 15:45:24 +00:00
Maks Orlovich efbbd87f5c - Try to fix warnings-as-errors MSVC build
- Fix ModPagespeedSlurpFlushLimit
2011-02-10 14:52:26 +00:00
Josh Marantz cca83ca04e Change the html keyword comparison from being atom-based to being enum-based,
eliminating the need for each filter to initialize its own member variables
for Atoms.  This also makes it chaeper to construct the filter-chains and
the lexer itself, and achieves case-insensitivity for our rewriting filters
while allowing our data representation to retain the case-sensitive text
so that we can make case-folding an option.

This is phase-3 in a 5-phase fixing of an issue where we case-fold
sensitive XML that's masquerading as HTML by lying about its
content-type.

  Phase 1:  Add HtmlName construct with tests (done: CL 19353690)
  Phase 2:  Change symbol-table to case-sensitive, but for
            the short term, lower-case while lexing:  CL 19343411
  Phase 3:  Change the rewriters to use keywords rather than enums.
            This requires changes in Page Speed and Ads as well.
  Phase 4:  Stop lower-casing while lexing, and eliminate this method.
  Phase 5:  Turn case-folding off in Writer, fixing issues with flash sites
  Phase 6:  Better content-detection of XML and allow<enter description here>
2011-02-10 03:27:47 +00:00
Shawn Ligocki 45b33a8218 Update rewrite_single_resource_filter and fix third_party things 2011-02-09 22:19:09 +00:00
Josh Marantz c5278ed38d Use GNU hash_set on g++ and std::set otherwise in SymbolTable so
we can update Page Speed's version of instaweb without complicating 
its build flow. Note that we still employ dense_hash_map in the 
CSS parser, which Page Speed does not depend on.
2011-02-09 20:51:28 +00:00
Josh Marantz d578b32de5 Update mod_pagespeed to a more recent version of chromium and page speed. 2011-02-09 16:04:51 +00:00
Josh Marantz ecc07904a4 Add test-case that will fail if someone tries to change StringCaseCompare
to be implemented by strcasecmp.
2011-02-09 15:12:20 +00:00
Josh Marantz 5d0b0282f0 Use HtmlName construct for tag and attribute names, so that we
can both keep the case-preserved name, and do fast word
comparisons for tag matching.  We still case-fold on output
so this should have essentially no functional difference.

Moved the keyword comparison from being atom-based to being enum-based,
eliminating the need for each filter to initialize its own member variables
for Atoms.  This also makes it chaeper to construct the filter-chains and
the lexer itself.


Use condition variables for thread synchronization in serf_url_async_fetcher. 
This makes worker threads notably more responsive.  Also uses thread join rather
than multi-thread unlock/lock for termination detection (should work reliably
everywhere), and fixes subtle logic & locking bugs in during termination that
caused the main thread to shut down prematurely when fetches were in transit to
the async thread.  (jmaessen)
2011-02-08 23:52:06 +00:00
Josh Marantz a556b2fa78 Change usages of str*casecmp to our own versions. Avoids unexpected
locale issues.  Also can use StringPiece which is advantageous when
source is a std::string.

Clean up gperf usage a little.  Make an explicit name for the
generated table to reduce the non-obvious magic in the C++ section of
our gperf file.
2011-02-08 21:35:27 +00:00
Shawn Ligocki cc54bada48 Cache extend images in CSS files 2011-02-08 19:29:01 +00:00
Shawn Ligocki 63b9852671 Make serf tests more robust when run under valgrind. We would occasionally get timeout failures where the worker thread was simply being starved, in spite of efforts to the contrary in the test code. We solve this by bounding the length of time we spend in a single Poll(...) call in WaitTillDone, and then pull loops out of the tests (since they're not relevant after the change). Note that the tests still occasionally block for long periods when run under valgrind, but they do appear to always succeed. 2011-02-08 19:23:54 +00:00
Josh Marantz 983022d90d Add/test keyword-to-string table, owned & maintained by html_keywords. 2011-02-08 18:36:51 +00:00
Josh Marantz 5f5477d7b3 Use a perfect hash table for HTML keywords. 2011-02-08 15:01:42 +00:00
Maks Orlovich ba3e49f886 - Work on new HTML tag/attribute representation (jmarantz)
- Support of versionning rewrite metadata caches (morlovich)
2011-02-07 22:35:19 +00:00
Josh Marantz 22542f1713 Add test for issue 211, it passes, so following up with report.
http://code.google.com/p/modpagespeed/issues/detail?id=211

Update rewrite_single_resource_filter API docs a bit.
2011-02-07 16:38:10 +00:00
Josh Marantz 5a60f49e8f Refactor html_escape to html_keywords cause we are going to put
more keywords into that structure beyond just escaping.
2011-02-07 15:32:23 +00:00
Maks Orlovich 866908cd36 - Fix Fetch path in single-resource rewriters to update metadata, too
- Add some API misusage detection in CachedResult
2011-02-07 15:19:01 +00:00
Josh Marantz df8b3b8b99 Rewrite the resource tag scanner so it doesn't care about types or
other attributes.
2011-02-04 22:56:01 +00:00
Maks Orlovich 7ccdceb851 Fix UrlInputResource::Freshen to not existing contents of the resource.
Should fix issue 202.
2011-02-04 21:36:50 +00:00
Maks Orlovich a1121095a7 - Refactorings in serf fetcher to use pools (jmaessen)
- Time unit consistency fixes (jmaessen)
- Refactoring of many single-resource rewriter to 
share the input/output + result cache code. (morlovich)
2011-02-03 19:47:04 +00:00
Shawn Ligocki 9b0e6cddfe Add experimental rewriter to replace synchronous loads of ga.js with an asynchronous load. (slamm) 2011-02-01 20:44:52 +00:00
Maks Orlovich 102fda35e7 Fix regression in r422 that caused cache extender to
crash on reject urls
2011-02-01 18:33:53 +00:00
Maks Orlovich cfd4f039a1 - Avoid tempfiles for resizing if OpenCV is new enough
- Fix bug with some malformed image width/height attributes 
- Pool data structure for some upcoming refactors (jmaessen)
- Some tweaks to rewrite result metadata cache APIs
2011-02-01 15:18:55 +00:00
Shawn Ligocki 0d9d0a6de3 Fix bug 203 as per HTTP spec: we have to consider "Transfer-Encoding: chunked" before "Content-Length" 2011-01-31 19:22:18 +00:00
Josh Marantz 5d9f381b57 Let cache-extender rewrite a resource even if it's got a long
cache lifetime to begin with, if we would shard its domain or
map it to a different domain.
2011-01-28 19:48:56 +00:00
Josh Marantz 11d84380a1 Upgrade to latest version of 'gflags' to allow memory cleanup. 2011-01-28 19:46:41 +00:00
Josh Marantz 4e3fa28635 Tweak the rewrite_images example so make it easier to see the benefit.
In particular, don't put in the same image more than once with two
different resolutions, which causes mod_pagespeed to make page-load
time worse.  And do include a png that can be losslessly re-encoded.
2011-01-27 18:42:35 +00:00
Josh Marantz 6e222dcc1d Further consolidation of http://test.com into one string-constant. 2011-01-27 17:33:54 +00:00
Shawn Ligocki 2533e2941a Stop piping pounters everywhere. 2011-01-27 16:38:05 +00:00
Josh Marantz 38d8f69b9d Simplify null_filter -- make it one file. 2011-01-27 16:06:18 +00:00
Shawn Ligocki 4ed36d1379 Turn off HtmlParse timing information by default added params to support it. 2011-01-26 23:17:51 +00:00
Maks Orlovich 76f9adbfa1 Some refactoring to make it easier to implement some additional
caching.
2011-01-26 22:55:22 +00:00
Maks Orlovich 4b98540bfb Compilation fix for some gcc versions. 2011-01-26 22:54:49 +00:00
Shawn Ligocki 73c059955d Some basic fixes. 2011-01-26 21:18:00 +00:00
Shawn Ligocki 14609d89de Factor out common http://test.com/ testing domain into one constant -- there were previously two, and a scattering of literal strings. (jmarantz) 2011-01-26 21:14:54 +00:00
Shawn Ligocki aaeb6088e2 Fix Issue 197 and improve code coverage. 2011-01-26 19:45:46 +00:00
Jan-Willem Maessen 44de3a96e4 Fix semantics of CreateInputResource, which was prematurely mapping to the
Rewrite domain via the partnership.  That should only be done when creating
output resources.
2011-01-26 18:04:54 +00:00
Josh Marantz 1d471ab04c Issue 196: Don't inline css with @import statements, at least until
we add code to absolutify them.
2011-01-26 13:55:43 +00:00
Josh Marantz ff51785037 Remove the implication that origin-domain-mappings imply authorization
of the origin domain.  Admins will often (at our recommendation)
origin-map their internet domain to 'localhost' so that their apache
server will serve their own resource requests via loopback rather than
going out to the load-balancer and back in to another server.

But we shouldn't allow an HTML reference of 'localhost' -- or any
other origin resource -- to sneak through and be evaluated on the
Apache server.
2011-01-25 23:43:16 +00:00
Maks Orlovich b4494e18e3 - Add system test for and fix /mod_pagespeed_beacon bug 193. (sligocki)
- Fix bug 192, mishandling of URLs with trailing things, by 
404ing those with junk and accepting (but not mis-caching) those with 
queries (morlovich)
- Work on infrastructure for partitioning (jmarantz)
2011-01-25 20:37:21 +00:00
Shawn Ligocki 14a49c0f15 Fix interpretation of ?ModPagespeedFilters= to disable all filters rather than 2011-01-24 21:30:48 +00:00
Shawn Ligocki a93207ba69 Missed some files from prev checkin 2011-01-24 21:29:49 +00:00
Shawn Ligocki 21096f1284 Arena-allocate DOM Nodes. This is worth about a 15% speedup on parsing text, or ~1.959s -> 1.649s. -morlovich 2011-01-24 21:26:19 +00:00
Shawn Ligocki 4aec286d2c Add STATIC_STRLEN macro and replace uses of sizeof() - 1 2011-01-20 21:18:43 +00:00
Shawn Ligocki 222bb1fb94 Condition variable implementations for apr and google3. Goal is to use the apr version to control fetcher synchronization. -jmaessen 2011-01-20 21:07:40 +00:00
Josh Marantz 9ed32ecb7d Issue 189: don't freshen short-TTL resources, or with ForceCaching on. 2011-01-19 21:04:43 +00:00
Josh Marantz 7948fd577c Improve parsing speed by using dense_hash_map for the symbol table.
Issue 176: Relax 250 character restriction on URL segment size by
overriding Apache httpd map_to_storage hook.  This can be overridden
in the config.

Issue 161: Allow config file prevention of combining files across paths.
2011-01-19 20:02:41 +00:00
Josh Marantz 734b4eb1e3 Refactor fetcher classes to live under net/instaweb/http rather than
net/instaweb/util.
2011-01-18 22:14:47 +00:00
Josh Marantz 1f9ea04aa3 Add proactive refreshing of soon-to-expire resources.
Increase robustness of translate_name hook by calling it directly from
instaweb_handler if was somehow bypassed by an earlier translate_name hook.
2011-01-15 00:08:58 +00:00
Shawn Ligocki 019a6972c4 Stop rewriting 404s. Only rewrite HTTP 200 HTML and added a system test (that failed before I made this change).
See Issue 170
2011-01-12 22:24:12 +00:00
Shawn Ligocki a2d1cfbb71 Implement Bryan's suggestion of avoiding work in Unescape when none needed. Makes the simple parsing benchmark go from taking about 2.35sec to about 1.99sec, so around 15% faster. -morlovich 2011-01-12 22:22:47 +00:00
Shawn Ligocki 2235f66c97 Split the CSS-specific and generic combination filter logic into separate classes, so the eventual JS combiner can share a lot of the subtler code.
Don't use an overly exprensive data structure here, it slows down parsing considerably; enough for this to be a ~15-18% speedup on parsing only, and overall ~4% speedup on hot path.
2011-01-12 22:19:05 +00:00
Shawn Ligocki c625688889 Report an error, but do not crash, when there is an invalid URL. 2011-01-12 22:16:44 +00:00
Shawn Ligocki fd1c656b06 Optimize collapse whitespace by modifying the string in place with
a flat state machine.
2011-01-12 22:14:20 +00:00
Shawn Ligocki c8fd3fc5e2 First round of abstract condition variables. Rather than building everything at
once, I thought it best to build just enough so that folks could comment on the
design and testing before I proceeded.  Hopefully this CL is fairly managable;
it can go in on its own (though nothing presently depends on any of the code).
2011-01-12 22:11:57 +00:00
Shawn Ligocki 5705d35553 Move serf fetcher over to a more generic url_pollable interface 2011-01-12 22:07:45 +00:00
Shawn Ligocki ad8c38b316 Provide a formal way of marking when we looked at a resource and decided to
not touch it; previously the image rewriter used to just store a 304, and then
	notice the problem when fetching the image. Now we just mark it inside an
rname/
	entry, without writing out a bogus content entry pointlessly.

	Make the CSS filter take advantage of this, and test that. Also, make the tests
	somewhat less bool-heavy.
2011-01-12 22:03:22 +00:00
Josh Marantz 175d90e9f5 Change all references from [Simple]MetaData to ResponseHeaders &
RequestHeaders.
         
Note that the parsing functionality is now split into a separate class, 
ResponseHeaderParser, that needs to be instantiated explicitly from 
any class that needs to parse HTTP streams. 

This does not switch to using protobufs for serialization yet - 
that's a cache-busting move that requires us to do something specific 
to ensure that we don't try to read the old-format files. 

Move more functionality from meta_data.cc to response_headers.cc and
request_headers.cc.

Get rid of the now-obsolete simple_meta_data[_test].(cc|h)
2011-01-07 04:02:12 +00:00
Josh Marantz b16b9dc41d Fix slurping. 2011-01-06 23:40:36 +00:00
Josh Marantz 4618753f81 Use a different, hopefully more robust approach to preventing
mod_headers from corrupting our caching headers.  Rather than
depending on a late-running output-filter for fixing up our headers,
instead try to remove mod_headers and mod_expires from the filter
chain via a late-running add-filter hook.
2011-01-06 23:10:14 +00:00
Josh Marantz 9712342290 Split out separate RequestHeaders class, sharing some code with
ResponseHeaders via an explicitly instantiated base class templated
on the protobuf.
2011-01-06 20:53:38 +00:00
Josh Marantz acf18c239c Add new http/ subdirectory and RequestHeader class. 2011-01-06 19:35:40 +00:00
abliss@google.com 68b44ada9d add testdata files so that the tests pass in SVN. 2011-01-05 23:38:33 +00:00
Shawn Ligocki 26c2751848 Fix Issue 136
Disambiguate error messages.

Rename StringMap -> StringMultiMap.
2011-01-05 19:40:20 +00:00
Jan-Willem Maessen 1d92165c46 Factor out string_map from simple_meta_data and query_params and place in a
standalone multimap class.
2011-01-04 18:40:17 +00:00
Josh Marantz f16c694426 Changed the mod_rewrite bypass to be more robust.
I no longer depend on string literals in mod_rewrite.c but have
taken matters into my own hands by squirreling away the original
URL in request->notes, which provides me a string-map.

So now I let mod_rewrite do whatever it wants, and instead examine
the original URL only once, before mod_rewrite.  Note that the user
can, with a bogus rewrite rule, completely screw up mod_pagespeed
now, because the the authorization module will work with the output
of mod_rewrite.  In fact this was happening in my test because I
was rewriting to a URL that did not start with a /.
2011-01-03 22:16:52 +00:00
Josh Marantz f47e708733 Use the "mod_rewrite_rewritten" hack to prevent mod_rewrite from mutating
mod_pagespeed's resources.
2011-01-03 17:53:55 +00:00
Shawn Ligocki e71c437b3e Add missing directory 2010-12-30 19:08:24 +00:00
Jan-Willem Maessen 36ec780bb3 Fix missed svn add in prior checkin. 2010-12-30 15:55:11 +00:00
Jan-Willem Maessen 511ee4b070 Fix for space leak (lost requests during serf cleanup), lots of changes to
eliminate redundant cache Puts.
2010-12-29 18:46:51 +00:00
Shawn Ligocki 50896da1b7 Fix Issue 154. IE requires <button> to have a type attribute. 2010-12-27 22:11:58 +00:00
Jan-Willem Maessen 0bf8abba0c Avoid 403s when serving mod_pagespeed resources due to bogus request->filename. 2010-12-24 00:03:33 +00:00
Josh Marantz e085b42a12 Register a 'filename translator' to be run upstream of mod_rewrite
to fix a variety of incompatibilities with that module.
2010-12-23 16:28:06 +00:00
Josh Marantz d905c2ce8c Remove spurious warning from the error log 2010-12-22 21:02:56 +00:00
Shawn Ligocki c03a176e07 Make CssCombiner leave slack in URL length for other filters. 2010-12-22 03:56:46 +00:00
Shawn Ligocki 93fecf375d Add testing for those http cache stats. -jmarantz 2010-12-22 03:03:12 +00:00
Josh Marantz 6454eb33f6 Debug and test the 'ModPagespeedStatistics off' using the system-test.
Adds in a new testcase to explicitly validate a claim made on the discussion
list -- that we can rewrite CSS files across domains that have been mapped
together via ModPagespeedMapRewriteDomain.  Note that no functional changes were
needed, but I did a minor refactor in the test to pull together all the
'yellow' and 'blue' css text into char[] constants.

Fix a corner-case combining CSS files from different paths where a file
that changes the resolved base needs to be backed out cause it makes the
URL too big.  This was resulting in an extra level of hierarchy in the
encoded names, and could create functional issues on multi-server setups
where rewritten URL decoding is needed for functionality.

Make ScriptTagScanner understand various attributes that determine
whether something is JavaScript or not, whether it should run, and to
decode the various non-blocking execution modes.

Port existing filters to use ScriptTagScanner rather than ad-hoc JS
detection code that was different in all of and add testcases for
instances where the previous checks failed.
2010-12-20 21:53:21 +00:00
Josh Marantz f34ebc00d6 Fix problem occuring when a CSS combination encounters a URL that
would make the URL too large, and would also change its 'resolved
base'.  The change to the resolved base was not properly backed out,
leaving the extra level of hierarchy in the path.
2010-12-20 14:58:12 +00:00
Josh Marantz 0656f5c724 Cleaned up caching headers so that IE8 can cache images (Issue 157)
Forcibly remove caching and last-modified headers on rewritten HTML files,
as we have cache-extended all the resources on the HTML files, so it's
dangerous to cache the HTML files.  They should be rewritten each time
to give a chance for changed origin resources to be rewritten in.

Fixed race-condition in async serf fetching that caused rare crashes
and server-load issues with URLs that time out.  This primarily happened
with the browser-proxy pointing to the Apache server and the mod_pagespeed
slurp mode turned on, but the URL being requested was actually on the
Apache server.

Add several new statistics for measuring cache activity, rewriting overhead,
and option-parsing overhead (for .htaccess).

Add locking of resources during rewriting, so that multiple processes don't
try to optimize the same css, js, or images at the same time.

Add more system-testing for caching headers.
2010-12-17 23:59:47 +00:00
abliss@google.com b62c79cc88 Fixes cleanup of apr_statistics and memory leaks in serf. 2010-12-13 19:53:03 +00:00
Shawn Ligocki 1bc670317b Allow ?ModPagespeed=on when "ModPagespeed off" in .conf by checking enabled after parsing params. Issue 145 2010-12-10 21:33:50 +00:00
Shawn Ligocki 3c4a3fc9f1 Add more filter levels: TestingCoreFilters and AllFilters 2010-12-10 21:26:55 +00:00
Shawn Ligocki a4fbc3aa22 Respect ModPagespeedDisallow in the document-serving path. Issue 144 2010-12-10 19:50:45 +00:00
Shawn Ligocki 936d59f695 jmarantz:
Add memory-leak checking for the open-source unit tests.

Fix leaks both in the serf library (as a patch)
and in our serf fetcher.

Change the fix_third_party_memory_leaks script to /bin/sh.

Refactor the check_for_leaks script to generate more concise and
timely output.

Stop destroying the AprStatistics pool -- it destroys the global mutexes
when they must still remain alive.
2010-12-10 19:49:28 +00:00
Josh Marantz 4b7cd0c3a0 Fix small memory leaks, and add infrastructure to help automatically
test for memory leaks in live Apache.

Add directive to disable statistics:
    ModPagepseedStatistics off

Fix inline Javascript for XHTML by adding CDATA tags.

Reduce severity of 'missing body tag' in add_head from Error to Info.
2010-12-08 20:42:47 +00:00
Shawn Ligocki 2c2f004af9 Fix font: menu issue 2010-12-06 23:13:25 +00:00
Maks Orlovich 359334daa7 Fix http://code.google.com/p/modpagespeed/issues/detail?id=134
by changing the missing body message to be an information notice
and not an error, as requested.

The bulk of the change is the testing infrastructure to verify this
(and similar changes)
2010-12-06 22:40:39 +00:00
Jan-Willem Maessen b6b4238830 Add macro definition for ModPagespeedImgMaxRewritesAtOnce, fixing
http://code.google.com/p/modpagespeed/issues/detail?id=131
2010-12-05 21:25:03 +00:00
bmcquade@google.com 1477f8b353 Last change needed to get core libs building on windows. 2010-12-04 11:04:06 +00:00
Shawn Ligocki f371c153ec Allow list-style-type: none 2010-12-03 21:16:30 +00:00
bmcquade@google.com 0d66dae341 Fix StringToInt to compile on Windows. 2010-12-03 20:43:17 +00:00
Josh Marantz a81fb00c90 Escape ".pagespeed." as ",M" so that when a series of modpagespeed filters operates
on a single resource the name explodes a little more slowly.
2010-12-03 20:34:39 +00:00
Josh Marantz 459924400c Adds system test for legacy URLs.
Fixes combining options.

Fixes bug parsing content type with char-set.

Updates example .htaccess file with some of the entries you can put in .htaccess.
2010-12-03 18:49:01 +00:00
bmcquade@google.com bb6b2e5edd Sync open src repo. 2010-12-03 17:20:40 +00:00
Jan-Willem Maessen 57b0bfcefb Fetcher changes to avoid Host: trouble 2010-12-02 23:47:14 +00:00
Shawn Ligocki 99f57a9251 Fix font: shorthand issues (and a few other CLs) 2010-12-02 23:42:43 +00:00
Jan-Willem Maessen 4e73df64be More fetching fixes, modified DEPS 2010-12-02 23:38:26 +00:00
Jan-Willem Maessen 8ceee5ad00 Parsing fixes for xhtml; async timeout fixes; better permissions checking; other miscellaneous bug fixes. 2010-12-02 18:57:16 +00:00
Josh Marantz 104a5af83a Adds wildcard support directives:
ModPagespeedAllow wildcard_expr
     ModPagespeedDisallow wildcard_expr

These are usable from the conf file or htaccess.

Fix CentOS 5.4 compile problem.

Fixes compatibility between elide_attributes and xhtml.
2010-12-01 00:29:55 +00:00
Josh Marantz 88b53db488 Support usage of ModPagespeedDomain in .htaccess files. 2010-11-30 21:46:30 +00:00
Josh Marantz 348a43ff9a Add support for wildcard groups, which is not used yet.
Fix handling of htaaccess, and test it (manually).
2010-11-30 17:29:43 +00:00
Josh Marantz 4dbbd1cccb Add support for doctype parsing and xhtml. Do not remove quotes in XHTML.
Add support for legacy URLs so we can continue to serve any old ones
that were captured somehow (e.g. a search engine or browser bookmark).

When rewriting resources, encode ? and & embedded in origin URLs to
avoid having the new URL misinterpreted as having query params.

Add robustness and breadth to content-type parsing to improve the
reach of cache extension.

When fetching URLs, time them out and cancel them if they hang.

Remove obsolete dependence on protobufs and remove an implemented
but unused string buffer class.
2010-11-30 16:29:50 +00:00
Josh Marantz d76f524735 Add experimental new support for .htaccess files.
Change format of generated URLs to lead with the original URL
with minimal encoding, and then follow with ".pagespeed." then
other information required for decoding and cache extension.
2010-11-25 00:10:19 +00:00
Josh Marantz 5301272b30 Add/test domain mapping support, both for the origin and for
rewritten resources.
2010-11-22 22:21:07 +00:00
Josh Marantz 8da87bb4b4 Protect stack-allocated Writer and ResponseHeaders from being accessed after
an AsyncFetch has been released.
2010-11-22 22:02:45 +00:00
abliss@google.com 6174173a92 Include mod_pagespeed in the useragent of the fetches we spawn. This
make us better internet citizens, and allows us to fix a case of Issue 85
	where we were rewriting our own documents.
	Also begins to plumb through the referer, but that is not working yet.
2010-11-20 00:36:56 +00:00
Josh Marantz b5cb663dae Reduce the number of cache lookups by skipping rewritten resources in the cache
extencer.

Update the RPM spec to avoid overwriting modified config files on auto-update
2010-11-19 22:50:51 +00:00
Josh Marantz 0114413ba8 Ensure resolved_base of output_resources always ends in a /. Seems
to fix (at least some instances of) Issue 95: 
http://code.google.com/p/modpagespeed/issues/detail?id=95.

Fix Issue 60: http://code.google.com/p/modpagespeed/issues/detail?id=60 --
combine_css breaks background image url due to mis-handling of quotes.
2010-11-19 16:03:55 +00:00
Josh Marantz 4e09f9886a http://code.google.com/p/modpagespeed/issues/detail?id=99
Fix generate time format per RFC 822
http://code.google.com/p/modpagespeed/issues/detail?id=34 
        Replace auto-generated expires header with our own 
http://code.google.com/p/modpagespeed/issues/detail?id=35 
        Remove 'public' from cache-control header 
        See http://code.google.com/p/page-speed/issues/detail?id=9
2010-11-18 22:51:33 +00:00
Josh Marantz abb59cc7b1 Bound the number of concurrent image optimizations done in a single Apache server.
Fix corner-case in lexer with invalid HTML.

Downgrade 'lock' warnings to INFO messaeges.

Respect 'loglevel' in all remaining messages.
2010-11-18 16:34:07 +00:00
Josh Marantz 54bd888790 Various fixes to keep the server load under control.
When a URL fetch fails; wait 5 minutes before trying again.
Add lock expiration based on timestamp to avoid failing resource loads due to stale locks
Avoid optimizing more than 8 images (by default) at the same time.
2010-11-16 18:33:40 +00:00
Josh Marantz e1e77f4863 When a URL fetch fails, or is returned with 'nocache' or cache-control:private,
don't request it again for 5 minutes.

Add version number information into the log.
2010-11-15 22:14:46 +00:00
Jan-Willem Maessen 9fba1b019d Get rid of url_prefix, but leave the option (with a depracation notice) in
mod_pagespeed.
2010-11-13 00:40:03 +00:00
Josh Marantz 4d59608a78 Fix spurious warnings and errors in the Apache log.
Scan first bytes in output filter to see if incoming bytes actually
look like HTML, and passing the bytes directly to the next filter if
they don't.  This should reduce the wasted CPU trying to rewrite HTML
when the source is actually gzipped or a mis-typed image.

Avoid rewriting resources with empty name e.g. <script src="">.

Add stress test script.

Avoid warning on <?xml ...>

Add script install_apxs.sh to assist users installing against custom-built Apache
2010-11-12 23:52:31 +00:00
Jan-Willem Maessen e5f5111460 Include full path in name+filter cache key (used to find hash of
already-rewritten resource).  Now with tests (the only difference to last time
is resource_manager_test).  I also wasted quite a bit of time with a bum Apache
config before verifying that it does appear to resolve
http://code.google.com/p/modpagespeed/issues/detail?id=3 .
2010-11-12 00:03:31 +00:00
Josh Marantz 2267ea6a70 Add path limitations for combine_css. Add mechanism to help test
fetches on alternate servers before their cache is populated.
2010-11-11 18:30:13 +00:00
Shawn Ligocki 318f8f047a Add test for http://code.google.com/p/modpagespeed/issues/detail?id=66 2010-11-10 20:07:13 +00:00
Shawn Ligocki c380a1e15b No info for tags that are allowed to be implicitly closed. 2010-11-10 20:06:43 +00:00
Jan-Willem Maessen b8566cba3f Don't resize png images that have an alpha channel or transparent color, as
OpenCV ignores alpha.  See
http://code.google.com/p/modpagespeed/issues/detail?id=21 .
2010-11-10 18:44:06 +00:00
Josh Marantz 7913729ca9 Solve race condition around the RewriteDriver freelist to (hopefully) better
support Threaded and Event MPMs.
2010-11-09 23:34:13 +00:00
Shawn Ligocki 5b718c0898 Detect a couple reported parse failures 2010-11-09 23:13:10 +00:00
Josh Marantz cc91d35f7c Improve error message from serf fetcher to try and resolve failure
seen at mulitple sites.

Refactor rewriter unit tests to separate them into multiple files.
2010-11-09 19:57:43 +00:00
Josh Marantz 17f7e2548a Reduce the severity of HTML syntax errors from Warning to Info.
Refactor URL parternships in preparation for solving Issue 9: generated name
too long.
2010-11-09 14:37:47 +00:00
Jan-Willem Maessen 675bcff951 Reduce logging to info-only when we decide a resource is ineligible for
inlining.  Instead bump a stats counter.  See
http://code.google.com/p/modpagespeed/issues/detail?id=33
2010-11-08 04:02:20 +00:00
Josh Marantz dc6c190a6f Add tests to demonstrate that domains with the same host but
different ports are considered distinct for the purposes of
rewriting authorization.

See http://code.google.com/p/modpagespeed/issues/detail?id=32
2010-11-07 02:49:42 +00:00
Shawn Ligocki 4b126d0bd2 Add fall-through return, shouldn't ever happen, but apperently gcc 4.3 didn't like the old way 2010-11-06 00:16:44 +00:00
Josh Marantz 84db51dd9a Fixes for a variety of issues reported in mod-pagespeed-discuss and
on the Issues page:

Issue #30: Very slow memory leak
Issue #18: Apache log level is ignored
Issue #11: After installing module server becomes unusable
Issue #10: A whole lot of HTTPD processes
Issue #5: Incorrectly handling not-quoted font-family names with spaces

Issue #5 was resolved by removing "rewrite_css" from teh Core filters
set until we fix the problem properly.  If you are not using font family
names with spaces you may be able to re-enable the filter manual.
2010-11-05 22:38:18 +00:00
bmcquade@google.com 4755aa4ba3 Sync open src repo. 2010-11-02 21:08:44 +00:00
Jan-Willem Maessen e261540b93 Audit resource creation and fix use of security policies, cleaning up resource management code as we go. This completes the transition to the new resource management policy, where rewritten resources should remain at the same path and should only be rewritten if they are in the same domain as served html or if they're in the list of rewritable domains. 2010-11-02 20:14:48 +00:00
bmcquade@google.com cc878e0dcb Sync open src repo. 2010-11-02 11:35:58 +00:00
bmcquade@google.com 586d519546 Sync open src repo. 2010-11-01 19:50:20 +00:00
bmcquade@google.com d0d81458fe Sync open src repo. 2010-11-01 19:42:24 +00:00
Josh Marantz b411d2f622 Fix SEGVs when attempting to rewrite resources from unauthorized domains. Add JS example. 2010-10-29 20:53:49 +00:00
Josh Marantz 42ea96ece2 comment out test that's currently failing pending investigation. 2010-10-29 17:30:01 +00:00
bmcquade@google.com e721107509 Sync open src repo. 2010-10-29 16:47:49 +00:00
Josh Marantz f1b2cc43cf Fixed bugs in css combine filter. 2010-10-29 01:08:04 +00:00
bmcquade@google.com 4888412fd0 Sync open src repo. 2010-10-29 00:11:33 +00:00
bmcquade@google.com b7363b8dcd Sync open src repo. 2010-10-28 23:54:03 +00:00
bmcquade@google.com ac4b0a0a95 Sync open src repo. 2010-10-28 23:20:20 +00:00
bmcquade@google.com efb7db29a9 Sync open src repo. 2010-10-28 02:27:22 +00:00
bmcquade@google.com 9265e9faeb Sync open src repo. 2010-10-28 02:26:10 +00:00
bmcquade@google.com 488c217bc4 Sync open src repo. 2010-10-27 21:34:05 +00:00
bmcquade@google.com afc445693d Sync open src repo. 2010-10-27 19:43:21 +00:00
bmcquade@google.com 4f38701ef8 Sync open src repo 2010-10-27 18:07:37 +00:00
bmcquade@google.com 78cf9e7486 Sync open src repo. 2010-10-27 15:19:29 +00:00
bmcquade@google.com 96546d9613 Sync open src repo. 2010-10-27 14:55:11 +00:00
Josh Marantz dab37f35c8 More resource naming updates, and a unit-test for cache_extender. 2010-10-26 21:22:20 +00:00
Josh Marantz 3f53dd7f8e Added URL partnership class. 2010-10-26 14:23:55 +00:00
bmcquade@google.com c261401dd6 Sync open src repo. 2010-10-26 00:43:43 +00:00
Jan-Willem Maessen dd3c499a13 Common subclass for filename encoding, extended by url_escaper and by the img
filter filename encoding scheme.  Also pulled image_dim into a separate class,
cleaning up testing a bit in the process.  Finally, fixed a rare crash bug in
img_rewrite_filter due to mis-ordered a callback.
2010-10-25 22:19:57 +00:00
Shawn Ligocki 1f042b564b Don't rewrite CSS on error 2010-10-25 20:18:12 +00:00
bmcquade@google.com 878bf63a41 Sync open src repo. 2010-10-25 19:40:40 +00:00
Shawn Ligocki 9115f5f62e Update css_parser 2010-10-25 19:31:22 +00:00
Shawn Ligocki 5bcab05743 sync 2010-10-25 19:09:09 +00:00
Josh Marantz 7a2e9381ab Fix issues with suppressing inlined images for IE6 and IE7. 2010-10-22 23:53:28 +00:00
bmcquade@google.com a039d8f2c6 Update open src repo. Add our own copy of libpng 1.2.44. 2010-10-22 17:58:54 +00:00
Josh Marantz 83cadcceca Add support for changing rewriter passes via query params. 2010-10-22 17:39:30 +00:00
Josh Marantz f6ea584a8e Add query-params and user-agent infrastructure 2010-10-22 05:09:28 +00:00
lsong@google.com 9b4c20b746 export. 2010-10-21 22:13:26 +00:00
lsong@google.com f9c3ac07fd Add version related files. 2010-10-21 20:46:37 +00:00
bmcquade@google.com 1ce8f4b469 Sync open src repo. 2010-10-20 16:29:57 +00:00
bmcquade@google.com b515305bbd Sync open source repo. 2010-10-20 14:24:32 +00:00
bmcquade@google.com 636428645e Sync open src repo. 2010-10-20 12:37:59 +00:00
bmcquade@google.com 0392b7e816 Sync open src repo. 2010-10-19 21:01:27 +00:00
Josh Marantz 30a285e84d Update for enum-based rewriter options, 32-bit compiles. 2010-10-19 18:23:51 +00:00
Josh Marantz 3234a4d470 Fix IE directives handling in css_combine 2010-10-19 12:53:46 +00:00
Shawn Ligocki 9e8c5a6a54 Sync 2010-10-18 21:50:43 +00:00
Josh Marantz bcb520155f Rename mod_instaweb to mod_pagespeed 2010-10-15 21:26:11 +00:00
Josh Marantz c58542b3ec Allow rewriters to span multiple lines in apache config file 2010-10-15 15:06:50 +00:00
bmcquade@google.com aa82f9d35e Update for common.gypi. 2010-10-15 12:34:26 +00:00
Josh Marantz 51e394dd97 Latest updates, including resource management and built-in slurping 2010-10-15 03:37:45 +00:00
bmcquade@google.com 451e9c2214 Make sure we build static libs (.a) instead of shared, so the resulting .so links all it needs. 2010-10-14 19:50:13 +00:00
Josh Marantz 16fe3c3ff5 Refactor Apache modules to use a consistent namespace. Clean up
option processing.

Add streamlined URL encoding.
2010-10-07 19:35:01 +00:00
Josh Marantz 03e96d9728 Refactor Apache module to consolidate a few classes with 1:1
relationships into single classes.

Add system tests.

Clean up options (phase 1).
2010-10-06 19:23:39 +00:00
Shawn Ligocki 9c87a3951c Clean up DEPS and lock the rev # for mod-spdy 2010-10-06 18:22:22 +00:00
Shawn Ligocki 8dafa7f1aa update statistics 2010-10-06 18:16:03 +00:00
Shawn Ligocki 8fd1f1b2f9 copyrights. 2010-10-05 15:31:10 +00:00
Shawn Ligocki 86038e9713 Add HttpDumpUrlAsyncWriter and many tests 2010-10-05 00:01:50 +00:00
Shawn Ligocki 83f20da730 Add LICENSE 2010-10-04 21:43:22 +00:00
Shawn Ligocki 96ee73872a Sync from internal. 2010-10-04 17:07:31 +00:00
Josh Marantz 68cb63878b Add and use custom version of instaweb_response_buckets.c 2010-09-29 14:45:56 +00:00
Josh Marantz c71eef258d Add resource manager testing files, unmodified copy of serf's response_buckets.c 2010-09-29 14:34:02 +00:00
Josh Marantz e5071aae87 Rolled up updates. 2010-09-28 16:26:03 +00:00
Shawn Ligocki fe6a0f27a3 Add -funsigned-char 2010-09-23 19:42:31 +00:00
Shawn Ligocki b4b10df22c Turn on RTTI (needed for g++ 4.2 lib) 2010-09-22 17:22:40 +00:00
Shawn Ligocki 8ee2b40a43 Add CSS parser. 2010-09-17 19:46:06 +00:00
Josh Marantz 84f2af6226 Fix gcc 4.1 compilation issues due to warnings promoted to errors. Where
we can fix, the warnings.  Where they are in OpenCV header files, remove
the strictness in our compile options.
2010-09-15 01:41:28 +00:00
Josh Marantz 47d89535a5 Go away -- we do everything we need in the config. 2010-09-14 21:52:10 +00:00
Josh Marantz cd113c6d7e Add CentOS install/compile support 2010-09-14 21:51:26 +00:00
Shawn Ligocki 7eac33b069 Add revisions to new includes 2010-09-14 20:27:07 +00:00
Shawn Ligocki 3301c7a1b5 Oops missed a dep 2010-09-14 19:06:32 +00:00
Shawn Ligocki f5d915f224 rm unneeded includes 2010-09-14 17:48:38 +00:00
Shawn Ligocki 2e92013ace rm system-independent includes 2010-09-14 17:42:45 +00:00
Shawn Ligocki 90afba408f Add deps for gflags and google-sparsehash needed for css-parsing. 2010-09-14 15:39:23 +00:00
Josh Marantz 000c01f40b remove more obsolete files. 2010-09-14 13:45:55 +00:00
Josh Marantz bf70f6731c Remove obsolete files - these were moved to net/instaweb/util. 2010-09-14 13:44:13 +00:00
Josh Marantz 534d890dcb Rolled up updates.
Add numerous new tests.  Fix deadlock in threaded fetches.
2010-09-13 16:42:39 +00:00
Josh Marantz a38c1717ba Add installation scripts/Makefiles for Apache. Update for disallowing copy/assign. 2010-09-12 01:59:27 +00:00
Josh Marantz 1d4540abda Updates from the last few days of changes. 2010-09-10 14:44:35 +00:00
Josh Marantz d6ad164dd8 Add apache configuration template, and allow usage of domain-sharding.
Add rewrite_driver field to all RewriteFilters.
2010-09-01 21:36:13 +00:00
Josh Marantz fd4c95f6a3 Change the base-tag filter so it inserts the base-tag at the beginning
of the <head></head> block, rather than the end. Putting it at the end 
was causing trouble for relative hrefs specified in the head.
2010-08-31 20:42:34 +00:00
Josh Marantz 48ef15f4c6 Add domain sharding. 2010-08-31 20:26:28 +00:00
bmcquade@google.com baeca7cbed Fix windows build. 2010-08-31 17:29:54 +00:00
Jan-Willem Maessen bb2933603d Fix crashes when paths aren't set up correctly. Fail gracefully instead. Also
common up this error checking a bit, getting rid of code in multiple filters.
2010-08-30 19:00:11 +00:00
Josh Marantz 8f2650dccd Reduce spew from the image rewriting and cache. We'll make the cache
spew be one #define setting away, so it'll be easy to take a look if
we need to check it again.
2010-08-27 13:24:22 +00:00
Shawn Ligocki 189d525a72 Sync from internal 2010-08-26 20:20:00 +00:00
Josh Marantz a0f69b8ca1 Update/check cache explicitly from resource manager, rather than relying
on cache_url_async_fetcher to do it for us.  This eliminates some extra
string copying.  Update rewriter to accomodate change to nested cache
ownership model.

Add write-through cache implemenation, and change the ownership model
so when we compose caches, the outer cache owns the inner one.
2010-08-20 13:58:11 +00:00
Josh Marantz 9d70ddf79a Tweak performance based on observing Apache server in action.
Add Name() method to all HtmlFilters for better logging. 
Change timer granularity to microseconds, by default.
2010-08-19 02:22:40 +00:00
Josh Marantz fb804e7f85 Update tests to include rewriter and HTML parse tests.
Add helper thread for serf_url_async_fetcher so we can fill caches in the background.
Add mod_slurp to serve web-sites that were copied into files.
2010-08-17 20:29:09 +00:00
lsong@google.com 51c9a1f0a7 Move mod_pagespeed to mod_instaweb.
r=bmcquade
2010-08-10 15:20:52 +00:00
mdsteele@google.com 3dd8003e36 Bump Instaweb to Chromium r55218 (build now works)
r=bmcquade
2010-08-06 19:33:38 +00:00
mdsteele@google.com 4a604c81f2 Tweak string_util in prep for bumping Chromium version
r=lsong
2010-08-06 19:08:10 +00:00
lsong@google.com acf700d14b Sync instaweb. 2010-08-04 23:32:41 +00:00
lsong@google.com 79a7eade35 Sync instaweb. 2010-08-04 19:48:55 +00:00
lsong@google.com 3f6664529c Sync instaweb. 2010-08-03 14:17:40 +00:00
bmcquade@google.com 3967856633 Sync instaweb. 2010-07-30 18:33:30 +00:00
lsong@google.com f616911146 Sync instaweb. 2010-07-29 15:45:59 +00:00
lsong@google.com 051c752c7a Sync instaweb. 2010-07-29 13:33:18 +00:00
lsong@google.com 7f6b059120 Sync instaweb. Add url-to-filename in the dependency.
r=bmcquade
2010-07-28 21:33:22 +00:00
bmcquade@google.com 225f868a54 Remove some unnecessary deps from instawebcore. 2010-07-28 19:05:20 +00:00
bmcquade@google.com 856074c76f Refactor instaweb gyp files. 2010-07-27 14:31:57 +00:00
lsong@google.com bd1155a12a Fix build dependency on Zlib, and new files.
r=bmcquade
2010-07-26 17:44:58 +00:00
lsong@google.com 73a36857ec Sync instaweb. 2010-07-26 15:36:41 +00:00
mdsteele@google.com 95540c5672 Include google_message_handler.cc in instaweb_core
r=bmcquade
2010-07-23 13:07:56 +00:00
lsong@google.com aafcd4f305 Sync instaweb. 2010-07-21 19:06:40 +00:00
bmcquade@google.com 69d8cb921f Sync instaweb repo. 2010-07-20 01:44:17 +00:00
bmcquade@google.com f0f292d62e forgot to add base64_util.h 2010-07-16 15:01:17 +00:00
bmcquade@google.com 216848a80d Sync instaweb repo. 2010-07-16 14:50:05 +00:00
bmcquade@google.com cf54ab0e22 Move data_url from core to instaweb, since it depends on base64. 2010-07-15 20:44:43 +00:00
lsong@google.com 5799d96e96 Export dependency on zlib.
r=bmcquade
2010-07-15 18:33:47 +00:00
bmcquade@google.com 5e8f12eb0a Re-sync instaweb repo. Enable chromium_code checks in gyp files. 2010-07-15 15:52:23 +00:00
bmcquade@google.com b2c155542b Sync instaweb repository to newest version. 2010-07-15 14:39:25 +00:00
bmcquade@google.com 682d07a7ee Split up instaweb.gyp so both mod_pagespeed and pagespeed lib can use it. 2010-07-14 01:19:07 +00:00
bmcquade@google.com c211ff0f60 Add missing opencv deps. 2010-07-12 18:21:43 +00:00
bmcquade@google.com 0b42c80ff4 Add missing dep. 2010-07-12 16:04:01 +00:00
bmcquade@google.com 226758dbb4 Add missing dep on zlib. 2010-07-12 15:59:07 +00:00
bmcquade@google.com ee627187d9 Make sure both the project root and DEPTH are in the include path. 2010-07-12 15:54:57 +00:00
bmcquade@google.com 6cf1a53188 Use instaweb_root instead of depth. 2010-07-12 15:51:08 +00:00
bmcquade@google.com 3535c5274b Clean up instaweb.gyp 2010-07-12 15:36:36 +00:00
bmcquade@google.com 90d6ebf236 Make base64 dependency local to instaweb. 2010-07-12 14:34:34 +00:00
bmcquade@google.com bfe4b94cd6 Get instaweb project building. 2010-07-12 14:17:57 +00:00
bmcquade@google.com dc90aa55f0 Clean up base64.gyp 2010-07-09 17:29:43 +00:00
bmcquade@google.com acf7b9d801 Put base64 in instaweb third_party. 2010-07-09 17:26:55 +00:00
mdsteele@google.com ca969c4553 Sync to latest version: fix html_attribute_quote_removal and cleanup elsewhere 2010-07-01 19:28:41 +00:00
mdsteele@google.com e45e7f683f Add missing header files 2010-06-30 20:06:28 +00:00
mdsteele@google.com 5f0000bf38 Initial checkin. 2010-06-30 19:42:50 +00:00
2932 changed files with 737756 additions and 13377 deletions
+12 -4
View File
@@ -1,4 +1,12 @@
test/tmp
psol/
psol-*.tar.gz
*.*.*.*.tar.gz
Makefile
!third_party/libjpeg_turbo/yasm/source/config/linux/Makefile
*.mk
!install/**/*.mk
*.Makefile
client.timestamp
hooks.timestamp
build/gyp_helper.pyc
build/landmine_utils.pyc
out/
tools/closure/
!devel/Makefile
+113
View File
@@ -0,0 +1,113 @@
# The two httpds are the longest syncs, so we'd like to start them first.
[submodule "third_party/httpd/src"]
path = third_party/httpd/src
url = git://git.apache.org/httpd.git
[submodule "third_party/httpd24/src"]
path = third_party/httpd24/src
url = git://git.apache.org/httpd.git
[submodule "third_party/brotli/src"]
path = third_party/brotli/src
url = https://github.com/google/brotli.git
[submodule "third_party/giflib"]
path = third_party/giflib
url = https://github.com/pagespeed/giflib.git
[submodule "third_party/closure_library"]
path = third_party/closure_library
url = https://github.com/google/closure-library.git
[submodule "third_party/aprutil/src"]
path = third_party/aprutil/src
url = git://git.apache.org/apr-util.git
[submodule "third_party/re2/src"]
path = third_party/re2/src
url = https://github.com/google/re2.git
[submodule "third_party/icu"]
path = third_party/icu
url = https://github.com/pagespeed/icu.git
[submodule "third_party/libjpeg_turbo/src"]
path = third_party/libjpeg_turbo/src
url = https://chromium.googlesource.com/chromium/deps/libjpeg_turbo
# For gyp generated makefiles.
ignore = untracked
[submodule "third_party/libjpeg_turbo/yasm/source/patched-yasm"]
path = third_party/libjpeg_turbo/yasm/source/patched-yasm
url = https://chromium.googlesource.com/chromium/deps/yasm/patched-yasm
[submodule "third_party/libpng/src"]
path = third_party/libpng/src
url = https://github.com/glennrp/libpng.git
[submodule "third_party/hiredis/src"]
path = third_party/hiredis/src
url = https://github.com/redis/hiredis.git
[submodule "third_party/apr/src"]
path = third_party/apr/src
url = git://git.apache.org/apr.git
[submodule "third_party/optipng"]
path = third_party/optipng
url = https://github.com/pagespeed/optipng.git
[submodule "third_party/libwebp"]
path = third_party/libwebp
url = https://chromium.googlesource.com/webm/libwebp.git
[submodule "third_party/serf/src"]
path = third_party/serf/src
url = https://git.apache.org/serf.git
[submodule "third_party/grpc/src"]
path = third_party/grpc/src
url = https://github.com/grpc/grpc.git
[submodule "third_party/protobuf/src"]
path = third_party/protobuf/src
url = https://github.com/google/protobuf.git
[submodule "third_party/modp_b64"]
path = third_party/modp_b64
url = https://chromium.googlesource.com/chromium/src/third_party/modp_b64
# For gyp generated makefiles.
ignore = untracked
[submodule "third_party/boringssl/src"]
path = third_party/boringssl/src
url = https://boringssl.googlesource.com/boringssl.git
[submodule "third_party/zlib"]
path = third_party/zlib
url = https://github.com/pagespeed/zlib.git
[submodule "third_party/chromium/src/base"]
path = third_party/chromium/src/base
url = https://chromium.googlesource.com/chromium/src/base
# For gyp generated makefiles.
ignore = untracked
[submodule "third_party/chromium/src/build"]
path = third_party/chromium/src/build
url = https://chromium.googlesource.com/chromium/src/build
[submodule "third_party/chromium/src/googleurl"]
path = third_party/chromium/src/googleurl
url = https://chromium.googlesource.com/external/google-url
[submodule "third_party/google-sparsehash/src"]
path = third_party/google-sparsehash/src
url = https://github.com/google/sparsehash.git
[submodule "third_party/domain_registry_provider"]
path = third_party/domain_registry_provider
url = https://github.com/pagespeed/domain-registry-provider.git
[submodule "third_party/jsoncpp/src"]
path = third_party/jsoncpp/src
url = https://github.com/open-source-parsers/jsoncpp.git
[submodule "third_party/gflags/arch"]
path = third_party/gflags/arch
url = https://chromium.googlesource.com/external/webrtc/trunk/third_party/gflags
[submodule "third_party/gflags/src"]
path = third_party/gflags/src
url = https://chromium.googlesource.com/external/gflags/src
[submodule "testing/gtest"]
path = testing/gtest
url = https://github.com/google/googletest.git
[submodule "testing/gmock"]
path = testing/gmock
url = https://github.com/google/googlemock.git
[submodule "tools/clang"]
path = tools/clang
url = https://chromium.googlesource.com/chromium/src/tools/clang
[submodule "tools/gyp"]
path = tools/gyp
url = https://chromium.googlesource.com/external/gyp
# For building a development apache.
[submodule "third_party/nghttp2"]
path = third_party/nghttp2
url = https://github.com/nghttp2/nghttp2
[submodule "third_party/mod_fcgid"]
path = third_party/mod_fcgid
url = https://github.com/pagespeed/mod_fcgid.git
+34 -44
View File
@@ -1,50 +1,40 @@
language: c++
install:
- mv $TRAVIS_BUILD_DIR ~/ngxpagespeed
- sudo apt-get install build-essential zlib1g-dev libpcre3 libpcre3-dev unzip g++ python gperf make devscripts fakeroot git curl netcat-traditional gcc-mozilla clang-3.4 2>&1 > /dev/null
- export PATH=/usr/lib/gcc-mozilla/bin:$PATH
- sudo ln -sf /usr/lib/gcc-mozilla/lib/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.so.6
# - sudo sh -c 'echo "image/webp webp" >> /etc/mime.types'
# - mkdir -p ~/bin
# - cd ~/bin
# - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
- mkdir ~/mod_pagespeed
- cd ~/mod_pagespeed
- git clone --recursive https://github.com/pagespeed/mod_pagespeed.git src
- cd src
- python build/gyp_chromium --depth=.
- cd ~/mod_pagespeed/src/pagespeed/automatic
- make BUILDTYPE=Release -C ../../pagespeed/automatic all
- cd ~
- git clone https://github.com/FRiCKLE/ngx_cache_purge.git
- NGX_CACHE_PURGE=$PWD/ngx_cache_purge
- wget https://openresty.org/download/ngx_openresty-1.9.7.2.tar.gz
- tar xzf ngx_openresty-*.tar.gz
- cd ngx_openresty-*/
- ./configure --with-luajit
- make
- NGX_DEVEL_KIT=$(echo $HOME/ngx_openresty-*/build/ngx_devel_kit-*/)
- SET_MISC_MODULE=$(echo $HOME/ngx_openresty-*/build/set-misc-nginx-module-*/)
- HEADERS_MORE_MODULE=$(echo $HOME/ngx_openresty-*/build/headers-more-nginx-module-*/)
- cd ~
- wget https://github.com/nginx/nginx/archive/branches/default.zip
- unzip default.zip
- cd nginx-branches-default
- MOD_PAGESPEED_DIR="$HOME/mod_pagespeed/src" ./auto/configure --add-module=$HOME/ngxpagespeed --add-module="$NGX_CACHE_PURGE" --add-module="$NGX_DEVEL_KIT" --add-module="$SET_MISC_MODULE" --add-module="$HEADERS_MORE_MODULE" --with-ipv6
- make
- sudo make install
script:
- echo "build successful"
- echo "cd ~/ngxpagespeed"
- echo "sudo ./test/run_tests.sh $HOME/mod_pagespeed $HOME/nginx-branches-default/objs/nginx"
sudo: required
compiler:
- gcc
git:
# It takes a while to clone our submodules, so we'd like to use --jobs to
# speed it up. Here we prevent travis from using git clone --recursive, so
# below in before_install we can manually update including --jobs.
submodules: false
before_install:
# Unfortunately, the version of git we get by default is too low to support
# --jobs on subdmodule, so update git before pulling in the submodules.
- sudo add-apt-repository -y ppa:git-core/ppa
- sudo apt-get update -q
- sudo apt-get install -q -y git
- git submodule update --init --recursive --jobs=6
env:
global:
- MAKEFLAGS=-j3
matrix:
- BIT_FLAG=
# This would do another build for 32-bit, but we're already borderline
# too slow on faster 64-bit, so skip this for now.
# - BIT_FLAG=--32bit
script:
# Travis will time out our build if doesn't output anything for > 10 mintes,
# but --verbose sometimes outputs more than 4 MB of data, which will also
# cause our build to be killed. travis_wait allows the command to be silent
# for longer, but has the downside of not producing output if we timeout. See:
# https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
# For now, stick with --verbose and keep an eye on the logs.
- install/build_release.sh --verbose --skip_psol --debug $BIT_FLAG
notifications:
email:
- cheesy@google.com
- jefftk@google.com
- morlovich@google.com
- jmarantz@google.com
- huibao@google.com
- jcrowell@google.com
- pagespeed-ci@googlegroups.com
-1
View File
@@ -1 +0,0 @@
https://dl.google.com/dl/page-speed/psol/1.12.34.2-$BIT_SIZE_NAME.tar.gz
+26 -30
View File
@@ -1,40 +1,36 @@
![ngx_pagespeed](https://lh6.googleusercontent.com/-qufedJIJq7Y/UXEvVYxyYvI/AAAAAAAADo8/JHDFQhs91_c/s401/04_ngx_pagespeed.png)
# mod_pagespeed
![logo](https://storage.googleapis.com/icons.google.com.a.appspot.com/google-assets/branding/product_logos/_quantum/res-export/logo_pagespeed_192px_clr.svg)
[![Build Status](https://travis-ci.org/pagespeed/ngx_pagespeed.svg?branch=trunk-tracking)](https://travis-ci.org/pagespeed/ngx_pagespeed)
|CI|Status|
|---|---|
|Travis|[![Build Status](https://travis-ci.org/pagespeed/mod_pagespeed.svg?branch=master)](https://travis-ci.org/pagespeed/mod_pagespeed)|
|Jenkins (CentOS5)|[![Build Status](http://104.154.17.78:8080/buildStatus/icon?job=mod_pagespeed)](http://104.154.17.78:8080/job/mod_pagespeed)|
ngx_pagespeed speeds up your site and reduces page load time by automatically
applying web performance best practices to pages and associated assets (CSS,
JavaScript, images) without requiring you to modify your existing content or
workflow. Features include:
`mod_pagespeed` is an open-source Apache module created by Google to help Make the Web Faster by rewriting web pages to reduce latency and bandwidth.
- Image optimization: stripping meta-data, dynamic resizing, recompression
- CSS & JavaScript minification, concatenation, inlining, and outlining
- Small resource inlining
- Deferring image and JavaScript loading
- HTML rewriting
- Cache lifetime extension
- and
[more](https://developers.google.com/speed/docs/mod_pagespeed/config_filters)
mod_pagespeed releases are available as [precompiled linux packages](https://modpagespeed.com/doc/download) or as [source](https://modpagespeed.com/doc/build_mod_pagespeed_from_source). (See [Release Notes](https://modpagespeed.com/doc/release_notes) for information about bugs fixed)
To see ngx_pagespeed in action, with example pages for each of the
optimizations, see our <a href="http://ngxpagespeed.com">demonstration site</a>.
mod_pagespeed is an open-source Apache module which automatically applies web performance best practices to pages, and associated assets (CSS, JavaScript, images) without requiring that you modify your existing content or workflow.
## How to build
mod_pagespeed is built on PageSpeed Optimization Libraries, deployed across 100,000+ web-sites, and provided by popular hosting and CDN providers such as DreamHost, GoDaddy, EdgeCast, and others. There are 40+ available optimizations filters, which include:
Follow the steps on <a
href="https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source">build
ngx_pagespeed from source</a>.
- Image optimization, compression, and resizing
- CSS & JavaScript concatenation, minification, and inlining
- Cache extension, domain sharding, and domain rewriting
- Deferred loading of JavaScript and image resources
- and many others...
## How to use
[![Demo](http://img.youtube.com/vi/8moGR2qf994/0.jpg)](http://www.youtube.com/watch?v=8moGR2qf994)
Follow the steps on <a
href="https://developers.google.com/speed/pagespeed/module/configuration">PageSpeed
configuration</a>.
| Try it | [modpagespeed.com](https://modpagespeed.com) |
|--- |--- |
| Read about it |https://developers.google.com/speed/pagespeed/module |
| Download it | https://modpagespeed.com/doc/download |
| Check announcements |https://groups.google.com/group/mod-pagespeed-announce |
| Discuss it | https://groups.google.com/group/mod-pagespeed-discuss |
|FAQ | https://modpagespeed.com/doc/faq |
For feedback, questions, and to follow
the progress of the project:
- [ngx-pagespeed-discuss mailing
list](https://groups.google.com/forum/#!forum/ngx-pagespeed-discuss)
- [ngx-pagespeed-announce mailing
list](https://groups.google.com/forum/#!forum/ngx-pagespeed-announce)
Curious to learn more about mod_pagespeed? Check out our GDL episode below, which covers the history of the project, an architectural overview of how mod_pagespeed works under the hood, and a number of operational tips and best practices for deploying mod_pagespeed.
[![GDL Episode](http://img.youtube.com/vi/6uCAdQSHhmA/0.jpg)](http://www.youtube.com/watch?v=6uCAdQSHhmA)
+63
View File
@@ -0,0 +1,63 @@
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Base was branched from the chromium version to reduce the number of
# dependencies of this package. Specifically, we would like to avoid
# depending on the chrome directory, which contains the chrome version
# and branding information.
# TODO(morlovich): push this refactoring to chronium trunk.
{
'variables': {
'chromium_code': 1,
'chromium_root': '<(DEPTH)/third_party/chromium/src',
},
'includes': [
'base.gypi',
],
'targets': [
{
# This is the subset of files from base that should not be used with a
# dynamic library. Note that this library cannot depend on base because
# base depends on base_static.
'target_name': 'base_static',
'type': 'static_library',
'sources': [
'<(chromium_root)/base/base_switches.cc',
'<(chromium_root)/base/base_switches.h',
'<(chromium_root)/base/win/pe_image.cc',
'<(chromium_root)/base/win/pe_image.h',
],
'include_dirs': [
'<(chromium_root)',
'<(DEPTH)',
],
},
{
'target_name': 'base_unittests',
'type': 'executable',
'sources': [
'<(chromium_root)/base/string_piece_unittest.cc',
'<(chromium_root)/base/win/win_util_unittest.cc',
],
'dependencies': [
'base',
'base_static',
'<(DEPTH)/testing/gmock.gyp:gmock',
'<(DEPTH)/testing/gtest.gyp:gtest',
'<(DEPTH)/testing/gtest.gyp:gtest_main',
],
'include_dirs': [
'<(DEPTH)',
],
'conditions': [
['OS != "win"', {
'sources!': [
'<(chromium_root)/base/win_util_unittest.cc',
],
}],
],
},
],
}
+298
View File
@@ -0,0 +1,298 @@
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'target_defaults': {
'variables': {
'base_target': 0,
'chromium_root': '<(DEPTH)/third_party/chromium/src',
'conditions': [
# The default stack_trace_posix.cc is not compatible with NaCL newlib
# toolchain, so we provide a stubbed version when building for NaCL.
[ 'build_nacl==1', {
'stack_trace_posix_cc': 'nacl_stubs/stack_trace_posix.cc',
}, {
'stack_trace_posix_cc': '<(chromium_root)/base/debug/stack_trace_posix.cc',
}],
],
},
'target_conditions': [
# This part is shared between the targets defined below. Only files and
# settings relevant for building the Win64 target should be added here.
# All the rest should be added to the 'base' target below.
['base_target==1', {
'sources': [
'<(chromium_root)/build/build_config.h',
'<(chromium_root)/base/third_party/dmg_fp/dmg_fp.h',
'<(chromium_root)/base/third_party/dmg_fp/g_fmt.cc',
'<(chromium_root)/base/third_party/dmg_fp/dtoa_wrapper.cc',
'<(chromium_root)/base/third_party/icu/icu_utf.cc',
'<(chromium_root)/base/third_party/icu/icu_utf.h',
'<(chromium_root)/base/third_party/nspr/prtime.cc',
'<(chromium_root)/base/third_party/nspr/prtime.h',
'<(chromium_root)/base/at_exit.cc',
'<(chromium_root)/base/at_exit.h',
'<(chromium_root)/base/atomicops.h',
'<(chromium_root)/base/atomicops_internals_x86_gcc.cc',
'<(chromium_root)/base/atomicops_internals_x86_msvc.h',
'<(chromium_root)/base/callback.h',
'<(chromium_root)/base/callback_internal.h',
'<(chromium_root)/base/callback_internal.cc',
'<(chromium_root)/base/command_line.cc',
'<(chromium_root)/base/command_line.h',
'<(chromium_root)/base/cpu_patched.cc',
'<(chromium_root)/base/cpu.h',
'<(chromium_root)/base/debug/alias.cc',
'<(chromium_root)/base/debug/alias.h',
'<(chromium_root)/base/debug/debugger.cc',
'<(chromium_root)/base/debug/debugger.h',
'<(chromium_root)/base/debug/debugger_posix.cc',
'<(chromium_root)/base/debug/debugger_win.cc',
'<(chromium_root)/base/debug/profiler.cc',
'<(chromium_root)/base/debug/profiler.h',
'<(chromium_root)/base/debug/stack_trace.cc',
'<(chromium_root)/base/debug/stack_trace.h',
'<(stack_trace_posix_cc)',
'<(chromium_root)/base/debug/stack_trace_win.cc',
'<(chromium_root)/base/files/file_path.cc',
'<(chromium_root)/base/files/file_path.h',
'<(chromium_root)/base/files/file_path_constants.cc',
'<(chromium_root)/base/json/json_parser.cc',
'<(chromium_root)/base/json/json_parser.h',
'<(chromium_root)/base/json/json_reader.cc',
'<(chromium_root)/base/json/json_reader.h',
'<(chromium_root)/base/json/json_writer.cc',
'<(chromium_root)/base/json/json_writer.h',
'<(chromium_root)/base/json/string_escape.cc',
'<(chromium_root)/base/json/string_escape.h',
'<(chromium_root)/base/lazy_instance.cc',
'<(chromium_root)/base/lazy_instance.h',
'<(chromium_root)/base/logging.cc',
'<(chromium_root)/base/logging.h',
'<(chromium_root)/base/logging_win.cc',
'<(chromium_root)/base/logging_win.h',
'<(chromium_root)/base/location.cc',
'<(chromium_root)/base/memory/ref_counted.cc',
'<(chromium_root)/base/memory/ref_counted.h',
'<(chromium_root)/base/memory/singleton.cc',
'<(chromium_root)/base/memory/singleton.h',
'<(chromium_root)/base/mac/foundation_util.h',
'mac/foundation_util.mm',
'<(chromium_root)/base/pickle.cc',
'<(chromium_root)/base/pickle.h',
'<(chromium_root)/base/process.h',
'process_util.cc',
'<(chromium_root)/base/safe_strerror_posix.cc',
'<(chromium_root)/base/safe_strerror_posix.h',
'<(chromium_root)/base/strings/string_number_conversions.cc',
'<(chromium_root)/base/strings/string_number_conversions.h',
'<(chromium_root)/base/strings/string_piece.cc',
'<(chromium_root)/base/strings/string_piece.h',
'<(chromium_root)/base/strings/string_split.cc',
'<(chromium_root)/base/strings/string_split.h',
'<(chromium_root)/base/strings/string_util.cc',
'<(chromium_root)/base/strings/string_util.h',
'<(chromium_root)/base/strings/string_util_constants.cc',
'<(chromium_root)/base/strings/string_util_win.h',
'<(chromium_root)/base/strings/stringprintf.cc',
'<(chromium_root)/base/strings/stringprintf.h',
'<(chromium_root)/base/strings/sys_string_conversions.h',
'<(chromium_root)/base/strings/sys_string_conversions_mac.mm',
'<(chromium_root)/base/strings/sys_string_conversions_posix.cc',
'<(chromium_root)/base/strings/sys_string_conversions_win.cc',
'<(chromium_root)/base/strings/utf_string_conversion_utils.cc',
'<(chromium_root)/base/strings/utf_string_conversion_utils.h',
'<(chromium_root)/base/strings/utf_string_conversions.cc',
'<(chromium_root)/base/strings/utf_string_conversions.h',
'<(chromium_root)/base/synchronization/cancellation_flag.cc',
'<(chromium_root)/base/synchronization/cancellation_flag.h',
'<(chromium_root)/base/synchronization/condition_variable.h',
'<(chromium_root)/base/synchronization/condition_variable_posix.cc',
'<(chromium_root)/base/synchronization/condition_variable_win.cc',
'<(chromium_root)/base/synchronization/lock.cc',
'<(chromium_root)/base/synchronization/lock.h',
'<(chromium_root)/base/synchronization/lock_impl.h',
'<(chromium_root)/base/synchronization/lock_impl_posix.cc',
'<(chromium_root)/base/synchronization/lock_impl_win.cc',
'<(chromium_root)/base/synchronization/spin_wait.h',
'<(chromium_root)/base/synchronization/waitable_event.h',
'<(chromium_root)/base/synchronization/waitable_event_posix.cc',
'<(chromium_root)/base/synchronization/waitable_event_watcher.h',
'<(chromium_root)/base/synchronization/waitable_event_watcher_posix.cc',
'<(chromium_root)/base/synchronization/waitable_event_watcher_win.cc',
'<(chromium_root)/base/synchronization/waitable_event_win.cc',
'<(chromium_root)/base/threading/platform_thread.h',
'<(chromium_root)/base/threading/platform_thread_linux.cc',
'<(chromium_root)/base/threading/platform_thread_mac.mm',
'<(chromium_root)/base/threading/platform_thread_posix.cc',
'<(chromium_root)/base/threading/platform_thread_win.cc',
'<(chromium_root)/base/threading/thread_collision_warner.cc',
'<(chromium_root)/base/threading/thread_collision_warner.h',
'<(chromium_root)/base/threading/thread_id_name_manager.cc',
'<(chromium_root)/base/threading/thread_id_name_manager.h',
'<(chromium_root)/base/threading/thread_local.h',
'<(chromium_root)/base/threading/thread_local_posix.cc',
'<(chromium_root)/base/threading/thread_local_storage.cc',
'<(chromium_root)/base/threading/thread_local_storage.h',
'<(chromium_root)/base/threading/thread_local_storage_posix.cc',
'<(chromium_root)/base/threading/thread_local_storage_win.cc',
'<(chromium_root)/base/threading/thread_local_win.cc',
'<(chromium_root)/base/threading/thread_restrictions.cc',
'<(chromium_root)/base/threading/thread_restrictions.h',
'<(chromium_root)/base/time/time.cc',
'<(chromium_root)/base/time/time.h',
'<(chromium_root)/base/time/time_mac.cc',
'<(chromium_root)/base/time/time_posix.cc',
'<(chromium_root)/base/time/time_win.cc',
'<(chromium_root)/base/tracked_objects.cc',
'<(chromium_root)/base/tracked_objects.h',
'<(chromium_root)/base/values.cc',
'<(chromium_root)/base/values.h',
'<(chromium_root)/base/vlog.cc',
'<(chromium_root)/base/vlog.h',
'<(chromium_root)/base/win/registry.cc',
'<(chromium_root)/base/win/registry.h',
'<(chromium_root)/base/win/scoped_handle.cc',
'<(chromium_root)/base/win/scoped_handle.h',
'<(chromium_root)/base/win/win_util.cc',
'<(chromium_root)/base/win/win_util.h',
'<(chromium_root)/base/win/windows_version.cc',
'<(chromium_root)/base/profiler/tracked_time.h',
'<(chromium_root)/base/profiler/tracked_time.cc',
'<(chromium_root)/base/profiler/alternate_timer.h',
'<(chromium_root)/base/profiler/alternate_timer.cc',
'<(chromium_root)/base/win/windows_version.h',
],
'include_dirs': [
'<(chromium_root)',
'<(DEPTH)',
],
# These warnings are needed for the files in third_party\dmg_fp.
'msvs_disabled_warnings': [
4244, 4554, 4018, 4102,
],
'mac_framework_dirs': [
'$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework/Frameworks',
],
'conditions': [
[ 'OS != "linux" and OS != "freebsd" and OS != "openbsd" and OS != "solaris"', {
'sources!': [
'<(chromium_root)/base/atomicops_internals_x86_gcc.cc',
],
},],
['OS != "win"', {
'sources/': [ ['exclude', '^win/'] ],
},
],
[ 'OS == "win"', {
'sources!': [
'<(chromium_root)/base/strings/string16.cc',
],
},],
],
}],
],
},
'targets': [
# Older assemblers don't recognize the xgetbv opcode, and require explicit
# bytes instead. These can be found by searching the web; example:
# http://lxr.free-electrons.com/source/arch/x86/include/asm/xcr.h#L31
{
'target_name': 'cpu_patched',
'type': 'none',
'sources': [
'<(chromium_root)/base/cpu.cc',
'<(chromium_root)/base/cpu_patched.cc',
],
'actions': [
{
'action_name': 'Patch cpu.cc',
'inputs': [
'<(chromium_root)/base/cpu.cc',
],
'outputs': [
'<(chromium_root)/base/cpu_patched.cc',
],
'action': [
'bash', '-c',
'sed \'s/"xgetbv"/".byte 0x0f, 0x01, 0xd0"/\' <@(_inputs) > <@(_outputs)'
],
'message': 'Attempting to generate patched <@(_outputs) from <@(_inputs)',
},
],
},
{
'target_name': 'base',
'type': '<(component)',
'variables': {
'base_target': 1,
},
'dependencies': [
'base_static',
'cpu_patched',
'<(DEPTH)/third_party/modp_b64/modp_b64.gyp:modp_b64',
'<(chromium_root)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
],
# TODO(gregoryd): direct_dependent_settings should be shared with the
# 64-bit target, but it doesn't work due to a bug in gyp
'direct_dependent_settings': {
'include_dirs': [
'<(chromium_root)',
'<(DEPTH)',
],
},
'conditions': [
[ 'OS == "linux"', {
'cflags': [
'-Wno-write-strings',
'-Wno-error',
],
'conditions': [
[ 'build_nacl==0', {
# We do not need clock_gettime() when building for NaCL newlib.
'link_settings': {
'libraries': [
# We need rt for clock_gettime().
'-lrt',
],
},
}],
],
}],
[ 'OS == "mac"', {
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
'$(SDKROOT)/System/Library/Frameworks/Carbon.framework',
'$(SDKROOT)/System/Library/Frameworks/CoreFoundation.framework',
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
'$(SDKROOT)/System/Library/Frameworks/IOKit.framework',
'$(SDKROOT)/System/Library/Frameworks/Security.framework',
],
},
},],
[ 'build_nacl==1', {
'defines': [
# A super-hack. prtime.cc (and possibly other sources) call
# timegm, which is a non-standard function that's
# unavailable when compiling using NaCl newlib. mktime is
# essentially a drop-in replacement for timegm, modulo time
# zone issues, however NaCL will default to UTC which is the
# expected behavior for timegm, so the two should behave
# identically.
'timegm=mktime',
],
}],
],
'sources': [
'<(chromium_root)/base/base64.cc',
'<(chromium_root)/base/base64.h',
'<(chromium_root)/base/md5.cc',
'<(chromium_root)/base/md5.h',
'<(chromium_root)/base/strings/string16.cc',
'<(chromium_root)/base/strings/string16.h',
],
},
],
}
+35
View File
@@ -0,0 +1,35 @@
// Copyright 2013 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Chromium's foundation_util.cc pulls a lot of mac related functions into the
// base package. We don't need them, so strip down all the code.
#include "base/mac/foundation_util.h"
namespace base {
namespace mac {
void* CFTypeRefToNSObjectAutorelease(CFTypeRef cf_object) {
// When GC is on, NSMakeCollectable marks cf_object for GC and autorelease
// is a no-op.
//
// In the traditional GC-less environment, NSMakeCollectable is a no-op,
// and cf_object is autoreleased, balancing out the caller's ownership claim.
//
// NSMakeCollectable returns nil when used on a NULL object.
return [NSMakeCollectable(cf_object) autorelease];
}
} // namespace mac
} // namespace base
+23
View File
@@ -0,0 +1,23 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// NaCL newlib is not compatible with the default
// stack_trace_posix.cc. So we provide this stubbed out version for
// use when building for NaCL.
#ifndef __native_client__
#error This file should only be used when compiling for Native Client.
#endif
#include "base/debug/stack_trace.h"
namespace base {
namespace debug {
StackTrace::StackTrace() {}
void StackTrace::PrintBacktrace() const {}
void StackTrace::OutputToStream(std::ostream* os) const {}
} // namespace debug
} // namespace base
+29
View File
@@ -0,0 +1,29 @@
// Copyright 2013 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Chromium's process.cc pulls a lot of file related functions into the
// base package. We don't need them, so strip down all the code.
#include "base/logging.h"
#include "base/process/process.h"
namespace base {
// Returns the id of the current process.
ProcessId GetCurrentProcId() {
DCHECK(false); // we don't actually expect this to be called.
return 0;
}
} // namespace base
+13
View File
@@ -0,0 +1,13 @@
The following files in this directory were copied from chromium's repository at
revision 256281 (https://src.chromium.org/svn/trunk/src/build/?p=256281).
compiler_version.py (with local bugfix decribed at the top)
filename_rules.gypi
get_landmines.py
grit_action.gypi
gyp_chromium (with minor local modifications described at the top)
gyp_helper.py
java.gypi
landmine_utils.py
landmines.py
release.gypi
+72
View File
@@ -0,0 +1,72 @@
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{
'targets': [
{
'target_name': 'All',
'type': 'none',
'xcode_create_dependents_test_runner': 1,
'dependencies': [
'mod_pagespeed',
'test',
'js_minify',
'pagespeed_automatic',
],},
{
'target_name': 'mod_pagespeed',
'type': 'none',
'dependencies': [
'../net/instaweb/instaweb.gyp:instaweb_rewriter',
'../net/instaweb/instaweb_apr.gyp:*',
'../net/instaweb/mod_pagespeed.gyp:mod_pagespeed',
'install.gyp:*',
],
'conditions': [
['use_system_apache_dev==0', {
'dependencies+': [
'../net/instaweb/mod_pagespeed.gyp:mod_pagespeed_ap24',
],
}],
]},
{
'target_name': 'pagespeed_automatic',
'type': 'none',
'dependencies': [
'../net/instaweb/test.gyp:pagespeed_automatic_test',
'../net/instaweb/instaweb.gyp:automatic_util',
],},
{
'target_name': 'test',
'type': 'none',
'xcode_create_dependents_test_runner': 1,
'dependencies': [
'../net/instaweb/instaweb.gyp:*',
'../net/instaweb/instaweb_core.gyp:*',
'../net/instaweb/instaweb_apr.gyp:*',
'../net/instaweb/test.gyp:mod_pagespeed_test',
'../net/instaweb/test.gyp:mod_pagespeed_speed_test',
'install.gyp:*',
'<(DEPTH)/pagespeed/kernel.gyp:redis_cache_cluster_setup',
]
},
{
'target_name': 'js_minify',
'type': 'none',
'dependencies': [
'../net/instaweb/instaweb.gyp:js_minify',
],
},
],
}
@@ -0,0 +1,41 @@
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file is meant to be included into an action to provide an action that
# combines a directory of shared libraries and an incomplete APK into a
# standalone APK.
#
# To use this, create a gyp action with the following form:
# {
# 'action_name': 'some descriptive action name',
# 'variables': {
# 'inputs': [ 'input_path1', 'input_path2' ],
# 'input_apk_path': '<(unsigned_apk_path)',
# 'output_apk_path': '<(unsigned_standalone_apk_path)',
# 'libraries_top_dir': '<(libraries_top_dir)',
# },
# 'includes': [ 'relative/path/to/create_standalone_apk_action.gypi' ],
# },
{
'message': 'Creating standalone APK: <(output_apk_path)',
'variables': {
'inputs': [],
},
'inputs': [
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/create_standalone_apk.py',
'<(input_apk_path)',
'>@(inputs)',
],
'outputs': [
'<(output_apk_path)',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/create_standalone_apk.py',
'--libraries-top-dir=<(libraries_top_dir)',
'--input-apk-path=<(input_apk_path)',
'--output-apk-path=<(output_apk_path)',
],
}
+56
View File
@@ -0,0 +1,56 @@
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file is meant to be included into an action to provide a rule that dexes
# compiled java files. If proguard_enabled == "true" and CONFIGURATION_NAME ==
# "Release", then it will dex the proguard_enabled_input_path instead of the
# normal dex_input_paths/dex_generated_input_paths.
#
# To use this, create a gyp target with the following form:
# {
# 'action_name': 'some name for the action'
# 'actions': [
# 'variables': {
# 'dex_input_paths': [ 'files to dex (when proguard is not used) and add to input paths' ],
# 'dex_generated_input_dirs': [ 'dirs that contain generated files to dex' ],
#
# # For targets that use proguard:
# 'proguard_enabled': 'true',
# 'proguard_enabled_input_path': 'path to dex when using proguard',
# },
# 'includes': [ 'relative/path/to/dex_action.gypi' ],
# ],
# },
#
{
'message': 'Creating dex file: <(output_path)',
'variables': {
'dex_input_paths': [],
'dex_generated_input_dirs': [],
'proguard_enabled%': 'false',
'proguard_enabled_input_path%': '',
'dex_no_locals%': 0,
},
'inputs': [
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/util/md5_check.py',
'<(DEPTH)/build/android/gyp/dex.py',
'>@(dex_input_paths)',
],
'outputs': [
'<(output_path)',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/dex.py',
'--dex-path=<(output_path)',
'--android-sdk-tools=<(android_sdk_tools)',
'--configuration-name=<(CONFIGURATION_NAME)',
'--proguard-enabled=<(proguard_enabled)',
'--proguard-enabled-input-path=<(proguard_enabled_input_path)',
'--no-locals=<(dex_no_locals)',
'>@(dex_input_paths)',
'>@(dex_generated_input_dirs)',
]
}
+40
View File
@@ -0,0 +1,40 @@
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file is meant to be included into an action to provide an action that
# signs and zipaligns an APK.
#
# To use this, create a gyp action with the following form:
# {
# 'action_name': 'some descriptive action name',
# 'variables': {
# 'input_apk_path': 'relative/path/to/input.apk',
# 'output_apk_path': 'relative/path/to/output.apk',
# },
# 'includes': [ '../../build/android/finalize_apk.gypi' ],
# },
#
{
'message': 'Signing/aligning <(_target_name) APK: <(input_apk_path)',
'variables': {
'keystore_path%': '<(DEPTH)/build/android/ant/chromium-debug.keystore',
},
'inputs': [
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/finalize_apk.py',
'<(keystore_path)',
'<(input_apk_path)',
],
'outputs': [
'<(output_apk_path)',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/finalize_apk.py',
'--android-sdk-root=<(android_sdk_root)',
'--unsigned-apk-path=<(input_apk_path)',
'--final-apk-path=<(output_apk_path)',
'--keystore-path=<(keystore_path)',
],
}
+53
View File
@@ -0,0 +1,53 @@
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file is meant to be included into an action to provide a rule that
# instruments either java class files, or jars.
{
'variables': {
'instr_type%': 'jar',
'input_path%': '',
'output_path%': '',
'stamp_path%': '',
'extra_instr_args': [
'--coverage-file=<(_target_name).em',
'--sources-file=<(_target_name)_sources.txt',
],
'emma_jar': '<(android_sdk_root)/tools/lib/emma.jar',
'conditions': [
['emma_instrument != 0', {
'extra_instr_args': [
'--sources=<(java_in_dir)/src >(additional_src_dirs) >(generated_src_dirs)',
'--src-root=<(DEPTH)',
'--emma-jar=<(emma_jar)',
'--filter-string=<(emma_filter)',
],
'conditions': [
['instr_type == "jar"', {
'instr_action': 'instrument_jar',
}, {
'instr_action': 'instrument_classes',
}]
],
}, {
'instr_action': 'copy',
'extra_instr_args': [],
}]
]
},
'inputs': [
'<(DEPTH)/build/android/gyp/emma_instr.py',
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/pylib/utils/command_option_parser.py',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/emma_instr.py',
'<(instr_action)',
'--input-path=<(input_path)',
'--output-path=<(output_path)',
'--stamp=<(stamp_path)',
'<@(extra_instr_args)',
]
}
+39
View File
@@ -0,0 +1,39 @@
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file is meant to be included into an action to provide a rule to
# run lint on java/class files.
{
'action_name': 'lint_<(_target_name)',
'message': 'Linting <(_target_name)',
'variables': {
'conditions': [
['chromium_code != 0 and android_lint != 0 and never_lint == 0', {
'is_enabled': '--enable',
}, {
'is_enabled': '',
}]
]
},
'inputs': [
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/lint.py',
'<(DEPTH)/build/android/lint/suppressions.xml',
'<(DEPTH)/build/android/AndroidManifest.xml',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/lint.py',
'--lint-path=<(android_sdk_root)/tools/lint',
'--config-path=<(DEPTH)/build/android/lint/suppressions.xml',
'--processed-config-path=<(config_path)',
'--manifest-path=<(DEPTH)/build/android/AndroidManifest.xml',
'--result-path=<(result_path)',
'--product-dir=<(PRODUCT_DIR)',
'--src-dirs=>(src_dirs)',
'--classes-dir=<(classes_dir)',
'--stamp=<(stamp_path)',
'<(is_enabled)',
],
}
+85
View File
@@ -0,0 +1,85 @@
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'version_py_path': 'version.py',
'instaweb_path': '<(DEPTH)/net/instaweb',
'version_path': '<(instaweb_path)/public/VERSION',
'version_h_in_path': '<(instaweb_path)/public/version.h.in',
'public_path' : 'net/instaweb/public',
'version_h_path': '<(SHARED_INTERMEDIATE_DIR)/<(public_path)/version.h',
'lastchange_out_path': '<(SHARED_INTERMEDIATE_DIR)/build/LASTCHANGE',
},
'targets': [
{
'target_name': 'lastchange',
'type': 'none',
'variables': {
'default_lastchange_path': '../LASTCHANGE.in',
},
'actions': [
{
'action_name': 'lastchange',
'inputs': [
# Note: <(default_lastchange_path) is optional,
# so it doesn't show up in inputs.
'<(DEPTH)/build/lastchange.sh',
],
'outputs': [
'<(lastchange_out_path)',
],
'action': [
'/bin/sh', '<@(_inputs)',
'<(DEPTH)',
'-o', '<(lastchange_out_path)',
'-d', '<(default_lastchange_path)',
],
'message': 'Extracting last change to <(lastchange_out_path)',
'process_outputs_as_sources': '1',
},
],
},
{
'target_name': 'mod_pagespeed_version_header',
'type': 'none',
'dependencies': [
'lastchange',
],
'actions': [
{
'action_name': 'version_header',
'inputs': [
'<(version_path)',
'<(lastchange_out_path)',
'<(version_h_in_path)',
],
'outputs': [
'<(version_h_path)',
],
'action': [
'python',
'<(version_py_path)',
'-f', '<(version_path)',
'-f', '<(lastchange_out_path)',
'<(version_h_in_path)',
'<@(_outputs)',
],
'message': 'Generating version header file: <@(_outputs)',
},
],
'direct_dependent_settings': {
'include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)',
],
},
},
]
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
+57
View File
@@ -0,0 +1,57 @@
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
"""Compiler version checking tool for clang.
(Based on corresponding tool for gcc in Chromium build system).
Prints X*100 + Y if $CXX is pointing to clang X.Y.*. Prints 0 otherwise.
Note that this output convention is different from compiler_version.py's. This
also never returns a failing status, since we want to run this even on systems
without clang, and gyp will complain on a non-successful status.
"""
import os
import re
import subprocess
import sys
def GetVersion(compiler):
try:
compiler = compiler + " --version"
pipe = subprocess.Popen(compiler, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = pipe.communicate()
if pipe.returncode:
raise subprocess.CalledProcessError(pipe.returncode, compiler)
result = re.search(r"clang version (\d+)\.?(\d+)?", output)
if result is None:
return "0"
minor_version = result.group(2)
if minor_version is None:
minor_version = "0"
return str(int(result.group(1)) * 100 + int(minor_version))
except Exception, e:
if error:
sys.stderr.write(error)
print >> sys.stderr, "clang_version.py failed to execute:", compiler
print >> sys.stderr, e
return "0"
def main():
# Check if CXX environment variable exists, and if it does use that compiler.
cxx = os.getenv("CXX", None)
if cxx:
print GetVersion(cxx)
else:
print "0"
if __name__ == "__main__":
main()
sys.exit(0)
+178
View File
@@ -0,0 +1,178 @@
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{
'variables': {
# Make sure we link statically so everything gets linked into a
# single shared object.
'library': 'static_library',
# We're building a shared library, so everything needs to be built
# with Position-Independent Code.
'linux_fpic': 1,
'instaweb_src_root': 'net/instaweb',
# Define the overridable use_system_libs variable in its own
# nested block, so it's available for use in the conditions block
# below.
'variables': {
'use_system_libs%': 0,
},
# Which versions development is usually done with. These version will
# get -Werror
'gcc_devel_version%': '46',
'gcc_devel_version2%': '48',
# We need inter-process mutexes to support POSIX shared memory, and they're
# unfortunately not supported on some common systems.
'support_posix_shared_mem%': 0,
# Detect clang being configured via CXX envvar, which is the easiest
# way for our users to change the compiler (since gclient gets in
# the way of tweaking gyp flags directly).
'clang_version':
'<!(python <(DEPTH)/build/clang_version.py)',
'conditions': [
# TODO(morlovich): AIX, Solaris, FreeBSD10?
['OS == "linux"', {
'support_posix_shared_mem': 1
}],
['use_system_libs==1', {
'use_system_apache_dev': 1,
'use_system_icu': 1,
'use_system_libjpeg': 1,
'use_system_libpng': 1,
'use_system_opencv': 1,
'use_system_openssl': 1,
'use_system_zlib': 1,
},{
'use_system_apache_dev%': 0,
}],
],
},
'includes': [
# Import base Chromium build system, and pagespeed customizations of it.
'../third_party/chromium/src/build/common.gypi',
'pagespeed_overrides.gypi',
],
'target_defaults': {
'variables': {
# Make this available here as well.
'use_system_libs%': 0,
},
'conditions': [
['support_posix_shared_mem == 1', {
'defines': [ 'PAGESPEED_SUPPORT_POSIX_SHARED_MEM', ],
}],
['OS == "linux"', {
# Disable -Werror when not using the version of gcc that development
# is generally done with, to avoid breaking things for users with
# something older or newer (which produces different warnings).
'conditions': [
['<(gcc_version) != <(gcc_devel_version) and '
'<(gcc_version) != <(gcc_devel_version2)', {
'cflags!': ['-Werror']
}],
['<(gcc_version) < 48 and (clang_version == 0)', {
'cflags+': '<!(echo gcc \< 4.8 is too old and no longer supported; false)'
}]
],
'cflags': [
# Our dependency on OpenCV need us to turn on exceptions.
'-fexceptions',
# Now we are using exceptions. -fno-asynchronous-unwind-tables is
# set in libpagespeed's common.gypi. Now enable it.
'-fasynchronous-unwind-tables',
# We'd like to add '-Wtype-limits', but this does not work on
# earlier versions of g++ on supported operating systems.
#
# Use -DFORTIFY_SOURCE to add extra checks to functions like printf,
# and bounds checking to copies.
'-D_FORTIFY_SOURCE=2',
],
'cflags_cc!': [
# Newer Chromium build adds -Wsign-compare which we have some
# difficulty with. Remove it for now.
'-Wsign-compare',
'-fno-rtti', # Same reason as using -frtti below.
],
'cflags_cc': [
'-frtti', # Hardy's g++ 4.2 <trl/function> uses typeid
'-D_FORTIFY_SOURCE=2',
],
'defines!': [
# testing/gtest.gyp defines GTEST_HAS_RTTI=0 for itself and all deps.
# This breaks when we turn rtti on, so must be removed.
'GTEST_HAS_RTTI=0',
# third_party/protobuf/protobuf.gyp defines GOOGLE_PROTOBUF_NO_RTTI
# for itself and all deps. I assume this is just a ticking time bomb
# like GTEST_HAS_RTTI=0 was, so remove it as well.
'GOOGLE_PROTOBUF_NO_RTTI',
],
'defines': [
'GTEST_HAS_RTTI=1', # gtest requires this set to indicate RTTI on.
],
# Disable -z,defs in linker.
# This causes mod_pagespeed.so to fail because it doesn't link apache
# libraries.
'ldflags!': [
'-Wl,-z,defs',
],
}],
['OS == "mac"', {
'xcode_settings':{
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', # -fexceptions
'GCC_ENABLE_CPP_RTTI': 'YES', # -frtti
# The Google CSS parser escapes from functions without
# returning anything. Only with flow analysis that is,
# evidently, beyond the scope of the g++ configuration in
# MacOS, do we see those paths cannot be reached.
'OTHER_CFLAGS': ['-funsigned-char', '-Wno-error'],
},
}],
['use_system_libs == 0', {
'ldflags+': [
'-static-libstdc++',
'-static-libgcc',
]
}],
],
'defines': [ # See https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
'_GLIBCXX_USE_CXX11_ABI=0' ],
'cflags_cc+': [
'-std=gnu++0x'
],
# Permit building us with coverage information
'configurations': {
'Debug_Coverage': {
'inherit_from': ['Debug'],
'cflags': [
'-ftest-coverage',
'-fprofile-arcs',
],
'ldflags': [
# takes care of -lgcov for us, but can be in a build configuration
'-ftest-coverage -fprofile-arcs',
],
},
},
},
}
+61
View File
@@ -0,0 +1,61 @@
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This version contains a bugfix for the compiler returning a single digit
# version number, as is the case for gcc 5.
"""Compiler version checking tool for gcc
Print gcc version as XY if you are running gcc X.Y.*.
This is used to tweak build flags for gcc 4.4.
"""
import os
import re
import subprocess
import sys
def GetVersion(compiler):
try:
# Note that compiler could be something tricky like "distcc g++".
compiler = compiler + " -dumpversion"
pipe = subprocess.Popen(compiler, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
gcc_output, gcc_error = pipe.communicate()
if pipe.returncode:
raise subprocess.CalledProcessError(pipe.returncode, compiler)
result = re.match(r"(\d+)\.?(\d+)?", gcc_output)
minor_version = result.group(2)
if minor_version is None:
minor_version = "0"
return result.group(1) + minor_version
except Exception, e:
if gcc_error:
sys.stderr.write(gcc_error)
print >> sys.stderr, "compiler_version.py failed to execute:", compiler
print >> sys.stderr, e
return ""
def main():
# Check if CXX environment variable exists and
# if it does use that compiler.
cxx = os.getenv("CXX", None)
if cxx:
cxxversion = GetVersion(cxx)
if cxxversion != "":
print cxxversion
return 0
else:
# Otherwise we check the g++ version.
gccversion = GetVersion("g++")
if gccversion != "":
print gccversion
return 0
return 1
if __name__ == "__main__":
sys.exit(main())
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Writes True if the argument is a directory."""
import os.path
import sys
def main():
sys.stdout.write(str(os.path.isdir(sys.argv[1])))
return 0
if __name__ == '__main__':
sys.exit(main())
+18
View File
@@ -0,0 +1,18 @@
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Chromium expects this file to be here, but for our (Page Speed) purposes, it
# doesn't need to actually do anything.
{}
+125
View File
@@ -0,0 +1,125 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This gypi file defines the patterns used for determining whether a
# file is excluded from the build on a given platform. It is
# included by common.gypi for chromium_code.
{
'target_conditions': [
['OS!="win" or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_win(_browsertest|_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)win/'],
['exclude', '(^|/)win_[^/]*\\.(h|cc)$'] ],
}],
['OS!="mac" or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_(cocoa|mac)(_unittest)?\\.(h|cc|mm?)$'],
['exclude', '(^|/)(cocoa|mac)/'] ],
}],
['OS!="ios" or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_ios(_unittest)?\\.(h|cc|mm?)$'],
['exclude', '(^|/)ios/'] ],
}],
['(OS!="mac" and OS!="ios") or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '\\.mm?$' ] ],
}],
# Do not exclude the linux files on *BSD since most of them can be
# shared at this point.
# In case a file is not needed, it is going to be excluded later on.
# TODO(evan): the above is not correct; we shouldn't build _linux
# files on non-linux.
['OS!="linux" and OS!="openbsd" and OS!="freebsd" or >(nacl_untrusted_build)==1', {
'sources/': [
['exclude', '_linux(_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)linux/'],
],
}],
['OS!="android" or _toolset=="host"', {
'sources/': [
['exclude', '_android(_unittest)?\\.cc$'],
['exclude', '(^|/)android/'],
],
}],
['OS=="win" and >(nacl_untrusted_build)==0', {
'sources/': [
['exclude', '_posix(_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)posix/'],
],
}],
['<(chromeos)!=1 or >(nacl_untrusted_build)==1', {
'sources/': [
['exclude', '_chromeos(_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)chromeos/'],
],
}],
['>(nacl_untrusted_build)==0', {
'sources/': [
['exclude', '_nacl(_unittest)?\\.(h|cc)$'],
],
}],
['OS!="linux" and OS!="openbsd" and OS!="freebsd" or >(nacl_untrusted_build)==1', {
'sources/': [
['exclude', '_xdg(_unittest)?\\.(h|cc)$'],
],
}],
['<(use_x11)!=1 or >(nacl_untrusted_build)==1', {
'sources/': [
['exclude', '_(x|x11)(_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)x11_[^/]*\\.(h|cc)$'],
['exclude', '(^|/)x11/'],
['exclude', '(^|/)x/'],
],
}],
['<(toolkit_uses_gtk)!=1 or >(nacl_untrusted_build)==1', {
'sources/': [
['exclude', '_gtk(_browsertest|_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)gtk/'],
['exclude', '(^|/)gtk_[^/]*\\.(h|cc)$'],
],
}],
['<(toolkit_views)==0 or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_views\\.(h|cc)$'] ]
}],
['<(use_aura)==0 or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_aura(_browsertest|_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)aura/'],
]
}],
['<(use_aura)==0 or <(use_x11)==0 or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_aurax11(_browsertest|_unittest)?\\.(h|cc)$'] ]
}],
['<(use_aura)==0 or OS!="win" or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_aurawin\\.(h|cc)$'] ]
}],
['<(use_aura)==0 or OS!="linux" or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_auralinux\\.(h|cc)$'] ]
}],
['<(use_ash)==0 or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_ash(_browsertest|_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)ash/'],
]
}],
['<(use_ash)==0 or OS!="win" or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_ashwin\\.(h|cc)$'] ]
}],
['<(use_ozone)==0 or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_ozone(_browsertest|_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)ozone/'],
]
}],
['<(use_ozone_evdev)==0 or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_evdev(_browsertest|_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)evdev/'],
]
}],
['<(ozone_platform_dri)==0 or >(nacl_untrusted_build)==1', {
'sources/': [ ['exclude', '_dri(_browsertest|_unittest)?\\.(h|cc)$'],
['exclude', '(^|/)dri/'],
]
}],
['<(use_pango)==0', {
'sources/': [ ['exclude', '(^|_)pango(_util|_browsertest|_unittest)?\\.(h|cc)$'], ],
}],
]
}
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
set -e
set -u
if [ $# -lt 3 ];then
echo "Usage: $(basename $0) <proto_in> <proto_out> <protoc_path>"\
"[<protoc_opts> ...]" >&2
exit 1
fi
proto_in=$1
proto_out=$2
protoc=$3
shift 3
sed -e 's!"third_party/pagespeed/!"pagespeed/!; s!// \[opensource\] !!' \
< "$proto_in" > "$proto_out"
exec "$protoc" "$@" "$proto_out"
+71
View File
@@ -0,0 +1,71 @@
#!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This file emits the list of reasons why a particular build needs to be clobbered
(or a list of 'landmines').
"""
import optparse
import sys
import landmine_utils
builder = landmine_utils.builder
distributor = landmine_utils.distributor
gyp_defines = landmine_utils.gyp_defines
gyp_msvs_version = landmine_utils.gyp_msvs_version
platform = landmine_utils.platform
def print_landmines(target):
"""
ALL LANDMINES ARE EMITTED FROM HERE.
target can be one of {'Release', 'Debug', 'Debug_x64', 'Release_x64'}.
"""
if (distributor() == 'goma' and platform() == 'win32' and
builder() == 'ninja'):
print 'Need to clobber winja goma due to backend cwd cache fix.'
if platform() == 'android':
print 'Clobber: Autogen java file needs to be removed (issue 159173002)'
if platform() == 'win' and builder() == 'ninja':
print 'Compile on cc_unittests fails due to symbols removed in r185063.'
if platform() == 'linux' and builder() == 'ninja':
print 'Builders switching from make to ninja will clobber on this.'
if platform() == 'mac':
print 'Switching from bundle to unbundled dylib (issue 14743002).'
if platform() in ('win', 'mac'):
print ('Improper dependency for create_nmf.py broke in r240802, '
'fixed in r240860.')
if (platform() == 'win' and builder() == 'ninja' and
gyp_msvs_version() == '2012' and
gyp_defines().get('target_arch') == 'x64' and
gyp_defines().get('dcheck_always_on') == '1'):
print "Switched win x64 trybots from VS2010 to VS2012."
if (platform() == 'win' and builder() == 'ninja' and
gyp_msvs_version().startswith('2013')):
print "Switched win from VS2010 to VS2013."
print 'Need to clobber everything due to an IDL change in r154579 (blink)'
if (platform() != 'ios'):
print 'Clobber to get rid of obselete test plugin after r248358'
def main():
parser = optparse.OptionParser()
parser.add_option('-t', '--target',
help=='Target for which the landmines have to be emitted')
options, args = parser.parse_args()
if args:
parser.error('Unknown arguments %s' % args)
print_landmines(options.target)
return 0
if __name__ == '__main__':
sys.exit(main())
+42
View File
@@ -0,0 +1,42 @@
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file is meant to be included into an action to invoke grit in a
# consistent manner. To use this the following variables need to be
# defined:
# grit_grd_file: string: grd file path
# grit_out_dir: string: the output directory path
# It would be really nice to do this with a rule instead of actions, but it
# would need to determine inputs and outputs via grit_info on a per-file
# basis. GYP rules dont currently support that. They could be extended to
# do this, but then every generator would need to be updated to handle this.
{
'variables': {
'grit_cmd': ['python', '<(DEPTH)/tools/grit/grit.py'],
'grit_resource_ids%': '<(DEPTH)/tools/gritsettings/resource_ids',
# This makes it possible to add more defines in specific targets,
# instead of build/common.gypi .
'grit_additional_defines%': [],
'grit_rc_header_format%': [],
},
'inputs': [
'<!@pymod_do_main(grit_info <@(grit_defines) <@(grit_additional_defines) '
'--inputs <(grit_grd_file) -f "<(grit_resource_ids)")',
],
'outputs': [
'<!@pymod_do_main(grit_info <@(grit_defines) <@(grit_additional_defines) '
'--outputs \'<(grit_out_dir)\' '
'<(grit_grd_file) -f "<(grit_resource_ids)")',
],
'action': ['<@(grit_cmd)',
'-i', '<(grit_grd_file)', 'build',
'-f', '<(grit_resource_ids)',
'-o', '<(grit_out_dir)',
'<@(grit_defines)',
'<@(grit_additional_defines)',
'<@(grit_rc_header_format)'],
'message': 'Generating resources from <(grit_grd_file)',
}
+572
View File
@@ -0,0 +1,572 @@
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script is wrapper for Chromium that adds some support for how GYP
# is invoked by Chromium beyond what can be done in the gclient hooks.
# This was copied from the chromium repository at revision 256281. The only
# change was adding back support and making default Makefile generation, instead
# of ninja support. This was removed as discussed in crbug.com/348686.
import glob
import gyp_helper
import json
import os
import pipes
import shlex
import shutil
import subprocess
import string
import sys
import tempfile
script_dir = os.path.dirname(os.path.realpath(__file__))
chrome_src = os.path.abspath(os.path.join(script_dir, os.pardir))
sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
import gyp
# Assume this file is in a one-level-deep subdirectory of the source root.
SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Add paths so that pymod_do_main(...) can import files.
sys.path.insert(1, os.path.join(chrome_src, 'tools'))
sys.path.insert(1, os.path.join(chrome_src, 'tools', 'generate_shim_headers'))
sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit'))
sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build'))
sys.path.insert(1, os.path.join(chrome_src, 'native_client', 'build'))
sys.path.insert(1, os.path.join(chrome_src, 'native_client_sdk', 'src',
'build_tools'))
sys.path.insert(1, os.path.join(chrome_src, 'remoting', 'tools', 'build'))
sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'liblouis'))
sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'WebKit',
'Source', 'build', 'scripts'))
# On Windows, Psyco shortens warm runs of build/gyp_chromium by about
# 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70
# seconds. Conversely, memory usage of build/gyp_chromium with Psyco
# maxes out at about 158 MB vs. 132 MB without it.
#
# Psyco uses native libraries, so we need to load a different
# installation depending on which OS we are running under. It has not
# been tested whether using Psyco on our Mac and Linux builds is worth
# it (the GYP running time is a lot shorter, so the JIT startup cost
# may not be worth it).
if sys.platform == 'win32':
try:
sys.path.insert(0, os.path.join(chrome_src, 'third_party', 'psyco_win32'))
import psyco
except:
psyco = None
else:
psyco = None
def GetSupplementalFiles():
"""Returns a list of the supplemental files that are included in all GYP
sources."""
return glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi'))
def FormatKeyForGN(key):
"""Returns the given GYP key reformatted for GN.
GYP dictionary keys can be almost anything, but in GN they are identifiers
and must follow the same rules. This reformats such keys to be valid GN
identifiers."""
return ''.join([c if c in string.ascii_letters else '_' for c in key])
def EscapeStringForGN(s):
"""Converts a string to a GN string literal."""
for old, new in [('\\', '\\\\'), ('$', '\\$'), ('"', '\\"')]:
s = s.replace(old, new)
return '"' + s + '"'
def ProcessGypDefinesItems(items):
"""Converts a list of strings to a list of key-value pairs."""
result = []
for item in items:
tokens = item.split('=', 1)
# Some GYP variables have hyphens, which we don't support.
key = FormatKeyForGN(tokens[0])
if len(tokens) == 2:
result += [(key, tokens[1])]
else:
# No value supplied, treat it as a boolean and set it. Note that we
# use the string '1' here so we have a consistent definition whether
# you do 'foo=1' or 'foo'.
result += [(key, '1')]
return result
def GetGypVarsForGN(supplemental_files):
"""Returns a dictionary of all GYP vars that we will be passing to GN."""
# Find the .gyp directory in the user's home directory.
home_dot_gyp = os.environ.get('GYP_CONFIG_DIR', None)
if home_dot_gyp:
home_dot_gyp = os.path.expanduser(home_dot_gyp)
if not home_dot_gyp:
home_vars = ['HOME']
if sys.platform in ('cygwin', 'win32'):
home_vars.append('USERPROFILE')
for home_var in home_vars:
home = os.getenv(home_var)
if home != None:
home_dot_gyp = os.path.join(home, '.gyp')
if not os.path.exists(home_dot_gyp):
home_dot_gyp = None
else:
break
if home_dot_gyp:
include_gypi = os.path.join(home_dot_gyp, "include.gypi")
if os.path.exists(include_gypi):
supplemental_files += [include_gypi]
# GYP defines from the supplemental.gypi files.
supp_items = []
for supplement in supplemental_files:
with open(supplement, 'r') as f:
try:
file_data = eval(f.read(), {'__builtins__': None}, None)
except SyntaxError, e:
e.filename = os.path.abspath(supplement)
raise
variables = file_data.get('variables', [])
for v in variables:
supp_items += [(FormatKeyForGN(v), str(variables[v]))]
# GYP defines from the environment.
env_items = ProcessGypDefinesItems(
shlex.split(os.environ.get('GYP_DEFINES', '')))
# GYP defines from the command line. We can't use optparse since we want
# to ignore all arguments other than "-D".
cmdline_input_items = []
for i in range(len(sys.argv))[1:]:
if sys.argv[i].startswith('-D'):
if sys.argv[i] == '-D' and i + 1 < len(sys.argv):
cmdline_input_items += [sys.argv[i + 1]]
elif len(sys.argv[i]) > 2:
cmdline_input_items += [sys.argv[i][2:]]
cmdline_items = ProcessGypDefinesItems(cmdline_input_items)
vars_dict = dict(supp_items + env_items + cmdline_items)
# It's not possible to set a default value for cpu_arch in GN, so do it here
# for now (http://crbug.com/344767).
if vars_dict.get('OS') == 'android' and not 'target_arch' in vars_dict:
vars_dict['target_arch'] = 'arm'
return vars_dict
def GetOutputDirectory():
"""Returns the output directory that GYP will use."""
# GYP generator flags from the command line. We can't use optparse since we
# want to ignore all arguments other than "-G".
needle = '-Goutput_dir='
cmdline_input_items = []
for item in sys.argv[1:]:
if item.startswith(needle):
return item[len(needle):]
env_items = shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', ''))
needle = 'output_dir='
for item in env_items:
if item.startswith(needle):
return item[len(needle):]
return "out"
def GetArgsStringForGN(vars_dict):
"""Returns the args to pass to GN.
Based on a subset of the GYP variables that have been rewritten a bit."""
gn_args = ''
# Note: These are the additional flags passed to various builds by builders
# on the main waterfall. We'll probably need to add these at some point:
# mac_strip_release=1 http://crbug.com/330301
# linux_dump_symbols=0 http://crbug.com/330300
# host_os=linux Probably can skip, GN knows the host OS.
# order_text_section=<path> http://crbug.com/330299
# chromium_win_pch=0 http://crbug.com/297678
# chromium_ios_signing=0 http://crbug.com/330302
# use_allocator=tcmalloc http://crbug.com/330303, 345554
# release_extra_flags=... http://crbug.com/330305
# These tuples of (key, value, gn_arg_string) use the gn_arg_string for
# gn when the key is set to the given value in the GYP arguments.
remap_cases = [
('android_webview_build', '1', 'is_android_webview_build=true'),
('branding', 'Chrome', 'is_chrome_branded=true'),
('build_for_tool', 'drmemory', 'disable_iterator_debugging=true'),
('build_for_tool', 'tsan', 'disable_iterator_debugging=true'),
('buildtype', 'Official', 'is_official_build=true'),
('component', 'shared_library', 'is_component_build=true'),
('clang', '1', 'is_clang=true'),
('clang_use_chrome_plugins', '0', 'clang_use_chrome_plugins=false'),
('disable_glibcxx_debug', '1', 'disable_iterator_debugging=true'),
('enable_mdns', '0', 'enable_mdns=false'),
('enable_mdns', '1', 'enable_mdns=true'),
('enable_plugins', '0', 'enable_plugins=false'),
('enable_plugins', '1', 'enable_plugins=true'),
('target_arch', 'ia32', 'cpu_arch="x86"'),
('target_arch', 'x64', 'cpu_arch="x64" force_win64=true'),
('target_arch', 'arm', 'cpu_arch="arm"'),
('target_arch', 'mipsel', 'cpu_arch="mipsel"'),
('fastbuild', '0', 'symbol_level=2'),
('fastbuild', '1', 'symbol_level=1'),
('fastbuild', '2', 'symbol_level=0'),
('OS', 'ios', 'os="ios"'),
('OS', 'android', 'os="android"'),
('chromeos', '1', 'os="chromeos"'),
('use_aura', '1', 'use_aura=true'),
('use_goma', '1', 'use_goma=true'),
('use_openssl', '0', 'use_openssl=false'),
('use_openssl', '1', 'use_openssl=true'),
('asan', '1', 'is_asan=true'),
('lsan', '1', 'is_lsan=true'),
('msan', '1', 'is_msan=true'),
('tsan', '1', 'is_tsan=true'),
]
for i in remap_cases:
if i[0] in vars_dict and vars_dict[i[0]] == i[1]:
gn_args += ' ' + i[2]
# These string arguments get passed directly as GN strings.
for v in ['android_src', 'arm_float_abi', 'ios_deployment_target',
'ios_sdk_path', 'windows_sdk_path']:
if v in vars_dict:
gn_args += ' ' + v + '=' + EscapeStringForGN(vars_dict[v])
# gomadir is renamed goma_dir in the GN build.
if 'gomadir' in vars_dict:
gn_args += ' goma_dir=%s' % EscapeStringForGN(vars_dict['gomadir'])
# Set the "use_ios_simulator" flag if the ios_sdk_path is set.
if 'ios_sdk_path' in vars_dict:
if os.path.basename(vars_dict['ios_sdk_path']).lower().startswith(
'iphonesimulator'):
gn_args += ' use_ios_simulator=true'
else:
gn_args += ' use_ios_simulator=false'
# These arguments get passed directly as integers (avoiding the quoting and
# escaping of the string ones above).
for v in ['arm_version']:
if v in vars_dict:
gn_args += ' %s=%s' % (v, vars_dict[v])
# Some other flags come from GYP environment variables.
gyp_msvs_version = os.environ.get('GYP_MSVS_VERSION', '')
if gyp_msvs_version:
gn_args += ' visual_studio_version=' + EscapeStringForGN(gyp_msvs_version)
gyp_msvs_override_path = os.environ.get('GYP_MSVS_OVERRIDE_PATH', '')
if gyp_msvs_override_path:
gn_args += ' visual_studio_path=' + \
EscapeStringForGN(gyp_msvs_override_path)
# Set the GYP flag so BUILD files know they're being invoked in GYP mode.
gn_args += ' is_gyp=true'
gyp_outdir = GetOutputDirectory()
gn_args += ' gyp_output_dir=\"%s\"' % gyp_outdir
return gn_args.strip()
def additional_include_files(supplemental_files, args=[]):
"""
Returns a list of additional (.gypi) files to include, without duplicating
ones that are already specified on the command line. The list of supplemental
include files is passed in as an argument.
"""
# Determine the include files specified on the command line.
# This doesn't cover all the different option formats you can use,
# but it's mainly intended to avoid duplicating flags on the automatic
# makefile regeneration which only uses this format.
specified_includes = set()
for arg in args:
if arg.startswith('-I') and len(arg) > 2:
specified_includes.add(os.path.realpath(arg[2:]))
result = []
def AddInclude(path):
if os.path.realpath(path) not in specified_includes:
result.append(path)
# Always include common.gypi.
AddInclude(os.path.join(script_dir, 'common.gypi'))
# Optionally add supplemental .gypi files if present.
for supplement in supplemental_files:
AddInclude(supplement)
return result
def RunGN(vars_dict):
"""Runs GN, returning True if it succeeded, printing an error and returning
false if not."""
# The binaries in platform-specific subdirectories in src/tools/gn/bin.
gnpath = SRC_DIR + '/tools/gn/bin/'
if sys.platform in ('cygwin', 'win32'):
gnpath += 'win/gn.exe'
elif sys.platform.startswith('linux'):
# On Linux we have 32-bit and 64-bit versions.
if subprocess.check_output(["getconf", "LONG_BIT"]).find("64") >= 0:
gnpath += 'linux/gn'
else:
gnpath += 'linux/gn32'
elif sys.platform == 'darwin':
gnpath += 'mac/gn'
else:
print 'Unknown platform for GN: ', sys.platform
return False
print 'Generating gyp files from GN...'
# Need to pass both the source root (the bots don't run this command from
# within the source tree) as well as set the is_gyp value so the BUILD files
# to know they're being run under GYP.
args = [gnpath, 'gyp', '-q',
'--root=' + chrome_src,
'--args=' + GetArgsStringForGN(vars_dict),
'--output=//' + GetOutputDirectory() + '/gn_build/']
return subprocess.call(args) == 0
def GetDesiredVsToolchainHashes():
"""Load a list of SHA1s corresponding to the toolchains that we want installed
to build with."""
sha1path = os.path.join(script_dir, 'toolchain_vs2013.hash')
with open(sha1path, 'rb') as f:
return f.read().strip().splitlines()
def DownloadVsToolChain():
"""Download the Visual Studio toolchain on Windows.
If on Windows, request that depot_tools install/update the automatic
toolchain, and then use it (unless opted-out) and return a tuple containing
the x64 and x86 paths. Otherwise return None.
"""
vs2013_runtime_dll_dirs = None
depot_tools_win_toolchain = \
bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1')))
if sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain:
import find_depot_tools
depot_tools_path = find_depot_tools.add_depot_tools_to_path()
temp_handle, data_file = tempfile.mkstemp(suffix='.json')
os.close(temp_handle)
get_toolchain_args = [
sys.executable,
os.path.join(depot_tools_path,
'win_toolchain',
'get_toolchain_if_necessary.py'),
'--output-json', data_file,
] + GetDesiredVsToolchainHashes()
subprocess.check_call(get_toolchain_args)
with open(data_file, 'r') as tempf:
toolchain_data = json.load(tempf)
os.unlink(data_file)
toolchain = toolchain_data['path']
version = toolchain_data['version']
version_is_pro = version[-1] != 'e'
win8sdk = toolchain_data['win8sdk']
wdk = toolchain_data['wdk']
# TODO(scottmg): The order unfortunately matters in these. They should be
# split into separate keys for x86 and x64. (See CopyVsRuntimeDlls call
# below). http://crbug.com/345992
vs2013_runtime_dll_dirs = toolchain_data['runtime_dirs']
os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain
os.environ['GYP_MSVS_VERSION'] = version
# We need to make sure windows_sdk_path is set to the automated
# toolchain values in GYP_DEFINES, but don't want to override any
# otheroptions.express
# values there.
gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES'))
gyp_defines_dict['windows_sdk_path'] = win8sdk
os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v)))
for k, v in gyp_defines_dict.iteritems())
os.environ['WINDOWSSDKDIR'] = win8sdk
os.environ['WDK_DIR'] = wdk
# Include the VS runtime in the PATH in case it's not machine-installed.
runtime_path = ';'.join(vs2013_runtime_dll_dirs)
os.environ['PATH'] = runtime_path + ';' + os.environ['PATH']
print('Using automatic toolchain in %s (%s edition).' % (
toolchain, 'Pro' if version_is_pro else 'Express'))
return vs2013_runtime_dll_dirs
def CopyVsRuntimeDlls(output_dir, runtime_dirs):
"""Copies the VS runtime DLLs from the given |runtime_dirs| to the output
directory so that even if not system-installed, built binaries are likely to
be able to run.
This needs to be run after gyp has been run so that the expected target
output directories are already created.
"""
assert sys.platform.startswith(('win32', 'cygwin'))
def copy_runtime(target_dir, source_dir, dll_pattern):
"""Copy both the msvcr and msvcp runtime DLLs, only if the target doesn't
exist, but the target directory does exist."""
for which in ('p', 'r'):
dll = dll_pattern % which
target = os.path.join(target_dir, dll)
source = os.path.join(source_dir, dll)
# If gyp generated to that output dir, and the runtime isn't already
# there, then copy it over.
if (os.path.isdir(target_dir) and
(not os.path.isfile(target) or
os.stat(target).st_mtime != os.stat(source).st_mtime)):
print 'Copying %s to %s...' % (source, target)
if os.path.exists(target):
os.unlink(target)
shutil.copy2(source, target)
x86, x64 = runtime_dirs
out_debug = os.path.join(output_dir, 'Debug')
out_debug_nacl64 = os.path.join(output_dir, 'Debug', 'x64')
out_release = os.path.join(output_dir, 'Release')
out_release_nacl64 = os.path.join(output_dir, 'Release', 'x64')
out_debug_x64 = os.path.join(output_dir, 'Debug_x64')
out_release_x64 = os.path.join(output_dir, 'Release_x64')
if os.path.exists(out_debug) and not os.path.exists(out_debug_nacl64):
os.makedirs(out_debug_nacl64)
if os.path.exists(out_release) and not os.path.exists(out_release_nacl64):
os.makedirs(out_release_nacl64)
copy_runtime(out_debug, x86, 'msvc%s120d.dll')
copy_runtime(out_release, x86, 'msvc%s120.dll')
copy_runtime(out_debug_x64, x64, 'msvc%s120d.dll')
copy_runtime(out_release_x64, x64, 'msvc%s120.dll')
copy_runtime(out_debug_nacl64, x64, 'msvc%s120d.dll')
copy_runtime(out_release_nacl64, x64, 'msvc%s120.dll')
if __name__ == '__main__':
args = sys.argv[1:]
if int(os.environ.get('GYP_CHROMIUM_NO_ACTION', 0)):
print 'Skipping gyp_chromium due to GYP_CHROMIUM_NO_ACTION env var.'
sys.exit(0)
# Use the Psyco JIT if available.
if psyco:
psyco.profile()
print "Enabled Psyco JIT."
# Fall back on hermetic python if we happen to get run under cygwin.
# TODO(bradnelson): take this out once this issue is fixed:
# http://code.google.com/p/gyp/issues/detail?id=177
if sys.platform == 'cygwin':
import find_depot_tools
depot_tools_path = find_depot_tools.add_depot_tools_to_path()
python_dir = sorted(glob.glob(os.path.join(depot_tools_path,
'python2*_bin')))[-1]
env = os.environ.copy()
env['PATH'] = python_dir + os.pathsep + env.get('PATH', '')
p = subprocess.Popen(
[os.path.join(python_dir, 'python.exe')] + sys.argv,
env=env, shell=False)
p.communicate()
sys.exit(p.returncode)
gyp_helper.apply_chromium_gyp_env()
# This could give false positives since it doesn't actually do real option
# parsing. Oh well.
gyp_file_specified = False
for arg in args:
if arg.endswith('.gyp'):
gyp_file_specified = True
break
# If we didn't get a file, check an env var, and then fall back to
# assuming 'all.gyp' from the same directory as the script.
if not gyp_file_specified:
gyp_file = os.environ.get('CHROMIUM_GYP_FILE')
if gyp_file:
# Note that CHROMIUM_GYP_FILE values can't have backslashes as
# path separators even on Windows due to the use of shlex.split().
args.extend(shlex.split(gyp_file))
else:
args.append(os.path.join(script_dir, 'all.gyp'))
# There shouldn't be a circular dependency relationship between .gyp files,
# but in Chromium's .gyp files, on non-Mac platforms, circular relationships
# currently exist. The check for circular dependencies is currently
# bypassed on other platforms, but is left enabled on the Mac, where a
# violation of the rule causes Xcode to misbehave badly.
# TODO(mark): Find and kill remaining circular dependencies, and remove this
# option. http://crbug.com/35878.
# TODO(tc): Fix circular dependencies in ChromiumOS then add linux2 to the
# list.
if sys.platform not in ('darwin',):
args.append('--no-circular-check')
# Default to make if no generator has
# explicitly been set.
if not os.environ.get('GYP_GENERATORS'):
os.environ['GYP_GENERATORS'] = 'make'
elif sys.platform == 'darwin' and not os.environ.get('GYP_GENERATORS') and \
not 'OS=ios' in os.environ.get('GYP_DEFINES', []):
os.environ['GYP_GENERATORS'] = 'make'
vs2013_runtime_dll_dirs = DownloadVsToolChain()
# If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check
# to enfore syntax checking.
syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK')
if syntax_check and int(syntax_check):
args.append('--check')
supplemental_includes = GetSupplementalFiles()
gn_vars_dict = GetGypVarsForGN(supplemental_includes)
# Automatically turn on crosscompile support for platforms that need it.
# (The Chrome OS build sets CC_host / CC_target which implicitly enables
# this mode.)
if all(('ninja' in os.environ.get('GYP_GENERATORS', ''),
gn_vars_dict.get('OS') in ['android', 'ios'],
'GYP_CROSSCOMPILE' not in os.environ)):
os.environ['GYP_CROSSCOMPILE'] = '1'
# TODO(brettw) bug 350974 either turn back on GN or delete all of this code.
#if not RunGN(gn_vars_dict):
# sys.exit(1)
args.extend(
['-I' + i for i in additional_include_files(supplemental_includes, args)])
args.extend(['-D', 'gyp_output_dir=' + GetOutputDirectory()])
print 'Updating projects from gyp files...'
sys.stdout.flush()
# Off we go...
gyp_rc = gyp.main(args)
# Check for landmines (reasons to clobber the build). This must be run here,
# rather than a separate runhooks step so that any environment modifications
# from above are picked up.
print 'Running build/landmines.py...'
subprocess.check_call(
[sys.executable, os.path.join(script_dir, 'landmines.py')])
if vs2013_runtime_dll_dirs:
x64_runtime, x86_runtime = vs2013_runtime_dll_dirs
CopyVsRuntimeDlls(os.path.join(chrome_src, GetOutputDirectory()),
(x86_runtime, x64_runtime))
sys.exit(gyp_rc)
+54
View File
@@ -0,0 +1,54 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file helps gyp_chromium and landmines correctly set up the gyp
# environment from chromium.gyp_env on disk
import os
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
CHROME_SRC = os.path.dirname(SCRIPT_DIR)
def apply_gyp_environment_from_file(file_path):
"""Reads in a *.gyp_env file and applies the valid keys to os.environ."""
if not os.path.exists(file_path):
return
with open(file_path, 'rU') as f:
file_contents = f.read()
try:
file_data = eval(file_contents, {'__builtins__': None}, None)
except SyntaxError, e:
e.filename = os.path.abspath(file_path)
raise
supported_vars = (
'CC',
'CC_wrapper',
'CHROMIUM_GYP_FILE',
'CHROMIUM_GYP_SYNTAX_CHECK',
'CXX',
'CXX_wrapper',
'GYP_DEFINES',
'GYP_GENERATOR_FLAGS',
'GYP_CROSSCOMPILE',
'GYP_GENERATOR_OUTPUT',
'GYP_GENERATORS',
'GYP_MSVS_VERSION',
)
for var in supported_vars:
file_val = file_data.get(var)
if file_val:
if var in os.environ:
print 'INFO: Environment value for "%s" overrides value in %s.' % (
var, os.path.abspath(file_path)
)
else:
os.environ[var] = file_val
def apply_chromium_gyp_env():
if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ:
# Update the environment based on chromium.gyp_env
path = os.path.join(os.path.dirname(CHROME_SRC), 'chromium.gyp_env')
apply_gyp_environment_from_file(path)
+166
View File
@@ -0,0 +1,166 @@
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'install_path': '<(DEPTH)/install',
'version_py_path': '<(DEPTH)/build/version.py',
'version_path': '<(DEPTH)/net/instaweb/public/VERSION',
'lastchange_path': '<(SHARED_INTERMEDIATE_DIR)/build/LASTCHANGE',
'branding_dir': '<(install_path)/common',
},
'conditions': [
['OS=="linux"', {
'variables': {
'version' : '<!(python <(version_py_path) -f <(version_path) -t "@MAJOR@.@MINOR@.@BUILD@.@PATCH@")',
'revision' : '<!(if [ -f <(DEPTH)/LASTCHANGE.in ]; then cat <(DEPTH)/LASTCHANGE.in | cut -d= -f2; else git rev-list --all --count; fi)',
'packaging_files_common': [
'<(install_path)/common/apt.include',
'<(install_path)/common/mod-pagespeed/mod-pagespeed.info',
'<(install_path)/common/installer.include',
'<(install_path)/common/repo.cron',
'<(install_path)/common/rpm.include',
'<(install_path)/common/rpmrepo.cron',
'<(install_path)/common/updater',
'<(install_path)/common/variables.include',
'<(install_path)/common/BRANDING',
'<(install_path)/common/pagespeed.load.template',
'<(install_path)/common/pagespeed.conf.template',
],
'packaging_files_deb': [
'<(install_path)/debian/build.sh',
'<(install_path)/debian/changelog.template',
'<(install_path)/debian/conffiles',
'<(install_path)/debian/control.template',
'<(install_path)/debian/postinst',
'<(install_path)/debian/postrm',
'<(install_path)/debian/prerm',
],
'packaging_files_rpm': [
'<(install_path)/rpm/build.sh',
'<(install_path)/rpm/mod-pagespeed.spec.template',
],
'packaging_files_binaries': [
'<(PRODUCT_DIR)/libmod_pagespeed.so',
'<(PRODUCT_DIR)/libmod_pagespeed_ap24.so',
],
'flock_bash': ['flock', '--', '/tmp/linux_package_lock', 'bash'],
'deb_build': '<(PRODUCT_DIR)/install/debian/build.sh',
'rpm_build': '<(PRODUCT_DIR)/install/rpm/build.sh',
'deb_cmd': ['<@(flock_bash)', '<(deb_build)', '-o' '<(PRODUCT_DIR)',
'-b', '<(PRODUCT_DIR)', '-a', '<(target_arch)'],
'rpm_cmd': ['<@(flock_bash)', '<(rpm_build)', '-o' '<(PRODUCT_DIR)',
'-b', '<(PRODUCT_DIR)', '-a', '<(target_arch)'],
'conditions': [
['target_arch=="ia32"', {
'deb_arch': 'i386',
'rpm_arch': 'i386',
}],
['target_arch=="x64"', {
'deb_arch': 'amd64',
'rpm_arch': 'x86_64',
}],
],
},
'targets': [
{
'target_name': 'linux_installer_configs',
'type': 'none',
# Add these files to the build output so the build archives will be
# "hermetic" for packaging.
'copies': [
{
'destination': '<(PRODUCT_DIR)/install/debian/',
'files': [
'<@(packaging_files_deb)',
]
},
{
'destination': '<(PRODUCT_DIR)/install/rpm/',
'files': [
'<@(packaging_files_rpm)',
]
},
{
'destination': '<(PRODUCT_DIR)/install/common/',
'files': [
'<@(packaging_files_common)',
]
},
],
'actions': [
{
'action_name': 'save_build_info',
'inputs': [
'<(branding_dir)/BRANDING',
'<(version_path)',
'<(lastchange_path)',
],
'outputs': [
'<(PRODUCT_DIR)/installer/version.txt',
],
# Just output the default version info variables.
'action': [
'python', '<(version_py_path)',
'-f', '<(branding_dir)/BRANDING',
'-f', '<(version_path)',
'-f', '<(lastchange_path)',
'-o', '<@(_outputs)'
],
},
],
},
{
'target_name': 'linux_package_deb_stable',
'suppress_wildcard': 1,
'variables': {
'channel': 'stable',
},
'includes': [
'linux_package_deb.gypi',
],
},
{
'target_name': 'linux_package_deb_beta',
'suppress_wildcard': 1,
'variables': {
'channel': 'beta',
},
'includes': [
'linux_package_deb.gypi',
],
},
{
'target_name': 'linux_package_rpm_stable',
'suppress_wildcard': 1,
'variables': {
'channel': 'stable',
},
'includes': [
'linux_package_rpm.gypi',
],
},
{
'target_name': 'linux_package_rpm_beta',
'suppress_wildcard': 1,
'variables': {
'channel': 'beta',
},
'includes': [
'linux_package_rpm.gypi',
],
},
],
},{
'targets': [
],
}],
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
+398
View File
@@ -0,0 +1,398 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file is meant to be included into a target to provide a rule
# to build Java in a consistent manner.
#
# To use this, create a gyp target with the following form:
# {
# 'target_name': 'my-package_java',
# 'type': 'none',
# 'variables': {
# 'java_in_dir': 'path/to/package/root',
# },
# 'includes': ['path/to/this/gypi/file'],
# }
#
# Required variables:
# java_in_dir - The top-level java directory. The src should be in
# <java_in_dir>/src.
# Optional/automatic variables:
# additional_input_paths - These paths will be included in the 'inputs' list to
# ensure that this target is rebuilt when one of these paths changes.
# additional_src_dirs - Additional directories with .java files to be compiled
# and included in the output of this target.
# generated_src_dirs - Same as additional_src_dirs except used for .java files
# that are generated at build time. This should be set automatically by a
# target's dependencies. The .java files in these directories are not
# included in the 'inputs' list (unlike additional_src_dirs).
# input_jars_paths - The path to jars to be included in the classpath. This
# should be filled automatically by depending on the appropriate targets.
# javac_includes - A list of specific files to include. This is by default
# empty, which leads to inclusion of all files specified. May include
# wildcard, and supports '**/' for recursive path wildcards, ie.:
# '**/MyFileRegardlessOfDirectory.java', '**/IncludedPrefix*.java'.
# has_java_resources - Set to 1 if the java target contains an
# Android-compatible resources folder named res. If 1, R_package and
# R_package_relpath must also be set.
# R_package - The java package in which the R class (which maps resources to
# integer IDs) should be generated, e.g. org.chromium.content.
# R_package_relpath - Same as R_package, but replace each '.' with '/'.
# java_strings_grd - The name of the grd file from which to generate localized
# strings.xml files, if any.
# res_extra_dirs - A list of extra directories containing Android resources.
# These directories may be generated at build time.
# res_extra_files - A list of the files in res_extra_dirs.
# never_lint - Set to 1 to not run lint on this target.
{
'dependencies': [
'<(DEPTH)/build/android/setup.gyp:build_output_dirs'
],
'variables': {
'android_jar': '<(android_sdk)/android.jar',
'input_jars_paths': [ '<(android_jar)' ],
'additional_src_dirs': [],
'javac_includes': [],
'jar_name': '<(_target_name).jar',
'jar_dir': '<(PRODUCT_DIR)/lib.java',
'jar_path': '<(intermediate_dir)/<(jar_name)',
'jar_final_path': '<(jar_dir)/<(jar_name)',
'jar_excluded_classes': [ '*/R.class', '*/R##*.class' ],
'instr_stamp': '<(intermediate_dir)/instr.stamp',
'additional_input_paths': [],
'dex_path': '<(PRODUCT_DIR)/lib.java/<(_target_name).dex.jar',
'generated_src_dirs': ['>@(generated_R_dirs)'],
'generated_R_dirs': [],
'has_java_resources%': 0,
'java_strings_grd%': '',
'res_extra_dirs': [],
'res_extra_files': [],
'res_v14_verify_only%': 0,
'resource_input_paths': ['>@(res_extra_files)'],
'intermediate_dir': '<(SHARED_INTERMEDIATE_DIR)/<(_target_name)',
'classes_dir': '<(intermediate_dir)/classes',
'compile_stamp': '<(intermediate_dir)/compile.stamp',
'lint_stamp': '<(intermediate_dir)/lint.stamp',
'lint_result': '<(intermediate_dir)/lint_result.xml',
'lint_config': '<(intermediate_dir)/lint_config.xml',
'never_lint%': 0,
'proguard_config%': '',
'proguard_preprocess%': '0',
'variables': {
'variables': {
'proguard_preprocess%': 0,
'emma_never_instrument%': 0,
},
'conditions': [
['proguard_preprocess == 1', {
'javac_jar_path': '<(intermediate_dir)/<(_target_name).pre.jar'
}, {
'javac_jar_path': '<(jar_path)'
}],
['chromium_code != 0 and emma_coverage != 0 and emma_never_instrument == 0', {
'emma_instrument': 1,
}, {
'emma_instrument': 0,
}],
],
},
'emma_instrument': '<(emma_instrument)',
'javac_jar_path': '<(javac_jar_path)',
},
# This all_dependent_settings is used for java targets only. This will add the
# jar path to the classpath of dependent java targets.
'all_dependent_settings': {
'variables': {
'input_jars_paths': ['<(jar_final_path)'],
'library_dexed_jars_paths': ['<(dex_path)'],
},
},
'conditions': [
['has_java_resources == 1', {
'variables': {
'res_dir': '<(java_in_dir)/res',
'res_crunched_dir': '<(intermediate_dir)/res_crunched',
'res_v14_compatibility_stamp': '<(intermediate_dir)/res_v14_compatibility.stamp',
'res_v14_compatibility_dir': '<(intermediate_dir)/res_v14_compatibility',
'res_input_dirs': ['<(res_dir)', '<@(res_extra_dirs)'],
'resource_input_paths': ['<!@(find <(res_dir) -type f)'],
'R_dir': '<(intermediate_dir)/java_R',
'R_text_file': '<(R_dir)/R.txt',
'R_stamp': '<(intermediate_dir)/resources.stamp',
'generated_src_dirs': ['<(R_dir)'],
'additional_input_paths': ['<(R_stamp)',
'<(res_v14_compatibility_stamp)',],
'additional_res_dirs': [],
'dependencies_res_input_dirs': [],
'dependencies_res_files': [],
},
'all_dependent_settings': {
'variables': {
# Dependent jars include this target's R.java file via
# generated_R_dirs and include its resources via
# dependencies_res_files.
'generated_R_dirs': ['<(R_dir)'],
'additional_input_paths': ['<(R_stamp)',
'<(res_v14_compatibility_stamp)',],
'dependencies_res_files': ['<@(resource_input_paths)'],
'dependencies_res_input_dirs': ['<@(res_input_dirs)'],
# Dependent APKs include this target's resources via
# additional_res_dirs, additional_res_packages, and
# additional_R_text_files.
'additional_res_dirs': ['<(res_crunched_dir)',
'<(res_v14_compatibility_dir)',
'<@(res_input_dirs)'],
'additional_res_packages': ['<(R_package)'],
'additional_R_text_files': ['<(R_text_file)'],
},
},
'conditions': [
['java_strings_grd != ""', {
'variables': {
'res_grit_dir': '<(intermediate_dir)/res_grit',
'res_input_dirs': ['<(res_grit_dir)'],
'grit_grd_file': '<(java_in_dir)/strings/<(java_strings_grd)',
'resource_input_paths': ['<!@pymod_do_main(grit_info <@(grit_defines) --outputs "<(res_grit_dir)" <(grit_grd_file))'],
},
'actions': [
{
'action_name': 'generate_localized_strings_xml',
'variables': {
'grit_additional_defines': ['-E', 'ANDROID_JAVA_TAGGED_ONLY=false'],
'grit_out_dir': '<(res_grit_dir)',
# resource_ids is unneeded since we don't generate .h headers.
'grit_resource_ids': '',
},
'includes': ['../build/grit_action.gypi'],
},
],
}],
],
'actions': [
# Generate R.java and crunch image resources.
{
'action_name': 'process_resources',
'message': 'processing resources for <(_target_name)',
'variables': {
'android_manifest': '<(DEPTH)/build/android/AndroidManifest.xml',
# Include the dependencies' res dirs so that references to
# resources in dependencies can be resolved.
'all_res_dirs': ['<@(res_input_dirs)',
'>@(dependencies_res_input_dirs)',],
# Write the inputs list to a file, so that the action command
# line won't exceed the OS limits when calculating the checksum
# of the list.
'inputs_list_file': '>|(inputs_list.<(_target_name).gypcmd >@(_inputs))'
},
'inputs': [
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/process_resources.py',
'>@(resource_input_paths)',
'>@(dependencies_res_files)',
],
'outputs': [
'<(R_stamp)',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/process_resources.py',
'--android-sdk', '<(android_sdk)',
'--android-sdk-tools', '<(android_sdk_tools)',
'--R-dir', '<(R_dir)',
'--res-dirs', '>(all_res_dirs)',
'--crunch-input-dir', '>(res_dir)',
'--crunch-output-dir', '<(res_crunched_dir)',
'--android-manifest', '<(android_manifest)',
'--non-constant-id',
'--custom-package', '<(R_package)',
'--stamp', '<(R_stamp)',
# Add hash of inputs to the command line, so if inputs change
# (e.g. if a resource if removed), the command will be re-run.
# TODO(newt): remove this once crbug.com/177552 is fixed in ninja.
'--ignore=>!(md5sum >(inputs_list_file))',
],
},
# Generate API 14 resources.
{
'action_name': 'generate_api_14_resources_<(_target_name)',
'message': 'Generating Android API 14 resources <(_target_name)',
'variables' : {
'res_v14_additional_options': [],
},
'conditions': [
['res_v14_verify_only == 1', {
'variables': {
'res_v14_additional_options': ['--verify-only']
},
}],
],
'inputs': [
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/generate_v14_compatible_resources.py',
'>@(resource_input_paths)',
],
'outputs': [
'<(res_v14_compatibility_stamp)',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/generate_v14_compatible_resources.py',
'--res-dir=<(res_dir)',
'--res-v14-compatibility-dir=<(res_v14_compatibility_dir)',
'--stamp', '<(res_v14_compatibility_stamp)',
'<@(res_v14_additional_options)',
]
},
],
}],
['proguard_preprocess == 1', {
'actions': [
{
'action_name': 'proguard_<(_target_name)',
'message': 'Proguard preprocessing <(_target_name) jar',
'inputs': [
'<(android_sdk_root)/tools/proguard/bin/proguard.sh',
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/proguard.py',
'<(javac_jar_path)',
'<(proguard_config)',
],
'outputs': [
'<(jar_path)',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/proguard.py',
'--proguard-path=<(android_sdk_root)/tools/proguard/bin/proguard.sh',
'--input-path=<(javac_jar_path)',
'--output-path=<(jar_path)',
'--proguard-config=<(proguard_config)',
'--classpath=<(android_sdk_jar) >(input_jars_paths)',
]
},
],
}],
],
'actions': [
{
'action_name': 'javac_<(_target_name)',
'message': 'Compiling <(_target_name) java sources',
'variables': {
'all_src_dirs': [
'>(java_in_dir)/src',
'>@(additional_src_dirs)',
'>@(generated_src_dirs)',
],
},
'inputs': [
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/javac.py',
'>!@(find >(java_in_dir)/src >(additional_src_dirs) -name "*.java")',
'>@(input_jars_paths)',
'>@(additional_input_paths)',
],
'outputs': [
'<(compile_stamp)',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/javac.py',
'--output-dir=<(classes_dir)',
'--classpath=>(input_jars_paths)',
'--src-dirs=>(all_src_dirs)',
'--javac-includes=<(javac_includes)',
'--chromium-code=<(chromium_code)',
'--stamp=<(compile_stamp)',
# TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja.
'--ignore=>!(echo \'>(_inputs)\' | md5sum)',
]
},
{
'variables': {
'src_dirs': [
'<(java_in_dir)/src',
'>@(additional_src_dirs)',
],
'stamp_path': '<(lint_stamp)',
'result_path': '<(lint_result)',
'config_path': '<(lint_config)',
},
'inputs': [
'<(compile_stamp)',
],
'outputs': [
'<(lint_stamp)',
],
'includes': [ 'android/lint_action.gypi' ],
},
{
'action_name': 'jar_<(_target_name)',
'message': 'Creating <(_target_name) jar',
'inputs': [
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/util/md5_check.py',
'<(DEPTH)/build/android/gyp/jar.py',
'<(compile_stamp)',
],
'outputs': [
'<(javac_jar_path)',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/jar.py',
'--classes-dir=<(classes_dir)',
'--jar-path=<(javac_jar_path)',
'--excluded-classes=<(jar_excluded_classes)',
]
},
{
'action_name': 'instr_jar_<(_target_name)',
'message': 'Instrumenting <(_target_name) jar',
'variables': {
'input_path': '<(jar_path)',
'output_path': '<(jar_final_path)',
'stamp_path': '<(instr_stamp)',
'instr_type': 'jar',
},
'outputs': [
'<(jar_final_path)',
],
'inputs': [
'<(jar_path)',
],
'includes': [ 'android/instr_action.gypi' ],
},
{
'action_name': 'jar_toc_<(_target_name)',
'message': 'Creating <(_target_name) jar.TOC',
'inputs': [
'<(DEPTH)/build/android/gyp/util/build_utils.py',
'<(DEPTH)/build/android/gyp/util/md5_check.py',
'<(DEPTH)/build/android/gyp/jar_toc.py',
'<(jar_final_path)',
],
'outputs': [
'<(jar_final_path).TOC',
],
'action': [
'python', '<(DEPTH)/build/android/gyp/jar_toc.py',
'--jar-path=<(jar_final_path)',
'--toc-path=<(jar_final_path).TOC',
]
},
{
'action_name': 'dex_<(_target_name)',
'variables': {
'conditions': [
['emma_instrument != 0', {
'dex_no_locals': 1,
}],
],
'dex_input_paths': [ '<(jar_final_path)' ],
'output_path': '<(dex_path)',
},
'includes': [ 'android/dex_action.gypi' ],
},
],
}
+114
View File
@@ -0,0 +1,114 @@
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import functools
import logging
import os
import shlex
import sys
def memoize(default=None):
"""This decorator caches the return value of a parameterless pure function"""
def memoizer(func):
val = []
@functools.wraps(func)
def inner():
if not val:
ret = func()
val.append(ret if ret is not None else default)
if logging.getLogger().isEnabledFor(logging.INFO):
print '%s -> %r' % (func.__name__, val[0])
return val[0]
return inner
return memoizer
@memoize()
def IsWindows():
return sys.platform in ['win32', 'cygwin']
@memoize()
def IsLinux():
return sys.platform.startswith(('linux', 'freebsd'))
@memoize()
def IsMac():
return sys.platform == 'darwin'
@memoize()
def gyp_defines():
"""Parses and returns GYP_DEFINES env var as a dictionary."""
return dict(arg.split('=', 1)
for arg in shlex.split(os.environ.get('GYP_DEFINES', '')))
@memoize()
def gyp_msvs_version():
return os.environ.get('GYP_MSVS_VERSION', '')
@memoize()
def distributor():
"""
Returns a string which is the distributed build engine in use (if any).
Possible values: 'goma', 'ib', ''
"""
if 'goma' in gyp_defines():
return 'goma'
elif IsWindows():
if 'CHROME_HEADLESS' in os.environ:
return 'ib' # use (win and !goma and headless) as approximation of ib
@memoize()
def platform():
"""
Returns a string representing the platform this build is targetted for.
Possible values: 'win', 'mac', 'linux', 'ios', 'android'
"""
if 'OS' in gyp_defines():
if 'android' in gyp_defines()['OS']:
return 'android'
else:
return gyp_defines()['OS']
elif IsWindows():
return 'win'
elif IsLinux():
return 'linux'
else:
return 'mac'
@memoize()
def builder():
"""
Returns a string representing the build engine (not compiler) to use.
Possible values: 'make', 'ninja', 'xcode', 'msvs', 'scons'
"""
if 'GYP_GENERATORS' in os.environ:
# for simplicity, only support the first explicit generator
generator = os.environ['GYP_GENERATORS'].split(',')[0]
if generator.endswith('-android'):
return generator.split('-')[0]
elif generator.endswith('-ninja'):
return 'ninja'
else:
return generator
else:
if platform() == 'android':
# Good enough for now? Do any android bots use make?
return 'ninja'
elif platform() == 'ios':
return 'xcode'
elif IsWindows():
return 'ninja'
elif IsLinux():
return 'ninja'
elif IsMac():
return 'ninja'
else:
assert False, 'Don\'t know what builder we\'re using!'
+132
View File
@@ -0,0 +1,132 @@
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
This script runs every build as a hook. If it detects that the build should
be clobbered, it will touch the file <build_dir>/.landmine_triggered. The
various build scripts will then check for the presence of this file and clobber
accordingly. The script will also emit the reasons for the clobber to stdout.
A landmine is tripped when a builder checks out a different revision, and the
diff between the new landmines and the old ones is non-null. At this point, the
build is clobbered.
"""
import difflib
import logging
import optparse
import os
import sys
import subprocess
import time
import landmine_utils
SRC_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
def get_target_build_dir(build_tool, target, is_iphone=False):
"""
Returns output directory absolute path dependent on build and targets.
Examples:
r'c:\b\build\slave\win\build\src\out\Release'
'/mnt/data/b/build/slave/linux/build/src/out/Debug'
'/b/build/slave/ios_rel_device/build/src/xcodebuild/Release-iphoneos'
Keep this function in sync with tools/build/scripts/slave/compile.py
"""
ret = None
if build_tool == 'xcode':
ret = os.path.join(SRC_DIR, 'xcodebuild',
target + ('-iphoneos' if is_iphone else ''))
elif build_tool in ['make', 'ninja', 'ninja-ios']: # TODO: Remove ninja-ios.
ret = os.path.join(SRC_DIR, 'out', target)
elif build_tool in ['msvs', 'vs', 'ib']:
ret = os.path.join(SRC_DIR, 'build', target)
else:
raise NotImplementedError('Unexpected GYP_GENERATORS (%s)' % build_tool)
return os.path.abspath(ret)
def set_up_landmines(target, new_landmines):
"""Does the work of setting, planting, and triggering landmines."""
out_dir = get_target_build_dir(landmine_utils.builder(), target,
landmine_utils.platform() == 'ios')
landmines_path = os.path.join(out_dir, '.landmines')
if not os.path.exists(out_dir):
os.makedirs(out_dir)
if not os.path.exists(landmines_path):
with open(landmines_path, 'w') as f:
f.writelines(new_landmines)
else:
triggered = os.path.join(out_dir, '.landmines_triggered')
with open(landmines_path, 'r') as f:
old_landmines = f.readlines()
if old_landmines != new_landmines:
old_date = time.ctime(os.stat(landmines_path).st_ctime)
diff = difflib.unified_diff(old_landmines, new_landmines,
fromfile='old_landmines', tofile='new_landmines',
fromfiledate=old_date, tofiledate=time.ctime(), n=0)
with open(triggered, 'w') as f:
f.writelines(diff)
elif os.path.exists(triggered):
# Remove false triggered landmines.
os.remove(triggered)
def process_options():
"""Returns a list of landmine emitting scripts."""
parser = optparse.OptionParser()
parser.add_option(
'-s', '--landmine-scripts', action='append',
default=[os.path.join(SRC_DIR, 'build', 'get_landmines.py')],
help='Path to the script which emits landmines to stdout. The target '
'is passed to this script via option -t. Note that an extra '
'script can be specified via an env var EXTRA_LANDMINES_SCRIPT.')
parser.add_option('-v', '--verbose', action='store_true',
default=('LANDMINES_VERBOSE' in os.environ),
help=('Emit some extra debugging information (default off). This option '
'is also enabled by the presence of a LANDMINES_VERBOSE environment '
'variable.'))
options, args = parser.parse_args()
if args:
parser.error('Unknown arguments %s' % args)
logging.basicConfig(
level=logging.DEBUG if options.verbose else logging.ERROR)
extra_script = os.environ.get('EXTRA_LANDMINES_SCRIPT')
if extra_script:
return options.landmine_scripts + [extra_script]
else:
return options.landmine_scripts
def main():
landmine_scripts = process_options()
if landmine_utils.builder() == 'dump_dependency_json':
return 0
for target in ('Debug', 'Release', 'Debug_x64', 'Release_x64'):
landmines = []
for s in landmine_scripts:
proc = subprocess.Popen([sys.executable, s, '-t', target],
stdout=subprocess.PIPE)
output, _ = proc.communicate()
landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()])
set_up_landmines(target, landmines)
return 0
if __name__ == '__main__':
sys.exit(main())
+55
View File
@@ -0,0 +1,55 @@
#!/bin/sh
#
# Copyright 2013 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: morlovich@google.com (Maksim Orlovich)
#
# Determine last git revision containing an actual change on a given branch
# Usage: lastchange.sh gitpath [-d default_file] [-o out_file]
set -e
set -u
SVN_PATH=$1
shift 1
DEFAULT_FILE=
OUT_FILE=/dev/stdout
while [ $# -ge 2 ]; do
case $1 in
-d)
# -d has no effect if file doesn't exist.
if [ -f $2 ]; then
DEFAULT_FILE=$2
fi
shift 2
;;
-o)
OUT_FILE=$2
shift 2
;;
*)
echo "Usage: lastchange.sh gitpath [-d default_file] [-o out_file]"
exit 1
;;
esac
done
if [ -z $DEFAULT_FILE ]; then
KEY='Last Changed Rev: '
REVISION=$(git rev-list --all --count)
echo LASTCHANGE=$REVISION > $OUT_FILE
else
cat $DEFAULT_FILE > $OUT_FILE
fi
+25
View File
@@ -0,0 +1,25 @@
# Copyright 2013 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: morlovich@google.com (Maksim Orlovich)
#
# This simply forwards to the Chromium's lastchange.py script, but runs it
# from the mod_pagespeed repo so it gets the mod_pagespeed revision and not
# the chromium one.
import sys
sys.path.append('util')
from lastchange import main
if __name__ == '__main__':
sys.exit(main())
+170
View File
@@ -0,0 +1,170 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'libwebp_dec',
'type': 'static_library',
'dependencies' : [
'libwebp_dsp',
'libwebp_dsp_neon',
'libwebp_mux',
'libwebp_utils',
],
'sources': [
'<(DEPTH)/third_party/libwebp/src/dec/alpha.c',
'<(DEPTH)/third_party/libwebp/src/dec/buffer.c',
'<(DEPTH)/third_party/libwebp/src/dec/frame.c',
'<(DEPTH)/third_party/libwebp/src/dec/idec.c',
'<(DEPTH)/third_party/libwebp/src/dec/io.c',
'<(DEPTH)/third_party/libwebp/src/dec/quant.c',
'<(DEPTH)/third_party/libwebp/src/dec/tree.c',
'<(DEPTH)/third_party/libwebp/src/dec/vp8.c',
'<(DEPTH)/third_party/libwebp/src/dec/vp8l.c',
'<(DEPTH)/third_party/libwebp/src/dec/webp.c',
],
'direct_dependent_settings': {
'include_dirs': [
'<(DEPTH)/third_party/libwebp/src/webp'
],
},
},
{
'target_name': 'libwebp_dsp',
'type': 'static_library',
'sources': [
'<(DEPTH)/third_party/libwebp/src/dsp/alpha_processing.c',
'<(DEPTH)/third_party/libwebp/src/dsp/alpha_processing_mips_dsp_r2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/alpha_processing_sse2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/alpha_processing_sse41.c',
'<(DEPTH)/third_party/libwebp/src/dsp/argb.c',
'<(DEPTH)/third_party/libwebp/src/dsp/argb_mips_dsp_r2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/argb_sse2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/cost.c',
'<(DEPTH)/third_party/libwebp/src/dsp/cost_mips32.c',
'<(DEPTH)/third_party/libwebp/src/dsp/cost_mips_dsp_r2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/cost_sse2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/cpu.c',
'<(DEPTH)/third_party/libwebp/src/dsp/dec.c',
'<(DEPTH)/third_party/libwebp/src/dsp/dec_clip_tables.c',
'<(DEPTH)/third_party/libwebp/src/dsp/dec_mips32.c',
'<(DEPTH)/third_party/libwebp/src/dsp/dec_mips_dsp_r2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/dec_sse2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/dec_sse41.c',
'<(DEPTH)/third_party/libwebp/src/dsp/enc.c',
'<(DEPTH)/third_party/libwebp/src/dsp/enc_avx2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/enc_mips32.c',
'<(DEPTH)/third_party/libwebp/src/dsp/enc_mips_dsp_r2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/enc_sse2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/enc_sse41.c',
'<(DEPTH)/third_party/libwebp/src/dsp/filters.c',
'<(DEPTH)/third_party/libwebp/src/dsp/filters_mips_dsp_r2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/filters_sse2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/lossless.c',
'<(DEPTH)/third_party/libwebp/src/dsp/lossless_enc.c',
'<(DEPTH)/third_party/libwebp/src/dsp/lossless_enc_mips32.c',
'<(DEPTH)/third_party/libwebp/src/dsp/lossless_enc_mips_dsp_r2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/lossless_enc_sse2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/lossless_enc_sse41.c',
'<(DEPTH)/third_party/libwebp/src/dsp/lossless_mips_dsp_r2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/lossless_sse2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/rescaler.c',
'<(DEPTH)/third_party/libwebp/src/dsp/rescaler_mips32.c',
'<(DEPTH)/third_party/libwebp/src/dsp/rescaler_mips_dsp_r2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/rescaler_sse2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/upsampling.c',
'<(DEPTH)/third_party/libwebp/src/dsp/upsampling_mips_dsp_r2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/upsampling_sse2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/yuv.c',
'<(DEPTH)/third_party/libwebp/src/dsp/yuv_mips32.c',
'<(DEPTH)/third_party/libwebp/src/dsp/yuv_mips_dsp_r2.c',
'<(DEPTH)/third_party/libwebp/src/dsp/yuv_sse2.c',
],
},
{
'target_name': 'libwebp_dsp_neon',
'type': 'static_library',
'sources': [
'<(DEPTH)/third_party/libwebp/src/dsp/dec_neon.c',
'<(DEPTH)/third_party/libwebp/src/dsp/enc_neon.c',
'<(DEPTH)/third_party/libwebp/src/dsp/lossless_enc_neon.c',
'<(DEPTH)/third_party/libwebp/src/dsp/lossless_neon.c',
'<(DEPTH)/third_party/libwebp/src/dsp/rescaler_neon.c',
'<(DEPTH)/third_party/libwebp/src/dsp/upsampling_neon.c',
],
},
{
'target_name': 'libwebp_enc',
'type': 'static_library',
# note these dependencies are shared with libwebp_dec, if they are merged
# into each lib causing duplicate symbol issues when both are used then
# the deps could be split to enc/dec parts or a combined libwebp target
# could be added similar to chrome.
'dependencies' : [
'libwebp_dsp',
'libwebp_dsp_neon',
'libwebp_mux',
'libwebp_utils',
],
'sources': [
'<(DEPTH)/third_party/libwebp/src/enc/alpha.c',
'<(DEPTH)/third_party/libwebp/src/enc/analysis.c',
'<(DEPTH)/third_party/libwebp/src/enc/backward_references.c',
'<(DEPTH)/third_party/libwebp/src/enc/config.c',
'<(DEPTH)/third_party/libwebp/src/enc/cost.c',
'<(DEPTH)/third_party/libwebp/src/enc/delta_palettization.c',
'<(DEPTH)/third_party/libwebp/src/enc/filter.c',
'<(DEPTH)/third_party/libwebp/src/enc/frame.c',
'<(DEPTH)/third_party/libwebp/src/enc/histogram.c',
'<(DEPTH)/third_party/libwebp/src/enc/iterator.c',
'<(DEPTH)/third_party/libwebp/src/enc/near_lossless.c',
'<(DEPTH)/third_party/libwebp/src/enc/picture.c',
'<(DEPTH)/third_party/libwebp/src/enc/picture_csp.c',
'<(DEPTH)/third_party/libwebp/src/enc/picture_psnr.c',
'<(DEPTH)/third_party/libwebp/src/enc/picture_rescale.c',
'<(DEPTH)/third_party/libwebp/src/enc/picture_tools.c',
'<(DEPTH)/third_party/libwebp/src/enc/quant.c',
'<(DEPTH)/third_party/libwebp/src/enc/syntax.c',
'<(DEPTH)/third_party/libwebp/src/enc/token.c',
'<(DEPTH)/third_party/libwebp/src/enc/tree.c',
'<(DEPTH)/third_party/libwebp/src/enc/vp8l.c',
'<(DEPTH)/third_party/libwebp/src/enc/webpenc.c',
],
'direct_dependent_settings': {
'include_dirs': [
'<(DEPTH)/third_party/libwebp/src/webp'
],
},
},
{
'target_name': 'libwebp_utils',
'type': 'static_library',
'sources': [
'<(DEPTH)/third_party/libwebp/src/utils/bit_reader.c',
'<(DEPTH)/third_party/libwebp/src/utils/bit_writer.c',
'<(DEPTH)/third_party/libwebp/src/utils/color_cache.c',
'<(DEPTH)/third_party/libwebp/src/utils/filters.c',
'<(DEPTH)/third_party/libwebp/src/utils/huffman.c',
'<(DEPTH)/third_party/libwebp/src/utils/huffman_encode.c',
'<(DEPTH)/third_party/libwebp/src/utils/quant_levels.c',
'<(DEPTH)/third_party/libwebp/src/utils/quant_levels_dec.c',
'<(DEPTH)/third_party/libwebp/src/utils/random.c',
'<(DEPTH)/third_party/libwebp/src/utils/rescaler.c',
'<(DEPTH)/third_party/libwebp/src/utils/thread.c',
'<(DEPTH)/third_party/libwebp/src/utils/utils.c',
],
},
{
'target_name': 'libwebp_mux',
'type': 'static_library',
'sources': [
'<(DEPTH)/third_party/libwebp/src/mux/anim_encode.c',
'<(DEPTH)/third_party/libwebp/src/mux/muxedit.c',
'<(DEPTH)/third_party/libwebp/src/mux/muxinternal.c',
'<(DEPTH)/third_party/libwebp/src/mux/muxread.c',
],
},
],
}
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Outputs host CPU architecture in format recognized by gyp."""
import platform
import re
import sys
def main():
host_arch = platform.machine()
# Convert machine type to format recognized by gyp.
if re.match(r'i.86', host_arch) or host_arch == 'i86pc':
host_arch = 'ia32'
elif host_arch in ['x86_64', 'amd64']:
host_arch = 'x64'
elif host_arch.startswith('arm'):
host_arch = 'arm'
# platform.machine is based on running kernel. It's possible to use 64-bit
# kernel with 32-bit userland, e.g. to give linker slightly more memory.
# Distinguish between different userland bitness by querying
# the python binary.
if host_arch == 'x64' and platform.architecture()[0] == '32bit':
host_arch = 'ia32'
print host_arch
return 0
if __name__ == '__main__':
sys.exit(main())
+33
View File
@@ -0,0 +1,33 @@
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'type': 'none',
'dependencies': [
'all.gyp:All',
'linux_installer_configs',
],
'actions': [
{
'action_name': 'linux_package_deb_<(channel)_action',
'process_outputs_as_sources': 1,
'inputs': [
'<(deb_build)',
'<@(packaging_files_binaries)',
'<@(packaging_files_common)',
'<@(packaging_files_deb)',
],
'outputs': [
'<(PRODUCT_DIR)/mod-pagespeed-<(channel)-<(version)-r<(revision)_<(deb_arch).deb',
],
'action': [ '<@(deb_cmd)', '-c', '<(channel)', ],
},
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
+34
View File
@@ -0,0 +1,34 @@
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'type': 'none',
'dependencies': [
'all.gyp:All',
'linux_installer_configs',
],
'actions': [
{
'action_name': 'linux_package_deb_<(channel)_action',
'process_outputs_as_sources': 1,
'inputs': [
'<(rpm_build)',
'<(PRODUCT_DIR)/install/rpm/mod-pagespeed.spec.template',
'<@(packaging_files_binaries)',
'<@(packaging_files_common)',
'<@(packaging_files_rpm)',
],
'outputs': [
'<(PRODUCT_DIR)/mod-pagespeed-<(channel)-<(version)-r<(revision).<(rpm_arch).rpm',
],
'action': [ '<@(rpm_cmd)', '-c', '<(channel)', ],
},
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:
+5
View File
@@ -0,0 +1,5 @@
{
/* Make sure we don't export anything unneeded */
global: pagespeed_module;
local: *;
};
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<VisualStudioToolFile
Name="Output DLL copy"
Version="8.00"
>
<Rules>
<CustomBuildRule
Name="Output DLL copy"
CommandLine="xcopy /R /C /Y $(InputPath) $(OutDir)"
Outputs="$(OutDir)\$(InputFileName)"
FileExtensions="*.dll"
>
<Properties>
</Properties>
</CustomBuildRule>
</Rules>
</VisualStudioToolFile>
+139
View File
@@ -0,0 +1,139 @@
# Copyright 2013 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# PageSpeed overrides for Chromium's common.gypi.
{
'variables': {
# Putting a variables dict inside another variables dict looks
# kind of weird. This is done so that some variables are defined
# as variables within the outer variables dict here. This is
# necessary to get these variables defined for the conditions
# within this variables dict that operate on these variables.
'variables': {
# Whether or not we are building for native client.
'build_nacl%': 0,
},
# Copy conditionally-set variables out one scope.
'build_nacl%': '<(build_nacl)',
# Conditions that operate on our variables defined above.
'conditions': [
['build_nacl==1', {
# Disable position-independent code when building under Native
# Client.
'linux_fpic': 0,
}],
],
# Override a few Chromium variables:
# Chromium uses system shared libraries on Linux by default
# (Chromium already has transitive dependencies on these libraries
# via gtk). We want to link these libraries into our binaries so
# we change the default behavior.
'use_system_libjpeg': 0,
'use_system_libpng': 0,
'use_system_zlib': 0,
# We don't use google API keys in the PageSpeed build, so disable them.
'use_official_google_api_keys': 0,
# Disable the chromium linting plugins since our code doesn't
# (yet) meet their requirements.
'clang_use_chrome_plugins': 0,
# Disable use of special ld gold flags, since it isn't installed
# by default.
'linux_use_gold_binary': 0,
'linux_use_gold_flags': 0,
},
'target_defaults': {
# Make sure our shadow view of chromium source is available to
# targets that don't explicitly declare their dependencies and
# assume chromium source headers are available from the root
# (third_party/modp_b64 is one such target).
'include_dirs': [
'<(DEPTH)/third_party/chromium/src',
],
# ABI-incompatible changes are trouble when you have a library, so turn off
# _GLIBCXX_DEBUG --- it makes various STL objects have different types and
# sizes.
'defines!': [
'_GLIBCXX_DEBUG=1'
],
},
'conditions': [
['build_nacl==1', {
'target_defaults': {
'defines': [
# NaCL newlib's libpthread.a provides the
# GetRunningOnValgrind symbol already, so we should not
# provide it.
'DYNAMIC_ANNOTATIONS_PROVIDE_RUNNING_ON_VALGRIND=0',
],
'include_dirs': [
'<(DEPTH)/build/nacl_header_stubs',
],
},
}],
['os_posix==1 and OS!="mac"', {
'target_defaults': {
'ldflags': [
# Fail to link if there are any undefined symbols.
'-Wl,-z,defs',
],
}
}],
['OS=="mac"', {
'target_defaults': {
'xcode_settings': {
'conditions': [
['clang==1', {
# Chromium's common.gypi does not currently scope the
# clang binary paths relative to DEPTH, so we must
# override the paths here.
'CC': '$(SOURCE_ROOT)/<(DEPTH)/third_party/llvm-build/Release+Asserts/bin/clang',
'LDPLUSPLUS': '$(SOURCE_ROOT)/<(DEPTH)/third_party/llvm-build/Release+Asserts/bin/clang++',
}],
]
},
},
}],
['OS=="win"', {
'target_defaults': {
# Remove the following defines, which are normally defined by
# Chromium's common.gypi.
'defines!': [
# Chromium's common.gypi disables tr1. We need it for tr1
# regex so remove their define to disable it.
'_HAS_TR1=0',
# Chromium disables exceptions in some environments, but our
# use of tr1 regex requires exception support, so we have to
# re-enable it here.
'_HAS_EXCEPTIONS=0',
],
'msvs_settings': {
'VCCLCompilerTool': {
'ExceptionHandling': '1', # /EHsc
},
},
},
}]
],
}
+17
View File
@@ -0,0 +1,17 @@
{
'conditions': [
# Handle build types.
['buildtype=="Dev"', {
'includes': ['internal/release_impl.gypi'],
}],
['buildtype=="Official"', {
'includes': ['internal/release_impl_official.gypi'],
}],
# TODO(bradnelson): may also need:
# checksenabled
# coverage
# dom_stats
# pgo_instrument
# pgo_optimize
],
}
+201
View File
@@ -0,0 +1,201 @@
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# (See http://src.chromium.org/viewvc/chrome/trunk/src/LICENSE)
# This file itself is from
# http://src.chromium.org/viewvc/chrome/trunk/src/build/util/ as of
# revision r252481
"""
version.py -- Chromium version string substitution utility.
"""
import getopt
import os
import sys
class Usage(Exception):
def __init__(self, msg):
self.msg = msg
def fetch_values_from_file(values_dict, file_name):
"""
Fetches KEYWORD=VALUE settings from the specified file.
Everything to the left of the first '=' is the keyword,
everything to the right is the value. No stripping of
white space, so beware.
The file must exist, otherwise you get the Python exception from open().
"""
for line in open(file_name, 'r').readlines():
key, val = line.rstrip('\r\n').split('=', 1)
values_dict[key] = val
def fetch_values(file_list):
"""
Returns a dictionary of values to be used for substitution, populating
the dictionary with KEYWORD=VALUE settings from the files in 'file_list'.
Explicitly adds the following value from internal calculations:
OFFICIAL_BUILD
"""
CHROME_BUILD_TYPE = os.environ.get('CHROME_BUILD_TYPE')
if CHROME_BUILD_TYPE == '_official':
official_build = '1'
else:
official_build = '0'
values = dict(
OFFICIAL_BUILD = official_build,
)
for file_name in file_list:
fetch_values_from_file(values, file_name)
return values
def subst_template(contents, values):
"""
Returns the template with substituted values from the specified dictionary.
Keywords to be substituted are surrounded by '@': @KEYWORD@.
No attempt is made to avoid recursive substitution. The order
of evaluation is random based on the order of the keywords returned
by the Python dictionary. So do NOT substitute a value that
contains any @KEYWORD@ strings expecting them to be recursively
substituted, okay?
"""
for key, val in values.iteritems():
try:
contents = contents.replace('@' + key + '@', val)
except TypeError:
print repr(key), repr(val)
return contents
def subst_file(file_name, values):
"""
Returns the contents of the specified file_name with substited
values from the specified dictionary.
This is like subst_template, except it operates on a file.
"""
template = open(file_name, 'r').read()
return subst_template(template, values);
def write_if_changed(file_name, contents):
"""
Writes the specified contents to the specified file_name
iff the contents are different than the current contents.
"""
try:
old_contents = open(file_name, 'r').read()
except EnvironmentError:
pass
else:
if contents == old_contents:
return
os.unlink(file_name)
open(file_name, 'w').write(contents)
def main(argv=None):
if argv is None:
argv = sys.argv
short_options = 'e:f:i:o:t:h'
long_options = ['eval=', 'file=', 'help']
helpstr = """\
Usage: version.py [-h] [-f FILE] ([[-i] FILE] | -t TEMPLATE) [[-o] FILE]
-f FILE, --file=FILE Read variables from FILE.
-i FILE, --input=FILE Read strings to substitute from FILE.
-o FILE, --output=FILE Write substituted strings to FILE.
-t TEMPLATE, --template=TEMPLATE Use TEMPLATE as the strings to substitute.
-e VAR=VAL, --eval=VAR=VAL Evaluate VAL after reading variables. Can
be used to synthesize variables. e.g.
-e 'PATCH_HI=int(PATCH)/256'.
-h, --help Print this help and exit.
"""
evals = {}
variable_files = []
in_file = None
out_file = None
template = None
try:
try:
opts, args = getopt.getopt(argv[1:], short_options, long_options)
except getopt.error, msg:
raise Usage(msg)
for o, a in opts:
if o in ('-e', '--eval'):
try:
evals.update(dict([a.split('=',1)]))
except ValueError:
raise Usage("-e requires VAR=VAL")
elif o in ('-f', '--file'):
variable_files.append(a)
elif o in ('-i', '--input'):
in_file = a
elif o in ('-o', '--output'):
out_file = a
elif o in ('-t', '--template'):
template = a
elif o in ('-h', '--help'):
print helpstr
return 0
while len(args) and (in_file is None or out_file is None or
template is None):
if in_file is None:
in_file = args.pop(0)
elif out_file is None:
out_file = args.pop(0)
if args:
msg = 'Unexpected arguments: %r' % args
raise Usage(msg)
except Usage, err:
sys.stderr.write(err.msg)
sys.stderr.write('; Use -h to get help.\n')
return 2
values = fetch_values(variable_files)
for key, val in evals.iteritems():
values[key] = str(eval(val, globals(), values))
if template is not None:
contents = subst_template(template, values)
elif in_file:
contents = subst_file(in_file, values)
else:
# Generate a default set of version information.
contents = """MAJOR=%(MAJOR)s
MINOR=%(MINOR)s
BUILD=%(BUILD)s
PATCH=%(PATCH)s
LASTCHANGE=%(LASTCHANGE)s
OFFICIAL_BUILD=%(OFFICIAL_BUILD)s
""" % values
if out_file:
write_if_changed(out_file, contents)
else:
print contents
return 0
if __name__ == '__main__':
sys.exit(main())
-384
View File
@@ -1,384 +0,0 @@
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Environment Variables (Optional):
# MOD_PAGESPEED_DIR: absolute path to the mod_pagespeed/src directory
# PSOL_BINARY: absolute path to pagespeed_automatic.a
mod_pagespeed_dir="${MOD_PAGESPEED_DIR:-unset}"
position_aux="${POSITION_AUX:-unset}"
if [ "$mod_pagespeed_dir" = "unset" ] ; then
mod_pagespeed_dir="$ngx_addon_dir/psol/include"
build_from_source=false
if [ ! -e "$mod_pagespeed_dir" ] ; then
echo "ngx_pagespeed: pagespeed optimization library not found:"
psol_binary_url="$($ngx_addon_dir/scripts/format_binary_url.sh \
$ngx_addon_dir/PSOL_BINARY_URL)"
if [[ "$psol_binary_url" != https://* ]]; then
echo "
This is a development branch of ngx_pagespeed, which means there is no
precompiled PSOL library available to link against. Either build from a
release tag, like latest-beta, or build PSOL from source:
https://github.com/pagespeed/ngx_pagespeed/wiki/Building-PSOL-From-Source"
exit 1
fi
echo "
You need to separately download the pagespeed library:
$ cd $ngx_addon_dir
$ wget $psol_binary_url
$ tar -xzvf $(basename $psol_binary_url) # expands to psol/
Or see the installation instructions:
https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source"
exit 1
fi
else
build_from_source=true
fi
os_name='unknown_os'
arch_name='unknown_arch'
uname_os=`uname`
uname_arch=`uname -m`
if [ $uname_os = 'Linux' ]; then
os_name='linux'
elif [ $uname_os = 'Darwin' ]; then
os_name='mac'
else
echo "OS not supported: $uname_os"
exit 1
fi
if [ $uname_arch = 'x86_64' -o $uname_arch = 'amd64' ]; then
arch_name='x64'
elif [ $uname_arch = 'x86_32' -o $uname_arch = 'i686' \
-o $uname_arch = 'i386' ]; then
arch_name='ia32'
else
echo "Architecture not supported: $uname_arch"
exit 1
fi
if [ "$NGX_DEBUG" = "YES" ]; then
buildtype=Debug
# If we're using a psol tarball that doesn't contain Debug/ (which is the case
# from 1.12 onward) then this will be overriden to buildtype=Release below.
else
buildtype=Release
fi
# If the compiler is gcc, we want to use g++ to link, if at all possible,
# so that -static-libstdc++ works.
# Annoyingly, the feature test doesn't even use $LINK for linking, so that
# needs an explicit -lstdc++
pagespeed_libs=
ps_maybe_gpp_base=`basename $CC| sed s/gcc/g++/`
ps_maybe_gpp="`dirname $CC`/$ps_maybe_gpp_base"
if [ -n "$NGX_GCC_VER" -a \( -x "$ps_maybe_gpp" \) ]; then
LINK=$ps_maybe_gpp
fi
pagespeed_libs="-lstdc++"
# The compiler needs to know that __sync_add_and_fetch_4 is ok,
# and this requires an instruction that didn't exist on i586 or i386.
if [ "$uname_arch" = "i686" ]; then
FLAG_MARCH='-march=i686'
fi
CFLAGS="$CFLAGS $FLAG_MARCH"
# For now, standardize on gcc-4.x ABI --- if we don't set this, people building
# with new gcc defaulting to gcc-5 C++11 ABI will have build trouble linking
# to our libpsol.a
# See https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
CFLAGS="$CFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
CC_OLD_TEST_FLAGS="$CC_TEST_FLAGS"
CC_TEST_FLAGS="$CC_TEST_FLAGS -D_GLIBCXX_USE_CXX11_ABI=0 --std=c++11"
case "$NGX_GCC_VER" in
4.8*)
# On GCC 4.8 and above, -Wall enables -Wunused-local-typedefs. This breaks
# on VerifySizesAreEqual in bit_cast in chromium/src/base/basictypes.h which
# has a typedef that is intentionally unused.
CFLAGS="$CFLAGS -Wno-unused-local-typedefs"
# On GCC 4.8 and above, we get the following compiler warning:
# chromium/src/base/memory/scoped_ptr.h:133:7: warning: declaration of class scoped_ptr<C> [enabled by default]
# Based on discussion at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54055,
# this is invalid code, but hasn't been fixed yet in chromium.
# Unfortunately, there also does not appear to be a flag for just disabling
# that warning, so we add Wno-error to override nginx's default -Werror
# option.
CFLAGS="$CFLAGS -Wno-error"
;;
esac
# workaround for a bug in nginx-1.9.11, see:
# http://hg.nginx.org/nginx/rev/ff1e625ae55b
NGX_VERSION=`grep nginx_version src/core/nginx.h | sed -e 's/^.* \(.*\)$/\1/'`
if [ "$NGX_VERSION" = "1009011" ]; then
CFLAGS="$CFLAGS -Wno-write-strings"
fi
if [ "$WNO_ERROR" = "YES" ]; then
CFLAGS="$CFLAGS -Wno-error"
fi
psol_binary="${PSOL_BINARY:-unset}"
if [ "$psol_binary" = "unset" ] ; then
if $build_from_source ; then
psol_binary="\
$mod_pagespeed_dir/pagespeed/automatic/pagespeed_automatic.a"
else
if ! [ -d "$ngx_addon_dir/psol/lib/$buildtype" ]; then
echo "
You have set --with-debug for building nginx, but precompiled Debug binaries for
PSOL, which ngx_pagespeed depends on, aren't available. If you're trying to
debug PSOL you need to build it from source. If you just want to run nginx with
debug-level logging you can use the Release binaries."
echo -n "
Use the available Release binaries?"
read -p " [Y/n] " yn
if [[ "$yn" == N* || "$yn" == n* ]]; then
echo "Cancelled."
exit 1
fi
buildtype=Release
fi
psol_library_dir="$ngx_addon_dir/psol/lib/$buildtype/$os_name/$arch_name"
psol_binary="$psol_library_dir/pagespeed_automatic.a"
fi
fi
echo "mod_pagespeed_dir=$mod_pagespeed_dir"
echo "build_from_source=$build_from_source"
ngx_feature="psol"
ngx_feature_name=""
ngx_feature_run=no
ngx_feature_incs="
#include \"pagespeed/kernel/base/string.h\"
#include \"pagespeed/kernel/base/string_writer.h\"
#include \"pagespeed/kernel/base/null_message_handler.h\"
#include \"pagespeed/kernel/html/html_parse.h\"
#include \"pagespeed/kernel/html/html_writer_filter.h\"
"
pagespeed_include="\
$mod_pagespeed_dir \
$mod_pagespeed_dir/third_party/chromium/src \
$mod_pagespeed_dir/third_party/google-sparsehash/src/src \
$mod_pagespeed_dir/third_party/google-sparsehash/gen/arch/$os_name/$arch_name/include \
$mod_pagespeed_dir/third_party/grpc/src/include \
$mod_pagespeed_dir/third_party/protobuf/src/src \
$mod_pagespeed_dir/third_party/re2/src \
$mod_pagespeed_dir/out/$buildtype/obj/gen \
$mod_pagespeed_dir/out/$buildtype/obj/gen/protoc_out/instaweb \
$mod_pagespeed_dir/third_party/apr/src/include \
$mod_pagespeed_dir/third_party/aprutil/src/include \
$mod_pagespeed_dir/third_party/apr/gen/arch/$os_name/$arch_name/include \
$mod_pagespeed_dir/third_party/aprutil/gen/arch/$os_name/$arch_name/include \
$mod_pagespeed_dir/url"
ngx_feature_path="$pagespeed_include"
pagespeed_libs="$psol_binary $pagespeed_libs -lrt -pthread -lm"
ngx_feature_libs="$pagespeed_libs"
ngx_feature_test="
GoogleString output_buffer;
net_instaweb::StringWriter write_to_string(&output_buffer);
net_instaweb::NullMessageHandler handler;
net_instaweb::HtmlParse html_parse(&handler);
net_instaweb::HtmlWriterFilter html_writer_filter(&html_parse);
html_writer_filter.set_writer(&write_to_string);
html_parse.AddFilter(&html_writer_filter);
html_parse.StartParse(\"http:example.com\");
html_parse.ParseText(
\"<html ><body ><h1 >Test</h1 ><p>Test Text</p></body></html>\n\");
html_parse.FinishParse();
printf(\"parsed as: %s\", output_buffer.c_str())"
# Test whether we have pagespeed and can compile and link against it.
. "$ngx_addon_dir/cpp_feature"
if [ $ngx_found = no ]; then
cat << END
$0: error: module ngx_pagespeed requires the pagespeed optimization library.
Look in $PWD/$NGX_AUTOCONF_ERR for more details.
END
exit 1
fi
ps_src="$ngx_addon_dir/src"
ngx_addon_name=ngx_pagespeed
NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
$ps_src/log_message_handler.h \
$ps_src/ngx_base_fetch.h \
$ps_src/ngx_caching_headers.h \
$ps_src/ngx_event_connection.h \
$ps_src/ngx_fetch.h \
$ps_src/ngx_gzip_setter.h \
$ps_src/ngx_list_iterator.h \
$ps_src/ngx_message_handler.h \
$ps_src/ngx_pagespeed.h \
$ps_src/ngx_rewrite_driver_factory.h \
$ps_src/ngx_rewrite_options.h \
$ps_src/ngx_server_context.h \
$ps_src/ngx_url_async_fetcher.h \
$psol_binary"
NPS_SRCS=" \
$ps_src/log_message_handler.cc \
$ps_src/ngx_base_fetch.cc \
$ps_src/ngx_caching_headers.cc \
$ps_src/ngx_event_connection.cc \
$ps_src/ngx_fetch.cc \
$ps_src/ngx_gzip_setter.cc \
$ps_src/ngx_list_iterator.cc \
$ps_src/ngx_message_handler.cc \
$ps_src/ngx_pagespeed.cc \
$ps_src/ngx_rewrite_driver_factory.cc \
$ps_src/ngx_rewrite_options.cc \
$ps_src/ngx_server_context.cc \
$ps_src/ngx_url_async_fetcher.cc"
# Save our sources in a separate var since we may need it in config.make
PS_NGX_SRCS="$NGX_ADDON_SRCS \
$NPS_SRCS"
# Make pagespeed run immediately before gzip and Brotli.
if echo $HTTP_FILTER_MODULES | grep ngx_http_brotli_filter_module >/dev/null; then
next=ngx_http_brotli_filter_module
elif [ $HTTP_GZIP = YES ]; then
next=ngx_http_gzip_filter_module
else
next=ngx_http_range_header_filter_module
fi
if [ -n "$ngx_module_link" ]; then
# nginx-1.9.11+
ngx_module_type=HTTP_FILTER
ngx_module_name="ngx_pagespeed ngx_pagespeed_etag_filter"
ngx_module_incs="$ngx_feature_path"
ngx_module_deps=
ngx_module_srcs="$NPS_SRCS"
ngx_module_libs="$ngx_feature_libs"
ngx_module_order="ngx_http_range_header_filter_module\
ngx_pagespeed_etag_filter\
ngx_http_gzip_filter_module \
ngx_http_brotli_filter_module \
ngx_pagespeed \
ngx_http_postpone_filter_module \
ngx_http_ssi_filter_module \
ngx_http_charset_filter_module \
ngx_http_xslt_filter_module \
ngx_http_image_filter_module \
ngx_http_sub_filter_module \
ngx_http_addition_filter_module \
ngx_http_gunzip_filter_module \
ngx_http_userid_filter_module \
ngx_http_headers_filter_module"
. auto/module
if [ $ngx_module_link != DYNAMIC ]; then
# ngx_module_order doesn't work with static modules,
# so we must re-order filters here.
if [ "$position_aux" = "true" ] ; then
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name"
else
HTTP_FILTER_MODULES=$(echo $HTTP_FILTER_MODULES \
| sed "s/ngx_pagespeed//" \
| sed "s/$next/$next ngx_pagespeed/")
fi
# Make the etag header filter run immediately before range header filter.
HTTP_FILTER_MODULES=$(echo $HTTP_FILTER_MODULES \
| sed "s/ngx_pagespeed_etag_filter//" \
| sed "s/ngx_http_range_header_filter_module/ngx_http_range_header_filter_module ngx_pagespeed_etag_filter/")
else
if [ "$position_aux" = "true" ] ; then
ngx_module_type=HTTP_AUX_FILTER
ngx_module_order=""
fi
fi
else
CORE_LIBS="$CORE_LIBS $pagespeed_libs"
CORE_INCS="$CORE_INCS $pagespeed_include"
NGX_ADDON_SRCS="$PS_NGX_SRCS"
if [ "$position_aux" = "true" ] ; then
HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name"
else
HTTP_FILTER_MODULES=$(echo $HTTP_FILTER_MODULES | sed "s/$next/$next $ngx_addon_name/")
fi
# Make the etag header filter run immediately before range header filter.
HTTP_FILTER_MODULES=$(echo $HTTP_FILTER_MODULES |\
sed "s/ngx_http_range_header_filter_module/ngx_http_range_header_filter_module ngx_pagespeed_etag_filter/")
fi
echo "List of modules (in reverse order of applicability): "$HTTP_FILTER_MODULES
# Test whether the compiler is compatible
ngx_feature="psol-compiler-compat"
ngx_feature_name=""
ngx_feature_run=no
ngx_feature_incs=""
ngx_feature_path=""
ngx_feature_libs="-lstdc++"
ngx_feature_test="
#if defined(__clang__) && defined(__GLIBCXX__)
// See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html#abi.versioning
// for a list of various values of __GLIBCXX__. Note that they're not monotonic
// with respect to version numbers.
#if __GLIBCXX__ == 20120322 || __GLIBCXX__ == 20120614
#error \"clang is using libstdc++ 4.7.0 or 4.7.1, which can cause binary incompatibility.\"
#endif
#endif
#if !defined(__clang__) && defined(__GNUC__)
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
#error \"GCC < 4.8 no longer supported. Please use gcc >= 4.8 or clang >= 3.3\"
#endif
#endif
#if defined(__clang__)
#if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 3)
#error \"Please use gcc >= 4.8 or clang >= 3.3\"
#endif
#endif
"
. "$ngx_addon_dir/cpp_feature"
if [ $ngx_found = no ]; then
cat << END
$0: error: module ngx_pagespeed requires gcc >= 4.8 or clang >= 3.3.
See https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source for some recommendations.
Look in $PWD/$NGX_AUTOCONF_ERR for more details.
END
exit 1
fi
have=NGX_PAGESPEED . auto/have
CC_TEST_FLAGS="$CC_OLD_TEST_FLAGS"
-7
View File
@@ -1,7 +0,0 @@
# Since nginx build system doesn't normally do C++, there is no CXXFLAGS for us
# to touch, and compilers are understandably unhappy with --std=c++11 on C
# files. Hence, we hack the makefile to add it for just our sources.
for ps_src_file in $PS_NGX_SRCS; do
ps_obj_file="$NGX_OBJS/addon/src/`basename $ps_src_file .cc`.o"
echo "$ps_obj_file : CFLAGS += --std=c++11" >> $NGX_MAKEFILE
done
-122
View File
@@ -1,122 +0,0 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
# 2012-10-01 Modified from auto/feature by jefftk to support c++ test files.
echo $ngx_n "checking for $ngx_feature ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
----------------------------------------
checking for $ngx_feature
END
ngx_found=no
if test -n "$ngx_feature_name"; then
ngx_have_feature=`echo $ngx_feature_name \
| tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
fi
if test -n "$ngx_feature_path"; then
for ngx_temp in $ngx_feature_path; do
ngx_feature_inc_path="$ngx_feature_inc_path -I $ngx_temp"
done
fi
cat << END > $NGX_AUTOTEST.cc
#include <sys/types.h>
$NGX_INCLUDE_UNISTD_H
$ngx_feature_incs
int main() {
$ngx_feature_test;
return 0;
}
END
ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
-o $NGX_AUTOTEST $NGX_AUTOTEST.cc $NGX_TEST_LD_OPT $ngx_feature_libs"
ngx_feature_inc_path=
eval "/bin/sh -c \"$ngx_test\" >> $NGX_AUTOCONF_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
case "$ngx_feature_run" in
yes)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
echo " found"
ngx_found=yes
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
fi
else
echo " found but is not working"
fi
;;
value)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
echo " found"
ngx_found=yes
cat << END >> $NGX_AUTO_CONFIG_H
#ifndef $ngx_feature_name
#define $ngx_feature_name `$NGX_AUTOTEST`
#endif
END
else
echo " found but is not working"
fi
;;
bug)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
echo " not found"
else
echo " found"
ngx_found=yes
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
fi
fi
;;
*)
echo " found"
ngx_found=yes
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
fi
;;
esac
else
echo " not found"
echo "----------" >> $NGX_AUTOCONF_ERR
cat $NGX_AUTOTEST.cc >> $NGX_AUTOCONF_ERR
echo "----------" >> $NGX_AUTOCONF_ERR
echo $ngx_test >> $NGX_AUTOCONF_ERR
echo "----------" >> $NGX_AUTOCONF_ERR
fi
rm $NGX_AUTOTEST*
+702
View File
@@ -0,0 +1,702 @@
# This Makefile contains targets for building, testing, and debugging
# mod_pagespeed during develoment. Useful targets:
#
# apache_debug
# apache_release
# - Build a development (debug), or release (optimized), version of
# mod_pagespeed.
#
# apache_debug_psol
# - Build a development version of PSOL, as '.a' file suitable for
# ngx_pagespeed to link against.
#
# apache_test
# - Run all unit tests. You can also run the tests in halves with:
# - mod_pagespeed_test
# - Run unit tests under test.gyp:mod_pagespeed_test
# - pagespeed_automatic_test
# - Run unit tests under test.gyp:pagespeed_automatic_test
# - You can run a specific unit test by setting TEST=test_name.
# For example:
# TEST=SerfUrlAsyncFetcherTest.FetchOneURLWithGzip
# You can also run a subset of tests, using wildcards:
# TEST=SerfUrlAsyncFetcherTest.* make apache_test
# What you give to TEST is passed to googletest with --gtest_filter, so for
# more details see the doc there:
# https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#running-a-subset-of-the-tests
#
# apache_release_test
# - Run all unit test with a release (non-debug) build.
#
# apache_root_test
# - Currently broken test that builds install tarball, installs it as the root
# apache on port 80 (requires sudo password) and runs most of our system
# tests to make sure filters are working and rewritten resources are served.
#
# (This file also pulls in the contents of Makefile.tests, so some useful
# targets are defined there instead. To run system tests, for example, you can
# run apache_debug_smoke_test.)
#
# apache_install_conf
# - Copy install/debug.conf.template to your development apache directory,
# making substitutions for @@VARS@@ and, depending on how OPTIONS is set,
# uncommenting some #TESTVAR lines.
# - When running tests this target is run automatically, but you may need to
# run it manually during debugging.
#
# apache_debug_install
# apache_release_install
# - Install the debug/release version of mod_pagespeed into the build of apache
# that build_development_apache.sh created.
# - This is another command that you probably only need when debugging
# manually.
#
# apache_debug_start
# apache_debug_stop
# apache_debug_restart
# - Start, stop, and restart the development apache instance. This also
# includes a few other potentially useful maintenance tasks, like cleaning up
# temp files and rotating logs.
# - Unless you specify FAST_RESTART=1, apache_debug_restart runs
# apache_debug_install to make sure you're running the module you built and
# not an earlier version.
#
# apache_debug_slurp
# - mod_pagespeed can be run in "slurp" mode, where it is configured as a
# forward proxy that saves a copy of everything that runs through it. Later
# on the slurp can be served in read-only mode, to serve the cached copy of
# whatever was visited. This is intended for testing and debugging, and is
# what the load test uses.
#
# apache_debug_leak_test
# - Run the unit tests and system tests under valgrind, to check for memory
# errors and leaks.
#
# update_gyp_manifest
# - If you add or remove a .gyp or .gypi file, run this target so we know to
# watch it for changes.
#
# submodule_update
# - The mod_pagespeed git repo includes its dependencies as git submodules.
# These dependencies are pinned to a specific git revision. If someone has
# upgraded one, you need to run submodule_update to apply those changes.
#
# doxygen
# - Builds html documentation for PSOL. It includes everything defined as
# public in the .h files. You might ask: how do I know what things are safe
# to depend on as consumer of PSOL, and which might change? This is a good
# question with a bad answer: you can depend on anything, and anything might
# change. We don't offer ABI or even API compatibility across versions, even
# across point releases.
#
# This Makefile also includes various test targets that really should be in
# Makefile.tests:
# - apache_debug_proxy_test
# - apache_debug_slurp_test
# TODO(jefftk): move these into Makefile.tests
#
# It also includes other targets that are not indended to be run directly, and
# are either here to support devel/ scripts or to support other targets.
# somewhat redundant with the .gyp files, but helps bridge the gap and automate
# the transition.
#
# You can use the CONF= parameter to change build settings or enable coverage
# testing for debug builds:
#
# CONF=Debug
# - default, shouldn't be needed
# CONF=Coverage
# - run the test coverage analysis scripts after tests complete
# CONF=Release
# - shouldn't be needed; use targets with "release" in their name instead.
# CONF=OptDebug
# - build optimized binaries with debug info (-O2 -g)
# We need gcc-mozilla/bin to pick up our special gcc 4.8 for old versions of
# ubuntu. It's ok to have it in the path even if we're on a machine where that
# directory doesn't exist; bash will just move on.
# TODO(jefftk): source ubuntu/make_vars.mk here, then move this there.
# TODO(jefftk): get this Makefile working on other platforms (centos, ubuntu16)
PATH := /usr/lib/gcc-mozilla/bin:/usr/local/bin:/usr/bin:$(PATH)
export PATH
GIT_SRC = $(realpath ${PWD}/..)
DEVEL_DIR = $(GIT_SRC)/devel
INSTALL_DATA_DIR = $(GIT_SRC)/install
# Where binaries go.
GIT_RELEASE_BIN = $(GIT_SRC)/out/Release
GIT_DEBUG_BIN = $(GIT_SRC)/out/Debug
GIT_BIN = $(GIT_SRC)/out/$(BUILDTYPE)
# GYP_MANIFEST holds a cached copy of the gyp files in this client. When we
# first create a new checkout we run update_gyp_manifest, and from then on we
# use the cached copy when we need to know whether to rerun hooks.
GYP_MANIFEST = $(GIT_SRC)/gyp_manifest.d
.PHONY : update_gyp_manifest
update_gyp_manifest :
find $(GIT_SRC) -name '*.gyp' -o -name '*.gypi' | \
sort > $(GYP_MANIFEST)
# It's ok for this variable to be empty, and it will be empty the first time we
# run in a new checkout. When it's empty we won't know whether to run gyp
# but on an initial checkout we run them regardless because we won't yet
# have the hook stamp.
GYP_FILES = $(shell [ -f $(GYP_MANIFEST) ] && cat $(GYP_MANIFEST) || echo "")
HOOKS_STAMP = $(GIT_SRC)/hooks.timestamp
ifeq ($(OBJDIR),)
OBJDIR := $(shell mktemp -td instaweb.XXXXXX)
endif
export OBJDIR
MAKE := $(MAKE) --no-print-directory OBJDIR=$(OBJDIR)
# Unset environment variables that can interfere with the make process.
# TODO(vchudnov): Not all of these may be problematic. Narrow down
# this list if possible.
unexport CC CXX GYP_DEFINES GYP_GENERATORS http_proxy
# gcc-mozilla contains /usr/lib/gcc-mozilla/bin/gcc but not
# /usr/lib/gcc-mozilla/bin/cc so if we want to use gcc-mozilla, which we do on
# Ubuntu 12 LTS, then we need to explicitly set CC=gcc.
# TODO(jefftk): do this in a way that lets people explicitly choose to build
# with clang instead of forcing gcc on everyone.
export CC=gcc
# By default, precompiled JS files are used. When developing, though, we want to
# enable local compilation of JS, so export the flag that enables use of the
# closure compiler. Note that this var is checked when gyp is run, not at
# compile time.
export BUILD_JS=1
# Run the proxy tests from a host configured via
# cd install; ./ubuntu.sh setup_test_machine
# We use 'export' here so that apache/system_test.sh can see it.
PAGESPEED_TEST_HOST ?= selfsigned.modpagespeed.com
export PAGESPEED_TEST_HOST
# We don't want our targets to be run parallelized, as we want
# various directory maintenance steps to be run in-order
# This prevents that from happening, but still passes -j to actual
# compilation
.NOTPARALLEL :
.PHONY : prepare_objdir
prepare_objdir : $(OBJDIR)
CHECKIN_PREP_TARGETS = test_no_var_growth prepare_objdir exes
.PHONY : checkin_prep echo_checkin_prep
checkin_prep : $(CHECKIN_PREP_TARGETS)
echo_checkin_prep :
@echo $(CHECKIN_PREP_TARGETS)
# Determine gyp BUILDTYPE and hooks we should run based on the passed in CONF
# TOOD(jefftk): The difference between setting CONF, BUILDTYPE, and running a
# target that sets BUILDTYPE makes it pretty hard to know what BUILDTYPE(s) a
# section of this Makefile might run under. Clean this up.
CONF ?= Debug
HOOKTYPE = NoHooks
BUILDTYPE = $(CONF)
ifeq ($(CONF),Coverage)
override BUILDTYPE=Debug_Coverage
override HOOKTYPE=Coverage
else ifeq ($(CONF),OptDebug)
# For -O2 -g type builds, we have to build as BUILDTYPE=Release CXXLAGS=-g;
# with BUILDTYPE=Debug CXXFLAGS="-O2" we would get a -O2 -g -O0 out of gyp,
# with the -O0 cancelling the -O2.
override BUILDTYPE=Release
# We need to make sure to add -g only once (since otherwise recursive
# invocation will end up with something like -g -g -g and force a rebuild)
ifeq (,$(findstring -g,$(CFLAGS)))
override CFLAGS+= -g
override CXXFLAGS+= -g
endif
export CFLAGS
endif
# We'd like to put this in gyp file, but that makes it hard to compile
# on old versions of g++ that do not support this flag. However we
# can add the flag during development. Don't add this in if it's
# already present; that causes cxxflags to mismatch adding extra compiles.
ifeq (,$(findstring -Wtype-limits,$(CXXFLAGS)))
override CXXFLAGS+= -Wtype-limits
endif
export CXXFLAGS
export BUILDTYPE
# test to make sure that CXXFLAGS doesn't grow on each recursion
.PHONY : test_no_var_growth
test_no_var_growth :
[ "$(CXXFLAGS)" = \
"`$(MAKE) echo_var VAR=CXXFLAGS `" ] || \
$(DEVEL_DIR)/expectfail echo CXXFLAGS changed on Makefile recursion
APACHE_RELEASE_MODULES_DIR=/usr/lib/apache2/modules
APACHE_DEBUG_ROOT ?= $(HOME)/apache2
# Note: these must be distinct from the ports used for apache_root_test.
APACHE_PORT = 8080
APACHE_SLURP_ORIGIN_PORT = 8081
APACHE_SLURP_PORT = 8082
APACHE_SECONDARY_PORT = 8083
APACHE_TERTIARY_PORT = 8085
APACHE_HTTPS_PORT = 8443
CONTROLLER_PORT = 8086
RCPORT=9091
# If you add additional ports here, make sure they don't overlap with the test
# ports ngx_pagespeed uses. Check ngx_pagespeed/test/run_tests.sh for the list.
OPTIONS = $(EXTRA_OPTIONS) HTTPS_TEST=1
APACHE_DEBUG_MODULES = $(APACHE_DEBUG_ROOT)/modules
APACHE_DEBUG_BIN = $(APACHE_DEBUG_ROOT)/bin
MOD_PAGESPEED_CACHE = $(APACHE_DEBUG_ROOT)/pagespeed_cache
MOD_PAGESPEED_LOG = $(APACHE_DEBUG_ROOT)/pagespeed_log
TMP_SLURP_DIR = /tmp/instaweb/$(USER)/slurp
# Not used in this Makefile, but needed for some submake/script.
APACHE_LOG = $(APACHE_DEBUG_ROOT)/logs/error_log
APACHE_DEBUG_PAGESPEED_CONF = $(APACHE_DEBUG_ROOT)/conf/pagespeed.conf
APACHE_DOC_ROOT = $(APACHE_DEBUG_ROOT)/htdocs
APACHE_SERVER = http://localhost:$(APACHE_PORT)
# We want to track borgingssl branch chromium-stable at head, but submodules
# tracks a specific commit ID.
# If we need more deps like this, we should figure out a more generic solution.
UPDATE_BORINGSSL = git checkout chromium-stable && git pull
# These hooks are invoked before/after apache or tests are run
.PHONY : pre_start_NoHooks post_run_NoHooks pre_start_Coverage post_run_Coverage
.PHONY : pre_start post_run
pre_start_NoHooks :
post_run_NoHooks :
pre_start_Coverage :
$(DEVEL_DIR)/gcov-all.sh --prepare $(GIT_SRC)
post_run_Coverage :
$(DEVEL_DIR)/gcov-all.sh --summarize $(GIT_SRC)
pre_start : pre_start_$(HOOKTYPE)
post_run : post_run_$(HOOKTYPE)
# We check closure-compiled javascript into git to enable people to use
# closure-compiled output without needing to have a closure compiler dependency
# in the build process.
GENFILES = $(GIT_SRC)/net/instaweb/genfiles
.PHONY : apache_debug apache_debug_psol
# Sets up a development tree, and builds the modules
apache_debug : $(HOOKS_STAMP)
@echo "building Apache module $@ ..."
cd $(GIT_SRC) && $(MAKE)
@echo Built mod_pagespeed successfully:
ls -l $(GIT_DEBUG_BIN)/libmod_pagespeed.so
@echo To install, type
@echo " " cp $(GIT_DEBUG_BIN)/libmod_pagespeed.so \
$(APACHE_DEBUG_ROOT)/modules/mod_pagespeed.so
apache_debug_psol : apache_debug
cd $(GIT_SRC)/pagespeed/automatic && $(MAKE) \
MOD_PAGESPEED_ROOT=$(GIT_SRC) \
OUTPUT_DIR=$(GIT_DEBUG_BIN) \
BUILDTYPE=Debug \
CXXFLAGS=$(CXXFLAGS) \
all
@echo Built PSOL successfully under in $(GIT_DEBUG_BIN)
.PHONY : submodule_update
submodule_update:
@echo "Updating local checkouts from open source. If these generate any"
@echo "merge conflicts you'll need to resolve them manually."
cd $(GIT_SRC) && git pull --ff-only && git submodule update --recursive
.PHONY : exes apache_debug_install apache_debug_stop apache_debug_start
exes : apache_debug_install
apache_debug_install : apache_debug
install -c $(GIT_BIN)/libmod_pagespeed.so \
$(APACHE_DEBUG_MODULES)/mod_pagespeed.so
install -c $(GIT_BIN)/libmod_pagespeed_ap24.so \
$(APACHE_DEBUG_MODULES)/mod_pagespeed_ap24.so
apache_debug_stop :
$(MAKE) stop
$(MAKE) post_run
apache_debug_start :
$(MAKE) pre_start
$(MAKE) stop
$(DEVEL_DIR)/apache_cleanup.sh $(USER)
-$(DEVEL_DIR)/apache_rotate_logs.sh $(APACHE_DEBUG_ROOT)/logs
$(MAKE) start
.PHONY : apache_debug_restart
ifeq ($(FAST_RESTART),1)
apache_debug_restart :
$(MAKE) apache_debug_stop
$(MAKE) apache_debug_start
else
# Restarts with newest module
apache_debug_restart :
$(MAKE) apache_debug_stop
$(MAKE) apache_debug_install
$(MAKE) apache_debug_start
endif
# Installs a slurping pagespeed.conf on localhost:8082 and runs a debug
# binary.
.PHONY : apache_debug_slurp
apache_debug_slurp : slurp_test_prepare apache_install_conf
$(MAKE) apache_debug_restart
@echo Set your browser proxy to `hostname`:$(APACHE_SLURP_PORT)
# Stop and start Apache as reliably as possible.
.PHONY : stop start
stop :
$(INSTALL_DATA_DIR)/stop_apache.sh $(APACHE_DEBUG_BIN)/apachectl \
$(APACHE_DEBUG_ROOT)/logs/httpd.pid \
$(APACHE_DEBUG_BIN)/httpd \
graceful-stop \
$(APACHE_PORT)
start :
$(APACHE_DEBUG_BIN)/apachectl start
@if [ ! -f $(APACHE_DEBUG_ROOT)/logs/httpd.pid ]; then \
/bin/echo -n "Waiting for httpd to start"; \
while [ ! -f $(APACHE_DEBUG_ROOT)/logs/httpd.pid ]; do \
/bin/echo -n "."; \
sleep 1; \
done; \
/bin/echo; \
fi
.PHONY : apache_debug_leak_test
apache_debug_leak_test :
rm -rf $(MOD_PAGESPEED_CACHE)/* # Start with an empty cache
$(DEVEL_DIR)/check_for_leaks \
$(APACHE_DEBUG_ROOT) localhost:$(APACHE_PORT)
include $(INSTALL_DATA_DIR)/Makefile.tests
# Installs the apache debug server and runs a stress test against it.
# This will blow away your existing cache and pagespeed.conf.
#
# Note: this test is obsolete; you probably want mps_load_test.sh or one of the
# siege tests.
#
# TODO(sligocki): Lock Apache.
apache_debug_stress_test : stress_test_prepare apache_install_conf
$(MAKE) apache_debug_restart
$(INSTALL_DATA_DIR)/stress_test.sh localhost:$(APACHE_PORT)
$(MAKE) apache_debug_stop
stress_test_prepare :
# stop old apaches, w/o generating any coverage reports,
# (as we're about to do some new test)
$(MAKE) stop
$(eval OPTIONS+=STRESS_TEST=1)
-rm -rf $(MOD_PAGESPEED_CACHE)/*
# This test checks that when ProxyPass is set on a host with mod_pagespeed
# enabled, URLs are rewritten correctly. (See install/debug.conf.template)
# See: http://github.com/pagespeed/mod_pagespeed/issues/74
#
# TODO(sligocki): Lock Apache.
.PHONY : apache_debug_proxy_test proxy_test_prepare
apache_debug_proxy_test : proxy_test_prepare apache_install_conf
$(MAKE) apache_debug_restart
$(WGET_NO_PROXY) -q -O /dev/null \
$(APACHE_SERVER)/proxy_pass.html?PageSpeedFilters=extend_cache
sleep 1
$(WGET_NO_PROXY) -q -O - \
$(APACHE_SERVER)/proxy_pass.html?PageSpeedFilters=extend_cache\
| grep "localhost:8080/proxy_pass.css.pagespeed.ce"
# Before this was fixed, it would be rewritten as localhost:8081/...
proxy_test_prepare :
$(eval OPTIONS+=PROXY_TEST=1)
# This test checks that we can serve slurped pages, both from requests
# like those sent from a browser-proxy. We'd also like to test
# requests sent from a fake DNS, like webpagetest, but I haven't
# figured out how to do that yet. For now we'll just test read-only
# proxying.
#
# In our test flow, we first warm up mod_pagespeed's cache with a
# fetch and a sleep. Then we test to make sure that we rewrite a
# resource properly, with mps on, and that we don't rewrite it with
# mps off.
#
# TODO(sligocki): Lock Apache.
.PHONY : apache_debug_slurp_test slurp_test_prepare
apache_debug_slurp_test : slurp_test_prepare apache_install_conf
$(MAKE) apache_debug_restart
$(DEVEL_DIR)/slurp_test.sh $(APACHE_SERVER) \
$(APACHE_SLURP_ORIGIN_PORT) $(APACHE_SLURP_PORT) $(WGET) \
$(TMP_SLURP_DIR) $(PAGESPEED_TEST_HOST)
slurp_test_prepare :
$(eval OPTIONS+=SLURP_TEST=1)
rm -rf $(MOD_PAGESPEED_CACHE)/*
# This is for trace-based stress tests, that operate on recorded URLs
# and slurp databases
# Note: you can pass PAR=, EXP= and RUNS= to stress test targets that
# execute the tests
.PHONY : check_dump_dir apache_trace_stress_test_prepare
check_dump_dir :
$(if $(DUMP_DIR),,$(error "Need data directory set with DUMP_DIR="))
$(if $(wildcard $(DUMP_DIR)/slurp),,\
$(error "No slurp/ under $(DUMP_DIR)"))
# mod_pagespeed load tests can be started with scripts/mps_load_test.sh. If
# given an arg 'memcached', then that script will export MEMCACHED=1 and that
# will be passed to target 'apache_install_conf' as indicated below. Same
# with cache_invalidation and inline_unauthorized_resources (IUR).
apache_trace_stress_test_prepare : check_dump_dir
$(MAKE) stress_test_prepare
echo MEMCACHED=$(MEMCACHED)
echo REDIS=$(REDIS)
echo PURGING=$(PURGING)
echo IUR=$(IUR)
echo IPRO_PRESERVE=$(IPRO_PRESERVE)
$(MAKE) apache_install_conf SLURP_DIR=$(DUMP_DIR)/slurp SLURP_WRITE=0 \
OPTIONS="$(OPTIONS) \
LOADTEST_TEST=1 \
STRESS_TEST=1 \
HTTPS_TEST=0 \
IPRO_PRESERVE_LOADTEST_TEST=$(IPRO_PRESERVE) \
MEMCACHED_LOADTEST_TEST=$(MEMCACHED) \
REDIS_LOADTEST_TEST=$(REDIS) \
PURGING_LOADTEST_TEST=$(PURGING) \
IUR_LOADTEST_TEST=$(IUR)"
apache_trace_stress_test_server :
$(MAKE) apache_trace_stress_test_prepare
$(MAKE) apache_debug_install
$(MAKE) apache_debug_start
ifeq ($(TEST),)
TEST_ARG=
else
TEST_ARG=--gtest_filter=$(TEST)
endif
.PHONY : apache_test mod_pagespeed_test
apache_test : apache_debug
$(MAKE) pre_start
cd $(GIT_SRC) && \
install/run_program_with_ext_caches.sh \
$(GIT_BIN)/mod_pagespeed_test $(TEST_ARG)
cd $(GIT_SRC) && \
install/run_program_with_ext_caches.sh \
$(GIT_BIN)/pagespeed_automatic_test $(TEST_ARG)
$(MAKE) post_run
# TODO(jefftk): figure out if dividing the unit tests into mod_pagespeed_test
# and pagespeed_automatic_test is actually helpful. Currently it looks like if
# there was once a principled distinction between the targets it has atrophied.
mod_pagespeed_test : apache_debug
$(MAKE) pre_start
cd $(GIT_SRC) && \
install/run_program_with_ext_caches.sh \
$(GIT_BIN)/mod_pagespeed_test $(TEST_ARG)
$(MAKE) post_run
.PHONY : pagespeed_automatic_smoke_test
# TODO(jefftk): get rid of this and just use apache_debug_psol
pagespeed_automatic_smoke_test :
@echo Building Pagespeed Automatic ...
cd $(GIT_SRC)/pagespeed/automatic/ && \
$(MAKE) MOD_PAGESPEED_ROOT=$(GIT_SRC) \
OUTPUT_DIR=$(GIT_BIN) \
CXXFLAGS=$(CXXFLAGS) \
all
.PHONY : pagespeed_automatic_test
pagespeed_automatic_test : apache_debug
$(MAKE) pre_start
cd $(GIT_SRC) && \
install/run_program_with_ext_caches.sh \
$(GIT_BIN)/pagespeed_automatic_test $(TEST_ARG)
$(MAKE) post_run
.PHONY : apache_release_test
apache_release_test : apache_release internal_release_test
TMP_PREFIX = /tmp/mod_pagespeed.$(USER).install
# Builds a binary release tarball, installs it as root (requires sudo password)
# and tests that rewrites occur.
#
# TODO(jmarantz): We are still leaving a bunch of stuff behind in /tmp; organize
# the temp dirs better and clean up.
.PHONY : apache_root_test internal_release_test
# TODO(jmarantz): This target is not working yet...it fails copying over
# pagespeed_libraries.conf. Investigate:
# cat common/pagespeed.load.template | \
# sed s~@@APACHE_MODULEDIR@@~/usr/lib/apache2/modules~ | \
# sed s/@@COMMENT_OUT_DEFLATE@@// > /tmp/mod_pagespeed.install/pagespeed.load
# cp -f /tmp/instaweb.vRV047/mod_pagespeed-test-jmarantz/install/net/instaweb/genfiles/conf/pagespeed_libraries.conf /tmp/mod_pagespeed.install/pagespeed_libraries.conf
# cp: cannot stat /tmp/instaweb.vRV047/mod_pagespeed-test-jmarantz/install/net/instaweb/genfiles/conf/pagespeed_libraries.conf: No such file or directory
# TODO(jefftk): this also depends on prepare_release.sh and install-glucid.sh,
# that haven't been open sourced yet.
#apache_root_test :
# sudo /etc/init.d/apache2 stop
# sudo rm -rf $(TMP_PREFIX) /tmp/mod_pagespeed.install
# cd ../.. && devel/prepare_release.sh -force \
# mod_pagespeed-test-$(USER)
# cd $(OBJDIR) && tar xzf \
# $(TMP_PREFIX)/mod_pagespeed-test-$(USER).tgz
# cd $(OBJDIR)/mod_pagespeed-test-$(USER) && ./install-glucid.sh
# rm -rf $(OBJDIR) /tmp/mod_pagespeed-test-$(USER).tgz
# sudo rm -rf $(TMP_PREFIX) /tmp/mod_pagespeed.install
internal_release_test :
cd $(GIT_SRC) && \
BUILDTYPE=Release install/run_program_with_ext_caches.sh \
$(GIT_RELEASE_BIN)/mod_pagespeed_test $(TEST_ARG) && \
BUILDTYPE=Release install/run_program_with_ext_caches.sh \
$(GIT_RELEASE_BIN)/pagespeed_automatic_test $(TEST_ARG)
# Configuration root for Apache file-system and cache directories, to
# be written into config file.
#
# Installs a development copy of the the Instaweb server into $APACHE_DEBUG_ROOT
.PHONY : apache_install_conf
apache_install_conf : setup_doc_root
rm -f $(APACHE_DEBUG_ROOT)/conf/pagespeed.conf
mkdir -p $(MOD_PAGESPEED_CACHE)
mkdir -p $(MOD_PAGESPEED_LOG)
cd $(INSTALL_DATA_DIR) && \
$(MAKE) $(APACHE_DEBUG_ROOT)/conf/pagespeed.conf \
STAGING_DIR=$(APACHE_DEBUG_ROOT)/conf \
APACHE_DOC_ROOT=$(APACHE_DEBUG_ROOT)/htdocs \
APACHE_MODULES=$(APACHE_DEBUG_MODULES) \
APACHE_DOMAIN=$(APACHE_SERVER) \
CONTROLLER_PORT=$(CONTROLLER_PORT) \
RCPORT=$(RCPORT) \
APACHE_SECONDARY_PORT=$(APACHE_SECONDARY_PORT) \
APACHE_TERTIARY_PORT=$(APACHE_TERTIARY_PORT) \
APACHE_HTTPS_DOMAIN=$(APACHE_HTTPS_SERVER) \
MOD_PAGESPEED_CACHE=$(MOD_PAGESPEED_CACHE) \
MOD_PAGESPEED_LOG=$(MOD_PAGESPEED_LOG) \
MOD_PAGESPEED_ROOT=$(GIT_SRC) \
SLURP_DIR=$(SLURP_DIR) \
SLURP_WRITE=$(SLURP_WRITE) \
PAGESPEED_TEST_HOST=$(PAGESPEED_TEST_HOST) \
TMP_SLURP_DIR=$(TMP_SLURP_DIR) \
$(OPTIONS)
$(DEVEL_DIR)/apache_configure_https_port.sh $(APACHE_DEBUG_ROOT) \
$(APACHE_HTTPS_PORT)
$(DEVEL_DIR)/apache_create_server_certificate.sh $(APACHE_DEBUG_ROOT)
$(DEVEL_DIR)/apache_configure_php5_from_etc_php5.sh $(APACHE_DEBUG_ROOT)
$(DEVEL_DIR)/apache_install.sh \
$(APACHE_DEBUG_ROOT) $(APACHE_PORT) $(GIT_SRC)
# Builds the release objects. This should not be run on its own -- it
# should be run manually via 'make apache_release'.
.PHONY : internal_release_build
internal_release_build : $(GIT_SRC) $(HOOKS_STAMP)
@echo "building Apache release module ..."
cd $(GIT_SRC) && BUILDTYPE=Release $(MAKE)
DOXYGEN_TARBALL = $(OBJDIR)/psol_doc.tar.gz
# Generates a doxygen tarball in $(DOXYGEN_TARBALL) suitable for
# scp to modpagespeed.com.
.PHONY : doxygen
doxygen :
$(DEVEL_DIR)/doxify_tree.sh $(DOXYGEN_TARBALL)
.PHONY : apache_release apache_release_install
apache_release : internal_release_build
@echo Release apache module built. Install it with
@echo " " cd $(GIT_SRC)/install
@echo " " make staging
@echo " " sudo make install
@echo "or"
@echo " " sudo cp \
$(GIT_RELEASE_BIN)/libmod_pagespeed.so \
$(APACHE_RELEASE_MODULES_DIR)/mod_pagespeed.so
apache_release_install : apache_release
@echo "Copy the module to your Apache2 modules directory."
@echo "Then, restart your Apache server."
install -c $(GIT_RELEASE_BIN)/libmod_pagespeed.so \
$(APACHE_RELEASE_MODULES_DIR)/mod_pagespeed.so
install -c $(GIT_RELEASE_BIN)/libmod_pagespeed_ap24.so \
$(APACHE_RELEASE_MODULES_DIR)/mod_pagespeed_ap24.so
/etc/init.d/apache2 stop
/etc/init.d/apache2 start
# Using pipefail to ensure grep -v doesn't obscure a gyp failure.
$(HOOKS_STAMP) : $(GPERF) $(GYP_FILES)
bash -o pipefail -c \
"cd $(GIT_SRC) && python build/gyp_chromium --depth=. | \
egrep -v '^(Generating )[a-zA-Z0-9_/.-]*(Makefile|mk)$$'"
touch $(HOOKS_STAMP)
$(OBJDIR) : make_obj_dirs
.PHONY : make_obj_dirs clean
make_obj_dirs : $(GIT_SRC)
@echo Setting up library directories...
@mkdir -p $(GIT_INSTAWEB_LIB_PATH) \
$(GENFILES) \
$(OBJDIR)/apache/net/instaweb \
$(OBJDIR)/apache/pagespeed/opt/ads \
$(OBJDIR)/apache/pagespeed/kernel/base \
$(OBJDIR)/apache/pagespeed/kernel/cache \
$(OBJDIR)/apache/pagespeed/kernel/html \
$(OBJDIR)/apache/pagespeed/kernel/http \
$(OBJDIR)/apache/pagespeed/kernel/image \
$(OBJDIR)/apache/pagespeed/kernel/image/testdata/gif \
$(OBJDIR)/apache/pagespeed/kernel/image/testdata/jpeg \
$(OBJDIR)/apache/pagespeed/kernel/image/testdata/png \
$(OBJDIR)/apache/pagespeed/kernel/image/testdata/pngsuite \
$(OBJDIR)/apache/pagespeed/kernel/image/testdata/pngsuite/gif \
$(OBJDIR)/apache/pagespeed/kernel/image/testdata/resized \
$(OBJDIR)/apache/pagespeed/kernel/image/testdata/webp \
$(OBJDIR)/apache/pagespeed/kernel/js \
$(OBJDIR)/apache/pagespeed/kernel/sharedmem \
$(OBJDIR)/apache/pagespeed/kernel/thread \
$(OBJDIR)/apache/pagespeed/kernel/util \
$(OBJDIR)/apache/pagespeed/install \
$(OBJDIR)/apache/pagespeed/apache \
$(OBJDIR)/apache/pagespeed/automatic \
$(OBJDIR)/apache/pagespeed/automatic/public \
$(OBJDIR)/apache/pagespeed/controller \
$(OBJDIR)/apache/pagespeed/system \
$(OBJDIR)/apache/pagespeed/system/public \
$(OBJDIR)/css_parser
@cd $(OBJDIR)/apache/net/instaweb; mkdir -p \
config htmlparse/public http/public http/testdata \
js/public public rewriter/public rewriter/testdata spriter \
spriter/public util/public
clean :
rm -rf $(OBJDIR)
rm -rf $(GIT_SRC)/out
# Install gperf if it doesn't exist
GPERF = /usr/bin/gperf
$(GPERF) :
sudo apt-get install gperf
.PHONY : echo_var echo_vars
echo_var :
@echo $($(VAR))
echo_vars :
@echo OBJDIR=$(OBJDIR)
@echo G3_ROOT=$(G3_ROOT)
@echo SANDBOX=$(SANDBOX)
@echo GOOGLE_PROTO_FILES=$(GOOGLE_PROTO_FILES)
@echo GIT_SRC=$(GIT_SRC)
@echo GYP_MANIFEST=$(GYP_MANIFEST)
+51
View File
@@ -0,0 +1,51 @@
#!/bin/bash
#
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# See bug 3103898 and
# http://carlosrivero.com/fix-apache
#---no-space-left-on-device-couldnt-create-accept-lock
#
# This script might help cleanup any leftover resources that prevent
# Apache from restarting. The error message might look a little something
# like this:
#
# [Sat Oct 16 21:22:46 2010] [warn] pid file /usr/local/apache2/logs/httpd.pid
# overwritten -- Unclean shutdown of previous Apache run?
#
# [Sat Oct 16 21:22:46 2010] [emerg] (28)No space left on device: Couldn't
# create accept lock (/usr/local/apache2/logs/accept.lock.16025) (5)
#
# Usage:
#
# devel/apache_cleanup $USER
#
# You may want to see the owners of the IPC blocks by running ipcs -s
# manually. For example, you might need to run:
#
# sudo devel/apache_cleanup www-data
# or
# sudo devel/apache_cleanup root
apache_user=$1
for ipsemId in $(ipcs -s | grep $apache_user | cut -f 2 -d ' '); do
echo ipcrm -s $ipsemId
ipcrm -s $ipsemId || true
done
for ipsemId in $(ipcs -m | grep $apache_user | cut -f 2 -d ' '); do
echo ipcrm -m $ipsemId
ipcrm -m $ipsemId || true
done
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
#
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Script to enable SSL on the given port for Apache, usually in ~/apache2.
#
# usage: apache_configure_https_port.sh apache-root-directory https-port
APACHE_ROOT=$1
HTTPS_PORT=$2
# If either argument is missing, do nothing (assume that https is disabled).
[ -z "$APACHE_ROOT" ] && exit 0
[ -z "$HTTPS_PORT" ] && exit 0
# Change the port only if we can find the file where we expect it.
conf_file=$APACHE_ROOT/conf/extra/httpd-ssl.conf
if [ -e $conf_file ]; then
sed -e '/^[ ]*Listen /s/^.*$/Listen '"$HTTPS_PORT"'/' \
-e '/<VirtualHost /s/.*:[0-9]*/<VirtualHost localhost:'"$HTTPS_PORT"'/' \
-e '/^[ ]*ServerName /s/^.*$/ServerName '"$(hostname):$HTTPS_PORT"'/' \
${conf_file} > ${conf_file}.$$
if mv -f ${conf_file}.$$ ${conf_file}; then
echo HTTPS was enabled on port $HTTPS_PORT in $conf_file
else
rm -f ${conf_file}.$$
echo FAILED: mv ${conf_file}.$$ ${conf_file}
echo Cannot enable HTTPS on port $HTTPS_PORT in $conf_file
fi
else
echo $conf_file does not exist.
echo Consider updating devel/Makefile and/or devel/$(basename $0)
exit 1
fi
exit 0
+167
View File
@@ -0,0 +1,167 @@
#!/bin/bash
#
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Script to enable PHP5 in Apache assuming it has already been installed into
# the standard Ubuntu directory (/etc/apache, /usr/apache) rather than the
# ~/apache2 directory we use [in other words, modules have been apt install'd
# rather than built from source].
#
# PHP5 can be installed using the following commands:
# apt-get install php5-common php5
# apt-get install php5-cgi php5-cli libapache2-mod-fcgid # * worker MPM only *
#
# Note that it does not fail if any of these are not installed since we don't
# want to force site admins to install them just to run some tests.
#
# usage: apache_configure_php5_from_etc_php5.sh apache-root-directory
APACHE_ROOT=$1
if [ -z "${APACHE_ROOT}" ]; then
echo "Usage: $0 <apache-root-directory>"
exit 1
fi
HTTPD_CONF=${APACHE_ROOT}/conf/httpd.conf
DST_PHP5_CONFIG=${APACHE_ROOT}/conf/php5.conf
DST_PHP5_MODULE=${APACHE_ROOT}/modules/libphp5.so
DST_FCGID_CONFIG=${APACHE_ROOT}/conf/fcgid.conf
DST_FCGID_MODULE=${APACHE_ROOT}/modules/mod_fcgid.so
# Note: contains an embedded TAB.
WS="[ ]"
# Early exit if everything seems to be installed already.
grep -q "^${WS}*Include${WS}.*conf/php5.conf${WS}*$" "${HTTPD_CONF}" && \
grep -q "^${WS}*Include${WS}.*conf/fcgid.conf${WS}*$" "${HTTPD_CONF}"
if [[ $? -eq 0 && \
-r "${DST_PHP5_CONFIG}" && \
-r "${DST_PHP5_MODULE}" && \
-r "${DST_FCGID_MODULE}" ]]; then
exit 0
fi
# Hardwire where we get things from since it's a Ubuntu standard.
SRC_PHP5_INIDIR=/etc/php5/apache2
SRC_PHP5_MODULE=/usr/lib/apache2/modules/libphp5.so
# We want our own build of fcgid since we want to test with 2.2, while the
# packages are for 2.4
SRC_FCGID_MODULE=${APACHE_ROOT}/modules/mod_fcgid-src_build.so
# Bail if PHP5 isn't installed [where we expect it].
if [[ ! -r "/usr/bin/php5-cgi" ||
! -r "${SRC_FCGID_MODULE}" ]]; then
echo "*** PHP5 is not installed, or is not installed where we expect" >&2
echo " under /etc/php5 and /usr/lib/apache2. Please run:" >&2
echo " sudo apt-get install php5-common php5" >&2
echo " sudo apt-get install php5-cgi php5-cli libapache2-mod-fcgid">&2
echo ""
echo " You may also need to rm -rf ${APACHE_ROOT}" >&2
echo " and re-run install/build_development_apache.sh"
exit 1
fi
# Tricky grep'ing to find the correct Directory section in httpd.conf:
PAT1="<Directory${WS}${WS}*${APACHE_ROOT}/htdocs${WS}*>"
PAT2="<Directory${WS}${WS}*\"${APACHE_ROOT}/htdocs\"${WS}*>"
HTDOCS_OPEN_LINENO=$(
egrep -n "${PAT1}|${PAT2}" "${HTTPD_CONF}" \
| sed -e 's/:.*//')
if [ -z "$HTDOCS_OPEN_LINENO" ]; then
echo
echo "*** ${HTTPD_CONF} does not have a line like:" >&2
echo ' <Directory "'${APACHE_ROOT}/htdocs'">' >&2
echo " which is the expected document root for the installation" >&2
echo " and whose entry needs to be updated. ABORTING." >&2
exit 1
fi
HTDOCS_CLOSE_LINENO=$(
tail -n +${HTDOCS_OPEN_LINENO} "${HTTPD_CONF}" \
| grep -n "^${WS}*</${WS}*Directory${WS}*>" \
| head -1 \
| sed -e 's/:.*//')
OPTIONS_LINENO=$(
tail -n +${HTDOCS_OPEN_LINENO} "${HTTPD_CONF}" \
| head -${HTDOCS_CLOSE_LINENO:-999999} \
| grep -i "^${WS}${WS}*Options${WS}.*[+]\?ExecCGI")
if [ -z "$OPTIONS_LINENO" ]; then
[ -n "${HTDOCS_CLOSE_LINENO}" ] && \
HTDOCS_CLOSE_LINENO=$((HTDOCS_OPEN_LINENO + HTDOCS_CLOSE_LINENO - 1))
sed -e "${HTDOCS_CLOSE_LINENO:-$}"'i\
# Required for mod_fcgi which is required for PHP when using worker MPM.\
Options +ExecCGI' "${HTTPD_CONF}" > "${HTTPD_CONF}".tmp
mv "${HTTPD_CONF}".tmp "${HTTPD_CONF}"
fi
# Add the necessary lines to httpd.conf if/as necessary.
fgrep -q "LoadModule fcgid_module modules/mod_fcgid.so" "${HTTPD_CONF}"
if [ $? -ne 0 ]; then
# Backwards compatibility: check if PHP5 for Apache 2.2 prefork is setup.
grep -q "^${WS}*LoadModule${WS}${WS}*php5_module${WS}.*modules/libphp5.so${WS}*$" "${HTTPD_CONF}"
if [ $? -eq 0 ]; then
# Remove the lines that just setup PHP5 for APache 2.2 prefork.
sed -e "/^${WS}*LoadModule${WS}${WS}*php5_module${WS}.*/d" \
-e "/^${WS}*Include${WS}${WS}*conf\/php5.conf${WS}*$/d" \
"${HTTPD_CONF}" > "${HTTPD_CONF}.tmp"
mv "${HTTPD_CONF}.tmp" "${HTTPD_CONF}"
fi
# Insert the all-singing all dancing lines for Apache 2.2 prefork/worker.
# Unconditionally use mod_fcgid.
cat - >> "${HTTPD_CONF}" <<EOF
LoadModule fcgid_module modules/mod_fcgid.so
Include conf/fcgid.conf
AddHandler fcgid-script .php
FCGIWrapper /usr/bin/php-cgi .php
EOF
fi
# Copy the config files over as necessary.
if [ ! -f "${DST_PHP5_CONFIG}" ]; then
cat - > "${DST_PHP5_CONFIG}" <<EOF
<IfModule php5_module>
AddHandler php5-script .php
DirectoryIndex index.html index.php
AddType text/html .php
AddType application/x-httpd-php-source phps
PHPIniDir ${SRC_PHP5_INIDIR}
</IfModule>
EOF
fi
if [ ! -f "${DST_FCGID_CONFIG}" ]; then
cat - > "${DST_FCGID_CONFIG}" <<EOF
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
FcgidConnectTimeout 20
FcgidProcessTableFile fcgid/fcgid_shm
FcgidIPCDir fcgid/sock
</IfModule>
EOF
fi
# Link the modules as necessary.
if [[ ! -f "${DST_PHP5_MODULE}" && -f "${SRC_PHP5_MODULE}" ]]; then
ln -s "${SRC_PHP5_MODULE}" "${DST_PHP5_MODULE}"
fi
if [ ! -f "${DST_FCGID_MODULE}" ]; then
ln -s "${SRC_FCGID_MODULE}" "${DST_FCGID_MODULE}"
fi
# Create the mod_fcgid directories.
[ -d "${APACHE_ROOT}"/fcgid ] || mkdir "${APACHE_ROOT}"/fcgid
[ -d "${APACHE_ROOT}"/fcgid/sock ] || mkdir "${APACHE_ROOT}"/fcgid/sock
exit 0
+33
View File
@@ -0,0 +1,33 @@
#!/bin/bash
#
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Script to create a server certificate (and key) file for Apache,
# usually in ~/apache2.
#
# usage: apache_create_server_certificate.sh apache-root-directory
APACHE_ROOT=$1
# Create a cert file iff we don't already have one.
if [ ! -e $APACHE_ROOT/conf/server.crt ]; then
openssl req -new -x509 -days 36500 -sha1 -newkey rsa:1024 -nodes \
-keyout $APACHE_ROOT/conf/server.key \
-out $APACHE_ROOT/conf/server.crt \
-subj "/O=Company/OU=Department/CN=$(hostname)"
echo Certificate files were created: $APACHE_ROOT/conf/server.{key,crt}
fi
exit 0
+85
View File
@@ -0,0 +1,85 @@
#!/bin/bash
#
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Script to install a debuggable mod_pagespeed.so into the Apache
# distribution, usually in ~/apache2.
APACHE_DEBUG_ROOT=$1
APACHE_DEBUG_PORT=$2
SRC_TREE=$3
mkdir -p $APACHE_DEBUG_ROOT/pagespeed/cache
chmod a+rwx $APACHE_DEBUG_ROOT/pagespeed/cache
# Check to see of mod_pagespeed is already loaded into httpd.conf
conf_file=$APACHE_DEBUG_ROOT/conf/httpd.conf
if [ -e $conf_file ]; then
if grep -q "^Listen $APACHE_DEBUG_PORT\$" $conf_file; then
echo $conf_file is set up to listen on the port $APACHE_DEBUG_PORT.
else
echo $conf_file is not set up to listen on port $APACHE_DEBUG_PORT
echo please remedy
exit 1
fi
if grep -q "LoadModule pagespeed_module" $conf_file; then
echo mod_pagespeed is already loaded in config file $conf_file
else
echo adding mod_pagespeed into apache config file $conf_file
cat $SRC_TREE/install/common/pagespeed.load.template | \
sed s#@@APACHE_MODULEDIR@@#$APACHE_DEBUG_ROOT/modules# | \
sed s#@@COMMENT_OUT_DEFLATE@@## >> $conf_file
echo Include $APACHE_DEBUG_ROOT/conf/pagespeed.conf >> $conf_file
fi
# Now hack the file to also load mod_h2.
MOD_H2=$APACHE_DEBUG_ROOT/modules/mod_http2.so
if [ -f $MOD_H2 ]; then
if grep -q "LoadModule http2_module" $conf_file; then
echo http2_module is already loaded in config file $conf_file
else
echo adding http2_module into apache config file $conf_file
cat $conf_file | sed -e '/pagespeed.conf/i\
\
# Load mod_http2 to test mod_pagespeed integration. This is done before\
# pagespeed.conf so it can detect it.\
LoadModule http2_module '$MOD_H2'\
Protocols h2 http/1.1 \
Protocols h2c http/1.1\
' > $conf_file.sp
mv $conf_file.sp $conf_file
fi
else
echo "No mod_http2 in $APACHE_DEBUG_ROOT/modules, so not loading"
fi
# pagespeed_libraries.conf was added later, so check for it separately.
libraries_conf_file="$APACHE_DEBUG_ROOT/conf/pagespeed_libraries.conf"
if grep -q "Include $libraries_conf_file" $conf_file; then
echo pagespeed_libraries.conf is already loaded by $conf_file
else
echo adding pagespeed_libraries.conf include to $conf_file
cp -f $SRC_TREE/net/instaweb/genfiles/conf/pagespeed_libraries.conf \
$libraries_conf_file
echo Include $libraries_conf_file >> $conf_file
fi
else
echo "$conf_file does not exist. Consider updating devel/Makefile and/or"
echo "devel/apache_install.sh"
exit 1
fi
exit 0
+92
View File
@@ -0,0 +1,92 @@
#!/bin/bash
#
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Rotate the logs in the apache logs directory specified on the command line,
# and gzip them, then erase old logs if disk usage is over 85%. Note that
# apache must be stopped when we do this. Note also that we take pains not to
# erase the newly-rotated logs, as those are the ones we are likely to care
# deeply about. This may mean the disk stays full, but logs are pretty
# compressible so it's unlikely.
set -e
now() {
date '+%Y%m%d-%H%M'
}
stamp=$(now)
if [ $# -ne 1 -o ! -d "$1" ]; then
echo "Usage: apache_rotate_logs.sh logs_directory" >&2
exit 1
fi
cd "$1"
if [ -f "error_log.gz" ]; then
# Clean up after partial log rotation
echo "Cleaning up error_log.gz"
mv error_log.gz error_log.$stamp.gz
cleaned_up=true
fi
if [ -f "access_log.gz" ]; then
# Clean up after partial log rotation
echo "Cleaning up access_log.gz"
mv access_log.gz access_log.$stamp.gz
cleaned_up=true
fi
if [ ! -f "error_log" -a ! -f "access_log" ]; then
# No logs to rotate.
echo "No new logs to rotate"
else
# gzip can be kind of slow, so parallelize.
# But gzip well, as this stuff eats a ton of space.
if [ -f "error_log" ]; then
echo "Gzipping error_log"
gzip -9 error_log &
fi
if [ -f "access_log" ]; then
echo "Gzipping access_log"
gzip -9 access_log
fi
wait
if [ ! -z "$cleaned_up" ]; then
# If we used stamp, create a fresh one (effectively spin)
old_stamp=stamp
stamp=$(now)
while [ "$stamp" == "$old_stamp" ]; do
sleep 1
stamp=$(now)
done
fi
# Now timestamp the just-compressed logs.
if [ -f "error_log.gz" ]; then
echo "Timestamping error_log"
mv error_log.gz error_log.$stamp.gz
fi
if [ -f "access_log.gz" ]; then
echo "Timestamping access_log"
mv access_log.gz access_log.$stamp.gz
fi
fi
# Clean up old logs if the disk is getting full (>85%).
df_percent() {
df . --output=pcent | egrep -o '[0-9]+'
}
if [ $(df_percent) -ge 85 ]; then
echo "Cleaning required."
for log in $(/bin/ls -1tr *_log.[0-9]* | head -n -2); do
echo "Cleaning $log"
rm $log
if [ $(df_percent) -lt 85 ]; then
break
fi
done
fi
+96
View File
@@ -0,0 +1,96 @@
#!/bin/bash
#
# Note: you might need to type your password a few times, once early, and once
# at the end.
#
# This should be run on a release branch to make sure we can make a tarball and
# at least build it on our workstations. It will also copy the tarball into
# ~/release (where the binaries usually go).
#
# Like most of our dev tools this assumes Ubuntu 14 LTS. If that isn't what you
# have, it's probably easiest to run this in a VM.
#
# Note that if this fails you may need to tweak the file list inside
# devel/create_distro_tarball.sh
set -e # exit script if any command returns an error
set -u # exit the script if any variable is uninitialized
function usage {
echo "Usage: devel/build_release_tarball.sh <beta|stable>"
exit 1
}
if [ $# -ne 1 ]; then
usage
fi
if [ ! -d net/instaweb ]; then
echo "This script must be run from the root of the mps checkout."
exit 1
fi
source net/instaweb/public/VERSION
RELEASE="$MAJOR.$MINOR.$BUILD.$PATCH"
CHANNEL="$1"
deps="libpng12-dev libicu-dev libssl-dev libjpeg-dev realpath build-essential
pkg-config gperf unzip libapr1-dev libaprutil1-dev apache2-dev"
if dpkg-query -Wf '${Status}\n' $deps 2>&1 | \
grep -v "install ok installed"; then
# Only run apt-get install if one of the deps is not already installed.
# See: http://stackoverflow.com/questions/1298066
sudo apt-get install $deps
fi
RELEASE_DIR="$HOME/release/$RELEASE"
mkdir -p "$RELEASE_DIR"
REVISION="$(build/lastchange.sh "$PWD" | sed 's/LASTCHANGE=//')"
TARBALL="$RELEASE_DIR/mod-pagespeed-$CHANNEL-$RELEASE-r$REVISION.tar.bz2"
devel/create_distro_tarball.sh "$TARBALL"
echo "Tarball should now be at $TARBALL"
# Try to build it
BUILD_DIR="$(mktemp -d)"
echo "Doing a test build inside $BUILD_DIR"
cd "$BUILD_DIR"
if openssl version | grep "^OpenSSL 1[.]0[.][01]\|^OpenSSL 0[.]"; then
echo "Your openssl version is too old to build the tarball; we need 1.0.2+"
echo "Building 1.0.2 from source..."
OPENSSL_VERSION="1.0.2j"
wget "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
tar -xzvf "openssl-${OPENSSL_VERSION}.tar.gz"
cd openssl-"${OPENSSL_VERSION}"
./config --prefix="$BUILD_DIR" shared
make
make install
export SSL_CERT_DIR=/etc/ssl/certs
export PKG_CONFIG_PATH="$BUILD_DIR/lib/pkgconfig"
export LD_LIBRARY_PATH="$BUILD_DIR/lib"
cd "$BUILD_DIR"
fi
tar xjf "$TARBALL"
cd modpagespeed*
./generate.sh -Dsystem_include_path_apr=/usr/include/apr-1.0/ \
-Dsystem_include_path_httpd=/usr/include/apache2
cd src
make -j6
out/Debug/mod_pagespeed_test
# These tests fail because they are golded against a specific version of
# compression libraries.
# TODO(sligocki): Could we change the tests to be less fragile or test in a
# different way in this case?
BROKEN_TESTS=\
ImageConverterTest.OptimizePngOrConvertToJpeg:\
ImageConverterTest.ConvertOpaqueGifToJpeg:\
JpegOptimizerTest.ValidJpegsLossy:\
JpegOptimizerTest.ValidJpegLossyAndColorSampling:\
JpegOptimizerTest.ValidJpegsProgressiveAndLossy
out/Debug/pagespeed_automatic_test --gtest_filter=-$BROKEN_TESTS
echo "Cleaning up"
rm -rf "$BUILD_DIR"
+229
View File
@@ -0,0 +1,229 @@
#!/bin/bash
set -u # exit the script if any variable is uninitialized
this_dir=$(dirname "${BASH_SOURCE[0]}")
cd "$this_dir/.."
src="$PWD"
if [ ! -d install ]; then
echo "Expected to see install."
exit 1
fi
source "$src/install/shell_utils.sh" || exit 1
# In order to set up the pagespeed.conf file correctly for external cache
# tests, we must have a special env variable established. The easiest way
# to do that is to re-run this script under 'run_program_with_<cache-type>.sh',
# which executes a command and then brings down external cache server.
#
# So when we run this script, if we don't already have our external cache
# configured, we just re-run the script under run_program_with_*.sh. That will
# establish a single external cache server for all the unit tests and system
# tests.
# One weird trick for testing a variable for whether it is set, without
# triggering an error due to "set -u" above:
# http://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash
if [[ -z ${MEMCACHED_PORT+x} ]]; then
exec "$src/install/run_program_with_memcached.sh" "$0" "$@"
fi
if [[ -z ${REDIS_PORT+x} ]]; then
exec "$src/install/run_program_with_redis.sh" "$0" "$@"
fi
valgrind="/usr/bin/valgrind"
if [ ! -e $valgrind ]; then
echo "***" You must install the system valgrind into $valgrind
echo sudo apt-get install valgrind
exit 1
fi
install_log_file=/tmp/install.log.$$
valgrind_test_out=/tmp/valgrind.test.out.$$
valgrind_httpd_out=/tmp/valgrind.httpd.out.$$
system_test_log=/tmp/system_test.log.$$
apache_test_log=/tmp/apache_test.log.$$
exit_status=0
failures=""
run_unit_tests=1
OPTIONS="${OPTIONS:-""} VALGRIND_TEST=1"
if [ $1 == "--no_unit_tests" ]; then
run_unit_tests="0"
shift
fi
apache_debug_root=$1
shift
server=$1
shift
function record_error() {
exit_status=1
failures="$failures $@"
echo FAIL: $@
}
function check_valgrind_log_for_problems() {
# TODO(jmaessen): Consider checking 'Use of uninitialized', but
# that will require image library exclusions.
grep 'Invalid .* of size' $2 && \
record_error "$1 contains invalid memory operations."
grep 'definitely lost: [1-9][0-9,]* bytes in [1-9][0-9,]* blocks' $2 && \
record_error "$1 Directly lost bytes"
grep "indirectly lost: [1-9][0-9,]* bytes in [1-9][0-9,]* blocks" $2 && \
record_error "$1 Indirectly Lost bytes"
}
# Because valgrind is so slow, we want to run it under tee. But tee swallows
# the exit status code, so we can get false positives. Instead we ignore the
# exit status from tee and search for a pattern in the log that indicates an
# error.
#
# $1 = the program to be run
# $2 = the log file
# $3 = the error-pattern to search for in the log.
function run_and_grep_for_error {
echo `date`: Running "$1 in $PWD ..."
$1 2>&1 | tee $2
grep "$3" $2 >/dev/null
if [ $? -eq 0 ]; then
record_error "$1 failed: \"$3\" found in $2"
fi
}
SUPPRESSIONS="$src/devel/valgrind_suppressions.txt"
function check_unit_test_for_leaks() {
exe=$1
shards=$2
echo `date`: Running $exe with $valgrind, log to $valgrind_test_out.$exe
cd $src
# For the unit tests only we use --child-silent-after-fork so that
# cross-process communication tests don't trigger false leak warnings
# at exit of kids they fork.
# If one sets envvars GTEST_TOTAL_SHARDS as well as GTEST_SHARD_INDEX
# with 0 <= GTEST_SHARD_INDEX < GTEST_TOTAL_SHARDS, gtest will only
# execute a portion of tests in a given process, letting us to parallelize
# unit test execution.
export GTEST_TOTAL_SHARDS=$shards
last_shard=$((GTEST_TOTAL_SHARDS - 1))
LOGS=
for i in $(seq 0 $last_shard); do
export GTEST_SHARD_INDEX=$i
LOG=$valgrind_test_out.$exe.$i
LOGS="$LOGS $LOG"
echo $valgrind --leak-check=full \
--suppressions=$SUPPRESSIONS \
--read-var-info=yes --num-callers=20 --child-silent-after-fork=yes \
./out/Debug/$exe "2>&1" "|" tee $LOG "&"
$valgrind --leak-check=full --suppressions=$SUPPRESSIONS \
--read-var-info=yes --num-callers=20 --child-silent-after-fork=yes \
./out/Debug/$exe 2>&1 | tee $LOG &
done
wait
run_and_grep_for_error "cat $LOGS" $valgrind_test_out.$exe '^\[ FAILED \] '
check_valgrind_log_for_problems $exe $valgrind_test_out.$exe
}
# Checks the system-tests using a pagespeed.conf configuration. An
# argument must be supplied that will be used as a suffix for log files.
function check_system_test_for_leaks() {
suffix=$1
local options="HTTPS_TEST=0 $OPTIONS"
if [[ $suffix == "memcached" ]]; then
options+=" MEMCACHED_TEST=1"
elif [[ $suffix == "redis" ]]; then
options+=" REDIS_TEST=1"
fi
echo make apache_debug_install apache_install_conf \
OPTIONS="$options" '>&' "$install_log_file"
make apache_debug_install apache_install_conf \
OPTIONS="$options" >& $install_log_file
outfile=$valgrind_httpd_out.$suffix
echo `date`: Running httpd $valgrind with output spewed to $outfile
ps auxww | grep httpd
echo $valgrind --gen-suppressions=all --leak-check=full --trace-children=yes \
--suppressions=$SUPPRESSIONS \
$apache_debug_root/bin/httpd --enable-pool-debug \
">&" $outfile "&"
$valgrind --gen-suppressions=all --leak-check=full --trace-children=yes \
--suppressions=$SUPPRESSIONS \
$apache_debug_root/bin/httpd --enable-pool-debug \
>& $outfile &
local apache_timeout=30
echo -n Waiting up to "$apache_timeout" seconds for valgrind/httpd \
to start listening
if ! wait_cmd_with_timeout "$apache_timeout" \
wget -q --timeout=2 -O/dev/null "http://$server"
then
record_error apache/valgrind did not start after "$apache_timeout" seconds.
return 1
fi
run_and_grep_for_error "$src/pagespeed/apache/system_test.sh \
$server" $apache_test_log '^\FAIL\.'
$apache_debug_root/bin/apachectl graceful-stop
echo -n Waiting for httpd to actually exit...
while [ -f $apache_debug_root/logs/httpd.pid ]; do sleep 1; done
echo done.
echo `date`: Waiting for $valgrind to finish spewing to $outfile
wait
check_valgrind_log_for_problems httpd $outfile
echo `date`: Cleaning up
tail -12 $outfile | tee $outfile.tail
}
set +u
PAGESPEED_TEST_HOST=${PAGESPEED_TEST_HOST:-selfsigned.modpagespeed.com}
export PAGESPEED_TEST_HOST
set -u
$apache_debug_root/bin/apachectl graceful-stop
if [ $? -ne 0 ]; then
record_error restart failed: please see log $install_log_file
else
if [ $run_unit_tests = "1" ]; then
# We use 1 shard here for convenience of memcached setup, since this
# test is quick.
check_unit_test_for_leaks mod_pagespeed_test 1
# 3 shards here in hope of using the idle CPU while not overwhelming things
# if other things (e.g. checkin.blaze) are parallel to us.
check_unit_test_for_leaks pagespeed_automatic_test 3
fi
cd "$src/devel"
echo Running system tests using a file cache...
check_system_test_for_leaks file_cache
echo Running system tests using memcached...
check_system_test_for_leaks memcached
echo Running system tests using redis...
check_system_test_for_leaks redis
fi
if [ $exit_status -eq 0 ]; then
echo PASS
else
echo FAIL: $failures
fi
echo NOTE: there can be multiple LEAK SUMMARY entries in Valgrid log, which
echo can be located in different parts of log, not necessarily in the end.
exit $exit_status
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
#
# Scans source directories for _test.cc files to find ones that aren't mentioned
# in the test gyp file. On success produces no output, otherwise prints the
# names of the unreferenced _test.cc files.
set -u
set -e
this_dir="$(dirname "${BASH_SOURCE[0]}")"
cd "$this_dir/.."
test_gyp="net/instaweb/test.gyp"
find net pagespeed -name *_test.cc | while read test_path; do
if ! grep -q "$(basename "$test_path")" "$test_gyp"; then
echo "$test_path ($(basename "$test_path")) missing from $test_gyp"
fi
done
Executable
+136
View File
@@ -0,0 +1,136 @@
#!/bin/bash
# Run the checkin tests for mod_pagespeed. These help ensure the build won't
# break.
#
# Extra parmeters are passed to make. For example, pass V=1 to get verbose
# gyp builds.
#
# We don't clean by default in checkin tests. That makes checkin tests take way
# too long, especially when re-running after a failure. This adds risk because
# someone might break the build by checking in a dependence on a file that
# cannot be regenerated, but that risk seems low compared with the cost of total
# rebuilds.
echo Starting tests at time `date`
# Don't leave processes hanging around on exit. "jobs -p" gives all background
# processes.
trap 'kill $(jobs -p)' SIGINT SIGTERM EXIT
APACHE_DEBUG_ROOT="$HOME/apache2"
FAIL=
if [ ! -d "$APACHE_DEBUG_ROOT" ]; then
echo "You must install a local Apache before running checkin tests, e.g."
echo " install/build_development_apache.sh 2.2 prefork"
FAIL=true
fi
required_binaries="autoconf g++ gperf libtool valgrind memcached redis-server"
missing=""
for bin in $required_binaries; do
which $bin >/dev/null || missing="$missing $bin"
done
if [ "$missing" != "" ]; then
echo You are missing required packages $missing. Type:
echo sudo apt-get install $missing
FAIL=true
fi
if ! locale -a | grep -q tr_TR.utf8; then
echo "You are missing language-pack-tr-base. Type:"
echo "sudo apt-get install language-pack-tr-base"
FAIL=true
fi
if [ ! -f /usr/bin/php5-cgi ]; then
echo "You are missing php5. Type:"
echo "sudo apt-get install php5-cgi"
FAIL=true
fi
if [ ! -f $APACHE_DEBUG_ROOT/modules/mod_fcgid-src_build.so ]; then
echo "You are missing source build of fcgid. Please re-run "
echo "build_development_apache.sh"
FAIL=true
fi
this_dir=$(dirname "${BASH_SOURCE[0]}")
cd "$this_dir"
tests_missing=$(./check_tests_are_run.sh)
if [ ! -z "$tests_missing" ]; then
echo "$tests_missing"
FAIL=true
fi
if [ -n "$FAIL" ]; then
echo "***" Please correct above errors and try again.
exit 1
fi
export OBJDIR=/tmp/instaweb.$$
make_log=/tmp/checkin.make.$$
blaze_log=/tmp/checkin.blaze.$$
function kill_subprocesses() {
echo "^C caught by $0, killing jobs..."
kill -INT $(jobs -p)
# Make is resilient to kills, partially due to our recursive make calls.
# Also we need to be wary of other 'make' processes on the system for
# different clients, but we always use OBJDIR=$OBJDIR on the command-line for
# our recursive makes. So keep finding them and killing them until they are
# all dead dead dead.
continue=1
while [ $continue -eq 1 ];
do
# TODO(jmarantz): jmaessen suggests: How about
# processes=$(ps auxw | awk "/[m]ake OBJDIR=$OBJDIR/{ print \$2 }")
# This would be more silent. But I'm inclined to leave it noisy for
# now until we are confident it's working well.
ps auxw | grep "make OBJDIR=$OBJDIR" | grep -v grep
if [ $? -eq 0 ]; then
processes=$(ps auxw|grep "make OBJDIR=$OBJDIR"|awk '{ print $2 }')
kill -TERM $processes
sleep 5
else
# All done. Let the 'checkin' script itself exit.
continue=0
fi
done
}
trap '{ kill_subprocesses; exit 1; }' INT
echo "$this_dir/checkin.make $* &> $make_log &"
rm -f "$make_log"
touch "$make_log"
echo $PWD
# TODO(jefftk): combine checkin and checkin.make
./checkin.make "$@" &> "$make_log" &
make_pid=$!
# Show make's output as it runs...
tail -f $make_log &
exit_status=0
# Wait for make to finish.
wait $make_pid
MAKE_STATUS="$?"
if [ "$MAKE_STATUS" = "0" ]; then
echo checkin.make Passed.
rm "$make_log"
else
echo "*** checkin.make failed: check $make_log for details. Last 4 lines:"
tail -n 4 "$make_log"
exit_status=1
fi
echo Exiting checkin at "$(date)" with status "$exit_status"
exit $exit_status
+79
View File
@@ -0,0 +1,79 @@
#!/bin/bash
#
# This script is intended to be run from 'checkin'. It runs a series of tests,
# noting which ones failed, and allowing re-running only the failed ones if
# needed.
this_dir=$(dirname "${BASH_SOURCE[0]}")
cd "$this_dir"
# When a single system test fails, keep running until the end of the test
# script, and then print out all failing tests. While this isn't a better flow
# for interactive use for all users, for system tests it allows you to see the
# full list of system tests that failed so you can iterate on them or test them
# for flakiness.
export CONTINUE_AFTER_FAILURE=true
source checkin_test_helpers.sh
export OBJDIR=${OBJDIR:-/tmp/instaweb.$$}
make_args_array=($MAKE_ARGS)
mkdir -p "$OBJDIR"
failed_tests=""
prep_failures=""
for prep in $(make echo_checkin_prep); do
run_noisy_command_showing_log "$OBJDIR"/"$prep".log "$prep" \
make "${make_args_array[@]}" "$prep"
if [ "$?" -ne "0" ]; then
prep_failures+=" $prep"
fi
done
if [ ! -z "$prep_failures" ]; then
echo checkin_prep failed: "$prep_failures"
exit 1
fi
if [ "$#" -eq 0 ]; then
tests=( \
apache_test \
apache_release_test \
apache_system_tests \
pagespeed_automatic_smoke_test \
)
else
tests=("$@")
fi
for testname in "${tests[@]}"; do
is_system_test=$(echo "$testname" | grep -c system_test)
if [ "$is_system_test" = 1 ]; then
SERVER="Apache"
LOCKFILE="$APACHE_LOCKFILE"
echo -n Waiting for "$SERVER" lock "$LOCKFILE" ...
acquire_lock "$SERVER" "$LOCKFILE"
print_elapsed_time
echo ""
fi
run_noisy_command_showing_log "$OBJDIR/${testname}.log" "$testname" \
make "${make_args_array[@]}" "$testname"
if [ "$?" -ne "0" ]; then
failed_tests+=" $testname"
fi
if [ "$is_system_test" = 1 ]; then
run_noisy_command_showing_log "$OBJDIR/apache_install_conf.log" \
"Returning Apache config to a consistent state." \
make "${make_args_array[@]}" apache_install_conf
release_lock "$SERVER" "$LOCKFILE"
fi
done
if [ -z "$failed_tests" ]; then
echo "All 'make' tests passed."
exit 0
fi
echo Failing tests: "$failed_tests"
echo Re-run with devel/checkin.make "$failed_tests"
exit 1
+144
View File
@@ -0,0 +1,144 @@
#!/bin/bash
#
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: sligocki@google.com (Shawn Ligocki)
#
# Helper functions for holding locks so that checkin tests from two clients
# can be run simultaneously, and printing status on long-running commands.
#
# Sourced from checkin.make.
readonly APACHE_LOCKFILE="/tmp/pagespeed-apache.lock"
function acquire_lock {
local server=$1
local lockfile=$2
local lockfile_tmp="$lockfile.$$"
local printed_msg=0
echo $$ > "$lockfile_tmp"
# ln will fail if $lockfile exists, making this an atomic test and set.
# Note that this is a hard link (ln), not a symlink (ln -s).
while ! ln "$lockfile_tmp" "$lockfile" 2>/dev/null; do
local lock_pid=$(cat "$lockfile" 2>/dev/null)
if [ "$lock_pid" = "$$" ]; then
## We already have the lock, apparently!
break
fi
if [ -n "$lock_pid" ] && ! ps "$lock_pid" >/dev/null; then
echo "Removing stale lock. Process PID=$lock_pid, no longer exists."
rm "$lockfile"
else
if [ "$printed_msg" = 0 ]; then
echo -n "Waiting for PID $lock_pid to give up the $server lock."
printed_msg=1
else
echo -n '.'
fi
sleep 1
fi
done
if [ "$printed_msg" != 0 ]; then
echo
fi
rm -f "$lockfile_tmp"
}
function release_lock {
SERVER=$1
LOCKFILE=$2
echo "Unlocking $SERVER."
rm "$LOCKFILE"
}
exit_status=0
# Returns the unix system time in seconds.
function now_sec() {
date +%s
}
start_time_sec=$(now_sec)
# Prints the elapsed time, in seconds, since the last time print_elapsed_time
# was called. Any arguments to this function will be passed to through as the
# first args to echo. The intent is you can put
# print_elapsed_time -n
# to allow callers to print more stuff on the same line.
function print_elapsed_time() {
current_time_sec=$(now_sec)
if [ "$previous_time_sec" != 0 ]; then
echo -n : "$((current_time_sec - start_time_sec))" sec
fi
}
# Determines whether the passed-in PID is alive.
function is_process_alive() {
ps "$1" > /dev/null
}
# Runs command, redirecting stdout+stderr to a logfile, which is specified as
# the first argument. The second argument is a string to put in the status
# messsage. This might be all or part of the actual command, or something
# descriptive. The rest of the arguments are the command.
#
# The full command will be added as the first line of the logfile.
#
# This function blocks until the command finishes, but it prints out status
# lines at increasing intervals, with the max interval being 60 seconds. Once
# the 60-second threshold is reached, each status line is emitted with a
# newline. This is so that two long-running commands running in parallel
# don't completely overwrite each other's status.
#
# The global variable 'exit_status' is set to 0 if the command succeeds, 1 if
# it fails.
function run_noisy_command_showing_log() {
logfile="$1"
shift
description="$1"
shift
start_time_sec=$(now_sec)
previous_time_sec=$start_time_sec
echo "$@" "&>" "$logfile" "..."
("$@" ; echo exit_status=$?) &> "$logfile" &
pid=$!
print_interval_sec=60
while is_process_alive $pid; do
sleep 1
current_sec=$(now_sec)
interval_sec=$((current_sec - previous_time_sec))
if [ $interval_sec -ge $print_interval_sec ]; then
previous_time_sec=$current_sec
lines_in_logfile=$(wc -l < "$logfile")
echo " ... $description: $lines_in_logfile lines$(print_elapsed_time)"
fi
done
if [ "$(tail -n 1 "$logfile")" = "exit_status=0" ]; then
echo -n "PASS"
local exit_status=0
else
echo -n "FAIL"
local exit_status=1
fi
print_elapsed_time
# shellcheck disable=SC2145
echo " ($@ >& $logfile)"
return $exit_status
}
+195
View File
@@ -0,0 +1,195 @@
#!/bin/bash
#
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: morlovich@google.com (Maksim Orlovich)
#
# The usual mechanism used to develop mod_pagespeed and build binaries is based
# on merging all dependencies into a single source tree. This script enables a
# standard untar/configure/make flow that does not bundle widely available
# external libraries. It generates the tarball including the configure (or
# rather generate.sh) script.
#
# If --minimal is passed, it will cut out even more things. This was meant
# for packaging properly Debian, which has a particularly extensive package
# repository. At the moment this configuration requires further patching of
# the .gyp[i] files and doesn't work out of the box. The pruning was also done
# as of branch 33, so further tweaks might be required for this mode in
# 34 or newer.
#
# This is expected to be run from build_release_tarball.sh, on the branch you
# want a tarball for.
set -e # exit script if any command returns an error
set -u # exit the script if any variable is uninitialized
function usage {
echo "create_distro_tarball_debian.sh [ --minimal ] tarball"
exit 1
}
# This outputs a little wrapper around gyp that calls it with appropriate -D
# flag
function config {
cat <<SCRIPT_END
#!/bin/sh
#
# This script uses gyp to generate Makefiles for mod_pagespeed built against
# the following system libraries:
# apr, aprutil, apache httpd headers, icu, libjpeg_turbo, libpng, zlib.
#
# Besides the -D use_system_libs=1 below, you may need to set (via -D var=value)
# paths for some of these libraries via these variables:
# system_include_path_httpd, system_include_path_apr,
# system_include_path_aprutil.
#
# for example, you might run
# ./generate.sh -Dsystem_include_path_apr=/usr/include/apr-1 \\
# -Dsystem_include_path_httpd=/usr/include/httpd
# to specify APR and Apache include directories.
#
# Also, BUILDTYPE=Release can be passed to make (the default is Debug).
echo "Generating src/Makefile"
src/build/gyp_chromium -D use_system_libs=1 \$*
SCRIPT_END
}
if [ $# -lt 1 ]; then
usage
exit
fi
MINIMAL=0
if [ "$1" == "--minimal" ]; then
MINIMAL=1
shift 1
fi
TARBALL="$1"
if [ -z "$TARBALL" ]; then
usage
fi
touch "$TARBALL"
TARBALL="$(realpath $TARBALL)"
MPS_CHECKOUT="$PWD"
git submodule update --init --recursive
# Pick up our version info, and wrap src inside a modpagespeed-version dir.
source net/instaweb/public/VERSION
VER_STRING="$MAJOR.$MINOR.$BUILD.$PATCH"
TEMP_DIR="$(mktemp -d)"
WRAPPER_DIR="modpagespeed-$VER_STRING"
mkdir "$TEMP_DIR/$WRAPPER_DIR"
DIR="$WRAPPER_DIR/src"
ln -s "$MPS_CHECKOUT" "$TEMP_DIR/$DIR"
# Also create a little helper script that shows how to run gyp
config > "$TEMP_DIR/$WRAPPER_DIR/generate.sh"
chmod +x "$TEMP_DIR/$WRAPPER_DIR/generate.sh"
# Normally, the build system runs build/lastchange.sh to figure out what
# to put into the last portion of the version number. We are, however, going to
# be getting rid of the .git dirs, so that will not work (nor would it without
# network access). Luckily, we can provide the number via LASTCHANGE.in,
# so we just compute it now, and save it there.
./build/lastchange.sh "$MPS_CHECKOUT" > LASTCHANGE.in
# Things that depends on minimal or not.
if [ $MINIMAL -eq 0 ]; then
GTEST=$DIR/testing
GFLAGS=$DIR/third_party/gflags
GIFLIB=$DIR/third_party/giflib
ICU="$DIR/third_party/icu/icu.gyp \
$DIR/third_party/icu/source/common/unicode/"
JSONCPP=$DIR/third_party/jsoncpp
LIBWEBP=$DIR/third_party/libwebp
PROTOBUF=$DIR/third_party/protobuf
RE2=$DIR/third_party/re2
else
GTEST="$DIR/testing \
--exclude $DIR/testing/gmock \
--exclude $DIR/testing/gtest"
GFLAGS=$DIR/third_party/gflags/gflags.gyp
GIFLIB=$DIR/third_party/giflib/giflib.gyp
ICU=$DIR/third_party/icu/icu.gyp
JSONCPP=$DIR/third_party/jsoncpp/jsoncpp.gyp
LIBWEBP="$DIR/third_party/libwebp/COPYING \
$DIR/third_party/libwebp/examples/gif2webp_util.*"
PROTOBUF="$DIR/third_party/protobuf/*.gyp \
$DIR/third_party/protobuf/*.gypi"
RE2=$DIR/third_party/re2/re2.gyp
fi
# It's tarball time!
# Note that this is highly-version specific, and requires tweaks for every
# release as its dependencies change. Always run the version of this
# script that's on the branch you're making a tarball for.
cd "$TEMP_DIR"
tar cj --dereference --exclude='.git' --exclude='.svn' --exclude='.hg' -f $TARBALL \
--exclude='*.mk' --exclude='*.pyc' \
--exclude=$DIR/net/instaweb/genfiles/*/*.cc \
$WRAPPER_DIR/generate.sh \
$DIR/LASTCHANGE.in \
$DIR/base \
$DIR/build \
--exclude $DIR/build/android/arm-linux-androideabi-gold \
$DIR/install \
$DIR/net/instaweb \
$DIR/pagespeed \
$DIR/strings \
$GTEST \
$DIR/third_party/apr/apr.gyp \
$DIR/third_party/aprutil/aprutil.gyp \
$DIR/third_party/aprutil/apr_memcache2.h \
$DIR/third_party/aprutil/apr_memcache2.c \
$DIR/third_party/httpd/httpd.gyp \
$DIR/third_party/httpd24/httpd24.gyp \
$DIR/third_party/base64 \
$DIR/third_party/brotli \
$DIR/third_party/chromium/src/base \
--exclude src/third_party/chromium/src/base/third_party/xdg_mime \
--exclude src/third_party/chromium/src/base/third_party/xdg_user_dirs \
$DIR/third_party/chromium/src/build \
--exclude $DIR/third_party/chromium/src/build/android \
$DIR/third_party/chromium/src/googleurl \
$DIR/third_party/chromium/src/net/tools \
$DIR/third_party/closure/ \
$DIR/third_party/closure_library/ \
$DIR/third_party/css_parser \
$DIR/third_party/domain_registry_provider \
$GFLAGS \
$GIFLIB \
$DIR/third_party/google-sparsehash \
$DIR/third_party/grpc \
$DIR/third_party/hiredis \
$ICU \
$JSONCPP \
$DIR/third_party/libjpeg_turbo/libjpeg_turbo.gyp \
$DIR/third_party/libpng/libpng.gyp \
$LIBWEBP \
$DIR/third_party/modp_b64 \
$DIR/third_party/optipng \
$PROTOBUF \
$DIR/third_party/rdestl \
$RE2 \
$DIR/third_party/redis-crc \
$DIR/third_party/serf \
$DIR/third_party/zlib/zlib.gyp \
$DIR/tools/gyp \
$DIR/url
cd "$MPS_CHECKOUT"
rm -r "$TEMP_DIR"
+60
View File
@@ -0,0 +1,60 @@
#!/bin/bash
#
# Copyright 2003 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Runs a file in $1 through a giant sed script, transforming normal
# C++ comments to Doxygen comments. The resultant file is placed in
# $2/$1, so $2 must be a subdirectory.
#
# Usage: scripts/doxify.sh filename destination_directory
set -u # exit the script if any variable is uninitialized
set -e # exit script if any command returns an error
filename=$1
destination_directory=$2
outfile=$destination_directory/$filename
mkdir -p "$(dirname $outfile)"
sed -r 's~/\*([^\*])~/\*\*\1~; # /* -> /** \
s~///*~///~; # // -> /// \
s~;[ ]*/\*\*([^<*]*)~; /\*\*<\1~; # /** -> /**< on right after code \
s~;[ ]*///*([^<])~; ///<\1~; # /// -> ///< on right after code \
s~,([ ]*)///*([^<])~,\1///<\2~; # /// -> ///< on right after enum \
s~([[:alnum:]][ ]*)///*([^<])~\1///<\2~; # /// -> ///< on right after enum \
s~DISALLOW_COPY_AND_ASSIGN\(.*\)\;~~; # /// -> ///< on right after code \
s~(///) *---+([^-].+[^-]) *---+~\1\2~; # /// ---- Bla ---- -> /// Bla
s~(///) *===+([^=].+[^=]) *===+~\1\2~; # /// ==== Bla ==== -> /// Bla
s~(///) *\*\*\*+([^\*].+[^\*]) *\*\*\*+~\1\2~; # /// **** Bla **** -> /// Bla
s~(///) *----*( *)~\1\2~; # /// -------- -> ///
s~(///) *====*( *)~\1\2~; # /// ======== -> ///
s~(///) *\*\*\*\**( *)~\1\2~; # /// ******** -> ///
s~(///) *\* \* \*( \*)* *~\1~; # /// * * * * * -> ///
s~(([^A-Z_])((TODO|FIXME)[^A-Z_].*))~\2 @todo \3~; # TODO* -> @todo TODO* \
s~(([^A-Z_])((BUG)[^A-Z_].*))~\2 @bug \3~; # BUG* -> @bug BUG* \
s~([ \t]*)ABSTRACT([ \t]*\;)~\1\=0\2~; # void f() ABSTRACT; -> void f() =0; \
s~DECLARE_string(.*)~DECLARE_STRING\1~; # /// -> ///< on right after code \
s~DECLARE_bool(.*)~DECLARE_BOOL\1~; # /// -> ///< on right after code \
s~DECLARE_int32(.*)~DECLARE_INT32\1~; # /// -> ///< on right after code \
s~DECLARE_uint32(.*)~DECLARE_UINT32\1~; # /// -> ///< on right after code \
s~DECLARE_int64(.*)~DECLARE_INT64\1~; # /// -> ///< on right after code \
s~DECLARE_uint64(.*)~DECLARE_UINT64\1~; # /// -> ///< on right after code \
s~/// *(Copyright(.*))~// \1~; # clutter \
s~/// *(All [rR]ights [rR]eserved(.*))~// \1~; # clutter \
s~/// *(Date: (.*))~/// @file~; # clutter \
s~/// *Author:(.*)~/// @file~; # /// Author -> /// @file \
s~/// *Author(.*)~/// @file~; # /// Author -> /// @file ' \
< $filename > $outfile
+85
View File
@@ -0,0 +1,85 @@
#!/bin/bash
#
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Processes the open-source header files using Doxygen. Each header
# must be preprocessed using doxify.sh to convert normal C++ comments
# into Doxygen Usage.
#
# comments: devel/doxify_tree.sh output_tarball
set -e # exit script if any command returns an error
set -u # exit the script if any variable is uninitialized
this_dir=$(dirname "${BASH_SOURCE[0]}")
cd "$this_dir/.."
src="$PWD"
cfg="$src/devel/doxygen.cfg"
if [ $# != 1 ]; then
echo Usage: $0 output_tarball
exit 1
fi
if ! which doxygen > /dev/null; then
echo "doxygen is not installed; run"
echo " sudo apt-get install doxygen"
exit 1
fi
# This generates a documentation tarball, suitable for copying to
# modpagespeed.com. This should be in $1
tarball="$(readlink -f $1)"
source "$src/net/instaweb/public/VERSION"
PSOL_VERSION="$MAJOR.$MINOR.$BUILD.$PATCH"
WORKDIR=$(mktemp -d)
trap "rm -r $WORKDIR" EXIT
OUTPUT_DIRECTORY="$WORKDIR/doxygen_out"
mkdir "$OUTPUT_DIRECTORY"
hacked_copies="$WORKDIR/hacked_copies"
mkdir "$hacked_copies"
echo Preprocessing header files to turn normal C++ comments into Doxygen-style
echo comments....
find net/ pagespeed/ -name "*.h" -exec "$src/devel/doxify.sh" {} \
"$hacked_copies" \;
# These variables are referenced in doxygen.cfg, so export them before running
# doxygen.
export PSOL_VERSION
export OUTPUT_DIRECTORY
log_file=$OUTPUT_DIRECTORY/doxygen.log
cd $hacked_copies
doxygen $cfg 2> $log_file
# Doxygen produces a large number of warnings about undocumented classes. At
# some point we should fix all these but this is going to take a while as there
# are 12431 as of 2016-11-18.
#
# These will reference files that we have hacked in this script, and using Emacs
# to navigate to these errors will get you to files you should never edit.
# Strip off the prefix so we'll print files with their source of truth.
grep hacked_copies $log_file | sed -e s@$hacked_copies/@@g
# TODO(jmarantz): walk through files in $OUTPUT_DIRECTORY/html and see whether
# there are changes to the corresponding files in the documentation.
cd $OUTPUT_DIRECTORY
tar czf $tarball .
ls -l $tarball
+1552
View File
File diff suppressed because it is too large Load Diff
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
"$@"
if [ $? -eq 0 ]; then
echo expected $1 to fail
exit 1
fi
exit 0
+168
View File
@@ -0,0 +1,168 @@
#!/usr/bin/python
#
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Fetches a set of URLs via a proxy, keeping statistics.
This script attempts to fetch all URLs in the list given on
the command-line via a specified proxy. It differs from the
widely available tools in that:
- The proxy connection is kept-alive to try to maximize throughput.
- Statuses and completion times for each URL are output to stdout to
help analyze the results.
With the --js option the output is a JavaScript object literal with fields named
for URLs with http:// replaced with whatever is passed as test_cat,
followed by a dash.
"""
__author__ = "morlovich@google.com (Maksim Orlovich)"
import getopt
import httplib
import socket
import sys
import time
import urlparse
def OpenProxy(config):
if config.ssl_mode:
new_proxy = httplib.HTTPSConnection(config.proxy_host, config.proxy_port)
else:
new_proxy = httplib.HTTPConnection(config.proxy_host, config.proxy_port)
new_proxy.connect()
return new_proxy
def ReopenProxy(config, old_proxy):
old_proxy.close()
return OpenProxy(config)
def TestName(config, test_url):
return test_url.replace("http://", config.test_cat + "-")
def FormatResult(config, time_str, status, test_url):
if config.js_mode:
return '"%s": %s,' % (TestName(config, test_url), time_str)
else:
return "%s %s %s" % (time_str, status, test_url)
class Configuration(object):
"""packages up execution settings."""
def __init__(self):
"""Initializes settings from command-line arguments."""
try:
opts, _ = getopt.getopt(sys.argv[1:], "",
["ssl", "js=", "proxy_host=", "proxy_port=",
"urls_file=", "user_agent="])
except getopt.GetoptError as err:
print str(err)
print ("Usage: devel/fetch_all.py [--ssl] [--js test_cat] "
"[--proxy_host host] [--proxy_port port] [--urls_file file] "
"[--user_agent user_agent]")
sys.exit(2)
self.ssl_mode = False
self.js_mode = False
self.has_user_agent = False
for name, value in opts:
if name == "--ssl":
self.ssl_mode = True
elif name == "--js":
self.js_mode = True
self.test_cat = value
elif name == "--proxy_host":
self.proxy_host = value
elif name == "--proxy_port":
self.proxy_port = int(value)
elif name == "--urls_file":
self.urls_file = value
elif name == "--user_agent":
self.has_user_agent = True
self.user_agent = value
def main():
conf = Configuration()
# Open a persistent connection to the proxy
proxy = OpenProxy(conf)
if conf.js_mode:
print "{"
f = open(conf.urls_file, "rt")
for url in f:
try:
# Fetch url
status = 301
followed = 0
while followed < 5:
url = url.strip()
if conf.ssl_mode:
url = url.replace("http://", "https://", 1)
start = time.time()
headers = {"Accept-Encoding": "gzip"}
if conf.has_user_agent:
headers["User-Agent"] = conf.user_agent
if "Chrome/" in conf.user_agent:
headers["Accept"] = "image/webp"
proxy.request("GET", url, None, headers)
response = proxy.getresponse()
response.read()
stop = time.time()
status = response.status
# Honor server's close request
connect_ctl = response.getheader("connection", default="")
if connect_ctl.lower().find("close") != -1:
proxy = ReopenProxy(conf, proxy)
# Report.
print FormatResult(conf, str((stop - start)*1000),
str(status), url)
# Handle redirections
if 301 <= status <= 303 or status == 307:
url = urlparse.urljoin(url,
response.getheader("Location", default=""))
followed += 1
else:
break
except httplib.BadStatusLine:
print FormatResult(conf, "0", "BadStatusLine", url)
proxy = ReopenProxy(conf, proxy)
except httplib.IncompleteRead:
print FormatResult(conf, "0", "IncompleteRead", url)
proxy = ReopenProxy(conf, proxy)
except socket.error:
print FormatResult(conf, "0", "SocketError", url)
proxy = ReopenProxy(conf, proxy)
if conf.js_mode:
print "}"
f.close()
if __name__ == "__main__":
main()
+266
View File
@@ -0,0 +1,266 @@
#!/bin/bash
#
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# A helper for running gcov on all of the project sources.
# Usage:
# gcov-all.sh (--prepare | --summarize) path
#
# where path is the same location where one runs make
#
# There are two modes:
# --prepare cleans up all the .gcda files. This should be done
# before running the test, as we need an accurate set of these
# to know which object files to include in the executable.
# It also effectively zeroes all the measurements, preventing
# different runs from getting added together.
#
# --summarize goes through the produced files, runs gcov on
# them, producing the gcov-summary.html and the gcov/ directory
# with individual dumps
#
# Glossary:
# .gcno file: produced by gcc during compilation, along with the
# corresponding .o file
# .gcda file: produced when an instrumented application is run
# (or .so is loaded), and then at its exit. Contains
# the actual measurements.
#
# To invoke gcov, we need to pass it in a list of all the source
# files we want coverage information for, as well as the directory
# to look into for the corresponding .gcno/.gcda files. The
# summarize mode collects these based on the .gcda files that exist.
#
# TODO(morlovich): evaluate lcov as an option? Its output looks nice.
function summarize {
WORKDIR=`mktemp -d`
SRCDIR=`pwd`
OUTNAME=gcov-summary.html
echo "Collecting all object and profile data into:" $WORKDIR
# Here, we look for the .gcda files, and the .o and .gcno that go with them.
# This is because they get generated for any object files that gets linked in,
# as soon as the executable/module are initialized, giving us an accurate
# picture of what should be checked
GCDAS=`find ./out/Debug_Coverage -name '*.gcda'`
DATA=
for F in $GCDAS
do
BASE=${F%.gcda}
GCNO=$BASE.gcno
O=$BASE.o
if [ ! -f $GCNO ]; then
echo "WARNING: can't find " $GCNO
continue
fi
if [ ! -f $O ]; then
echo "WARNING: can't find " $O
continue
fi
DATA+=" $F $GCNO $O"
done
cp $DATA $WORKDIR/
echo "Generating gcov summary into file://"$PWD/$OUTNAME
# Collect relevant sources. For each one, we check if we have the
# gcda (which means we have gcno, too). We want this for two reasons:
#
# 1) We only want coverage for a file if the gcda is there
# 2) gcov has a bug that screws up output if some files' .gcno
# does not exist (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35568)
#
# TODO(morlovich): worry about duplicate names!
SOURCES=`find -L $SRCDIR/net $SRCDIR/pagespeed -name '*.cc' -or -name '*.c'`
FILTERED_SOURCES=
for F in $SOURCES
do
GCDA=`basename $F .c`
GCDA=$WORKDIR/`basename $GCDA .cc`.gcda
if [ -f $GCDA ]; then
if [ $F == ${F/.svn/marker/} ]; then
FILTERED_SOURCES="$FILTERED_SOURCES $GCDA"
fi
fi
done
htmlDriver > $OUTNAME
echo "<pre id='data' style='display:none'>" >> $OUTNAME
gcov -o $WORKDIR $FILTERED_SOURCES >> $OUTNAME
echo "</pre>" >> $OUTNAME
echo "Moving all the .gcov files to gcov subdir (after wiping it)"
rm -rf $SRCDIR/gcov
mkdir $SRCDIR/gcov
mv *.gcov $SRCDIR/gcov
echo "Cleaning up..."
rm -r $WORKDIR
}
# This outputs the html driver that visualizes the results
function htmlDriver {
cat <<TEMPLATE_END
<!DOCTYPE html>
<head>
<script>
// Computes a color for given goodness percentage. (Using CSS3 hsl syntax)
function percentColor(percent) {
var hue = (percent / 100 * 120).toFixed(0);
return 'hsl(' + hue + ', 100%, 50%)';
}
// Adds a row with given DOM for the file info and given coverage
// percentage to the provided table section, giving it the appropriate color
function addResultRow(tsection, fileInfo, percent) {
var row = tsection.insertRow(-1);
row.style.backgroundColor = percentColor(percent);
var fileNameCell = row.insertCell(-1);
fileNameCell.appendChild(fileInfo);
var percentCell = row.insertCell(-1);
percentCell.align = 'right';
percentCell.appendChild(document.createTextNode(percent.toFixed(2) + '%'));
}
// Adds a result for given filename and coverage percentage to the first body
// of the table with id 'outTable'
function addFileResultRow(fileName, percent) {
var table = document.getElementById('outTable');
var tbody = table.tBodies[0];
// We want a link to the .gcov file here
var a = document.createElement('a');
a.appendChild(document.createTextNode(fileName));
var fragments = fileName.split('/');
a.setAttribute('href', 'gcov/' + fragments[fragments.length - 1] + '.gcov');
addResultRow(tbody, a, percent);
}
function addSummaryResultRow(summary, percent) {
var table = document.getElementById('outTable');
var tfoot = table.tFoot;
addResultRow(tfoot, document.createTextNode(summary), percent);
}
function prettifySummary() {
// Get the raw data from the <pre id='data'>
var preNode = document.getElementById('data');
var txt = (preNode.textContent ? preNode.textContent : preNode.innerText);
var allLines = txt.split('\n');
var currentFile;
// Collect file names, percentages, and lines
var allFiles = []; // array of name, coverage %, lines pairs
for (var i = 0; i < allLines.length; ++i) {
var line = allLines[i];
var fileInfo = /File '(.*)'/.exec(line);
if (fileInfo) {
currentFile = fileInfo[1];
// get rid of ./ if needed.
if (currentFile.substring(0, 2) == './') {
currentFile = currentFile.substring(2);
}
}
var linesInfo = /Lines executed:(.*)% of (\d+)/.exec(line);
if (linesInfo) {
allFiles.push([currentFile, Number(linesInfo[1]), Number(linesInfo[2])]);
}
if (/No executable lines/.exec(line)) {
allFiles.push([currentFile, 0, 0]);
}
}
// Sort by filename
allFiles.sort(function(a, b) {
if (a[0] < b[0]) {
return -1;
} else if (a[0] == b[0]) {
return 0;
} else {
return 1;
}
});
// Append all results we want to table, coloring by coverage; and also compute
// an overall number (which may include a few things we don't care about)
var totalLines = 0;
var totalCovered = 0;
for (var i = 0; i < allFiles.length; ++i) {
var fileName = allFiles[i][0];
var percent = allFiles[i][1];
var lines = allFiles[i][2];
// Skip paths -- we don't need coverage information for system headers
if (fileName.charAt(0) == '/') {
continue;
}
totalLines += lines;
totalCovered += Math.round(lines * percent / 100);
addFileResultRow(fileName, percent);
}
addSummaryResultRow('Total (' + totalCovered + '/' + totalLines +')',
totalCovered / totalLines * 100);
}
</script>
</head>
<body onload="prettifySummary()">
<table id="outTable">
<thead>
<tr><th>File name</th><th>Coverage percentage</th></tr>
</thead>
<tbody></tbody>
<tfoot style="font-weight:bold; "></tfoot>
</table>
TEMPLATE_END
}
function usage {
echo "Usage:" $0 "(--prepare | --summarize) path"
}
if [ -z $2 ]; then
usage
exit
fi
cd $2
case $1 in
--prepare)
echo "Removing old .gcda files"
find $2/out/Debug_Coverage -name '*.gcda' -delete;;
--summarize)
summarize;;
*)
usage;;
esac
@@ -0,0 +1,33 @@
ModPagespeedFileCachePath "#HOME/apache2/pagespeed_cache/"
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
<VirtualHost localhost:8080>
ModPagespeed on
<Location /pagespeed_admin>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
SetHandler pagespeed_admin
</Location>
<Location /pagespeed_global_admin>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
SetHandler pagespeed_global_admin
</Location>
KeepAlive On
KeepAliveTimeout 60
<Directory "#HOME/apache2/htdocs/" >
# This is enabled to make sure we don't crash mod_negotiation.
Options +MultiViews
</Directory>
ModPagespeedRewriteLevel AllFilters
ModPagespeedSlurpDirectory #SLURP_DIR
ModPagespeedSlurpReadOnly off
ModPagespeedRewriteDeadlinePerFlushMs -1
CustomLog "#LOG_PATH" %r
</VirtualHost>
+67
View File
@@ -0,0 +1,67 @@
#!/bin/bash
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script collects slurps and URLs (post-optimization, if possible), of
# some websites with the help of phantomjs.
function usage {
echo "Usage: loadtest_collect/loadtest_collect_corpus.sh pages.txt out.tar.bz2"
echo "Where pages.txt has a URL (including http://) per line"
}
set -u # exit the script if any variable is uninitialized
set -e
if [ $# -ne 2 ]; then
usage
exit 1
fi
if [ -d devel ]; then
cd devel
fi
if [ ! -d loadtest_collect ]; then
echo Run this script from the top or devel/ directories
exit 1
fi
if [ ! $(which phantomjs) ]; then
echo "phantomjs not found, trying to install it with apt-get"
sudo apt-get install phantomjs
fi
SLURP_TOP_DIR=$(mktemp -d)
SLURP_DIR=$SLURP_TOP_DIR/slurp
mkdir $SLURP_DIR
LOG_PATH=$SLURP_TOP_DIR/log.txt
URLS_PATH=$SLURP_TOP_DIR/corpus_all_urls.txt
make clean_slate_for_tests
make apache_debug_stop
sed -e "s^#HOME^$HOME^" -e "s^#SLURP_DIR^$SLURP_DIR^" \
-e "s^#LOG_PATH^$LOG_PATH^" \
< loadtest_collect/loadtest_collect.conf > ~/apache2/conf/pagespeed.conf
make -j8 apache_debug_restart
for site in $(cat $1); do
echo $site
phantomjs --proxy=127.0.0.1:8080 loadtest_collect/script.js $site
done
cat $LOG_PATH | grep ^GET | cut -d ' ' -f 2 > $URLS_PATH
cd $SLURP_TOP_DIR
tar cvjf $2 .
+12
View File
@@ -0,0 +1,12 @@
// This is basically just the stripped down http://phantomjs.org/quick-start.html
// example.
var page = require('webpage').create();
var system = require('system');
if (system.args.length === 1) {
console.log('Usage: script.js <some URL>');
phantom.exit();
}
page.open(system.args[1], function(status) {
phantom.exit();
});
+78
View File
@@ -0,0 +1,78 @@
#!/bin/bash
#
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: morlovich@google.com (Maksim Orlovich)
#
# Helpers for doing experiments with lots of vhosts.
#
# usage:
# scripts/lots_of_vhosts.sh --config | --traffic
#
# You can also set envvar NUM_VHOSTS to configure how many hosts to use.
set -e # exit script if any command returns an error
set -u # exit the script if any variable is uninitialized
NUM_VHOSTS=${NUM_VHOSTS:-10000}
function usage {
cat <<EOF >&2
Usage:
scripts/lots_of_vhosts.sh --config | --traffic
--config generates a suffix for pagespeed.conf
--traffic generates a list of URLs for trace_stress_test.sh
You can also set environment variable NUM_VHOSTS to control the number of
virtual hosts produced.
See also https://github.com/pagespeed/mod_pagespeed/wiki/Memory-Profiling
EOF
}
function config {
echo "NameVirtualHost *:8080"
for i in $(seq 0 $NUM_VHOSTS); do
echo "<VirtualHost *:8080>"
echo " DocumentRoot $HOME/apache2/htdocs/"
echo " ServerName vhost"$i".example.com"
echo " ModPagespeed on"
echo " ModPagespeedFileCachePath \"/tmp/vhost\""
echo " ModPagespeedBlockingRewriteKey \"foo"$i"\""
echo "</VirtualHost>"
done
}
function traffic {
for i in $(seq 0 $NUM_VHOSTS); do
echo "http://vhost"$i".example.com/mod_pagespeed_example/"
done
}
if [ $# -ne 1 ]; then
usage
exit 1
fi
case $1 in
--config)
config;;
--traffic)
traffic;;
*)
usage
exit 1
;;
esac
+64
View File
@@ -0,0 +1,64 @@
#!/bin/bash
#
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script is intended to be run from devel/mps_load_test.sh, although it can
# be run directly as well.
#
# Usage: devel/mps_generate_load.sh \
# [--ipro_preserve] [--ssl] [--user_agent user_agent_string]
set -e # exit script if any command returns an error
set -u # exit the script if any variable is uninitialized
devel_directory="$(dirname $0)"
corpus_suffix=
IPRO_PRESERVE=0
if [[ $# -ge 1 && "$1" = "--ipro_preserve" ]]; then
shift
corpus_suffix=.ipro_preserve
IPRO_PRESERVE=1
fi
extra_flags=
if [[ $# -ge 1 && "$1" = "--ssl" ]]; then
shift
extra_flags=$1
fi
user_agent=
if [[ $# -ge 1 && "$1" = "--user_agent" ]]; then
user_agent=$2
shift 2
fi
corpus_file=/tmp/corpus_all_urls.txt.$USER$corpus_suffix
# Grab the file from the server host if needed.
if [ ! -e $corpus_file ]; then
work_file=$(mktemp)
src="$HOME/pagespeed-loadtest-corpus/corpus_all_urls.txt"
cp $src $work_file
if [ $IPRO_PRESERVE = 1 ]; then
cat $work_file | fgrep -v .pagespeed. > $corpus_file
rm $work_file
else
mv $work_file $corpus_file
fi
fi
PROXY_HOST=127.0.0.1 FLAGS=$extra_flags USER_AGENT=$user_agent PAR=50 RUNS=3 \
$devel_directory/trace_stress_test.sh $corpus_file
+282
View File
@@ -0,0 +1,282 @@
#!/bin/bash
#
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Note: this script is not yet usable outside Google, because it depends on a
# corpus database that we can't open source. It should be possible to create a
# db with a combination of mod_pagespeed's slurping and a headless browser, but
# we don't currently have a script or instructions on how to do this.
# TODO(jefftk): resolve this
#
# This script runs a mod_pagespeed load-test. The typical
# configuration is to run this on your development workstation and
# mps_generate_load.sh will be run (via ssh) on a different machine
# (localhost by default, for single-machine runs).
#
# Usage: scripts/mps_load_test.sh
# [-start_apache_then_exit]
# [-custom_so mod_pagespeed.so]
# [-custom_so24 mod_pagespeed_ap24.so]
# [-user_agent user_agent_string]
# [-chrome]
# [-memcached|-redis]
# [-ipro_preserve]
# [-purging]
# [-inline_unauthorized_resources]
# [-ssl]
# [-debug]
# [corpus_file.tar.bz2]
#
# Note: Order of supplied command line parameters matters for correct working.
#
# corpus_file.tar.bz2 is mandatory on the first run and ignored on later runs.
# The extracted version is stored in the directory specified by $corpus (see
# below) between runs.
#
# Example of user_agent_string: Chrome/23.0.1271.17
# Saying '-chrome' is equivalent to saying 'give me a recent version of Chrome,
# which needs to be updated by editing this script.
#
# If the 'machine name' argument is "localhost" then:
# - you will not be prompted for your ssh password
# - your machine will be unusable for a little while
# - your results may be more consistent
#
# This scripts prompts you for your su password if it needs to set your
# /proc/sys/net/ipv4/tcp_tw_recycle file to contain a "1".
set -e # exit script if any command returns an error
set -u # exit the script if any variable is uninitialized
this_dir=$(dirname "${BASH_SOURCE[0]}")
cd "$this_dir/.."
src="$PWD"
gen_load="$src/devel/mps_generate_load.sh"
corpus="$HOME/pagespeed-loadtest-corpus"
start_apache_then_exit=0
# Check if we are asked for an external cache (e.g memcached or redis) but
# don't have a port configured first, as we need to re-launch ourselves using
# run_program_with_EXTCACHE.sh, so we don't want to mess up $@.
for argument in "$@"; do
if [ "$argument" = "-memcached" -a -z "${MEMCACHED_PORT+x}" ]; then
exec "$src/install/run_program_with_memcached.sh" \
"$src/devel/mps_load_test.sh" "$@"
elif [ "$argument" = "-redis" -a -z "${REDIS_PORT+x}" ]; then
exec "$src/install/run_program_with_redis.sh" \
"$src/devel/mps_load_test.sh" "$@"
fi
done
if [[ $# -ge 1 && "$1" = "-start_apache_then_exit" ]]; then
start_apache_then_exit=1
shift
fi
custom_so=
if [[ $# -ge 2 && "$1" = "-custom_so" ]]; then
custom_so=$2
shift 2
fi
custom_so24=
if [[ $# -ge 2 && "$1" = "-custom_so24" ]]; then
custom_so24=$2
shift 2
fi
if [[ $# -ge 1 && "$1" = "-chrome" ]]; then
export USER_AGENT_FLAG="--user_agent Chrome/47.0.2526.80"
shift
elif [[ $# -ge 2 && "$1" = "-user_agent" ]]; then
export USER_AGENT_FLAG="--user_agent $2"
shift 2
else
export USER_AGENT_FLAG=
fi
if [[ $# -ge 1 && "$1" = "-memcached" ]]; then
echo Using memcached on port $MEMCACHED_PORT
shift
export MEMCACHED=1
export REDIS=0
cache_stat_prefix="memcache"
elif [[ $# -ge 1 && "$1" = "-redis" ]]; then
echo Using redis on port "$REDIS_PORT"
shift
export MEMCACHED=0
export REDIS=1
cache_stat_prefix="redis"
else
export MEMCACHED=0
export REDIS=0
cache_stat_prefix="file_cache_"
fi
if [[ $# -ge 1 && "$1" = "-ipro_preserve" ]]; then
shift
export IPRO_PRESERVE=1
export EXTRA_URL_FLAGS=--ipro_preserve
else
export IPRO_PRESERVE=0
export EXTRA_URL_FLAGS=
fi
if [[ $# -ge 1 && "$1" = "-purging" ]]; then
shift
export PURGING=1
else
export PURGING=0
fi
if [[ $# -ge 1 && "$1" = "-inline_unauthorized_resources" ]]; then
shift
export IUR=1
else
export IUR=0
fi
if [[ $# -ge 1 && "$1" = "-ssl" ]]; then
shift
export EXTRA_FETCH_FLAGS=--ssl
else
export EXTRA_FETCH_FLAGS=
fi
if [[ $# -ge 1 && "$1" = "-debug" ]]; then
shift
compile_mode="Debug"
else
compile_mode="OptDebug"
fi
if [ $# -ge 2 ]; then
echo "Unknown arguments: $@"
exit 1
fi
if [ ! -d "$corpus" ] && [ $# -ne 1 ]; then
echo "Invalid arguments: corpus required"
exit 1
fi
if [ -d "$corpus" ] && [ $# -ne 0 ]; then
echo "Warning: using already extracted corpus instead of $1"
fi
# If an 'su' password is required, then get it before going off and compiling
# stuff.
"$src/devel/turn_on_timewait_recyling.sh"
if [ -d /var/run/pagespeed/ ]; then
rm -rf /var/run/pagespeed/*
else
sudo mkdir -p /var/run/pagespeed
sudo chown $USER /var/run/pagespeed
fi
# Only ssh (and warn user that they will need a password) if using a separate
# host for load generation.
cmd="$gen_load $EXTRA_URL_FLAGS $EXTRA_FETCH_FLAGS $USER_AGENT_FLAG"
APACHE_DEBUG_ROOT=${APACHE_DEBUG_ROOT:-$HOME/apache2}
echo Checking whether we have the corpus available.
if [ ! -d "$corpus" ]; then
corpus_src="$1"
echo "Copying corpus files from $corpus_src"
mkdir -p "$corpus"
cd "$corpus"
tar xjf "$corpus_src"
fi
cd "$src/devel"
# Build a version of mod_pagespeed with all optimizations enabled, but with
# a build that includes DCHECKs.
make -j8 CONF=$compile_mode apache_trace_stress_test_server \
DUMP_DIR="$corpus" \
APACHE_DEBUG_ROOT=${APACHE_DEBUG_ROOT} \
MOD_PAGESPEED_CACHE=/var/run/pagespeed/cache
# If a custom .so got specified, install it.
if [[ -n "$custom_so" ]]; then
install -c $custom_so /usr/local/apache2/modules/mod_pagespeed.so
fi
if [[ -n "$custom_so24" ]]; then
install -c $custom_so24 /usr/local/apache2/modules/mod_pagespeed_ap24.so
fi
# Restart apache for any hand-specified .so or alternative binary
if [[ -n "$custom_so" || -n "$custom_so24" ]]; then
make apache_debug_stop
make apache_debug_start
fi
if [[ "$start_apache_then_exit" = 1 ]]; then
exit 0
fi
stop_crash_scraper="/tmp/stop_crash_scraper"
error_log="$APACHE_DEBUG_ROOT/logs/error_log"
rm -f "$stop_crash_scraper"
echo starting test ...
"$src/devel/scrape_error_log_for_crashes.sh" \
"$error_log" "$stop_crash_scraper" &
echo $cmd ...
$cmd
touch "$stop_crash_scraper"
# Print some interesting statistics from the server
statsfile=/tmp/mps_load_test_stats.$$
wget -q -O $statsfile http://localhost:8080/mod_pagespeed_global_statistics
grep "$cache_stat_prefix" $statsfile | grep -v onchange=
grep shm $statsfile
grep dropped $statsfile
grep cache_batcher $statsfile
grep rewrite_cached_output_missed_deadline $statsfile
grep bytes_saved $statsfile
grep serf $statsfile
grep queued-fetch-count $statsfile
grep page_load_count $statsfile
grep 404_count $statsfile
grep file_cache_bytes_freed_in_cleanup $statsfile
grep file_cache_cleanups $statsfile
grep file_cache_write_errors $statsfile
grep image_webp_rewrites $statsfile
egrep "num_css|num_js" $statsfile
rm -f $statsfile
set +e
echo 'egrep "exit signal|CRASH" $error_log'
egrep "exit signal|CRASH" $error_log
if [ $? = 0 ]; then
echo "*** $error_log has dangerous looking errors. Please investigate."
exit 1
else
echo "No deaths reported in $error_log -- ship it."
fi
if [ "$MEMCACHED" = "1" -o "$REDIS" = "1" ]; then
date
echo -n Sleeping 5 seconds before killing external cache server to let
echo -n outstanding writes quiesce...
sleep 5
echo done
fi
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
#
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if [ $# -lt 2 ]; then
echo Usage: $0 error_log_filename stop_filename
exit 1
fi
error_log="$1"
stop_file="$2"
(tail -f $error_log | egrep "exit signal|CRASH") & background_pid=$!
while [ ! -e "$stop_file" ]; do sleep 10; done
kill $background_pid
rm -f "$stop_file"
+50
View File
@@ -0,0 +1,50 @@
# Global configuration.
#
# The ModPagespeedFileCachePath directory must exist and be writable
# by the apache user (as specified by the User directive).
ModPagespeedFileCachePath "#HOME/apache2/pagespeed_cache/"
# Direct Apache to send all HTML output to the mod_pagespeed
# output handler.
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
<VirtualHost localhost:8080>
# Turn on mod_pagespeed. To completely disable mod_pagespeed, you
# can set this to "off".
ModPagespeed on
<Location /pagespeed_admin>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
SetHandler pagespeed_admin
</Location>
<Location /pagespeed_global_admin>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
SetHandler pagespeed_global_admin
</Location>
# By default we siege-test without image beaconing.
ModPagespeedCriticalImagesBeaconEnabled false
# Turn on "KeepAlive" so the sieges go fast.
KeepAlive On
KeepAliveTimeout 60
LogFormat "%v %X %P %h %l %u %t \"%r\" %>s %b" common
LogLevel warn
# This configuration is required for siege_instant_ipro.
<Directory "#HOME/apache2/htdocs/mod_pagespeed_test/ipro/instant/wait/" >
ModPagespeedInPlaceWaitForOptimized on
ModPagespeedInPlaceRewriteDeadlineMs 5000
</Directory>
<Directory "#HOME/apache2/htdocs/" >
# This is enabled to make sure we don't crash mod_negotiation.
Options +MultiViews
</Directory>
# Test-specific configuration: #CUSTOM_CONFIG
</VirtualHost>
+39
View File
@@ -0,0 +1,39 @@
#!/bin/sh
this_dir=$(dirname "${BASH_SOURCE[0]}")
sieges=(extended_css extended_js html_high_entropy html instant_ipro \
ipro_image ipro_image_memcached rewritten_css rewritten_js)
echo "$(date): Starting ${#sieges[*]} sieges ..."
# So we can make the transactions/second line up, figure out the padding
# we'll need for smaller siege-names.
max_len=0
for siege in "${sieges[@]}"; do
len=${#siege}
if [ "$len" -gt "$max_len" ]; then
max_len=$len
fi
done
status=0
for siege in ${sieges[*]}; do
out="/tmp/siege_$siege.out"
# Make the columns line up by padding with spaces before the >& and "."
# before the transactions-per-second.
dots=$(eval printf "%0.s." {0..$((max_len - ${#siege}))})
spaces=$(echo "$dots" | sed -e 's/./ /g')
echo -n "$this_dir/siege_$siege.sh$spaces >& $out$dots.."
"$this_dir/siege_$siege.sh" &> "$out"
if [ $? -eq 0 ]; then
grep "Transaction rate:" "$out" |cut -f2 -d: | \
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
else
echo FAILED
status=1
fi
done
echo "$(date): Finished sieges, exit status $status"
exit $status
+25
View File
@@ -0,0 +1,25 @@
#!/bin/sh
# Runs 'siege' on a single cache-extended URL cache-extended CSS file
# scraped from rewrite_css.html.
#
# Usage:
# devel/siege/siege_extended_css.sh
this_dir=$(dirname "${BASH_SOURCE[0]}")
source "$this_dir/siege_helper.sh" || exit 1
# Fetch the rewrite_css example in cache-extend mode so we can get a small
# cache-extended CSS file.
EXAMPLE="http://localhost:8080/mod_pagespeed_example"
# The format of the 'link' HTML line we get is this:
# <link rel="stylesheet" type="text/css"
# href="styles/yellow.css.pagespeed.ce.lzJ8VcVi1l.css">
# The line-break before 'href' is added here to avoid exceeding 80 cols
# in this script but is not in the HTML.
#
# Splitting this by quotes seems a little fragile but it gets us the
# URL in the 6th token.
extract_pagespeed_url $EXAMPLE/rewrite_css.html 'link rel=' 6 extend_cache
run_siege "$EXAMPLE/$url"
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
this_dir=$(dirname "${BASH_SOURCE[0]}")
source "$this_dir/siege_helper.sh" || exit 1
# Fetch the rewrite_css example in cache-extend mode so we can get a small
# cache-extended CSS file.
EXAMPLE="http://localhost:8080/mod_pagespeed_example"
# The format of the 'script' HTML line we want is this:
# <script src="rewrite_javascript.js" ...
extract_pagespeed_url $EXAMPLE/rewrite_javascript.html 'script src=' \
2 extend_cache
run_siege "$EXAMPLE/$url"
+120
View File
@@ -0,0 +1,120 @@
# This file expects to be sourced from another file in the same directory in
# order to set us up for siege testing.
set -u # exit the script if any variable is uninitialized
set -e
if [ -d devel ]; then
cd devel
fi
if [ ! -d siege ]; then
echo Run this script from the top or devel/ directories
exit 1
fi
if ! hash siege 2>/dev/null; then
echo "'siege' command is not found, please install it. "
echo "siege_instant_ipro needs 3.0.8 or newer, other tests work with 3.0.5 "
echo "as well."
exit 1
fi
# If an 'su' password is required, then get it before going off and compiling
# stuff.
./turn_on_timewait_recyling.sh
# Build optimized mod_pagespeed.so if necessary, and restart it.
callgrind=0
if [ $# -eq 1 ]; then
if [ $1 == "-callgrind" ]; then
shift
callgrind=1
fi
fi
# Stop callgrind if it was running previously.
callgrind_control -k
# Clear all caches to make sure we start from a known state.
make clean_slate_for_tests
# This variable contains config that we want to inject into siege.conf when
# constructing pagespeed.conf, by sed-replacing "CUSTOM_CONFIG". This works
# with multiple config lines.
custom_config=""
function add_config_line() {
custom_config+="\n $1"
}
# If $MEMCACHED_PORT is set (i.e. we were run from
# run_program_with_memcached.sh) then configure it in the apache conf.
set +u
if [ ! -z "$MEMCACHED_PORT" ]; then
add_config_line "ModPagespeedMemcachedServers localhost:$MEMCACHED_PORT"
fi
set -u
make apache_debug_stop
sed -e "s/#CUSTOM_CONFIG/$custom_config/" -e "s^#HOME^$HOME^" < siege/siege.conf \
> ~/apache2/conf/pagespeed.conf
if [ $callgrind -eq 1 ]; then
echo running with callgrind...
make -j8 apache_debug_install CONF=OptDebug
valgrind --tool=callgrind --collect-systime=yes ~/apache2/bin/httpd -X &
sleep 5
callgrind=1
else
echo running without calgrind -- use -callgrind to get a profile.
make -j8 apache_debug_restart BUILDTYPE=Release
fi
# This function returns its value in shell variable 'url'. Note that it
# will return whatever is in the HTML value, which is usually a relative
# url.
function extract_pagespeed_url() {
url=""
html=$1
grep_pattern="$2"
url_token_index="$3"
filters="$4"
OPTIONS="?PageSpeedFilters=$filters"
echo -n Finding pagespeed url in $html${OPTIONS}, pattern=\"${grep_pattern}\"
echo ' #' $url_token_index
while true; do
LINE=$(wget -q -O - $html$OPTIONS | grep "$grep_pattern")
if [ "$LINE" != '' ]; then
url=$(echo $LINE | cut -d\" -f$url_token_index)
echo $url
break
else
sleep .1
echo -n '.'
fi
done
}
this_file=$(basename "$0")
this_name=$(basename "$this_file" .sh)
common_options=("--log=/tmp/$this_name.log" --rc=/dev/null)
# Runs siege, passing on any provided arguments.
function run_siege_with_options() {
(set -x; siege "${common_options[@]}" "$@")
if [ $callgrind -eq 1 ]; then
sleep 2
callgrind_control -d
ls -ltR callgrind.*
echo Type \'callgrind_control -k\' to close down valgrind.
fi
(set -x; ./expectfail egrep "exit signal|CRASH" \
~/apache2/logs/error_log)
}
# Run siege on a set of arguments, with reasonable defaults.
function run_siege() {
run_siege_with_options --benchmark --time=60s --concurrent=50 "$@"
}
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
# Runs 'siege' on a HTML file.
#
# Usage:
# devel/siege/siege_html.sh
this_dir=$(dirname "${BASH_SOURCE[0]}")
source "$this_dir/siege_helper.sh" || exit 1
# TODO(jmarantz): There appears to be no better way to turn all
# filters off via query-param. Though you might think that
# PageSpeedRewriteLevel=PassThrough should work, it does not. There
# is special handling for PageSpeedFilters=core but not for
# PassThrough.
URL="http://localhost:8080/mod_pagespeed_example/collapse_whitespace.html?PageSpeedFilters=rewrite_domains"
run_siege "$URL"
+32
View File
@@ -0,0 +1,32 @@
#!/bin/sh
# Runs 'siege' on a HTML file, but with 400k unique query-params. We
# use 400k because a typical siege covers >300k transactions and we
# want to avoid repeats.
#
# Usage:
# devel/siege/siege_html_high_entropy.sh
this_dir=$(dirname "${BASH_SOURCE[0]}")
source "$this_dir/siege_helper.sh" || exit 1
# Generate a list of unique URLs, each of which resolving to the same trival
# HTML file. I don't see an easy way of specifying zero rewriters (default is
# CoreFilters) but by specifying a single rewriter "rewrite_domains" as a
# query-param, we can emulate that. Note that "rewrite_domains" doesn't do
# anything if there are no domain-mappings set up.
#
# TODO(jmarantz): There appears to be no better way to turn all
# filters off via query-param. Though you might think that
# PageSpeedRewriteLevel=PassThrough should work, it does not. There
# is special handling for PageSpeedFilters=core but not for
# PassThrough.
echo "Generating URLs..."
urls="/tmp/high_entropy_urls.list.$$"
> "$urls"
trap "rm -f $urls" EXIT
base_url="http://localhost:8080/mod_pagespeed_example/collapse_whitespace.html?PageSpeedFilters=rewrite_domains&q"
for i in {1..400000}; do
echo "$base_url=$i" >> "$urls"
done
run_siege --file="$urls"
+61
View File
@@ -0,0 +1,61 @@
#!/bin/sh
if ! hash siege 2>/dev/null; then
echo "'siege' command is not found. Please install siege >=3.0.8."
echo "Note that repository may contain older version of Siege."
exit 1
fi
# Check that siege is at least 3.0.8.
siege_version=$(siege --version 2>&1 | head -n 1 | awk '{print $2}')
major=$(echo "$siege_version" | awk -F. '{print $1}')
minor=$(echo "$siege_version" | awk -F. '{print $2}')
point=$(echo "$siege_version" | awk -F. '{print $3}')
recent_siege=false
if [ "$major" -gt 3 ]; then
recent_siege=true
elif [ "$major" -eq 3 ]; then
if [ "$minor" -gt 0 ]; then
recent_siege=true
elif [ "$point" -ge 8 ]; then
recent_siege=true
fi
fi
if ! "$recent_siege"; then
# Versions before 3.0.8 didn't include the port number in the host header.
echo "$0: siege is version $siege_version but we need at least 3.0.8"
exit 1
fi
this_dir=$(dirname "${BASH_SOURCE[0]}")
source "$this_dir/siege_helper.sh" || exit 1
# Make a list of urls large enough that we can run through them for at least
# 20s.
urls_file=$(mktemp /tmp/siege.urls.XXXXXX)
function remove_urls_file() {
rm "$urls_file" 2> /dev/null
}
trap remove_urls_file EXIT
url_base="http://localhost:8080/mod_pagespeed_test/"
url_base+="ipro/instant/wait/purple.css?$RANDOM="
echo "Building url file..."
> "$urls_file"
N=100000
for i in $(seq 1 "$N"); do
echo "$url_base$i" >> "$urls_file"
done
# The siege documentation suggests that --reps means how many times to run
# through the file of urls, but it's actually implemented as meaning the number
# of urls each of the concurrent processes should run through. So if we have N
# urls to test and C processes, then each process should get N/C urls.
C=10
R="$(($N/$C))"
run_siege_with_options \
--file="$urls_file" \
--reps="$R" \
--benchmark \
--concurrent="$C"
+25
View File
@@ -0,0 +1,25 @@
#!/bin/sh
# Runs 'siege' on a single ipro-optimized image.
#
# Usage:
# devel/siege/siege_ipro_image.sh
this_dir=$(dirname "${BASH_SOURCE[0]}")
source "$this_dir/siege_helper.sh" || exit 1
echo "Waiting for the image to be IPRO-optimized..."
URL="http://localhost:8080/mod_pagespeed_example/images/Puzzle.jpg"
while true; do
content_length=$(curl -sS -D- -o /dev/null "$URL" | \
grep '^Content-Length: ' | \
grep -o '[0-9]*')
if [ "$content_length" -lt 100000 ]; then
# the image is fully ipro optimized
break
fi
sleep .1
echo -n .
done
run_siege "$URL"
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
# Runs 'siege' on a single ipro-optimized image with memcached.
#
# Usage:
# devel/siege/siege_ipro_image_memcached.sh
this_dir=$(readlink -e "$(dirname "${BASH_SOURCE[0]}")")
root_dir=$(readlink -e "$this_dir/../..")
install_dir="$root_dir/install"
set -e
"$install_dir/run_program_with_memcached.sh" "$this_dir/siege_ipro_image.sh"
+25
View File
@@ -0,0 +1,25 @@
#!/bin/sh
# Runs 'siege' on a single cache-extended URL cache-extended CSS file
# scraped from rewrite_css.html.
#
# Usage:
# devel/siege/siege_extended_css.sh
this_dir=$(dirname "${BASH_SOURCE[0]}")
source "$this_dir/siege_helper.sh" || exit 1
# Fetch the rewrite_css example in cache-extend mode so we can get a small
# cache-extended CSS file.
EXAMPLE="http://localhost:8080/mod_pagespeed_example"
# The format of the 'link' HTML line we get is this:
# <link rel="stylesheet" type="text/css"
# href="styles/yellow.css.pagespeed.ce.lzJ8VcVi1l.css">
# The line-break before 'href' is added here to avoid exceeding 80 cols
# in this script but is not in the HTML.
#
# Splitting this by quotes seems a little fragile but it gets us the
# URL in the 6th token.
extract_pagespeed_url $EXAMPLE/rewrite_css.html 'link rel=' 6 rewrite_css
run_siege "$EXAMPLE/$url"
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
this_dir=$(dirname "${BASH_SOURCE[0]}")
source "$this_dir/siege_helper.sh" || exit 1
# Fetch the rewrite_css example in cache-extend mode so we can get a small
# cache-extended CSS file.
EXAMPLE="http://localhost:8080/mod_pagespeed_example"
# The format of the 'script' HTML line we want is this:
# <script src="rewrite_javascript.js" ...
extract_pagespeed_url $EXAMPLE/rewrite_javascript.html 'script src=' \
2 rewrite_javascript
run_siege "$EXAMPLE/$url"
+84
View File
@@ -0,0 +1,84 @@
#!/bin/bash
#
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
set -u
APACHE_SERVER="$1"
APACHE_SLURP_ORIGIN_PORT="$2"
APACHE_SLURP_PORT="$3"
WGET="$4"
TMP_SLURP_DIR="$5"
PAGESPEED_TEST_HOST="$6"
this_dir=$(dirname "${BASH_SOURCE[0]}")
source "$this_dir/../pagespeed/automatic/system_test_helpers.sh" \
"$APACHE_SERVER"
EXTEND_CACHE_URL="http://www.modpagespeed.com/extend_cache.html"
DEVEL_DIR="$(dirname "${BASH_SOURCE[0]}")"
start_test "Testing slurping (read only, via proxy)"
http_proxy="$APACHE_SERVER" "$WGET" -q -O /dev/null \
"$EXTEND_CACHE_URL?PageSpeedFilters=extend_cache"
# TODO(sligocki): Use something like fetch_until rather than
# always waiting 2 seconds :/
sleep 2
OUT="$(http_proxy="$APACHE_SERVER" "$WGET" -q -O - \
"$EXTEND_CACHE_URL?PageSpeedFilters=extend_cache")"
check_from "$OUT" fgrep "images/Puzzle.jpg.pagespeed.ce."
OUT="$(http_proxy="$APACHE_SERVER" "$WGET" -q -O - \
"$EXTEND_CACHE_URL?PageSpeed=off")"
check_from "$OUT" fgrep '"images/Puzzle.jpg"'
start_test "Testing slurping (dns mode, mimicing webpagetest)"
OUT="$("$WGET" --header="Host: www.modpagespeed.com" -q -O - --save-headers \
"$EXTEND_CACHE_URL?PageSpeedFilters=extend_cache")"
check_from "$OUT" grep -q 'HTTP/1.[01] 200 OK'
start_test "Testing slurping http://www.example.com expecting index.html ..."
echo "rewrite will not happen"
OUT="$(http_proxy="$APACHE_SERVER" "$WGET" -q -O - http://www.example.com/)"
check_from "$OUT" fgrep "example.com expected body"
start_test "Connection-close stripping:"
echo 'First check we get "Connection:close"'
echo "straight from the origin -- no proxy."
rm -rf "$TMP_SLURP_DIR"
slurp_origin_url="http://localhost:$APACHE_SLURP_ORIGIN_PORT"
slurp_origin_url+="/close_connection/close_connection.html"
OUT="$("$WGET" --no-proxy -q --save-headers -O - --header="Connection:" \
"$slurp_origin_url")"
check_from "$OUT" fgrep "Connection: close"
echo "Now check that Connection:close is stripped from a writing slurp."
OUT=$(http_proxy=localhost:$APACHE_SLURP_PORT "$WGET" -q --save-headers -O - \
--header="Connection:" "$slurp_origin_url" || true)
check_not_from "$OUT" fgrep -q "Connection: close"
start_test "Testing slurp-proxying of a POST"
rm -rf "$TMP_SLURP_DIR"
OUT="$(http_proxy=localhost:$APACHE_SLURP_PORT "$WGET" -q -O - \
--post-data="a=b&c=d" \
http://$PAGESPEED_TEST_HOST/do_not_modify/cgi/verify_post.cgi)"
check_from "$OUT" grep "PASS"
+152
View File
@@ -0,0 +1,152 @@
#!/bin/bash
#
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This scripts reads a list of URLs from the provided file, and
# fetches them in parallel from a local slurping proxy in a randomized
# order. Loading times and statuses for them are then output to
# /tmp/latency-(encoding of settings).txt
# number of fetches to do in parallel
if [ -z $PAR ]; then
PAR=10
fi
# number of times to run
if [ -z $RUNS ]; then
RUNS=3
fi
# How many times to repeat each trace without restarting the workers
if [ -z $EXP ]; then
EXP=3
fi
# Proxy machine. If you specify this, make sure to give an IP address,
# as doing DNS lookups for it can slow things down a lot
if [ -z $PROXY_HOST ]; then
PROXY_HOST=127.0.0.1
fi
# .. and port
if [ -z $PROXY_PORT ]; then
PROXY_PORT=8080
fi
# Extra flags to pass to fetch_all.py
FLAGS=${FLAGS:-}
USER_AGENT_FLAG=${USER_AGENT:+--user_agent}
if [ $# -lt 1 ]; then
echo "Usage: devel/trace_stress_test.sh urls_file ..."
echo "Shuffles each urls_file in turn, runs through shuffled file using"
echo "$PAR parallel wget jobs. Repeats this process $RUN times."
exit 2
fi
OUR_PATH=`dirname $0`
STAMP=`date +%Y%m%d-%H%M`
LATENCY_REPORT=/tmp/latency-$PROXY_HOST-R$RUNS-P$PAR-E$EXP-$STAMP.txt
TAIL_HEAD_TEMP=/tmp/tail_head.$$
echo "time status url" > $LATENCY_REPORT
# Examines file in $1, starting at line $2, and the next $3 lines into file $4.
function tail_head {
input_file=$1
start_pos=$2
num_lines=$3
outfile=$4
# We make a temp file because otherwise we (at least Josh) get a lot of
# "tail: write error" printed out.
tail $input_file -n +$start_pos < $input_file > $TAIL_HEAD_TEMP
head $TAIL_HEAD_TEMP -n $num_lines >$outfile
}
function single_run {
FILE=$1
# Shuffle the log and split it into pieces
SHUF_FILE=`mktemp`
for I in `seq 1 $EXP`; do
shuf $FILE >> $SHUF_FILE
done
LINES=`wc -l $SHUF_FILE | sed s#$SHUF_FILE##`
# Setting chunk size slightly too large balances load a little better, most
# obvious when $LINES < $PAR.
CHUNK=`expr 1 + $LINES / $PAR`
# feed each chunk to a separate wget
PIECES=
LOGS=
POS=0
for I in `seq 1 $PAR`; do
CUR_CHUNK=$CHUNK
if [ $I -eq $PAR ]; then
# make sure we also include the remainder
EXTRA=`expr $LINES - $PAR \* $CHUNK`
CUR_CHUNK=`expr $CUR_CHUNK + $EXTRA`
fi
PIECE=`mktemp`
LOG=`mktemp`
PIECES="$PIECES $PIECE"
LOGS="$LOGS $LOG"
tail_head $SHUF_FILE $POS $CUR_CHUNK $PIECE
$OUR_PATH/fetch_all.py $FLAGS $USER_AGENT_FLAG $USER_AGENT \
--proxy_host $PROXY_HOST --proxy_port $PROXY_PORT \
--urls_file $PIECE &> $LOG &
POS=`expr $POS + $CHUNK`
done
# Wait for all to finish
wait
# Print out the summary messages
cat $LOGS >> $LATENCY_REPORT
# clean up
rm $PIECES
rm $LOGS
rm $SHUF_FILE
}
START=$SECONDS
for RUN in `seq 1 $RUNS`; do
echo "Run $RUN"
for FILE in "$@"; do
echo "File $FILE"
single_run "$FILE"
done
echo "----------------------------------------------------------------------"
done
STOP=$SECONDS
LINES=`tail -n +2 $LATENCY_REPORT|wc -l`
ELAPSED=`expr $STOP - $START`
QPS=`expr $LINES / $ELAPSED`
echo "QPS estimate (inaccurate for short runs):" $QPS "requests/sec"
echo
$OUR_PATH/trace_stress_test_percentiles.sh $LATENCY_REPORT | cut -c 1-80
echo
echo "10 worst latencies:"
head -n 10 ${LATENCY_REPORT%%.txt}-sorted.txt
echo
echo "Status statistics:"
tail -n +2 $LATENCY_REPORT | cut -d ' ' -f 2 | sort | uniq -c
echo "Full latency report in:" $LATENCY_REPORT
rm -f $TAIL_HEAD_TEMP
+36
View File
@@ -0,0 +1,36 @@
#!/bin/bash
#
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script takes the output of trace_stress_test.sh and reports cheap and
# cheerful median, 75th, 90th, 95th, 99th, and worst latencies.
if [ "X$1" == "X" ]; then
# work from stdin
sorted="/tmp/latency-$$-sorted.txt"
sort -r -g -k 1 > $sorted
else
# construct sorted file name
sorted="${1%%.txt}-sorted.txt"
sort -r -g -k 1 "$1" > "$sorted"
fi
echo "Sorted latency data in: $sorted" 1>&2
echo "% ms status url" 1>&2
lines=$(wc -l < "$sorted")
for i in 50 75 90 95 99; do
divisor=$((100 / (100 - $i)))
echo -n "$i "
head -$(($lines / $divisor)) "$sorted" | tail -1
done
echo -n "mx "
head -1 "$sorted"
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
#
# Copyright 2012 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makes linux enable fast reuse of sockets in TIME-WAIT state. We need this for
# load testing so that we don't run out of connection table slots and fail to
# get a socket. This isn't generally a good idea to set on public-facing
# servers because of trouble with NATs, but is fine here.
#
# This scripts prompts you for your su password if TIME-WAIT recycling isn't
# already enabled.
set -e # exit script if any command returns an error
set -u # exit the script if any variable is uninitialized
recycle_file=/proc/sys/net/ipv4/tcp_tw_recycle
if [ $(cat $recycle_file) -ne 1 ]; then
echo "Putting a '1' in proc/sys/net/ipv4/tcp_tw_recycle to avoid"
echo "running out of port numbers (due to old ones being in TIME_WAIT state)."
echo 1 >/tmp/1
sudo cp /tmp/1 $recycle_file
rm /tmp/1
fi
+133
View File
@@ -0,0 +1,133 @@
{
Jpeg*Test - chromium_jpeg - Conditional jump or move depends on uninitialised value(s)
Memcheck:Cond
...
fun:chromium_jpeg_*
...
fun:*Jpeg*Test_*
}
{
Jpeg*Test - chromium_jpeg - Use of uninitialised value of size 8
Memcheck:Value8
...
fun:chromium_jpeg_*
...
fun:*Jpeg*Test_*
}
{
ImageTest - WebPEncode - Use of uninitialised value of size 8
Memcheck:Value8
...
fun:WebPEncode
...
fun:*ImageTest_*
}
{
PngOptimizerTest - DGifGetLine - Conditional jump or move depends on uninitialised value(s)
Memcheck:Cond
...
fun:DGifGetLine
...
fun:*PngOptimizerTest_*
}
{
JpegReaderTest - DecodeAndCompareImagesByPSNRENS - Conditional jump or move depends on uninitialised value(s)
Memcheck:Cond
...
fun:*DecodeAndCompareImagesByPSNRENS*
...
fun:*JpegReaderTest_*
}
{
re2 leaks a little memory on startup due to InitEmpty - Ignore it
Memcheck:Leak
...
fun:*re2*InitEmpty*
...
}
{
protobufs with introspection leak a little memory -- Ignore it
Memcheck:Leak
...
fun:*google*protobuf*internal*InitEmptyString*
...
}
{
ImageAnalysisTest - PhotoMetric - Conditional jump or move depends on uninitialised value(s)
Memcheck:Cond
...
fun:*PhotoMetric*
...
fun:*ImageAnalysisTest_*
}
{
ImageAnalysisTest - PhotoMetric - Use of uninitialised value of size 8
Memcheck:Value8
...
fun:*Histogram*
...
fun:*ImageAnalysisTest_*
}
{
ScanlineResizerTest - ResizeAndWrite - Conditional jump or move depends on uninitialised value(s)
Memcheck:Cond
...
fun:*chromium_jpeg_write_scanlines*
...
fun:*ScanlineResizerTest_*
}
{
ScanlineResizerTest - ResizeAndWrite - Conditional jump or move depends on uninitialised value(s)
Memcheck:Cond
...
fun:*chromium_jpeg_finish_compress*
...
fun:*ScanlineResizerTest_*
}
{
ScanlineResizerTest - ResizeAndWrite - Use of uninitialised value of size 8
Memcheck:Value8
...
fun:*chromium_jpeg_finish_compress*
...
fun:*ScanlineResizerTest_*
}
{
OpenSSL fancy math
Memcheck:Value8
fun:bn_mul_mont
}
{
OpenSSL fancy math
Memcheck:Value8
fun:bn_mul4x_mont
}
{
mod_ssl leak
Memcheck:Leak
...
fun:EC_GROUP_new_by_curve_name
...
fun:ssl_init_Module
}
{
GFlags bookkeeping
Memcheck:Leak
...
fun:_ZN6google14FlagRegistererC1EPKcS2_S2_S2_PvS3_
...
}
{
RE2::Init singleton "leak"
Memcheck:Leak
...
fun:_ZZN3re23RE24InitERKNS_11StringPieceERKNS0_7OptionsEENKUlvE_clEv
}
{
grpc error "leak" -- TODO(cheesy): find the root cause and eliminate.
Memcheck:Leak
...
fun:grpc_error_create
fun:grpc_server_add_insecure_http2_port
}
+39
View File
@@ -0,0 +1,39 @@
#!/bin/sh
#
# Given a deb, extract mod_pagespeed.so and mod_pagespeed_ap24.so. This is
# useful for running load tests on prior releases. The files are left in a temp
# directory, and the path to them is printed to stdout.
set -e # exit script if any command returns an error
set -u # exit the script if any variable is uninitialized
if [ ! $# -eq 1 ]; then
echo "Usage: ./extract_so_from_deb.sh mod-pagespeed-beta_current_amd64.deb"
exit 1
fi
if [ ! -e $1 ]; then
echo "File '$1' not found."
exit 1
fi
input_deb=$(readlink -e $1)
TMP=$(mktemp -d)
cd "$TMP"
mkdir scratch
cd scratch
ar vx "$input_deb" > /dev/null
# all deb files have a data.tar.gz, which is now in the current directory.
tar -x --file=data.tar.gz \
--wildcards ./usr/lib/apache2/modules/mod_pagespeed\*.so
mv usr/lib/apache2/modules/* ..
cd ..
rm -r scratch/
echo "The .so files are:"
for x in $PWD/*; do
echo " $x"
done | sort -r
+21
View File
@@ -0,0 +1,21 @@
# Turn on server side include processing for the header inclusion.
AddOutputFilter INCLUDES .html
Options +Includes
Options +FollowSymLinks
# Make /foo.html available at /foo
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule !.*\.html$ %{REQUEST_FILENAME}.html [L]
# Turn on mod_pagespeed to optimize our docs.
ModPagespeed on
ModPagespeedRewriteLevel CoreFilters
ModPagespeedEnableFilters collapse_whitespace
ModPagespeedEnableFilters remove_comments
ModPagespeedInPlaceResourceOptimization on
# Do not optimize these resources which are used for blogpost
ModPagespeedDisallow */puzzle_optimized_to_low_quality_webp.webp
ModPagespeedDisallow */puzzle_optimized_to_low_quality_webp_and_saved_as_png.png
ModPagespeedDisallow */puzzle_original.jpg
+40
View File
@@ -0,0 +1,40 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>mod_pagespeed Security Advisory: Insufficient Hostname Verification</title>
<link rel="stylesheet" href="doc.css">
</head>
<body>
<!--#include virtual="_header.html" -->
<div id=content>
<h1>mod_pagespeed Security Advisory: Insufficient Hostname Verification</h1>
<dl>
<dt>CVE Identifier:</dt>
<dd>CVE-2012-4001</dd>
<dt>Disclosed:</dt>
<dd>September 12, 2012</dd>
<dt>Versions Affected:</dt>
<dd>All versions of mod_pagespeed up to and including 0.10.22.4.</dd>
<dt>Summary:</dt>
<dd>mod_pagespeed performs insufficient verification of its own host name,
which makes it possible to trick it into doing HTTP fetches and resource
processing from arbitrary host names, including potentially bypassing
firewalls.</dd>
<dt>Solution:</dt>
<dd>mod_pagespeed 0.10.22.6 has been released with a fix.</dd>
<dt>Workaround:</dt>
<dd>If you are unable to upgrade to the new version, you can avoid this
issue by changing your Apache httpd configuration. Give any virtual host
that enables mod_pagespeed (and the global configuration, if it also enables
mod_pagespeed) an accurate explicit <code>ServerName</code>, and set the
options <code>UseCanonicalName</code> and
<code>UseCanonicalPhysicalPort</code> to <code>On</code> in each. Please be
aware, however, that depending on the version,
<a href="CVE-2012-4360">CVE-2012-4360</a> may also apply.
</dd>
</div>
<!--#include virtual="_footer.html" -->
</body>
</html>
+30
View File
@@ -0,0 +1,30 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>mod_pagespeed Security Advisory: Cross-Site Scripting</title>
<link rel="stylesheet" href="doc.css">
</head>
<body>
<!--#include virtual="_header.html" -->
<div id=content>
<h1>mod_pagespeed Security Advisory: Cross-Site Scripting</h1>
<dl>
<dt>CVE Identifier:</dt>
<dd>CVE-2012-4360</dd>
<dt>Disclosed:</dt>
<dd>September 12, 2012</dd>
<dt>Versions Affected:</dt>
<dd>mod_pagespeed versions 0.10.19.1 through 0.10.22.4 (inclusive).
Versions 0.9.18.6 and earlier are unaffected.</dd>
<dt>Summary:</dt>
<dd>mod_pagespeed performs insufficient escaping in some cases, which can
permit a hostile 3rd party to inject JavaScript running in context of
the site.</dd>
<dt>Solution:</dt>
<dd>mod_pagespeed 0.10.22.6 has been released with a fix.</dd>
</div>
<!--#include virtual="_footer.html" -->
</body>
</html>
+61
View File
@@ -0,0 +1,61 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>mod_pagespeed and ngx_pagespeed Security Advisory: Cross-Site Scripting</title>
<link rel="stylesheet" href="doc.css">
</head>
<body>
<!--#include virtual="_header.html" -->
<div id=content>
<h1>mod_pagespeed and ngx_pagespeed Security Advisory: Cross-Site Scripting</h1>
<dl>
<dt>CVE Identifier:</dt>
<dd><p>CVE-2013-6111</p></dd>
<dt>Disclosed:</dt>
<dd><p>October 28th, 2013</p></dd>
<dt>Versions Affected:</dt>
<dd>
<ul>
<li>mod_pagespeed versions earlier than 1.0</li>
<li>mod_pagespeed version 1.0.22.7 (fixed in 1.0.22.8)</li>
<li>mod_pagespeed versions 1.1</li>
<li>mod_pagespeed 1.2.24.1 (fixed in 1.2.24.2)</li>
<li>mod_pagespeed 1.3.25.1 through 1.3.25.4 (fixed in 1.3.25.5)</li>
<li>mod_pagespeed 1.4.26.1 through 1.4.26.4 (fixed in 1.4.26.5)</li>
<li>mod_pagespeed and ngx_pagespeed 1.5.27.1 through 1.5.27.3 (fixed in 1.5.27.4)</li>
<li>mod_pagespeed and ngx_pagespeed 1.6.29.1 through 1.6.29.6 (fixed in 1.6.29.7)</li>
</ul>
</dd>
<dt>Summary:</dt>
<dd><p>Some versions of mod_pagespeed and ngx_pagespeed are vulnerable to
cross-site scripting (XSS), which can permit a hostile 3rd party to
inject javascript running in the context of the site.</p></dd>
<dt>Solution:</dt>
<dd><p>For mod_pagespeed, update to one of versions 1.0.22.8-stable,
1.2.24.2-stable, 1.3.25.5-stable, 1.4.26.5-stable, 1.5.27.4-beta, or
1.6.29.7 or newer.</p>
<p>For ngx_pagespeed, update to 1.6.29.7 or newer.</p>
</dd>
<dt>Workaround:</dt>
<dd>
<p>No workaround is available for mod_pagespeed.</p>
<p>For ngx_pagespeed, you can completely prohibit access to
<code>/ngx_pagespeed_statistics</code>,
<code>/ngx_pagespeed_global_statistics</code> and
<code>/ngx_pagespeed_message</code> (an IP whitelist is insufficient), via
options similar to:
<pre>
location /ngx_pagespeed_global_statistics { deny all; }
location /ngx_pagespeed_statistics { deny all; }
location /ngx_pagespeed_message { deny all; }
</pre>
</p>
</dd>
</div>
<!--#include virtual="_footer.html" -->
</body>
</html>
+91
View File
@@ -0,0 +1,91 @@
<div id=footer>
<!--#include virtual="_navline.html" -->
</div>
<script>
function buildTocHelper(node, headers) {
if (node.nodeType == 1) {
// Element node.
var nodeName = node.nodeName.toLowerCase();
if (nodeName == "h2" || nodeName == "h3" || nodeName == "h4" ||
nodeName == "h5" || nodeName == "h6") {
if (node.id) {
headers.push([nodeName, node.innerHTML, node.id]);
node.appendChild(document.createTextNode("\u00A0")); // nbsp
var a = document.createElement("a");
a.class = "header-link";
a.href = "#" + node.id;
a.textContent = "\uD83D\uDD17"; // link symbol
node.appendChild(a);
}
} else {
for (var i = 0; i < node.childNodes.length; i++) {
buildTocHelper(node.childNodes[i], headers);
}
}
}
}
function buildToc() {
var headers = [];
buildTocHelper(document.body, headers);
if (headers.length == 0) {
return;
}
var toc = document.getElementById("toc");
var tocContents = document.createElement("div");
tocContents.id = "toc-contents";
tocContents.textContent = "Contents";
toc.appendChild(tocContents);
var level = 1;
var currentUl = null;
for (var i = 0; i < headers.length; i++) {
var header = headers[i];
var headerLevel = header[0];
var headerValue = header[1];
var headerId = header[2];
var newLevel = parseInt(headerLevel.substring(1));
while (newLevel > level) {
// We loop here to handle the case where we have h2 ... h4. This
// isn't a good way to write html, but someone may still do it.
var newUl = document.createElement("ul");
if (currentUl == null) {
toc.appendChild(newUl);
} else {
currentUl.appendChild(newUl);
}
currentUl = newUl;
level++;
}
while (newLevel < level) {
currentUl = currentUl.parentNode;
level--;
}
var li = document.createElement("li");
var a = document.createElement("a");
a.href = "#" + headerId;
a.textContent = headerValue;
li.appendChild(a);
currentUl.appendChild(li);
}
}
function wrapTables() {
var tables = document.getElementsByTagName("table");
for (var i = 0; i < tables.length; i++) {
var table = tables[i];
var parent = table.parentNode;
var div = document.createElement('div');
div.className = "table-wrapper";
parent.insertBefore(div, table);
div.appendChild(table);
}
}
buildToc();
wrapTables();
</script>
+15
View File
@@ -0,0 +1,15 @@
<div id=header>
<div id=logoline>
<div id=logo>
<img src="https://www.gstatic.com/images/branding/product/1x/pagespeed_32dp.png"
srcset="https://www.gstatic.com/images/branding/product/2x/pagespeed_32dp.png"
width=32 height=32 alt="pagespeed logo">
</div>
<div id=logotext>PageSpeed</div>
</div>
<div id=navline>
<a href="/doc/">&larr; documentation index</a>
</div>
</div>
<div id=toc></div>
+3
View File
@@ -0,0 +1,3 @@
<div id=navline>
<a href="/doc/">&larr; documentation index</a>
</div>
+392
View File
@@ -0,0 +1,392 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PageSpeed Admin Pages</title>
<link rel="stylesheet" href="doc.css">
</head>
<body>
<!--#include virtual="_header.html" -->
<div id=content>
<h1>PageSpeed Admin Pages</h1>
<p>
The admin pages are a collection of features that provide visibility
into the operation of the PageSpeed optimizations.
</p>
<p>
The pagespeed_admin and pagespeed_global_admin pages aggregate a set of pages
showing server state so they can be accessed from a single handler. By
organizing all these features under a single admin page, this can be done once,
and can serve as a launching point for future administration features.
Before <strong>version 1.9.32.1</strong> the admin pages were read-only, but
starting in <strong>version 1.9.32.1</strong>, cache purging is supported.
</p>
<img src="images/admin_config.png" style="border:1px solid black" />
<p>
The name of the currently active page is underlined in the top navigation bar.
</p>
<table>
<thead>
<tr>
<th>Page</th>
<th>Related Options</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Statistics</td>
<td>
<a href="#statistics"><code>Statistics</code></a><br/>
<a href="#virtual-hosts-and-stats"
><code>UsePerVHostStatistics</code></a><br/>
<code>mod_pagespeed_beacon</code><br/>
<code>ngx_pagespeed_beacon</code>
</td>
<td>
Shows server statistics since startup, such as how many
resources are being optimized by filters, as well as various
latency and cache effectiveness metrics.
</td>
</tr>
<tr>
<td>Configuration</td>
<td><a href="config_filters">Configuring Filters</a><br/>
<a href="https_support#spdy_configuration"
><code>ModPagespeedIf</code></a> (Apache only)</td>
<td>
Shows detailed configuration information including all filters,
options, and the current cache flush timestamp.
</td>
</tr>
<tr>
<td>Histograms</td>
<td>
<a href="filter-instrumentation-add"
><code>add_instrumentation</code></a><br/>
</td>
<td>
Shows detailed latency data for Page Load Time, rewriting,
caches and HTTP fetching.
</td>
</tr>
<tr>
<td>Caches</td>
<td>
<a href="system#memcached"><code>MemcachedServers</code></a>
<a href="system#shm_cache"><code>CreateSharedMemoryMetadataCache</code></a>
<a href="system#purge_cache"><code>EnableCachePurge</code></a>
</td>
<td>
Shows detailed cache configuration information. When accessed
from the Admin handler, it can be used to inspect the contents
of the cache, and provides an interface to purge the cache.
</td>
</tr>
<tr>
<td>Console</td>
<td>
<a href="admin#statistics"><code>Statistics</code></a><br/>
<a href="console#configuring"><code>StatisticsLogging</code></a><br/>
<a href="console#configuring"><code>LogDir</code></a>
</td>
<td>
Displays a <a href="console">console</a> of graphs
of server optimization behavior over time.
</td>
</tr>
<tr>
<td>Message History</td>
<td>
<a href="#message-buffer-size"><code>MessageBufferSize</code></a>
</td>
<td>
Server-wide history of recent logging output from PageSpeed,
including messages that are omitted from the server log file based on
its log level.
</td>
</tr>
</tbody>
</table>
<p>
Before 1.8.31.2, the main admin page is not available, but there
are page-specific handlers for statistics, messages, and the
console. In 1.8.31.2 and later, the <code>*_pagespeed_*</code> handlers, such
as <code>mod_pagespeed_statistics</code>, will continue to be supported:
<ul>
<li>They provide read-only access to server operation. There may
be cases where a site owner wants to share statistics or console
information but not the ability to purge the cache.</li>
<li>Existing configurations must continue to work after an upgrade to
a release that supports pagespeed_admin.</li>
<li>The admin pages may later gain support for modifying the server
state</li>
</ul>
</p>
<h2 id="config">Configuring Admin Pages</h2>
<p>
In this table we use the term "server" for an Apache VirtualHost and
an nginx Server Block. We use the term "global" to mean the entire
Apache or nginx system, covering all the configured VirtualHost and
Server Blocks.
</p>
<table>
<thead>
<tr><th>Apache Handler</th><th>Nginx Option</th><th>Version</th>
<th>Description</th></tr>
</thead>
<tbody>
<tr>
<td><code>pagespeed_admin</code></td>
<td><code>AdminPath</code></td>
<td>1.8.31.2+</td><td>Covers all administrative functions for
a host in one handler. If you establish this handler,
you don't need any of the other server-scoped methods. Only
give 'admin' page access to clients that you are comfortable
allowing to modify the state of your PageSpeed configuration.
</td>
</tr>
<tr>
<td><code>pagespeed_global_admin</code></td>
<td><code>GlobalAdminPath</code></td>
<td>1.8.31.2+</td><td>Covers all administrative functions for
the entire global state in one handler. If you establish this
handler, you don't
need <code>mod_pagespeed_global_statistics</code>.</td>
</tr>
<tr>
<td><code>mod_pagespeed_statistics</code></td>
<td><code>StatisticsPath</code> (1.8.31.2+)</td>
<td>All</td><td>Launchpad for Statistics, Histograms, and
a subset of the Caches page as described above.</td>
</tr>
<tr>
<td><code>mod_pagespeed_global_statistics</code></td>
<td><code>GlobalStatisticsPath</code> (1.8.31.2+)</td>
<td>1.1+</td><td>Same as above, but aggregates statistics across all
configured servers. You must enable
<a href="#virtual-hosts-and-stats"
><code>UsePerVHostStatistics</code></a> for separate global
statistics to be retained, otherwise all statistics will be global.</td>
</tr>
<tr>
<td><code>mod_pagespeed_message</code></td>
<td><code>MessagesPath</code> (1.8.31.2+)</td>
<td>1.0+</td><td>Displays recent log messages printed by PageSpeed,
including messages that may be below the current server loglevel
threshold such as "Info" messages. Requires that
<a href="#message-buffer-size"><code>MessageBufferSize</code></a> be set.</td>
</tr>
<tr>
<td><code>pagespeed_console</code></td>
<td><code>ConsolePath</code> (1.8.31.2+)</td>
<td>1.6+</td><td>Displays a <a href="console">console</a> of graphs
of server optimization behavior over time.</td>
</tr>
</tbody>
</table>
<h3 id="handlers">Establishing Handlers in Apache</h2>
<p>
Each handler is optional; add them individually to enable
admin features. Note that when you add handlers for
<code>pagespeed_admin</code> and <code>pagespeed_global_admin</code>
you are granting read/write access to server-state. The other handlers
are read-only. A sample handler that filters on IP address is
in the default configuration, whose general form is:
</p>
<pre class="prettyprint lang-sh">
&lt;Location /PATH&gt;
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
SetHandler HANDLER_NAME
&lt;/Location&gt;
</pre>
<p>
You can choose any path for a handler, but you must specify the handler
name exactly as it appears in the table above. By convention we use
use the handler name for the path. You may also want to
employ login-based access to the admin pages, using
<code>AllowOverride AuthConfig</code>. Please see the Apache
<a href="http://httpd.apache.org/docs/2.2/howto/auth.html">2.2</a>
or
<a href="http://httpd.apache.org/docs/2.4/howto/auth.html">2.4</a>
Documentation for details.
</p>
<h3 id="handlers">Establishing Handlers in Nginx</h2>
<p>
In nginx, the handlers must be specified as location blocks.
</p>
<pre class="prettyprint lang-sh">
location /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }
location /ngx_pagespeed_global_statistics { allow 127.0.0.1; deny all; }
location /ngx_pagespeed_message { allow 127.0.0.1; deny all; }
location /pagespeed_console { allow 127.0.0.1; deny all; }
location ~ ^/pagespeed_admin { allow 127.0.0.1; deny all; }
location ~ ^/pagespeed_global_admin { allow 127.0.0.1; deny all; }
</pre>
<p class="note">
Note that these handlers must precede the
"<code>\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+</code>" location block.
</p>
<p>
In version 1.8.31.2 and later, the above location blocks are
needed for each path you elect to enable in PageSpeed options:
</p>
<pre>
pagespeed StatisticsPath /ngx_pagespeed_statistics;
pagespeed GlobalStatisticsPath /ngx_pagespeed_global_statistics;
pagespeed MessagesPath /ngx_pagespeed_message;
pagespeed ConsolePath /pagespeed_console;
pagespeed AdminPath /pagespeed_admin;
pagespeed GlobalAdminPath /pagespeed_global_admin;
</pre>
<p>
You can choose any path, as long as it's consistent between
the <code>pagespeed Path</code> and the <code>location</code>. By
convention we use the names as specified in the example.
</p>
<p>
Prior to version 1.8.31.2, the above "Path" settings do not exist,
and the failure to specify location blocks leaves the paths active
with no access restrictions. The module will service requests
to the paths whether the location blocks are specified or not.
This applies to <code>/ngx_pagespeed_statistics</code>,
<code>/ngx_pagespeed_global_statistics</code>,
<code>/ngx_pagespeed_message</code>, and <code>/pagespeed_console</code>.
</p>
<p class="note">
If you define access control for <code>/pagespeed_admin</code> or
<code>/pagespeed_console</code>, you must do so earlier in the configuration
file than the path to handle <code>.pagespeed</code> resources, to ensure
that the handlers are disambiguated.
</p>
<h3 id="limiting-handlers">Limiting Handler Access</h3>
<p class="note"><strong>Note: New feature as of 1.10.33.0</strong></p>
<p>
Apache's SetHandler access controls are accessible to anyone who can
modify <code>.htaccess</code> files, so in a typical shared hosting context
the global admin site isn't sufficiently protected. As of 1.10.33.0,
PageSpeed allows setting an additional restriction of what domains are allowed
to load handlers. For example, to deny access entirely, you could put:
</p>
<dl>
<dt>Apache:<dd><pre class="prettyprint"
>ModPagespeedStatisticsDomains Disallow *
ModPagespeedGlobalStatisticsDomains Disallow *
ModPagespeedMessagesDomains Disallow *
ModPagespeedConsoleDomains Disallow *
ModPagespeedAdminDomains Disallow *
ModPagespeedGlobalAdminDomains Disallow *</pre>
<dt>Nginx:<dd><pre class="prettyprint"
>pagespeed StatisticsDomains Disallow *;
pagespeed GlobalStatisticsDomains Disallow *;
pagespeed MessagesDomains Disallow *;
pagespeed ConsoleDomains Disallow *;
pagespeed AdminDomains Disallow *;
pagespeed GlobalAdminDomains Disallow *;</pre>
</dl>
<p>
To allow access only to an admin, define a new VHost
like <code>admin.example.com</code>, use standard web-server access control
(IP or password) to restrict access to only that admin, and then at the top
level of your config put:
</p>
<dl>
<dt>Apache:<dd><pre class="prettyprint"
>ModPagespeedStatisticsDomains Allow admin.example.com
ModPagespeedGlobalStatisticsDomains Allow admin.example.com
ModPagespeedMessagesDomains Allow admin.example.com
ModPagespeedConsoleDomains Allow admin.example.com
ModPagespeedAdminDomains Allow admin.example.com
ModPagespeedGlobalAdminDomains Allow admin.example.com</pre>
<dt>Nginx:<dd><pre class="prettyprint"
>pagespeed StatisticsDomains Allow admin.example.com;
pagespeed GlobalStatisticsDomains Allow admin.example.com;
pagespeed MessagesDomains Allow admin.example.com;
pagespeed ConsoleDomains Allow admin.example.com;
pagespeed AdminDomains Allow admin.example.com;
pagespeed GlobalAdminDomains Allow admin.example.com;</pre>
</dl>
<p>
Now when you visit <code>admin.example.com/pagespeed_global_admin</code>
you'll see global (server-level) admin information, but users are not able to
access this under their own domain or turn the handler on
with <code>.htaccess</code>.
</p>
<p>
For all six of these options the default value is <code>Allow *</code>. If
you explicitly <code>Allow</code> access to any site, all others are
automatically <code>Disallow</code>ed. Wildcards are allowed, and additional
directives are applied in sequence. For example, consider the following
config:
</p>
<dl>
<dt>Apache:<dd><pre class="prettyprint"
>ModPagespeedAdminDomains Allow *.example.*
ModPagespeedAdminDomains Disallow *.example.org
ModPagespeedAdminDomains Allow www.example.org</pre>
<dt>Nginx:<dd><pre class="prettyprint"
>pagespeed AdminDomains Allow *.example.*;
pagespeed AdminDomains Disallow *.example.org;
pagespeed AdminDomains Allow www.example.org;</pre>
</dl>
<p>
This would allow access to <code>www.example.com/pagespeed_admin</code>,
and <code>www.example.org/pagespeed_admin</code> but
not <code>shared.example.com/pagespeed_admin</code>.
</p>
<h3 id="statistics">Shared Memory Statistics</h2>
<p>
By default PageSpeed collects cross-process statistics. While
they're mostly intended for debugging and evaluation
using <code>/mod_pagespeed_statistics</code>, <code>/ngx_pagespeed_statistics</code>,
and the <a href="console">PageSpeed Console</a>, statistics are also
necessary for limiting concurrent image rewrites
and <a href="#rate_limit_background_fetches">background fetches</a>.
It's not recommended to turn them off, as their performance impact
is minimal, but if you need to you can do so with:
<dl>
<dt>Apache:<dd><pre class="prettyprint"
>ModPagespeedStatistics off</pre></dd></dt>
<dt>Nginx:<dd><pre class="prettyprint"
>pagespeed Statistics off;</pre></dd></dt>
</dl>
</p>
<h3 id="virtual-hosts-and-stats">Virtual hosts and statistics</h3>
<p>
You can choose whether PageSpeed aggregates its statistics
over all virtual hosts (the default), or to keeps separate counts for each. You
can chose the latter by specifying
<code>UsePerVHostStatistics on</code>. In that
case, <code>/pagespeed_admin</code>, <code>/mod_pagespeed_statistics</code>
and <code>/ngx_pagespeed_statistics</code> will show the data for
whatever virtual host is being accessed. If you do turn per-virtual
host statistics on, you can still access the aggregates
under <code>/pagespeed_global_admin</code>, <code>/mod_pagespeed_global_statistics</code>
or <code>/ngx_pagespeed_global_statistics</code>.
</p>
<dl>
<dt>Apache:<dd><pre class="prettyprint">ModPagespeedUsePerVhostStatistics on</pre>
<dt>Nginx:<dd><pre class="prettyprint">pagespeed UsePerVhostStatistics on;</pre>
</dl>
<h3 id="message-buffer-size">Message Buffer Size</h3>
<p>
Determines the number of bytes of shared memory to allocate as a circular
buffer for holding recent PageSpeed log messages. By default, the size of
this buffer is zero, and no messages will be retained.
</p>
<dl>
<dt>Apache:<dd><pre class="prettyprint">ModPagespeedMessageBufferSize 100000</pre>
<dt>Nginx:<dd><pre class="prettyprint">pagespeed MessageBufferSize 100000;</pre>
</dl>
</div>
<!--#include virtual="_footer.html" -->
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More