19 #ifndef PAGESPEED_OPT_HTTP_REQUEST_CONTEXT_H_
20 #define PAGESPEED_OPT_HTTP_REQUEST_CONTEXT_H_
24 #include "base/logging.h"
33 namespace net_instaweb {
35 class AbstractLogRecord;
42 typedef RefCountedPtr<RequestContext> RequestContextPtr;
67 return NewTestRequestContextWithTimer(thread_system, NULL);
119 void set_using_http2(
bool x) { using_http2_ = x; }
143 return minimal_private_suffix_;
146 minimal_private_suffix.CopyToString(&minimal_private_suffix_);
152 bool accepts_webp()
const {
return accepts_webp_; }
157 bool accepts_gzip()
const {
return accepts_gzip_; }
159 int64 request_id()
const {
162 void set_request_id(int64 x) {
166 const GoogleString& sticky_query_parameters_token()
const {
167 return sticky_query_parameters_token_;
169 void set_sticky_query_parameters_token(StringPiece x) {
170 x.CopyToString(&sticky_query_parameters_token_);
180 void AddSessionAuthorizedFetchOrigin(
const GoogleString& origin) {
181 session_authorized_fetch_origins_.insert(origin);
187 return session_authorized_fetch_origins_.find(origin)
188 != session_authorized_fetch_origins_.end();
204 bool log_url_indices,
205 int max_rewrite_info_log_size);
208 RequestTimingInfo* mutable_timing_info() {
return &timing_info_; }
210 void set_options(
const HttpOptions& options) {
211 DCHECK(!options_set_);
223 DCHECK(options_set_);
227 void Freeze() { frozen_ =
true; }
228 bool frozen()
const {
return frozen_; }
244 scoped_ptr<AbstractLogRecord> log_record_;
246 RequestTimingInfo timing_info_;
249 scoped_ptr<RequestTrace> root_trace_context_;
252 scoped_ptr<AbstractLogRecord> background_rewrite_log_record_;
254 StringSet session_authorized_fetch_origins_;
269 HttpOptions options_;
void PrepareLogRecordForOutput()
const GoogleString & minimal_private_suffix() const
Definition: request_context.h:142
Definition: request_context.h:51
Abstract interface for implementing a mutex.
Definition: abstract_mutex.h:28
virtual ~RequestContext()
Destructors in refcounted classes should be protected.
Definition: ref_counted_ptr.h:41
Definition: log_record.h:59
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
Definition: request_timing_info.h:43
void SetAcceptsWebp(bool x)
virtual RequestTrace * CreateDependentTraceContext(const StringPiece &label)
Definition: request_context.h:97
virtual AbstractLogRecord * log_record()
The log record for the this request, created when the request context is.
void SetHttp2SupportFromViaHeader(StringPiece header)
virtual void ReleaseDependentTraceContext(RequestTrace *t)
void SetAcceptsGzip(bool x)
static RequestContextPtr NewTestRequestContext(ThreadSystem *thread_system)
Definition: request_context.h:66
RequestContext(const HttpOptions &options, AbstractMutex *logging_mutex, Timer *timer)
void set_root_trace_context(RequestTrace *x)
Takes ownership of the given context.
RequestTrace * root_trace_context()
Definition: request_context.h:83
Definition: thread_system.h:40
void WriteBackgroundRewriteLog()
Write the log for background rewriting into disk.
Definition: request_trace.h:31
virtual AbstractLogRecord * NewSubordinateLogRecord(AbstractMutex *logging_mutex)
Any options which need to be accessed in http/ should be in here.
Definition: http_options.h:25
bool using_http2() const
Determines whether this request is using the HTTP2 protocol.
Definition: request_context.h:118
Timer interface, made virtual so it can be mocked for tests.
Definition: timer.h:27
bool IsSessionAuthorizedFetchOrigin(const GoogleString &origin) const
Definition: request_context.h:186
void ResetOptions(const HttpOptions &options)
Definition: request_context.h:218
AbstractLogRecord * GetBackgroundRewriteLog(ThreadSystem *thread_system, bool log_urls, bool log_url_indices, int max_rewrite_info_log_size)