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
- util/ and http/ have many of our basic tools, including abstract base classes
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
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):
- MessageHandler - Error handling (See for example FileMessageHandler and ApacheMessageHandler)
- FileSystem (See example StdioFileSystem and AprFileSystem)
- AbstractCondvar (See example PthreadCondvar and AprCondvar)
- AbstractMutex (See example PthreadMutex and AprMutex)
- Statistics - Keep track of various global stats (See example SimpleStats and AprStatistics)
- Timer (See example MockTimer and AprTimer)
- UrlFetcher - Fetcher for resources by URL (See example WgetUrlFetcher and SyncFetcherAdapter)
- UrlAsyncFetcher - Same but with a callback interface (See example WgetUrlAsyncFetcher and SerfUrlAsyncFetcher; the latter supports an asynchronous event model built on top of UrlPollableAsyncFetcher)
- RewriteDriverFactory - Manages all the options and classes specific to an implementation (See example ApacheRewriteDriverFactory)
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 (firstname.lastname@example.org) 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.