Page Speed Optimization Libraries
1.7.30.1
|
#include "url_async_fetcher.h"
Public Member Functions | |
virtual void | Fetch (const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch)=0 |
virtual bool | SupportsHttps () const |
virtual int64 | timeout_ms () |
virtual void | ShutDown () |
void | set_fetch_with_gzip (bool x) |
bool | fetch_with_gzip () const |
AsyncFetch * | EnableInflation (AsyncFetch *fetch, const std::set< const ContentType * > *inflation_content_type_blacklist) const |
Static Public Attributes | |
static const int64 | kUnspecifiedTimeout |
static const char | kStatisticsGroup [] |
Default statistics group name. | |
Protected Member Functions | |
UrlAsyncFetcher () |
UrlAsyncFetcher is an interface for asynchronously fetching URLs. The results of a fetch are asynchronously passed back to the callbacks in the supplied AsyncFetch object.
net_instaweb::UrlAsyncFetcher::UrlAsyncFetcher | ( | ) | [inline, protected] |
Put this in protected to make sure nobody constructs this class except for subclasses.
AsyncFetch* net_instaweb::UrlAsyncFetcher::EnableInflation | ( | AsyncFetch * | fetch, |
const std::set< const ContentType * > * | inflation_content_type_blacklist | ||
) | const |
Returns a new InflatingFetch to handle auto-inflating the response if needed. Use inflation_content_type_blacklist cautiously, it may cause resources to be corrupted if you use it with anything other than the IPRO path.
virtual void net_instaweb::UrlAsyncFetcher::Fetch | ( | const GoogleString & | url, |
MessageHandler * | message_handler, | ||
AsyncFetch * | fetch | ||
) | [pure virtual] |
Asynchronously fetch a URL, set the response headers and stream the contents to fetch and call fetch->Done() when the fetch finishes.
There is an unchecked contract that response_headers are set before the response_writer or callback are used. Caution, several implementations do not satisfy this contract (but should).
TODO(sligocki): GoogleString -> GoogleUrl or at least StringPiece.
TODO(sligocki): Include the URL in the fetch, like the request headers.
Implemented in net_instaweb::BackgroundFetchCheckingUrlAsyncFetcher, net_instaweb::SerfUrlAsyncFetcher, net_instaweb::CacheUrlAsyncFetcher, net_instaweb::MockUrlFetcher, net_instaweb::HttpDumpUrlFetcher, net_instaweb::UrlAsyncFetcherStats, net_instaweb::ProxyInterface, net_instaweb::ModSpdyFetcher, net_instaweb::HttpDumpUrlAsyncWriter, net_instaweb::RateControllingUrlAsyncFetcher, net_instaweb::LoopbackRouteFetcher, net_instaweb::CountingUrlAsyncFetcher, net_instaweb::WaitUrlAsyncFetcher, net_instaweb::ExternalUrlFetcher, net_instaweb::ReflectingTestFetcher, net_instaweb::AddHeadersFetcher, net_instaweb::UserAgentSensitiveTestFetcher, and net_instaweb::TestDistributedFetcher.
void net_instaweb::UrlAsyncFetcher::set_fetch_with_gzip | ( | bool | x | ) | [inline] |
Always requests content from servers using gzip. If the request headers do not accept that encoding, then it will be decompressed while streaming.
virtual void net_instaweb::UrlAsyncFetcher::ShutDown | ( | ) | [virtual] |
Stops all active fetches and prevents further fetches from starting, calling back to ->Done(false).
Base-class implementation is empty for forward compatibility.
Reimplemented in net_instaweb::SerfUrlAsyncFetcher, net_instaweb::UrlAsyncFetcherStats, and net_instaweb::RateControllingUrlAsyncFetcher.
virtual bool net_instaweb::UrlAsyncFetcher::SupportsHttps | ( | ) | const [inline, virtual] |
Determine if the fetcher supports fetching using HTTPS. By default we assume a fetcher can.
Reimplemented in net_instaweb::SerfUrlAsyncFetcher, net_instaweb::CacheUrlAsyncFetcher, net_instaweb::MockUrlFetcher, net_instaweb::UrlAsyncFetcherStats, net_instaweb::HttpDumpUrlAsyncWriter, net_instaweb::RateControllingUrlAsyncFetcher, net_instaweb::LoopbackRouteFetcher, net_instaweb::CountingUrlAsyncFetcher, net_instaweb::UserAgentSensitiveTestFetcher, and net_instaweb::AddHeadersFetcher.
virtual int64 net_instaweb::UrlAsyncFetcher::timeout_ms | ( | ) | [inline, virtual] |
Returns a maximum time that we will allow fetches to take, or kUnspecifiedTimeout (the default) if we don't promise to timeout fetches.
Reimplemented in net_instaweb::SerfUrlAsyncFetcher, and net_instaweb::UrlAsyncFetcherStats.