Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
net_instaweb::RewriteQuery Class Reference

Public Types

enum  Status { kSuccess, kInvalid, kNoneFound }
 

Public Member Functions

Status Scan (bool allow_related_options, bool allow_options_to_be_specified_by_cookies, const GoogleString &request_option_override, const RequestContextPtr &request_context, RewriteDriverFactory *factory, ServerContext *server_context, GoogleUrl *request_url, RequestHeaders *request_headers, ResponseHeaders *response_headers, MessageHandler *handler)
 
const QueryParamsquery_params () const
 
const QueryParamspagespeed_query_params () const
 
const QueryParamspagespeed_option_cookies () const
 
const RewriteOptionsoptions () const
 
RewriteOptionsReleaseOptions ()
 

Static Public Member Functions

template<class HeaderT >
static Status ScanHeader (bool allow_options, const GoogleString &request_option_override, const RequestContextPtr &request_context, HeaderT *headers, RequestProperties *request_properties, RewriteOptions *options, MessageHandler *handler)
 
static GoogleString GenerateResourceOption (StringPiece filter_id, RewriteDriver *driver)
 
static bool MightBeCustomOption (StringPiece name)
 
static bool IsOK (Status status)
 

Static Public Attributes

static const char kModPagespeed []
 The names of query-params.
 
static const char kPageSpeed []
 
static const char kModPagespeedFilters []
 
static const char kPageSpeedFilters []
 
static const char kNoscriptValue []
 

Friends

class RewriteQueryTest
 

Member Function Documentation

static GoogleString net_instaweb::RewriteQuery::GenerateResourceOption ( StringPiece  filter_id,
RewriteDriver driver 
)
static

Given a two-letter filter ID string, generates a query-param for any in the driver's options that are related to the filter, and differ from the default. If no settings have been altered the empty string is returned.

static bool net_instaweb::RewriteQuery::IsOK ( Status  status)
inlinestatic

Determines whether the status code is one that is acceptable for processing requests.

static bool net_instaweb::RewriteQuery::MightBeCustomOption ( StringPiece  name)
static

Indicates whether the specified name is likely to identify a custom header or query param.

Status net_instaweb::RewriteQuery::Scan ( bool  allow_related_options,
bool  allow_options_to_be_specified_by_cookies,
const GoogleString request_option_override,
const RequestContextPtr request_context,
RewriteDriverFactory factory,
ServerContext server_context,
GoogleUrl request_url,
RequestHeaders request_headers,
ResponseHeaders response_headers,
MessageHandler handler 
)

Scans request_url's query parameters and request_headers for "ModPagespeed" and "PageSpeed" flags, creating and populating options_ or request_context if any were found that were all parsed successfully. If any were parsed unsuccessfully, kInvalid is returned. If none were found, kNoneFound is returned. Also removes the options from the query_params of the url and the request_headers, populates pagespeed_query_params() with the removed query parameters, and populates pagespeed_option_cookies() with any PageSpeed option cookies in the request headers (which are NOT removed).

First cookies are processed, then query parameters, then request headers, then response headers. Therefore parameters set by response headers take precedence over request headers over query parameters over cookies. The exception is filter disables, which always take precedence over enables, even those processed later.

If NULL is passed for request_headers or response_headers those particular headers will be skipped in the scan.

'allow_related_options' applies only to .pagespeed. resources. It enables the parsing of filters & options by ID, that have been declared in the RelatedOptions() and RelatedFilters() methods of the filter identified in the .pagespeed. URL. See GenerateResourceOption for how they get into URLs in the first place.

'allow_options_to_be_specified_by_cookies' controls whether we parse cookies for options.

template<class HeaderT >
static Status net_instaweb::RewriteQuery::ScanHeader ( bool  allow_options,
const GoogleString request_option_override,
const RequestContextPtr request_context,
HeaderT *  headers,
RequestProperties request_properties,
RewriteOptions options,
MessageHandler handler 
)
static

Performs the request and response header scanning for Scan(). If any "ModPagespeed" or "PageSpeed" options are found in the headers they are stripped. Returns kNoneFound if no options found. Returns kSuccess and populates *'options' if options are found. Returns kInvalid if any headers were parsed unsuccessfully. Note: mod_instaweb::build_context_for_request assumes that headers will be stripped from the headers if options are found and that headers will not grow in this call.

Member Data Documentation

const char net_instaweb::RewriteQuery::kNoscriptValue[]
static

ModPagespeed query-param value for redirect from clients that do not support javascript.

  • Disables all filters that insert new javascript.
  • Enables filter kHandleNoscriptRedirect.

The documentation for this class was generated from the following file: