Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
request_headers.h
Go to the documentation of this file.
1 // Copyright 2011 Google Inc.
14 
16 
17 #ifndef PAGESPEED_KERNEL_HTTP_REQUEST_HEADERS_H_
18 #define PAGESPEED_KERNEL_HTTP_REQUEST_HEADERS_H_
19 
24 
25 namespace net_instaweb {
26 
27 class HttpRequestHeaders;
28 class MessageHandler;
29 class Writer;
30 
32 class RequestHeaders : public Headers<HttpRequestHeaders> {
33  public:
34  enum Method { kOptions, kGet, kHead, kPost, kPut, kDelete, kTrace, kConnect,
35  kPatch, kPurge, kError };
36 
43  struct Properties {
45  : has_cookie(true),
46  has_cookie2(true),
47  has_authorization(false) {
48  }
50  Properties(bool cookie, bool cookie2, bool authorization)
51  : has_cookie(cookie),
52  has_cookie2(cookie2),
53  has_authorization(authorization) {
54  }
55  bool has_cookie;
56  bool has_cookie2;
57  bool has_authorization;
58  };
59 
60  RequestHeaders();
61 
62  virtual void Clear();
63  void CopyFromProto(const HttpRequestHeaders& p);
64  void CopyFrom(const RequestHeaders& other);
65 
66  GoogleString ToString() const;
67  Method method() const;
68  const char* method_string() const;
69  void set_method(Method method);
70 
76  const GoogleString& message_body() const;
77  void set_message_body(const GoogleString& data);
78 
80  bool WriteAsHttp(const StringPiece& url, Writer* writer,
81  MessageHandler* handler) const;
82 
84  bool AcceptsGzip() const;
85 
89  bool IsXmlHttpRequest() const;
90 
95 
96  Properties GetProperties() const;
97 
104  const CookieMultimap& GetAllCookies() const;
105 
107  bool HasCookie(StringPiece cookie_name) const;
108 
111  bool HasCookieValue(StringPiece cookie_name, StringPiece cookie_value) const;
112 
113  private:
114 
115 };
116 
117 }
118 
119 #endif
bool HasCookie(StringPiece cookie_name) const
Determines whether the specified Cookie is present in the request.
const GoogleString & message_body() const
Read/write API for HTTP request (RequestHeaders is a misnomer).
Definition: request_headers.h:32
Definition: request_headers.h:43
void PopulateLazyCaches()
Definition: request_headers.h:94
bool HasCookieValue(StringPiece cookie_name, StringPiece cookie_value) const
void PopulateMap() const
const is a lie, mutates map_.
bool AcceptsGzip() const
Determines whether a request header accepts gzipped content.
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
virtual bool WriteAsHttp(Writer *writer, MessageHandler *handler) const
Serialize HTTP headers in HTTP format so it can be re-parsed.
Read/write API for HTTP headers (shared base class)
Definition: headers.h:37
const CookieMultimap & GetAllCookies() const
Properties()
The default constructor assumes all.
Definition: request_headers.h:44