Page Speed Optimization Libraries  1.12.34.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
net_instaweb::ProxyFetch Class Reference

#include "proxy_fetch.h"

Inheritance diagram for net_instaweb::ProxyFetch:
net_instaweb::SharedAsyncFetch net_instaweb::AsyncFetch net_instaweb::Writer

Public Member Functions

void set_trusted_input (bool trusted_input)
 
- Public Member Functions inherited from net_instaweb::SharedAsyncFetch
 SharedAsyncFetch (AsyncFetch *base_fetch)
 
virtual const RequestContextPtrrequest_context ()
 
- 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)
 
RequestHeadersrequest_headers ()
 
void set_request_headers (RequestHeaders *headers)
 
void SetRequestHeadersTakingOwnership (RequestHeaders *headers)
 Same as above, but takes ownership.
 
const RequestHeadersrequest_headers () const
 
ResponseHeadersresponse_headers ()
 See doc for request_headers and set_request_headers.
 
void set_response_headers (ResponseHeaders *headers)
 
ResponseHeadersextra_response_headers ()
 
void set_extra_response_headers (ResponseHeaders *headers)
 
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 AbstractLogRecordlog_record ()
 
void FixCacheControlForGoogleCache ()
 
- Public Member Functions inherited from net_instaweb::Writer
virtual bool Dump (Writer *writer, MessageHandler *message_handler)
 

Static Public Attributes

static const char kCollectorConnectProxyFetchFinish []
 
static const char kCollectorDetachFinish []
 
static const char kCollectorDoneFinish []
 
static const char kCollectorFinish []
 
static const char kCollectorDetachStart []
 
static const char kCollectorRequestHeadersCompleteFinish []
 
static const char kHeadersSetupRaceAlarmQueued []
 
static const char kHeadersSetupRaceDone []
 
static const char kHeadersSetupRaceFlush []
 
static const char kHeadersSetupRacePrefix []
 
static const char kHeadersSetupRaceWait []
 
static const int kTestSignalTimeoutMs = 200
 
- Static Public Attributes inherited from net_instaweb::AsyncFetch
static const int kContentLengthUnknown = -1
 

Protected Member Functions

virtual void HandleHeadersComplete ()
 protected interface from AsyncFetch.
 
virtual bool HandleWrite (const StringPiece &content, MessageHandler *handler)
 
virtual bool HandleFlush (MessageHandler *handler)
 
virtual void HandleDone (bool success)
 
virtual bool IsCachedResultValid (const ResponseHeaders &headers)
 
- Protected Member Functions inherited from net_instaweb::SharedAsyncFetch
virtual bool IsBackgroundFetch () const
 
void PropagateContentLength ()
 Propagates any set_content_length from this to the base fetch.
 

Friends

class ProxyFetchFactory
 
class ProxyFetchPropertyCallbackCollector
 
class MockProxyFetch
 

Additional Inherited Members

- Static Public Member Functions inherited from net_instaweb::AsyncFetch
static bool IsGoogleCacheVia (StringPiece via_value)
 

Detailed Description

Manages a single fetch of an HTML or resource file from the original server. If it is an HTML file, it is rewritten. Fetch is initialized by calling ProxyFetchFactory::StartNewProxyFetch(). For fetching pagespeed rewritten resources, use ResourceFetch. This is only meant to be used by ProxyInterface.

Takes ownership of custom_options.

The ProxyFetch passes through non-HTML directly to base_writer.

For HTML, the sequence is this:

  1. HeadersComplete is called, allowing us to establish we've got HTML.
  2. Some number of calls to Write occur.
  3. Optional: Flush is called, followed by more Writes. Repeat.
  4. Done is called. These virtual methods are called from some arbitrary thread, e.g. a dedicated fetcher thread. We use a QueuedWorkerPool::Sequence to offload them to a worker-thread. This implementation bundles together multiple Writes, and depending on the timing, may move Flushes to follow Writes and collapse multiple Flushes into one.

Member Function Documentation

virtual bool net_instaweb::ProxyFetch::IsCachedResultValid ( const ResponseHeaders headers)
protectedvirtual

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.

Todo:
TODO(nikhilmadan): Consider making this virtual so that subclass authors are forced to look at this function.

Reimplemented from net_instaweb::SharedAsyncFetch.

Member Data Documentation

const char net_instaweb::ProxyFetch::kCollectorConnectProxyFetchFinish[]
static

These strings identify sync-points for reproducing races between PropertyCache lookup completion and Origin HTML Fetch completion.

const char net_instaweb::ProxyFetch::kHeadersSetupRaceAlarmQueued[]
static

These strings identify sync-points for introducing races between PropertyCache lookup completion and HeadersComplete.

const int net_instaweb::ProxyFetch::kTestSignalTimeoutMs = 200
static

Number of milliseconds to wait, in a test, for an event that we are hoping does not occur, specifically an inappropriate call to base_fetch()->HeadersComplete() while we are still mutating response headers in SetupForHtml.

This is used only for testing.


The documentation for this class was generated from the following file: