Is there documentation to extend pagespeed?

18 views
Skip to first unread message

Sambasiva Suda

unread,
Nov 28, 2016, 1:59:39 AM11/28/16
to mod-pagespeed-discuss
Hi,
 I am trying to add more filters. I have the following questions. Please answer these

1.  How pagespeed will handle the requests for the urls generated by pagespeed. Where is the source file for this?

2.  In chain of filters, the changes made by one filter visible to downstream filters?

3. Is there a sample filter for playing with?


Thanks and Regards
Sambasiva

Otto van der Schaaf

unread,
Nov 28, 2016, 4:23:46 AM11/28/16
to mod-pagesp...@googlegroups.com
Hi,

1.  How pagespeed will handle the requests for the urls generated by pagespeed. Where is the source file for this?

I think InstawebHandler::handle_as_resource() may serve as a good starting point to follow that code flow:

 
2.  In chain of filters, the changes made by one filter visible to downstream filters?
Yes 

3. Is there a sample filter for playing with?

A simple filter that may give you an idea of how it works is the base tag filter:

The other filter implementations live in the same directory:

Hope this helps!

Otto 

Sambasiva Suda

unread,
Nov 28, 2016, 4:59:48 AM11/28/16
to mod-pagespeed-discuss
Hi Otto,
  Thank you so much for your reply. One more question.

1. Is handling pagespeed resources is server specific?


Thanks and Regards
Sambasiva

On Monday, 28 November 2016 14:53:46 UTC+5:30, Otto van der Schaaf wrote:
Hi,

1.  How pagespeed will handle the requests for the urls generated by pagespeed. Where is the source file for this?

I think InstawebHandler::handle_as_resource() may serve as a good starting point to follow that code fliow:

Sambasiva Suda

unread,
Nov 28, 2016, 5:05:51 AM11/28/16
to mod-pagespeed-discuss
Hi Otto,
  
1. How do we register the new filter?

Otto van der Schaaf

unread,
Nov 28, 2016, 5:15:19 AM11/28/16
to mod-pagesp...@googlegroups.com
Re: server specific handling of pagespeed resources.
The specifics of handling pagespeed resources (and integrating pagespeed optimization into a server module) mostly depends on if the hosting server uses a blocking or non-blocking model for handling requests.

For example, the nginx port of mod_pagespeed integrates a bit different because request processing needs to avoid blocking in nginx's server model. See ResourceFetch::Start at


Re: registering a new filter
That's old and inactive code, but in its history you can see how it used RewriteDriver::AddOwnedEarlyPreRenderFilter to insert a filter (AtsDemoFilter)

Otto




--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/7b942b84-17ec-4251-83df-1edb2aabda98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted

Sambasiva Suda

unread,
Nov 29, 2016, 4:41:10 AM11/29/16
to mod-pagespeed-discuss
Hi Otto,

If one filter inserted new image element, is that visible to the image filters?

Thanks
Sambasiva
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Otto van der Schaaf

unread,
Nov 29, 2016, 5:18:26 AM11/29/16
to mod-pagespeed-discuss
If the filter that inserts the image runs before the image rewrite filter, I would expect the image rewrite filter to see it.

So, concretely, any img elements that get inserted early should hit ImageRewriteFilter::EndElementImpl() :

Otto

To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/5e42cbd6-6a3e-48bb-a07e-02672061bfd6%40googlegroups.com.

Jan-Willem Maessen

unread,
Nov 29, 2016, 12:31:04 PM11/29/16
to mod-pagesp...@googlegroups.com
On Tue, Nov 29, 2016 at 5:18 AM, Otto van der Schaaf <osc...@we-amp.com> wrote:
If the filter that inserts the image runs before the image rewrite filter, I would expect the image rewrite filter to see it.

So, concretely, any img elements that get inserted early should hit ImageRewriteFilter::EndElementImpl() :


Correct.  One example of a filter that does this is responsive images, where we actually expand an img tag into a series of marked img tags, leave them to the image filter to process to the desired dimensions, and then a subsequent filter pass combines them together into a single responsive img tag.

-Jan
 
Otto

To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/CAHqmWiP08GFGt3VsKn9i1j6_4a%3DKW-W%2B-4AR1u%3Dx_x04Q%2B4_FA%40mail.gmail.com.

Joshua Marantz

unread,
Nov 29, 2016, 12:59:00 PM11/29/16
to mod-pagespeed-discuss
responsive_images is a great example.  The fitler itself:

and the place it's instantiated in two places in the filter-chain:


Can I ask about what you are trying to build?  Are you trying to optimize a different type of resource?

 
Otto

To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsubscri...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsubscri...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsubscri...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsubscri...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/CA%2B_-ou9X46g9JhcjTP%2BEfgv1verQVz1%2BEmA6DxH7raWafzY-hg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages