Page Speed Optimization Libraries
1.7.30.4
|
#include "inflating_fetch.h"
Public Member Functions | |
InflatingFetch (AsyncFetch *fetch) | |
void | EnableGzipFromBackend () |
Protected Member Functions | |
virtual bool | HandleWrite (const StringPiece &sp, MessageHandler *handler) |
virtual void | HandleHeadersComplete () |
virtual void | HandleDone (bool success) |
virtual void | Reset () |
This Fetch layer helps work with origin servers that serve gzipped content even when request-headers do not include accept-encoding:gzip. In that scenario, this class inflates the content and strips the content-encoding:gzip response header.
Some servers will serve gzipped content even to clients that didn't ask for it. Depending on the serving environment, we may also want to ask backend servers for gzipped content even if we want cleartext to be sent to the Write methods. Users of this class can force this by calling EnableGzipFromBackend.
Adds accept-encoding:gzip to the request headers sent to the origin. The data is inflated as we Write it. If deflate or gzip was already in the request then this has no effect.
virtual void net_instaweb::InflatingFetch::HandleHeadersComplete | ( | ) | [protected, virtual] |
Analyzes headers and depending on the request settings and flags will either setup inflater or not.
Reimplemented from net_instaweb::SharedAsyncFetch.
virtual bool net_instaweb::InflatingFetch::HandleWrite | ( | const StringPiece & | sp, |
MessageHandler * | handler | ||
) | [protected, virtual] |
If inflation is required, inflates and passes bytes to the linked fetch, otherwise just passes bytes.
Reimplemented from net_instaweb::SharedAsyncFetch.
virtual void net_instaweb::InflatingFetch::Reset | ( | ) | [protected, virtual] |
Resets the 'headers_complete_' flag.
Reimplemented from net_instaweb::AsyncFetch.