src/ngx_pagespeed.cc
// Some things pagespeed filters on the way past (html) and other things it
// actually handles, like requests for resources
// (example.css.pagespeed.ce.LyfcM6Wulf.css) and static content
// (/ngx_pagespeed_static/js_defer.q1EBmcgYOC.js).  This is called once we know
// we need to handle a resource, and it figures out which particular handler can
// supply it to the user.
Some things pagespeed filters on the way past (html) and other things it
actually handles, like requests for resources
(example.css.pagespeed.ce.LyfcM6Wulf.css) and static content
(/ngx_pagespeed_static/js_defer.q1EBmcgYOC.js).  This is called once we know
we need to handle a resource, and it figures out which particular handler can
supply it to the user.
Some things pagespeed filters on the way past ( html ) and other things it actually handles like requests for resources ( example . css . pagespeed . ce . LyfcM6Wulf . css ) and static content ( / ngx_pagespeed_static / js_defer . q1EBmcgYOC . js ) . This is called once we know we need to handle a resource and it figures out which particular handler can supply it to the user .
ngx_int_t ps_content_handler(ngx_http_request_t* r) {
  ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
  if (ps_disabled(cfg_s)) {
    return NGX_DECLINED;
  }
  cfg_s->server_context->FlushCacheIfNecessary();
  ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                 "http pagespeed handler \"%V\"", &r->uri);
  RequestRouting::Response response_category =
      ps_route_request(r);
  switch (response_category) {
    case RequestRouting::kError:
      return NGX_ERROR;
    case RequestRouting::kPagespeedDisabled:
    case RequestRouting::kInvalidUrl:
    case RequestRouting::kPagespeedSubrequest:
    case RequestRouting::kErrorResponse:
      return NGX_DECLINED;
    case RequestRouting::kBeacon:
      return ps_beacon_handler(r);
    case RequestRouting::kStaticContent:
    case RequestRouting::kMessages:
      return ps_simple_handler(r, cfg_s->server_context, response_category);
    case RequestRouting::kStatistics:
    case RequestRouting::kGlobalStatistics:
    case RequestRouting::kConsole:
    case RequestRouting::kAdmin:
    case RequestRouting::kGlobalAdmin:
    case RequestRouting::kCachePurge:
    case RequestRouting::kResource:
      return ps_resource_handler(
          r, false , response_category);
  }
  CHECK(0);
  return NGX_ERROR;
}
ngx_int_t ps_content_handler ( ngx_http_request_t * r ) { ps_srv_conf_t * cfg_s = ps_get_srv_config ( r ) ; if ( ps_disabled ( cfg_s ) ) { return NGX_DECLINED ; } cfg_s -> server_context -> FlushCacheIfNecessary ( ) ; ngx_log_debug1 ( NGX_LOG_DEBUG_HTTP , r -> connection -> log , 0 , " \" \" " , & r -> uri ) ; RequestRouting :: Response response_category = ps_route_request ( r ) ; switch ( response_category ) { case RequestRouting :: kError : return NGX_ERROR ; case RequestRouting :: kPagespeedDisabled : case RequestRouting :: kInvalidUrl : case RequestRouting :: kPagespeedSubrequest : case RequestRouting :: kErrorResponse : return NGX_DECLINED ; case RequestRouting :: kBeacon : return ps_beacon_handler ( r ) ; case RequestRouting :: kStaticContent : case RequestRouting :: kMessages : return ps_simple_handler ( r , cfg_s -> server_context , response_category ) ; case RequestRouting :: kStatistics : case RequestRouting :: kGlobalStatistics : case RequestRouting :: kConsole : case RequestRouting :: kAdmin : case RequestRouting :: kGlobalAdmin : case RequestRouting :: kCachePurge : case RequestRouting :: kResource : return ps_resource_handler ( r , false , response_category ) ; } CHECK ( 0 ) ; return NGX_ERROR ; }
Some things pagespeed filters on the way past (html) and other things it
actually handles, like requests for resources
(example.css.pagespeed.ce.LyfcM6Wulf.css) and static content
(/ngx_pagespeed_static/js_defer.q1EBmcgYOC.js).
Some things pagespeed filters on the way past ( html ) and other things it actually handles like requests for resources ( example . css . pagespeed . ce . LyfcM6Wulf . css ) and static content ( / ngx_pagespeed_static / js_defer . q1EBmcgYOC . js ) .
// Pagespeed is not on for this server block. // Poll for cache flush on every request (polls are rate-limited). /* html rewrite */