How to log GoogleUrl css_base_gurl_to_use

15 views
Skip to first unread message

anir...@webscalenetworks.com

unread,
Jun 22, 2016, 5:03:25 PM6/22/16
to mod-pagespeed-discuss
Hi ,

I am trying to debug one problem with my application and I want to log this variable : GoogleUrl css_base_gurl_to_use which is in css_filter.cc file. 

Could anyone please tell me how do I log this variable to the logs?

Thanks!

ANiruddha

Joshua Marantz

unread,
Jun 22, 2016, 5:20:31 PM6/22/16
to mod-pagespeed-discuss
I'd really recommend you describe your use-case first.  If you have found a bug in the way we absolutify URLs we should probably fix it.

But to answer your question, I'd search in the code for the variable-name you want to track changes to, and call something like StackTraceString (https://cs.corp.google.com/piper///depot/google3/third_party/pagespeed/kernel/base/debug.h) to print where changes to it are initiated from.

Or you could use a debugger with "run -X" to see what affects that variable.

-Josh

--
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/a32b3791-0a71-4413-b080-5ef6336c19be%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

anir...@webscalenetworks.com

unread,
Jun 22, 2016, 6:43:36 PM6/22/16
to mod-pagespeed-discuss
Hi Josh, 

Thanks for your reply. Here are the details of the use-case.

For example, suppose http://rx/wp-content/themes/brainstorm/style.css has:


body {

    background: url("/wp-content/uploads/2015/10/home.jpg") no-repeat scroll center top;

    background: url("c-content/uploads/2015/10/home.jpg") no-repeat scroll center top;

    height: 100%

}


When the CSS is sharded, it is rewritten to a URL like http://shardhost/rxkey/wp-content/themes/brainstorm/style.css. The rxkey part is a key derived from the rx hostname to allow shardhost accesses to use the right backend hostname (the secondary alias). (Using shared cdn)

To allow for relative URLs in the CSS (without a leading-slash), and to allow resources referenced by the CSS to be shareded as well, all URLs in the CSS that do not specify a hostname need to be rewritten.

When rewriting a relative URL (like c-content/uploads/2015/10/home.jpg) the reference is correctly rewritten as http://shardhost/rxkey/c-content/uploads/2015/10/home.jpg so that it accesses the backend with hostname rx. However, when rewriting the absolute URL (/wp-content/uploads/2015/10/home.jpg) for sharding, it incorrectly rewrites it relative to the origin URL, so ends up with http://shardhost/wp-content/uploads/2015/10/home.jpg (which should be http://shardhost/rxkey/wp-content/uploads/2015/10/home.jpg ) so that when the backend is accessed, it uses the primary alias as the hostname, which is incorrect and likely results in a 404.


On Wednesday, June 22, 2016 at 3:20:31 PM UTC-6, jmarantz wrote:
I'd really recommend you describe your use-case first.  If you have found a bug in the way we absolutify URLs we should probably fix it.

But to answer your question, I'd search in the code for the variable-name you want to track changes to, and call something like StackTraceString (https://cs.corp.google.com/piper///depot/google3/third_party/pagespeed/kernel/base/debug.h) to print where changes to it are initiated from.

Or you could use a debugger with "run -X" to see what affects that variable.

-Josh
On Wed, Jun 22, 2016 at 2:03 PM, <anir...@webscalenetworks.com> wrote:
Hi ,

I am trying to debug one problem with my application and I want to log this variable : GoogleUrl css_base_gurl_to_use which is in css_filter.cc file. 

Could anyone please tell me how do I log this variable to the logs?

Thanks!

ANiruddha

--
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.
Reply all
Reply to author
Forward
0 new messages