Page Speed Optimization Libraries  1.4.26.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
net_instaweb::FakeUrlAsyncFetcher Class Reference

#include "fake_url_async_fetcher.h"

Inheritance diagram for net_instaweb::FakeUrlAsyncFetcher:
net_instaweb::UrlPollableAsyncFetcher net_instaweb::UrlAsyncFetcher

List of all members.

Public Member Functions

 FakeUrlAsyncFetcher (UrlFetcher *url_fetcher)
virtual bool SupportsHttps () const
virtual void Fetch (const GoogleString &url, MessageHandler *message_handler, AsyncFetch *fetch)
virtual int Poll (int64 max_wait_ms)
void set_fetcher_supports_https (bool val)

Detailed Description

Constructs an async fetcher using a synchronous fetcher, blocking on a fetch and then the 'done' callback directly. It's also possible to construct a real async interface using a synchronous fetcher in a thread, but this does not do that: it blocks.

This is intended for functional regression tests only.


Member Function Documentation

virtual void net_instaweb::FakeUrlAsyncFetcher::Fetch ( const GoogleString url,
MessageHandler message_handler,
AsyncFetch fetch 
) [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:

TODO(sligocki): GoogleString -> GoogleUrl or at least StringPiece.

TODO(sligocki): Include the URL in the fetch, like the request headers.

Implements net_instaweb::UrlAsyncFetcher.

virtual int net_instaweb::FakeUrlAsyncFetcher::Poll ( int64  max_wait_ms) [inline, virtual]

Since the underlying fetcher is blocking, there can never be any outstanding fetches.

Implements net_instaweb::UrlPollableAsyncFetcher.

virtual bool net_instaweb::FakeUrlAsyncFetcher::SupportsHttps ( ) const [inline, virtual]

Determine if the fetcher supports fetching using HTTPS. By default we assume a fetcher can.

Reimplemented from net_instaweb::UrlAsyncFetcher.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines