18 #ifndef NET_INSTAWEB_APACHE_INSTAWEB_CONTEXT_H_
19 #define NET_INSTAWEB_APACHE_INSTAWEB_CONTEXT_H_
22 #include "net/instaweb/http/public/request_context.h"
23 #include "pagespeed/kernel/base/basictypes.h"
24 #include "pagespeed/kernel/base/scoped_ptr.h"
25 #include "pagespeed/kernel/base/string.h"
26 #include "pagespeed/kernel/base/string_writer.h"
27 #include "pagespeed/kernel/http/content_type.h"
33 #include "apr_pools.h"
35 struct apr_bucket_brigade;
39 namespace net_instaweb {
41 class ApacheServerContext;
45 class ResponseHeaders;
49 const char kPagespeedOriginalUrl[] =
"mod_pagespeed_original_url";
54 T* resolved =
static_cast<T*
>(object);
71 enum ContentEncoding { kNone, kGzip, kDeflate, kOther };
72 enum ContentDetectionState { kStart, kHtml, kNotHtml };
76 RequestHeaders* request_headers,
77 const ContentType& content_type,
79 const GoogleString& base_url,
80 const RequestContextPtr& request_context,
81 const QueryParams& pagespeed_query_params,
82 const QueryParams& pagespeed_option_cookies,
83 bool use_custom_options,
87 void Rewrite(
const char* input,
int size);
91 apr_bucket_brigade* bucket_brigade()
const {
return bucket_brigade_; }
92 ContentEncoding content_encoding()
const {
return content_encoding_; }
94 const GoogleString& output() {
return output_; }
95 bool empty()
const {
return output_.empty(); }
96 void clear() { output_.clear(); }
99 return response_headers_.get();
102 bool sent_headers() {
return sent_headers_; }
103 void set_sent_headers(
bool sent) { sent_headers_ = sent; }
114 static const char*
MakeRequestUrl(
const RewriteOptions& global_options,
115 request_rec* request);
118 void ComputeContentEncoding(request_rec* request);
119 void BlockingPropertyCacheLookup();
120 void ProcessBytes(
const char* input,
int size);
126 void SetExperimentStateAndCookie(request_rec* request,
127 RewriteOptions* options);
129 GoogleString output_;
130 apr_bucket_brigade* bucket_brigade_;
131 ContentEncoding content_encoding_;
132 const ContentType content_type_;
134 ApacheServerContext* server_context_;
135 RewriteDriver* rewrite_driver_;
136 StringWriter string_writer_;
137 scoped_ptr<GzipInflater> inflater_;
138 HtmlDetector html_detector_;
139 GoogleString absolute_url_;
140 scoped_ptr<RequestHeaders> request_headers_;
141 scoped_ptr<ResponseHeaders> response_headers_;
144 bool populated_headers_;
Definition: instaweb_context.h:69
apr_status_t apache_cleanup(void *object)
Generic deleter meant to be used with apr_pool_cleanup_register().
Definition: instaweb_context.h:53
static ApacheServerContext * ServerContextFromServerRec(server_rec *server)
Definition: apache_server_context.h:49
static const char * MakeRequestUrl(const RewriteOptions &global_options, request_rec *request)
Returns a fetchable URI from a request, using the request pool.
InstawebContext(request_rec *request, RequestHeaders *request_headers, const ContentType &content_type, ApacheServerContext *server_context, const GoogleString &base_url, const RequestContextPtr &request_context, const QueryParams &pagespeed_query_params, const QueryParams &pagespeed_option_cookies, bool use_custom_options, const RewriteOptions &options)
Takes ownership of request_headers.
void PopulateHeaders(request_rec *request)
Populated response_headers_ with the request's headers_out table.
Definition: rewrite_options.h:83
ResponseHeaders * response_headers()
Definition: instaweb_context.h:98