Page Speed Optimization Libraries
1.13.35.1
|
#include "apache_fetch.h"
Public Member Functions | |
ApacheFetch (const GoogleString &mapped_url, StringPiece debug_info, RewriteDriver *driver, ApacheWriter *apache_writer, RequestHeaders *request_headers, const RequestContextPtr &request_context, const RewriteOptions *options, MessageHandler *handler) | |
void | set_handle_error (bool x) |
void | set_buffered (bool x) |
void | Wait () LOCKS_EXCLUDED(scheduler_-> mutex()) |
Blocks waiting for the fetch to complete. | |
bool | status_ok () const |
virtual bool | IsCachedResultValid (const ResponseHeaders &headers) LOCKS_EXCLUDED(scheduler_-> mutex()) |
void | set_is_proxy (bool x) |
Public Member Functions inherited from net_instaweb::AsyncFetch | |
AsyncFetch (const RequestContextPtr &request_ctx) | |
void | HeadersComplete () |
void | Done (bool success) |
virtual bool | Write (const StringPiece &content, MessageHandler *handler) |
virtual bool | Flush (MessageHandler *handler) |
RequestHeaders * | request_headers () |
void | set_request_headers (RequestHeaders *headers) |
void | SetRequestHeadersTakingOwnership (RequestHeaders *headers) |
Same as above, but takes ownership. | |
const RequestHeaders * | request_headers () const |
ResponseHeaders * | response_headers () |
See doc for request_headers and set_request_headers. | |
void | set_response_headers (ResponseHeaders *headers) |
ResponseHeaders * | extra_response_headers () |
void | set_extra_response_headers (ResponseHeaders *headers) |
virtual bool | IsBackgroundFetch () const |
virtual void | Reset () |
bool | headers_complete () const |
bool | content_length_known () const |
int64 | content_length () const |
void | set_content_length (int64 x) |
GoogleString | LoggingString () |
virtual const RequestContextPtr & | request_context () |
virtual AbstractLogRecord * | log_record () |
void | FixCacheControlForGoogleCache () |
Public Member Functions inherited from net_instaweb::Writer | |
virtual bool | Dump (Writer *writer, MessageHandler *message_handler) |
Protected Member Functions | |
virtual void | HandleHeadersComplete () LOCKS_EXCLUDED(scheduler_-> mutex()) |
virtual void | HandleDone (bool success) LOCKS_EXCLUDED(scheduler_-> mutex()) |
virtual bool | HandleFlush (MessageHandler *handler) LOCKS_EXCLUDED(scheduler_-> mutex()) |
virtual bool | HandleWrite (const StringPiece &sp, MessageHandler *handler) LOCKS_EXCLUDED(scheduler_-> mutex()) |
Additional Inherited Members | |
Static Public Member Functions inherited from net_instaweb::AsyncFetch | |
static bool | IsGoogleCacheVia (StringPiece via_value) |
Static Public Attributes inherited from net_instaweb::AsyncFetch | |
static const int | kContentLengthUnknown = -1 |
Links an apache request_rec* to an AsyncFetch, adding the ability to block based on a condition variable.
If you need this to stream writes and flushes out to apache, call set_buffered(false) and make sure all calls are on the request thread. ApacheWriter will DCHECK-fail if it's called on another thread.
net_instaweb::ApacheFetch::ApacheFetch | ( | const GoogleString & | mapped_url, |
StringPiece | debug_info, | ||
RewriteDriver * | driver, | ||
ApacheWriter * | apache_writer, | ||
RequestHeaders * | request_headers, | ||
const RequestContextPtr & | request_context, | ||
const RewriteOptions * | options, | ||
MessageHandler * | handler | ||
) |
Takes ownership of apache_writer, but the underlying request_rec needs to stay around until Wait returns false or the caller finishes handling a true return and deletes the ApacheFetch. Also takes ownership of request_headers.
|
virtual |
Is the cache entry corresponding to headers valid? Default is that it is valid. Sub-classes can provide specific implementations, e.g., based on cache invalidation timestamp in domain specific options. Used by CacheUrlAsyncFetcher.
Reimplemented from net_instaweb::AsyncFetch.
|
inline |
If all calls to an ApacheFetch are on the apache request thread it is safe to set buffered to false. All calls Write()/Flush() will be passed through to the underlying writer immediately. Otherwise, leave it as true and they will be delayed until Wait().
|
inline |
When used for in-place resource optimization in mod_pagespeed, we have disabled fetching resources that are not in cache, otherwise we may wind up doing a loopback fetch to the same Apache server. So the CacheUrlAsyncFetcher will return a 501 or 404 but we do not want to send that to the client. So for ipro we suppress reporting errors in this flow.
|
inline |
By default ApacheFetch is not intended for proxying third party content. When it is to be used for proxying third party content, we must avoid sending a 'nosniff' header.