Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Design Doc: Adding new features to MPS by changing PSOL

Jeff Kaufman edited this page Jan 6, 2017 · 1 revision

Adding new features to MPS by changing PSOL

Joshua Marantz, 2012-11-07

If I add a new filter or option to PSOL, it should become available & documented for mod_pagespeed & ngx_pagespeed. This will require some refactoring in PSOL as well.

There are 6 sub-tasks:

  1. automatically making new filters available in mod_pagespeed (DONE)
  2. automatically making new options available in mod_pagespeed 3 automatically making new filters available in ngx_pagespeed 4 automatically making new options available in ngx_pagespeed

#1 is inherently solved because the enabled filters is simply a comma-separated list of strings that gets passed through directly from the Apache config to RewriteOptions::AddFiltersByCommaSeparatedList.

To solve #2 we need to programmatically generate the command-table passed to Apache based on the known set of options in ApacheConfig::apache_properties_ which is already initialized at static construction time in Apache. I've determined that generating that static table for the apache module at static-construction-time works. So the main infrastructural change required is to augment the properties table in RewriteOptions and to contain optional Help text, and a bit which indicates whether the option is server-scope only or can be used in Directory/.htaccess.

I suspect #3 will be inherently solved the same way it is in mod_pagepeed. #4 might be more easily solved in ngx_pagespeed if we design the config syntax differently, letting PSOL parse all single-valued options directly. In Apache we made the problem more complex than necessary by having a distinct Apache configuration table entry for each new PSOL option, and now that we’ve established that pattern it’s difficult to change. In nginx we can simply have "pagespeed OPTION VALUE" cover all single-valued options.

I’d estimate this at 2 weeks of work in PSOL & mod_pagespeed. The benefit of this for mod_pagespeed is that it will reduce the cost of adding new options, which currently requires editing many files & adding many new tests to make sure the parsing is working.

Clone this wiki locally