On Wed, May 1, 2013 at 12:14 PM, Sindhi Sindhi <sindhi....@gmail.com> wrote:
> Thanks to all for the reply. > > Josh, the concern I mentioned was, we may not want mod_pagespeed to modify > the in-memory HTML content. The only change we may want to see in our HTML > will be that the old strings are replaced by the new strings after applying > our business logic which is already done by the C++ filter module I have > written. This C++ filter implements all our business logic and takes an > input buffer that is expected to be the entire HTML file content. So the > Yeah the filter I gave you gives you only a block of HTML characters. E.g. if you have <div>a b c d <i>e</i> f</div> then you'll get this as 3 calls to Characters: "a b c d ", "e", and " f". Other than that, the Characters method I pointed you to has exactly the interface you asked for: it gets you an entire block of HTML text in one modifiable std::string which you can mutate at will. And it irons out all the brigade stuff for you. You can configure mod_pagespeed to run just one filter so no other modifications are made. But it looks like you probably need to read Nick's book. You can also read mod_deflate.c or one of the other content-modifying filters such as mod_sed or mod_substitute. -Josh