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

#include "instaweb_handler.h"

Inheritance diagram for net_instaweb::ApacheFetch:
net_instaweb::AsyncFetchUsingWriter net_instaweb::AsyncFetch

Public Member Functions

 ApacheFetch (const GoogleString &mapped_url, ServerContext *server_context, request_rec *request, const RequestContextPtr &request_context, const RewriteOptions *options)
 
void set_handle_error (bool x)
 
virtual void HandleHeadersComplete ()
 
virtual void HandleDone (bool success)
 
void Wait ()
 
bool status_ok () const
 
virtual bool IsCachedResultValid (const ResponseHeaders &headers)
 
void set_is_proxy (bool x)
 
- Public Member Functions inherited from net_instaweb::AsyncFetchUsingWriter
 AsyncFetchUsingWriter (const RequestContextPtr &request_context, Writer *writer)
 
- Public Member Functions inherited from net_instaweb::AsyncFetch
 AsyncFetch (const RequestContextPtr &request_ctx)
 
void HeadersComplete ()
 
void Done (bool success)
 
virtual bool Write (const StringPiece &content, MessageHandler *handler)
 
virtual bool Flush (MessageHandler *handler)
 
RequestHeaders * request_headers ()
 
void set_request_headers (RequestHeaders *headers)
 
void SetRequestHeadersTakingOwnership (RequestHeaders *headers)
 Same as above, but takes ownership.
 
const RequestHeaders * request_headers () const
 
ResponseHeaders * response_headers ()
 See doc for request_headers and set_request_headers.
 
void set_response_headers (ResponseHeaders *headers)
 
ResponseHeaders * extra_response_headers ()
 
void set_extra_response_headers (ResponseHeaders *headers)
 
virtual bool IsBackgroundFetch () const
 
virtual void Reset ()
 
bool headers_complete () const
 
bool content_length_known () const
 
int64 content_length () const
 
void set_content_length (int64 x)
 
GoogleString LoggingString ()
 
virtual const RequestContextPtr & request_context ()
 
virtual AbstractLogRecord * log_record ()
 

Additional Inherited Members

- Static Public Attributes inherited from net_instaweb::AsyncFetch
static const int kContentLengthUnknown = -1
 
- Protected Member Functions inherited from net_instaweb::AsyncFetchUsingWriter
virtual bool HandleWrite (const StringPiece &sp, MessageHandler *handler)
 
virtual bool HandleFlush (MessageHandler *handler)
 

Detailed Description

Links an apache request_rec* to an AsyncFetch, adding the ability to block based on a condition variable.

Member Function Documentation

virtual bool net_instaweb::ApacheFetch::IsCachedResultValid ( const ResponseHeaders &  headers)
virtual

Is the cache entry corresponding to headers valid? Default is that it is valid. Sub-classes can provide specific implementations, e.g., based on cache invalidation timestamp in domain specific options. Used by CacheUrlAsyncFetcher.

Todo:
TODO(nikhilmadan): Consider making this virtual so that subclass authors are forced to look at this function.

Reimplemented from net_instaweb::AsyncFetch.

void net_instaweb::ApacheFetch::set_handle_error ( bool  x)
inline

When used for in-place resource optimization in mod_pagespeed, we have disabled fetching resources that are not in cache, otherwise we may wind up doing a loopback fetch to the same Apache server. So the CacheUrlAsyncFetcher will return a 501 or 404 but we do not want to send that to the client. So for ipro we suppress resporting errors in this flow.

Todo:
TODO(jmarantz): consider allowing serf fetches in ipro when running as a reverse-proxy.
void net_instaweb::ApacheFetch::set_is_proxy ( bool  x)
inline

By default ApacheFetch is not intended for proxying third party content. When it is to be used for proxying third party content, we must avoid sending a 'nosniff' header.

void net_instaweb::ApacheFetch::Wait ( )

Blocks indefinitely waiting for the proxy fetch to complete. Every 'blocking_fetch_timeout_ms', log a message so that if we get stuck there's noise in the logs, but we don't expect this to happen because underlying fetch/cache timeouts should fire.

Note that enforcing a timeout in this function makes debugging difficult.


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