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

#include "http_value.h"

Inheritance diagram for net_instaweb::HTTPValue:

Public Member Functions

void Clear ()
 Clears the value (both headers and content)
bool Empty () const
 Is this HTTPValue empty.
void SetHeaders (ResponseHeaders *headers)
virtual bool Write (const StringPiece &str, MessageHandler *handler)
virtual bool Flush (MessageHandler *handler)
bool ExtractHeaders (ResponseHeaders *headers, MessageHandler *handler) const
 Retrieves the headers, returning false if empty.
bool ExtractContents (StringPiece *str) const
bool unique () const
 Tests whether this reference is the only active one to the string object.
bool Link (const SharedString &src, ResponseHeaders *headers, MessageHandler *handler)
void Link (HTTPValue *src)
const SharedStringshare () const
 Access the shared string, for insertion into a cache via Put.
size_t size () const
int64 contents_size ()
- Public Member Functions inherited from net_instaweb::Writer
virtual bool Dump (Writer *writer, MessageHandler *message_handler)

Static Public Member Functions

static bool Decode (StringPiece encoded_value, GoogleString *http_string, MessageHandler *handler)
static bool Encode (StringPiece http_string, GoogleString *encoded_value, MessageHandler *handler)
 Convert from raw HTTP stream to HTTPValue format.


class HTTPValueTest

Detailed Description

Provides shared, ref-counted, copy-on-write storage for HTTP contents, to aid sharing between active fetches and filters, and the cache, which from which data may be evicted at any time.

Member Function Documentation

static bool net_instaweb::HTTPValue::Decode ( StringPiece  encoded_value,
GoogleString http_string,
MessageHandler handler 

Useful functions for debugging. See http_value_explorer. Convert from HTTPValue format to raw HTTP stream.

bool net_instaweb::HTTPValue::ExtractContents ( StringPiece *  str) const

Retrieves the contents, returning false if empty. Note that the contents are only guaranteed valid as long as the HTTPValue object is in scope.

bool net_instaweb::HTTPValue::Link ( const SharedString src,
ResponseHeaders headers,
MessageHandler handler 

Assigns the storage of an HTTPValue based on the provided storage. This can be used for a cache Get. Returns false if the string is not well-formed.

Extracts the headers into the provided ResponseHeaders buffer.

void net_instaweb::HTTPValue::Link ( HTTPValue src)

Links two HTTPValues together, using the contents of 'src' and discarding the contents of this.

< SharedString links via assignment.

void net_instaweb::HTTPValue::SetHeaders ( ResponseHeaders headers)

Sets the HTTP headers for this value. This method may only be called once and must be called before or after all of the contents are set (using the streaming interface Write).

If Clear() is called, then SetHeaders() can be called once again.

Does NOT take ownership of headers. A non-const pointer is required for the response headers so that the cache fields can be updated if necessary.

virtual bool net_instaweb::HTTPValue::Write ( const StringPiece &  str,
MessageHandler handler 

Writes contents into the HTTPValue object. Write can be called multiple times to append more data, and can be called before or after SetHeaders. However, SetHeaders cannot be interleaved in between calls to Write.

Implements net_instaweb::Writer.

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