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

#include "apache_server_context.h"

Inheritance diagram for net_instaweb::ApacheServerContext:
net_instaweb::SystemServerContext net_instaweb::ServerContext

Public Member Functions

 ApacheServerContext (ApacheRewriteDriverFactory *factory, server_rec *server, const StringPiece &version)
ApacheRewriteDriverFactoryapache_factory ()
ApacheConfigglobal_config ()
const ApacheConfigglobal_config () const
bool InitPath (const GoogleString &path)
ApacheConfigSpdyConfigOverlay ()
ApacheConfigNonSpdyConfigOverlay ()
bool has_spdy_config_overlay () const
bool has_non_spdy_config_overlay () const
void set_spdy_config_overlay (ApacheConfig *x)
 These two take ownership of their parameters.
void set_non_spdy_config_overlay (ApacheConfig *x)
virtual void CollapseConfigOverlaysAndComputeSignatures ()
bool PoolDestroyed ()
const server_rec * server () const
ProxyFetchFactoryproxy_fetch_factory ()
void InitProxyFetchFactory ()
virtual bool ProxiesHtml () const
ApacheRequestContextNewApacheRequestContext (request_rec *request)
void ReportResourceNotFound (StringPiece message, request_rec *request)
void ReportStatisticsNotFound (StringPiece message, request_rec *request)
void ReportSlurpNotFound (StringPiece message, request_rec *request)
virtual GoogleString FormatOption (StringPiece option_name, StringPiece args)
- Public Member Functions inherited from net_instaweb::SystemServerContext
 SystemServerContext (RewriteDriverFactory *factory, StringPiece hostname, int port)
void SetCachePath (SystemCachePath *cache_path)
void FlushCacheIfNecessary ()
SystemRewriteOptionsglobal_system_rewrite_options ()
GoogleString hostname_identifier ()
void UpdateCachePurgeSet (const CopyOnWrite< PurgeSet > &purge_set)
virtual void PostInitHook ()
 Initialize this SystemServerContext to set up its admin site.
void CreateLocalStatistics (Statistics *global_statistics, SystemRewriteDriverFactory *factory)
bool initialized () const
virtual void ApplySessionFetchers (const RequestContextPtr &req, RewriteDriver *driver)
void AddHtmlRewriteTimeUs (int64 rewrite_time_us)
SystemCachePathcache_path ()
void ConsoleHandler (const SystemRewriteOptions &options, AdminSite::AdminSource source, const QueryParams &query_params, AsyncFetch *fetch)
void MessageHistoryHandler (const RewriteOptions &options, AdminSite::AdminSource source, AsyncFetch *fetch)
 Displays recent Info/Warning/Error messages.
void StatisticsGraphsHandler (Writer *writer)
 Deprecated handler for graphs in the PSOL console.
void AdminPage (bool is_global, const GoogleUrl &stripped_gurl, const QueryParams &query_params, const RewriteOptions *options, AsyncFetch *fetch)
void StatisticsPage (bool is_global, const QueryParams &query_params, const RewriteOptions *options, AsyncFetch *fetch)
AdminSiteadmin_site ()
- Public Member Functions inherited from net_instaweb::ServerContext
 ServerContext (RewriteDriverFactory *factory)
void SetDefaultLongCacheHeaders (const ContentType *content_type, StringPiece charset, StringPiece cache_control_suffix, ResponseHeaders *header) const
void set_filename_prefix (const StringPiece &file_prefix)
void set_statistics (Statistics *x)
void set_rewrite_stats (RewriteStats *x)
void set_lock_manager (NamedLockManager *x)
void set_enable_property_cache (bool enabled)
void set_message_handler (MessageHandler *x)
StringPiece filename_prefix () const
Statisticsstatistics () const
NamedLockManagerlock_manager () const
RewriteDriverFactoryfactory () const
ThreadSynchronizerthread_synchronizer ()
ExperimentMatcherexperiment_matcher ()
void ApplyInputCacheControl (const ResourceVector &inputs, ResponseHeaders *headers)
bool IsPagespeedResource (const GoogleUrl &url) const
 Is this URL a ref to a Pagespeed resource?
const RewriteFilterFindFilterForDecoding (const StringPiece &id) const
bool DecodeUrlGivenOptions (const GoogleUrl &url, const RewriteOptions *options, const UrlNamer *url_namer, StringVector *decoded_urls) const
 See RewriteDriver::DecodeUrl.
void ComputeSignature (RewriteOptions *rewrite_options) const
Hasherhasher () const
const Hasherlock_hasher () const
const Hashercontents_hasher () const
FileSystemfile_system ()
void set_file_system (FileSystem *fs)
UrlNamerurl_namer () const
void set_url_namer (UrlNamer *n)
RewriteOptionsManagerrewrite_options_manager () const
SHA1Signaturesignature () const
void SetRewriteOptionsManager (RewriteOptionsManager *rom)
 Takes ownership of RewriteOptionsManager.
StaticAssetManagerstatic_asset_manager () const
void set_static_asset_manager (StaticAssetManager *manager)
Schedulerscheduler () const
void set_scheduler (Scheduler *s)
bool has_default_system_fetcher () const
UrlAsyncFetcherDefaultSystemFetcher ()
virtual CacheUrlAsyncFetcherCreateCustomCacheFetcher (const RewriteOptions *options, const GoogleString &fragment, CacheUrlAsyncFetcher::AsyncOpHooks *hooks, UrlAsyncFetcher *fetcher)
Timertimer () const
void set_timer (Timer *timer)
 Note: doesn't take ownership.
HTTPCachehttp_cache () const
void set_http_cache (HTTPCache *x)
void MakePagePropertyCache (PropertyStore *property_store)
 Creates PagePropertyCache object with the provided PropertyStore object.
PropertyCachepage_property_cache () const
const PropertyCache::Cohortdom_cohort () const
void set_dom_cohort (const PropertyCache::Cohort *c)
const PropertyCache::Cohortbeacon_cohort () const
void set_beacon_cohort (const PropertyCache::Cohort *c)
const PropertyCache::Cohortdependencies_cohort () const
void set_dependencies_cohort (const PropertyCache::Cohort *c)
const PropertyCache::Cohortfix_reflow_cohort () const
void set_fix_reflow_cohort (const PropertyCache::Cohort *c)
CacheInterfacefilesystem_metadata_cache () const
void set_filesystem_metadata_cache (CacheInterface *x)
CacheInterfacemetadata_cache () const
void set_metadata_cache (CacheInterface *x)
CriticalImagesFindercritical_images_finder () const
void set_critical_images_finder (CriticalImagesFinder *finder)
CriticalSelectorFindercritical_selector_finder () const
void set_critical_selector_finder (CriticalSelectorFinder *finder)
UserAgentMatcheruser_agent_matcher () const
void set_user_agent_matcher (UserAgentMatcher *n)
SimpleRandomsimple_random ()
bool store_outputs_in_file_system ()
void set_store_outputs_in_file_system (bool store)
RewriteStatsrewrite_stats () const
MessageHandlermessage_handler () const
NamedLockMakeCreationLock (const GoogleString &name)
void TryLockForCreation (NamedLock *creation_lock, Function *callback)
 Attempt to obtain a named lock without blocking. Return true if we do so.
void LockForCreation (NamedLock *creation_lock, Sequence *worker, Function *callback)
void set_hasher (Hasher *hasher)
 Setters should probably only be used in testing.
void set_signature (SHA1Signature *signature)
void set_default_system_fetcher (UrlAsyncFetcher *fetcher)
bool HandleBeacon (StringPiece body, StringPiece user_agent, const RequestContextPtr &request_context)
RewriteOptionsglobal_options ()
const RewriteOptionsglobal_options () const
void reset_global_options (RewriteOptions *options)
RewriteOptionsNewOptions ()
 Makes a new, empty set of RewriteOptions.
bool GetQueryOptions (const RequestContextPtr &request_context, const RewriteOptions *domain_options, GoogleUrl *request_url, RequestHeaders *request_headers, ResponseHeaders *response_headers, RewriteQuery *rewrite_query)
void GetRemoteOptions (RewriteOptions *remote_options, bool on_startup)
RewriteOptionsGetCustomOptions (RequestHeaders *request_headers, RewriteOptions *domain_options, RewriteOptions *query_options)
GoogleString GetRewriteOptionsSignatureHash (const RewriteOptions *options)
RewriteDriverNewRewriteDriver (const RequestContextPtr &request_ctx)
RewriteDriverNewRewriteDriverFromPool (RewriteDriverPool *pool, const RequestContextPtr &request_ctx)
RewriteDriverNewUnmanagedRewriteDriver (RewriteDriverPool *pool, RewriteOptions *options, const RequestContextPtr &request_ctx)
RewriteDriverNewCustomRewriteDriver (RewriteOptions *custom_options, const RequestContextPtr &request_ctx)
void ReleaseRewriteDriver (RewriteDriver *rewrite_driver)
ThreadSystemthread_system ()
UsageDataReporterusage_data_reporter ()
void set_shutting_down ()
bool shutting_down () const
void ShutDownDrivers (int64 cutoff_time_ms)
void MergeNonCachingResponseHeaders (const ResourcePtr &input, const OutputResourcePtr &output)
void MergeNonCachingResponseHeaders (const ResponseHeaders &input_headers, ResponseHeaders *output_headers)
 Entry-point with the same functionality, exposed for easier testing.
QueuedWorkerPoolhtml_workers ()
 Pool of worker-threads that can be used to handle html-parsing.
QueuedWorkerPoolrewrite_workers ()
 Pool of worker-threads that can be used to handle resource rewriting.
QueuedWorkerPoollow_priority_rewrite_workers ()
size_t num_active_rewrite_drivers ()
void InitWorkers ()
bool response_headers_finalized () const
void set_response_headers_finalized (bool x)
RewriteDriverPoolstandard_rewrite_driver_pool ()
const GoogleStringhostname () const
 Returns the current server hostname.
void set_hostname (const GoogleString &x)
void set_central_controller (std::shared_ptr< CentralController > controller)
CentralControllercentral_controller ()
void AddOriginalContentLengthHeader (const ResourceVector &inputs, ResponseHeaders *headers)
RequestPropertiesNewRequestProperties ()
 Makes a new RequestProperties.
void DeleteCacheOnDestruction (CacheInterface *cache)
void set_cache_property_store (CachePropertyStore *p)
void set_decoding_driver (RewriteDriver *rd)
virtual PropertyStoreCreatePropertyStore (CacheInterface *cache_backend)
 Creates CachePropertyStore object which will be used by PagePropertyCache.
const PropertyCache::CohortAddCohort (const GoogleString &cohort_name, PropertyCache *pcache)
const PropertyCache::CohortAddCohortWithCache (const GoogleString &cohort_name, CacheInterface *cache, PropertyCache *pcache)
const CacheInterfacepcache_cache_backend ()
js_tokenizer_patterns () const
void ShowCacheHandler (Format format, StringPiece url, StringPiece ua, bool should_delete, AsyncFetch *fetch, RewriteOptions *options)

Static Public Member Functions

static void InitStats (Statistics *statistics)
 This must be called for every statistics object in use before using this.
- Static Public Member Functions inherited from net_instaweb::SystemServerContext
static void InitStats (Statistics *statistics)
- Static Public Member Functions inherited from net_instaweb::ServerContext
static bool IsExcludedAttribute (const char *attribute)
static GoogleString ShowCacheForm (StringPiece user_agent)

Static Public Attributes

static const char kProxyInterfaceStatsPrefix []
 Prefix for ProxyInterface stats (active in proxy_all_requests_mode() only).
- Static Public Attributes inherited from net_instaweb::ServerContext
static const int64 kGeneratedMaxAgeMs
 The lifetime for cache-extended generated resources, in milliseconds.
static const int64 kCacheTtlForMismatchedContentMs
 Short lifetime for generated resources fetched with mismatching hash.
static const char kResourceEtagValue []
static const char kCacheKeyResourceNamePrefix []

Additional Inherited Members

- Public Types inherited from net_instaweb::ServerContext
enum  Format { kFormatAsHtml, kFormatAsJson }
typedef std::pair
< RewriteOptions *, bool > 
- Protected Member Functions inherited from net_instaweb::SystemServerContext
virtual bool UpdateCacheFlushTimestampMs (int64 timestamp_ms)
void ConsoleJsonHandler (const QueryParams &params, AsyncFetch *fetch)
 Returns JSON used by the PageSpeed Console JavaScript.
void StatisticsHandler (const RewriteOptions &options, bool is_global_request, AdminSite::AdminSource source, AsyncFetch *fetch)
void PrintConfig (AdminSite::AdminSource source, AsyncFetch *fetch)
 Print details for configuration.
void PrintCaches (bool is_global, AdminSite::AdminSource source, const GoogleUrl &stripped_gurl, const QueryParams &query_params, const RewriteOptions *options, AsyncFetch *fetch)
void PrintHistograms (bool is_global_request, AdminSite::AdminSource source, AsyncFetch *fetch)
 Print histograms showing the dynamics of server activity.
Variablestatistics_404_count ()
- Protected Member Functions inherited from net_instaweb::ServerContext
void ManageRewriteDriverPool (RewriteDriverPool *pool)

Detailed Description

Creates an Apache-specific ServerContext. This differs from base class that it incorporates by adding per-VirtualHost configuration, including:

Member Function Documentation

virtual void net_instaweb::ApacheServerContext::CollapseConfigOverlaysAndComputeSignatures ( )

This should be called after all configuration parsing is done to collapse configuration inside the config overlays into actual ApacheConfig objects. It will also compute signatures when done.

Reimplemented from net_instaweb::SystemServerContext.

virtual GoogleString net_instaweb::ApacheServerContext::FormatOption ( StringPiece  option_name,
StringPiece  args 

Returns the format for specifying a configuration file option. E.g. for option_name="EnableCachePurge", args="on", returns: nginx: "pagespeed EnableCachePurge on;" apache: "ModPagespeed EnableCachePurge on" The base class simply returns "EnableCachePurge on".

Reimplemented from net_instaweb::ServerContext.

bool net_instaweb::ApacheServerContext::has_spdy_config_overlay ( ) const

These return true if the given overlays were constructed (in response to having something in config files to put in them).

bool net_instaweb::ApacheServerContext::PoolDestroyed ( )

Called on notification from Apache on child exit. Returns true if this is the last ServerContext that exists.

virtual bool net_instaweb::ApacheServerContext::ProxiesHtml ( ) const

We only proxy external HTML from mod_pagespeed in Apache using the ProxyFetch flow if proxy_all_requests_mode() is on in config. In the usual case, we handle HTML as an Apache filter, letting something like mod_proxy (or one of our own test modes like slurp) do the fetching.

Implements net_instaweb::ServerContext.

void net_instaweb::ApacheServerContext::ReportResourceNotFound ( StringPiece  message,
request_rec *  request 

Reports an error status to the HTTP resource request, and logs the error as a Warning to the log file, and bumps a stat as needed.

void net_instaweb::ApacheServerContext::ReportSlurpNotFound ( StringPiece  message,
request_rec *  request 

Reports an error status to the HTTP slurp request, and logs the error as a Warning to the log file, and bumps a stat as needed.

void net_instaweb::ApacheServerContext::ReportStatisticsNotFound ( StringPiece  message,
request_rec *  request 

Reports an error status to the HTTP statistics request, and logs the error as a Warning to the log file, and bumps a stat as needed.

ApacheConfig* net_instaweb::ApacheServerContext::SpdyConfigOverlay ( )

These return configuration objects that hold settings from <ModPagespeedIf spdy>=""> and <ModPagespeedIf !spdy> sections of configuration. They initialize lazily, so are not thread-safe; however they are only meant to be used during configuration parsing. These methods should be called only if there is actually a need to put something in them, since otherwise we may end up constructing separate SPDY vs. non-SPDY configurations needlessly.

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