18 #ifndef PAGESPEED_APACHE_INSTAWEB_CONTEXT_H_
19 #define PAGESPEED_APACHE_INSTAWEB_CONTEXT_H_
21 #include "net/instaweb/http/public/request_context.h"
33 #include "apr_pools.h"
35 namespace net_instaweb {
37 class ApacheServerContext;
41 class ResponseHeaders;
45 const char kPagespeedOriginalUrl[] =
"mod_pagespeed_original_url";
50 T* resolved =
static_cast<T*
>(object);
67 enum ContentEncoding { kNone, kGzip, kDeflate, kOther };
68 enum ContentDetectionState { kStart, kHtml, kNotHtml };
79 bool use_custom_options,
83 void Rewrite(
const char* input,
int size);
87 apr_bucket_brigade* bucket_brigade()
const {
return bucket_brigade_; }
88 ContentEncoding content_encoding()
const {
return content_encoding_; }
91 bool empty()
const {
return output_.empty(); }
92 void clear() { output_.clear(); }
95 return response_headers_.get();
98 bool sent_headers() {
return sent_headers_; }
99 void set_sent_headers(
bool sent) { sent_headers_ = sent; }
110 static const char*
MakeRequestUrl(
const RewriteOptions& global_options,
111 request_rec* request);
114 void ComputeContentEncoding(request_rec* request);
115 void BlockingPropertyCacheLookup();
116 void ProcessBytes(
const char* input,
int size);
122 void SetExperimentStateAndCookie(request_rec* request,
123 RewriteOptions* options);
126 apr_bucket_brigade* bucket_brigade_;
127 ContentEncoding content_encoding_;
128 const ContentType content_type_;
130 ApacheServerContext* server_context_;
131 RewriteDriver* rewrite_driver_;
132 StringWriter string_writer_;
133 scoped_ptr<GzipInflater> inflater_;
134 HtmlDetector html_detector_;
136 scoped_ptr<RequestHeaders> request_headers_;
137 scoped_ptr<ResponseHeaders> response_headers_;
140 bool populated_headers_;
Parses and rewrites URL query parameters.
Definition: query_params.h:31
Definition: instaweb_context.h:65
apr_status_t apache_cleanup(void *object)
Generic deleter meant to be used with apr_pool_cleanup_register().
Definition: instaweb_context.h:49
static ApacheServerContext * ServerContextFromServerRec(server_rec *server)
Definition: apache_server_context.h:52
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
static const char * MakeRequestUrl(const RewriteOptions &global_options, request_rec *request)
Returns a fetchable URI from a request, using the request pool.
Definition: content_type.h:31
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:84
ResponseHeaders * response_headers()
Definition: instaweb_context.h:94