Page Speed Optimization Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
net_instaweb::SerfFetch Class Reference

#include "serf_url_async_fetcher.h"

Inheritance diagram for net_instaweb::SerfFetch:
net_instaweb::PoolElement< SerfFetch >

Public Types

enum  CancelCause { kClientDecision, kSerfError, kFetchTimeout }
- Public Types inherited from net_instaweb::PoolElement< SerfFetch >
typedef std::list< SerfFetch * >

Public Member Functions

 SerfFetch (const GoogleString &url, AsyncFetch *async_fetch, MessageHandler *message_handler, Timer *timer)
bool Start (SerfUrlAsyncFetcher *fetcher, serf_context_t *context)
GoogleString DebugInfo ()
void Cancel (CancelCause cause)
 This must be called while holding SerfUrlAsyncFetcher's mutex_.
void CallCallback (SerfCompletionResult result)
void CallbackDone (SerfCompletionResult result)
void CleanupIfError ()
void ParseUrlForTesting (bool *status, apr_uri_t **url, const char **host_header, const char **sni_host)
void SetFetcherForTesting (SerfUrlAsyncFetcher *fetcher)
int64 TimeDuration () const
int64 fetch_start_ms () const
size_t bytes_received () const
MessageHandlermessage_handler ()
- Public Member Functions inherited from net_instaweb::PoolElement< SerfFetch >
Position * pool_position ()

Detailed Description

TODO(lsong): Move this to a separate file. Necessary?

Constructor & Destructor Documentation

net_instaweb::SerfFetch::SerfFetch ( const GoogleString url,
AsyncFetch async_fetch,
MessageHandler message_handler,
Timer timer 
TODO(lsong): make use of request_headers.

Member Function Documentation

void net_instaweb::SerfFetch::CallCallback ( SerfCompletionResult  result)

Calls the callback supplied by the user. This needs to happen exactly once. In some error cases it appears that Serf calls HandleResponse multiple times on the same object.

This must be called while holding SerfUrlAsyncFetcher's mutex_.

Note that when there are SSL error messages, we immediately call CallCallback, which is robust against duplicate calls in that case.

void net_instaweb::SerfFetch::CleanupIfError ( )

If last poll of this fetch's connection resulted in an error, clean it up. Must be called after serf_context_run, with fetcher's mutex_ held.

void net_instaweb::SerfFetch::ParseUrlForTesting ( bool *  status,
apr_uri_t **  url,
const char **  host_header,
const char **  sni_host 

For use only by unit tests. Calls ParseUrl(), then makes things available for checking.

bool net_instaweb::SerfFetch::Start ( SerfUrlAsyncFetcher fetcher,
serf_context_t *  context 

Start the fetch. It returns immediately. This can only be run when locked with fetcher->mutex_.

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