Page Speed Optimization Libraries
1.13.35.1
|
#include "instaweb_handler.h"
Public Member Functions | |
InstawebHandler (request_rec *request) | |
const GoogleUrl & | stripped_gurl () const |
Any PageSpeed query params are removed. | |
const RequestContextPtr | request_context () const |
bool | use_custom_options () const |
const QueryParams & | query_params () |
const QueryParams & | pagespeed_query_params () |
const QueryParams & | pagespeed_option_cookies () |
void | RemoveStrippedResponseHeadersFromApacheRequest () |
RewriteDriver * | MakeDriver () |
void | DisownDriver () |
Prevent "this" from cleaning up rewrite_driver_ at destruction. | |
ApacheFetch * | MakeFetch (const GoogleString &url, bool buffered, StringPiece debug_info) |
ApacheFetch * | MakeFetch (bool buffered, StringPiece debug_info) |
bool | HandleAsProxy () |
void | HandleAsProxyForAll () |
bool | HandleAsInPlace () |
void | HandleAsPagespeedResource () |
void | WaitForFetch () |
bool | ProxyUrl () |
bool | AuthenticateProxy () |
RequestHeaders * | ReleaseRequestHeaders () |
const ApacheConfig * | options () |
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) |
Context for handling a request, computing options and request headers in the constructor.
|
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 |
Handle mod_pagespeed-specific requests. Handles both .pagespeed. rewritten resources and /mod_pagespeed_statistics, /mod_pagespeed_beacon, etc.
|
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 |
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.
|
inline |
Allocates a Fetch object associated with the current request and its URL. Please read the comment above before setting buffered=false.
|
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 |
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 |
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.