Porting mod_pagespeed to Another System

Do you want to port mod_pagespeed to another server or integrate it in another system? Great! We developed mod_pagespeed to be modular and almost completely independent from Apache. The only Apache-specific code is in the net/instaweb/apache directory.

If you look into our source, our main code is in net/instaweb/:

  • util/ and http/ have many of our basic tools, including abstract base classes like MessageHandler, Timer, and UrlFetcher. There are some example implementations, but you will have to make your own implementations of many of these.
  • htmlparse/ has the core HTML parser. You shouldn't have to deal with that at all.
  • rewriter/ has the rewriting filters and framework. The central integration point is the partially abstract class here, RewriteDriverFactory. Your integration effort will start by subclassing it and implementing its pure virtual methods.

You will probably have to implement a port for the following classes (see example implementations in the apache/ directory):

Then to actually invoke the code, you'll need to create a FooRewriteDriverFactory to create all your objects, and then StartParseWithType(url, content_type), ParseText(text) between each flush of the server, and FinishParse() for each request.

Please contact us (mod-pagespeed-discuss@googlegroups.com) if you are looking into this or having any problems. We are not guaranteeing that any internal interfaces will stay the same, so we could easily break your port if we don't know that you are using them.