Page Speed Optimization Libraries  1.9.32.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
apache_server_context.h
Go to the documentation of this file.
1 // Copyright 2011 Google Inc.
16 
17 #ifndef NET_INSTAWEB_APACHE_APACHE_SERVER_CONTEXT_H_
18 #define NET_INSTAWEB_APACHE_APACHE_SERVER_CONTEXT_H_
19 
21 #include "net/instaweb/http/public/request_context.h"
24 #include "pagespeed/kernel/base/basictypes.h"
25 #include "pagespeed/kernel/base/message_handler.h"
26 #include "pagespeed/kernel/base/scoped_ptr.h"
27 #include "pagespeed/kernel/base/string.h"
28 #include "pagespeed/kernel/base/string_util.h"
29 
30 struct request_rec;
31 struct server_rec;
32 
33 namespace net_instaweb {
34 
35 class ApacheRewriteDriverFactory;
36 class ApacheRequestContext;
37 class ProxyFetchFactory;
38 class RewriteDriverPool;
39 class RewriteDriver;
40 class Statistics;
41 class Variable;
42 
50  public:
52  server_rec* server,
53  const StringPiece& version);
54  virtual ~ApacheServerContext();
55 
57  static void InitStats(Statistics* statistics);
58 
59  ApacheRewriteDriverFactory* apache_factory() { return apache_factory_; }
60  ApacheConfig* global_config();
61  bool InitPath(const GoogleString& path);
62 
71  ApacheConfig* NonSpdyConfigOverlay();
72 
75  bool has_spdy_config_overlay() const {
76  return spdy_config_overlay_.get() != NULL;
77  }
78 
79  bool has_non_spdy_config_overlay() const {
80  return non_spdy_config_overlay_.get() != NULL;
81  }
82 
85  spdy_config_overlay_.reset(x);
86  }
87 
88  void set_non_spdy_config_overlay(ApacheConfig* x) {
89  non_spdy_config_overlay_.reset(x);
90  }
91 
95  virtual const ApacheConfig* SpdyGlobalConfig() const {
96  return spdy_specific_config_.get();
97  }
98 
102  RewriteDriverPool* spdy_driver_pool() { return spdy_driver_pool_; }
103 
108 
111  bool PoolDestroyed();
112 
113  const server_rec* server() const { return server_rec_; }
114 
115  virtual RewriteDriverPool* SelectDriverPool(bool using_spdy);
116 
118  virtual void MaybeApplySpdySessionFetcher(const RequestContextPtr& request,
119  RewriteDriver* driver);
120 
121  ProxyFetchFactory* proxy_fetch_factory() {
122  return proxy_fetch_factory_.get();
123  }
124 
125  void InitProxyFetchFactory();
126 
130  virtual bool ProxiesHtml() const { return false; }
131 
141  ApacheRequestContext* NewApacheRequestContext(request_rec* request);
142 
146  void ReportResourceNotFound(StringPiece message, request_rec* request) {
147  ReportNotFoundHelper(kWarning, message, request,
148  rewrite_stats()->resource_404_count());
149  }
150 
154  void ReportStatisticsNotFound(StringPiece message, request_rec* request) {
155  ReportNotFoundHelper(kWarning, message, request, statistics_404_count());
156  }
157 
161  void ReportSlurpNotFound(StringPiece message, request_rec* request) {
162  ReportNotFoundHelper(kInfo, message, request,
163  rewrite_stats()->slurp_404_count());
164  }
165 
166  virtual GoogleString FormatOption(StringPiece option_name, StringPiece args);
167 
168  private:
169  virtual bool UpdateCacheFlushTimestampMs(int64 timestamp_ms);
170 
171  void ReportNotFoundHelper(MessageType message_type,
172  StringPiece url,
173  request_rec* request,
174  Variable* error_count);
175 
176  ApacheRewriteDriverFactory* apache_factory_;
177  server_rec* server_rec_;
178  GoogleString version_;
179 
182  scoped_ptr<ApacheConfig> spdy_config_overlay_;
183  scoped_ptr<ApacheConfig> non_spdy_config_overlay_;
184 
186  scoped_ptr<ApacheConfig> spdy_specific_config_;
187 
190  RewriteDriverPool* spdy_driver_pool_;
191 
192  scoped_ptr<ProxyFetchFactory> proxy_fetch_factory_;
193 
194  DISALLOW_COPY_AND_ASSIGN(ApacheServerContext);
195 };
196 
197 }
198 
199 #endif
bool has_spdy_config_overlay() const
Definition: apache_server_context.h:75
ApacheRequestContext * NewApacheRequestContext(request_rec *request)
Definition: apache_config.h:31
RewriteDriverPool * spdy_driver_pool()
Definition: apache_server_context.h:102
void set_spdy_config_overlay(ApacheConfig *x)
These two take ownership of their parameters.
Definition: apache_server_context.h:84
virtual GoogleString FormatOption(StringPiece option_name, StringPiece args)
virtual const ApacheConfig * SpdyGlobalConfig() const
Definition: apache_server_context.h:95
virtual void MaybeApplySpdySessionFetcher(const RequestContextPtr &request, RewriteDriver *driver)
Hook for implementations to support fetching directly from the spdy module.
Definition: rewrite_driver_pool.h:34
Definition: apache_server_context.h:49
void ReportSlurpNotFound(StringPiece message, request_rec *request)
Definition: apache_server_context.h:161
static void InitStats(Statistics *statistics)
This must be called for every statistics object in use before using this.
A server context with features specific to a PSOL port on a unix system.
Definition: system_server_context.h:54
void ReportStatisticsNotFound(StringPiece message, request_rec *request)
Definition: apache_server_context.h:154
virtual RewriteDriverPool * SelectDriverPool(bool using_spdy)
Chooses a driver pool based on the request protocol.
Creates an Apache RewriteDriver.
Definition: apache_rewrite_driver_factory.h:47
Definition: apache_request_context.h:39
void ReportResourceNotFound(StringPiece message, request_rec *request)
Definition: apache_server_context.h:146
virtual void CollapseConfigOverlaysAndComputeSignatures()
virtual bool ProxiesHtml() const
Definition: apache_server_context.h:130