Page Speed Optimization Libraries
1.3.25.1
|
#include "http_value.h"
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 (SharedString *src, ResponseHeaders *headers, MessageHandler *handler) |
void | Link (HTTPValue *src) |
SharedString * | share () |
Access the shared string, for insertion into a cache via Put. | |
size_t | size () const |
int64 | contents_size () |
Friends | |
class | HTTPValueTest |
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.
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 | ( | 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 | ) | [inline] |
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 | ||
) | [virtual] |
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.