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

#include "instaweb_handler.h"

Public Member Functions

 InstawebHandler (request_rec *request)
 
const GoogleUrlstripped_gurl () const
 Any PageSpeed query params are removed.
 
const RequestContextPtr request_context () const
 
bool use_custom_options () const
 
const QueryParamsquery_params ()
 
const QueryParamspagespeed_query_params ()
 
const QueryParamspagespeed_option_cookies ()
 
void RemoveStrippedResponseHeadersFromApacheRequest ()
 
RewriteDriverMakeDriver ()
 
void DisownDriver ()
 Prevent "this" from cleaning up rewrite_driver_ at destruction.
 
ApacheFetchMakeFetch (const GoogleString &url, bool buffered, StringPiece debug_info)
 
ApacheFetchMakeFetch (bool buffered, StringPiece debug_info)
 
bool HandleAsProxy ()
 
void HandleAsProxyForAll ()
 
bool HandleAsInPlace ()
 
void HandleAsPagespeedResource ()
 
void WaitForFetch ()
 
bool ProxyUrl ()
 
bool AuthenticateProxy ()
 
RequestHeadersReleaseRequestHeaders ()
 
const ApacheConfigoptions ()
 

Static Public Member Functions

static bool is_pagespeed_subrequest (request_rec *request)
 
static apr_status_t instaweb_handler (request_rec *request)
 
static apr_status_t save_url_hook (request_rec *request)
 
static apr_status_t save_url_in_note (request_rec *request, ApacheServerContext *server_context)
 
static apr_status_t instaweb_map_to_storage (request_rec *request)
 
static void AboutToBeDoneWithRecorder (request_rec *request, InPlaceResourceRecorder *recorder)
 

Detailed Description

Context for handling a request, computing options and request headers in the constructor.

Todo:
TODO(jmarantz): There are many static methods in this class. Some of them need to stay that way as they are used as C entry points. Some are helper methods, and we could adopt a policy of requiring the static methods to instantiate the class (possibly making its constructor lighter weight) and then calling them explicitly. For the time being, we'll leave these static methods with the non-compliant lower_case_names_with_underscores naming convention and fix their naming when we update whether they should be static or not.

Member Function Documentation

static void net_instaweb::InstawebHandler::AboutToBeDoneWithRecorder ( request_rec *  request,
InPlaceResourceRecorder recorder 
)
static

This must be called on any InPlaceResourceRecorder allocated by instaweb_handler before calling DoneAndSetHeaders() on it.

bool net_instaweb::InstawebHandler::AuthenticateProxy ( )

Checks to see whether the configuration has set up cookie-based proxy authentication. If so, and the cookies are not present, clients will be redirected to a page where the cookies can be obtained. Returns true if the client is authorized for proxying. Return false and responds to the request_ if the client was not authorized.

bool net_instaweb::InstawebHandler::HandleAsInPlace ( )

Attempts to handle this as an in-place resource. Returns false if the in-place handling didn't occur, and another handler should take over the request.

void net_instaweb::InstawebHandler::HandleAsPagespeedResource ( )

Unconditionally handles a resource that looks like a .pagespeed. resource, whether the result is success or failure.

bool net_instaweb::InstawebHandler::HandleAsProxy ( )

Attempts to handle this as a proxied resource (see MapProxyDomain). Returns false if the proxy handling didn't occur, and another handler should take over the request.

void net_instaweb::InstawebHandler::HandleAsProxyForAll ( )

Tries to acts as a full-featured proxy, handling both HTML and resources.

static apr_status_t net_instaweb::InstawebHandler::instaweb_handler ( request_rec *  request)
static

Handle mod_pagespeed-specific requests. Handles both .pagespeed. rewritten resources and /mod_pagespeed_statistics, /mod_pagespeed_beacon, etc.

static apr_status_t net_instaweb::InstawebHandler::instaweb_map_to_storage ( request_rec *  request)
static

By default, apache imposes limitations on URL segments of around 256 characters that appear to correspond to filename limitations. To prevent that, we hook map_to_storage for our own purposes.

static bool net_instaweb::InstawebHandler::is_pagespeed_subrequest ( request_rec *  request)
static

Was this request made by mod_pagespeed itself? If so, we should not try to handle it, just let Apache deal with it like normal.

RewriteDriver* net_instaweb::InstawebHandler::MakeDriver ( )

Makes a driver from the request_context and options. Note that this can only be called once, as it potentially mutates the options as it transfers ownership of custom_options. The driver is owned by the InstawebHandler and will be cleaned up at destruction, unless you call DisownDriver().

ApacheFetch* net_instaweb::InstawebHandler::MakeFetch ( const GoogleString url,
bool  buffered,
StringPiece  debug_info 
)

Allocates a Fetch object associated with the current request and the specified URL. Include in debug_info anything that's cheap to create and would be informative if something went wrong with the fetch. If any uses will be from other threads you must set buffered=true to keep your other thread from getting blocked if our output is being read by a slow reader.

ApacheFetch* net_instaweb::InstawebHandler::MakeFetch ( bool  buffered,
StringPiece  debug_info 
)
inline

Allocates a Fetch object associated with the current request and its URL. Please read the comment above before setting buffered=false.

const ApacheConfig* net_instaweb::InstawebHandler::options ( )
inline

Returns the options, whether they were custom-computed due to htaccess file, query params, or headers, or were the default options for the vhost.

bool net_instaweb::InstawebHandler::ProxyUrl ( )

Loads the URL based on the fetchers and other infrastructure in the factory, returning true if the request was handled. This is used both for slurping and for handling URLs ending with proxy_suffix.

static apr_status_t net_instaweb::InstawebHandler::save_url_hook ( request_rec *  request)
static

Save the original URL as a request "note" before mod_rewrite has a chance to corrupt mod_pagespeed's generated URLs, which would prevent instaweb_handler from being able to decode the resource.

static apr_status_t net_instaweb::InstawebHandler::save_url_in_note ( request_rec *  request,
ApacheServerContext server_context 
)
static

Implementation of the Apache 'translate_name' hook. Used by the actual hook 'save_url_hook' and directly when we already have the server context.

void net_instaweb::InstawebHandler::WaitForFetch ( )

Waits for an outstanding fetch (obtained by MakeFetch) to complete. On failure, a failure response will be sent to the client. The request is handled unconditionally.


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