Page Speed Optimization Libraries
1.13.35.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 |
Static Public Attributes | |
static const int64 | kUnspecifiedTimeout |
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.
|
inlineprotected |
Put this in protected to make sure nobody constructs this class except for subclasses.
AsyncFetch* net_instaweb::UrlAsyncFetcher::EnableInflation | ( | AsyncFetch * | fetch | ) | const |
Returns a new InflatingFetch to handle auto-inflating the response if needed.
|
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::HttpDumpUrlFetcher, net_instaweb::MockUrlFetcher, net_instaweb::SimulatedDelayFetcher, net_instaweb::UrlAsyncFetcherStats, net_instaweb::ProxyInterface, net_instaweb::HttpDumpUrlAsyncWriter, net_instaweb::RateControllingUrlAsyncFetcher, net_instaweb::LoopbackRouteFetcher, net_instaweb::CountingUrlAsyncFetcher, net_instaweb::WaitUrlAsyncFetcher, net_instaweb::ExternalUrlFetcher, net_instaweb::ReflectingTestFetcher, net_instaweb::AddHeadersFetcher, and net_instaweb::UserAgentSensitiveTestFetcher.
|
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 |
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.
|
inlinevirtual |
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.
|
inlinevirtual |
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.