Classes | |
class | Callback |
Public Member Functions | |
virtual bool | SupportsHttps () const |
virtual bool | StreamingFetch (const GoogleString &url, const RequestHeaders &request_headers, ResponseHeaders *response_headers, Writer *response_writer, MessageHandler *message_handler, Callback *callback) |
virtual bool | Fetch (const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch) |
virtual bool | ConditionalFetch (const GoogleString &url, int64 if_modified_since_ms, const RequestHeaders &request_headers, ResponseHeaders *response_headers, Writer *response_writer, MessageHandler *message_handler, Callback *callback) |
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 |
static const char | kStatisticsGroup [] |
Default statistics group name. | |
Protected Member Functions | |
UrlAsyncFetcher () |
net_instaweb::UrlAsyncFetcher::UrlAsyncFetcher | ( | ) | [inline, protected] |
Put this in protected to make sure nobody constructs this class except for subclasses.
virtual bool net_instaweb::UrlAsyncFetcher::ConditionalFetch | ( | const GoogleString & | url, | |
int64 | if_modified_since_ms, | |||
const RequestHeaders & | request_headers, | |||
ResponseHeaders * | response_headers, | |||
Writer * | response_writer, | |||
MessageHandler * | message_handler, | |||
Callback * | callback | |||
) | [virtual] |
AsyncFetch* net_instaweb::UrlAsyncFetcher::EnableInflation | ( | AsyncFetch * | fetch | ) | const |
Returns a new InflatingFetch to handle auto-inflating the response if needed.
virtual bool net_instaweb::UrlAsyncFetcher::Fetch | ( | const GoogleString & | url, | |
MessageHandler * | message_handler, | |||
AsyncFetch * | fetch | |||
) | [virtual] |
Fetch with AsyncFetch interface.
Default implementation uses StreamingFetch method and calls HeadersComplete right before the first call to Write, Flush or Done.
Future implementations ought to call HeadersComplete directly.
Return value is the same as StreamingFetch. (Returns true iff callback has already been called by the time Fetch returns.)
Reimplemented in net_instaweb::SerfUrlAsyncFetcher, net_instaweb::ProxyInterface, net_instaweb::CacheUrlAsyncFetcher, and net_instaweb::RateControllingUrlAsyncFetcher.
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.
virtual bool net_instaweb::UrlAsyncFetcher::StreamingFetch | ( | const GoogleString & | url, | |
const RequestHeaders & | request_headers, | |||
ResponseHeaders * | response_headers, | |||
Writer * | response_writer, | |||
MessageHandler * | message_handler, | |||
Callback * | callback | |||
) | [virtual] |
Fetch a URL, set response_headers and stream the output to response_writer. response_headers and response_writer must be valid until callback->Done().
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).
This function returns true if the request was immediately satisfied. In either case, the callback will be called with the completion status, so it's safe to ignore the return value.
Default implementation uses Fetch. So derivative classes only need to define one of these functions.
Reimplemented in net_instaweb::CountingUrlAsyncFetcher, net_instaweb::FakeUrlAsyncFetcher, net_instaweb::FetcherTest::MockAsyncFetcher, net_instaweb::HttpDumpUrlAsyncWriter, and net_instaweb::WaitUrlAsyncFetcher.
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::CountingUrlAsyncFetcher, net_instaweb::FakeUrlAsyncFetcher, net_instaweb::HttpDumpUrlAsyncWriter, and net_instaweb::RateControllingUrlAsyncFetcher.
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.