proxygen
HTTPMessage.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 #pragma once
11 
12 #include <array>
13 #include <boost/variant.hpp>
14 #include <folly/Conv.h>
15 #include <folly/Optional.h>
16 #include <folly/SocketAddress.h>
17 #include <folly/io/IOBufQueue.h>
18 #include <glog/logging.h>
19 #include <map>
20 #include <mutex>
26 #include <string>
27 
28 namespace proxygen {
29 
39 class HTTPMessage {
40  public:
41 
46  };
47 
48  HTTPMessage();
49  ~HTTPMessage();
52  HTTPMessage& operator=(const HTTPMessage& message);
53  HTTPMessage& operator=(HTTPMessage&& message);
54 
55  // upgradeWebsocket_ can have three states, WebSocketUpgrade::NONE by
56  // default. WebSocketUpgrade::INGRESS is used by the codec to indicate a
57  // websocket upgrade request was received from downstream or a successful
58  // upgrade finished on an upstream stream.
59  // WebSocketUpgrade::EGRESS is used by the application handler to indicate
60  // websocket upgrade headers should be sent with the outgoing
61  // request/response. Based on upstream/downstream, the codec serializes the
62  // appropriate headers.
64  upgradeWebsocket_ = WebSocketUpgrade::INGRESS;
65  }
67  upgradeWebsocket_ = WebSocketUpgrade::EGRESS;
68  }
70  return upgradeWebsocket_ == WebSocketUpgrade::INGRESS;
71  }
72  bool isEgressWebsocketUpgrade() const {
73  return upgradeWebsocket_ == WebSocketUpgrade::EGRESS;
74  }
75 
80  bool getIsChunked() const { return chunked_; }
81 
85  void setIsUpgraded(bool upgraded) { upgraded_ = upgraded; }
86  bool getIsUpgraded() const { return upgraded_; }
87 
92  std::string ipStr = empty_string,
93  std::string portStr = empty_string) {
95  if (ipStr.empty() || portStr.empty()) {
96  request().clientIP_ = addr.getAddressStr();
97  request().clientPort_ = folly::to<std::string>(addr.getPort());
98  } else {
99  request().clientIP_ = std::move(ipStr);
100  request().clientPort_ = std::move(portStr);
101  }
102  }
103 
105  return request().clientAddress_;
106  }
107 
108  const std::string& getClientIP() const {
109  return request().clientIP_;
110  }
111 
112  const std::string& getClientPort() const {
113  return request().clientPort_;
114  }
115 
120  std::string addressStr = empty_string,
121  std::string portStr = empty_string) {
122  dstAddress_ = addr;
123  if (addressStr.empty() || portStr.empty()) {
124  dstIP_ = addr.getAddressStr();
125  dstPort_ = folly::to<std::string>(addr.getPort());
126  } else {
127  dstIP_ = std::move(addressStr);
128  dstPort_ = std::move(portStr);
129  }
130  }
131 
133  return dstAddress_;
134  }
135 
136  const std::string& getDstIP() const {
137  return dstIP_;
138  }
139 
140  const std::string& getDstPort() const {
141  return dstPort_;
142  }
143 
147  template <typename T> // T = string
148  void setLocalIp(T&& ip) {
149  localIP_ = std::forward<T>(ip);
150  }
151  const std::string& getLocalIp() const {
152  return localIP_;
153  }
154 
158  void setMethod(HTTPMethod method);
159  void setMethod(folly::StringPiece method);
160  void rawSetMethod(const std::string& method) {
161  setMethod(method);
162  }
163 
170 
174  const std::string& getMethodString() const;
175 
182  template <typename T> // T = string
183  ParseURL setURL(T&& url) {
184  VLOG(9) << "setURL: " << url;
185 
186  // Set the URL, path, and query string parameters
187  ParseURL u(url);
188  if (u.valid()) {
189  VLOG(9) << "set path: " << u.path() << " query:" << u.query();
190  request().path_ = u.path().str();
191  request().query_ = u.query().str();
193  } else {
194  VLOG(4) << "Error in parsing URL: " << url;
195  }
196 
197  request().url_ = std::forward<T>(url);
198  return u;
199  }
200  // The template function above doesn't work with char*,
201  // so explicitly convert to a string first.
202  void setURL(const char* url) {
203  setURL(std::string(url));
204  }
205  const std::string& getURL() const {
206  return request().url_;
207  }
208  void rawSetURL(const std::string& url) {
209  setURL(url);
210  }
211 
215  const std::string& getPath() const {
216  return request().path_;
217  }
218 
222  const std::string& getQueryString() const {
223  return request().query_;
224  }
225 
229  static const std::pair<uint8_t, uint8_t> kHTTPVersion10;
230  static const std::pair<uint8_t, uint8_t> kHTTPVersion11;
231 
235  void setHTTPVersion(uint8_t major, uint8_t minor);
236  const std::pair<uint8_t, uint8_t>& getHTTPVersion() const;
237 
241  template <typename T> // T = string
242  void setStatusMessage(T&& msg) {
243  response().statusMsg_ = std::forward<T>(msg);
244  }
245  const std::string& getStatusMessage() const {
246  return response().statusMsg_;
247  }
249  setStatusMessage(msg);
250  }
251 
256  const std::string& getVersionString() const {
257  return versionStr_;
258  }
259  void setVersionString(const std::string& ver) {
260  if (ver.size() != 3 ||
261  ver[1] != '.' ||
262  !isdigit(ver[0]) ||
263  !isdigit(ver[2])) {
264  return;
265  }
266 
267  setHTTPVersion(ver[0] - '0', ver[2] - '0');
268  }
269 
274  const HTTPHeaders& getHeaders() const { return headers_; }
275 
280  return std::move(headers_);
281  }
282 
286  HTTPHeaders* getTrailers() { return trailers_.get(); }
287  const HTTPHeaders* getTrailers() const { return trailers_.get(); }
288 
292  void setTrailers(std::unique_ptr<HTTPHeaders>&& trailers) {
293  trailers_ = std::move(trailers);
294  }
295 
301  int processMaxForwards();
302 
306  bool isHTTP1_0() const;
307 
311  bool isHTTP1_1() const;
312 
316  bool is1xxResponse() const { return (getStatusCode() / 100) == 1; }
317 
321  bool is4xxResponse() const { return (getStatusCode() / 100) == 4; }
322 
326  bool is5xxResponse() const { return (getStatusCode() / 100) == 5; }
327 
331  static std::string formatDateHeader();
332 
337  void ensureHostHeader();
338 
343  void setWantsKeepalive(bool wantsKeepaliveVal) {
344  wantsKeepalive_ = wantsKeepaliveVal;
345  }
346  bool wantsKeepalive() const {
347  return wantsKeepalive_;
348  }
349 
354  bool trailersAllowed() const { return trailersAllowed_; }
358  void setTrailersAllowed(bool trailersAllowedVal) {
359  trailersAllowed_ = trailersAllowedVal;
360  }
361 
365  bool hasTrailers() const {
366  return trailersAllowed_ && trailers_ && trailers_->size() > 0;
367  }
368 
372  void setStatusCode(uint16_t status);
373  uint16_t getStatusCode() const;
374 
376  upgradeProtocol_ = std::make_unique<std::string>(std::move(protocol));
377  }
379  return upgradeProtocol_.get();
380  }
381 
385  void setPushStatusCode(const uint16_t status);
386  const std::string& getPushStatusStr() const;
387  uint16_t getPushStatusCode() const;
388 
399  void constructDirectResponse(const std::pair<uint8_t, uint8_t>& version,
400  const int statusCode,
401  const std::string& statusMsg,
402  int contentLength = 0);
403 
413  void constructDirectResponse(const std::pair<uint8_t, uint8_t>& version,
414  int contentLength = 0);
415 
419  bool hasQueryParam(const std::string& name) const;
420 
428  const std::string* getQueryParamPtr(const std::string& name) const;
429 
438  const std::string& getQueryParam(const std::string& name) const;
439 
445  int getIntQueryParam(const std::string& name) const;
446 
453  int getIntQueryParam(const std::string& name, int defval) const;
454 
461  std::string getDecodedQueryParam(const std::string& name) const;
462 
470  const std::map<std::string, std::string>& getQueryParams() const;
471 
477  bool setQueryString(const std::string& query);
478 
484  bool removeQueryParam(const std::string& name);
485 
491  bool setQueryParam(const std::string& name, const std::string& value);
492 
502  const folly::StringPiece getCookie(const std::string& name) const;
503 
507  void dumpMessage(int verbosity) const;
508 
509  void describe(std::ostream& os) const;
510 
515  void atomicDumpMessage(int verbosity) const;
516 
520  void dumpMessageToSink(google::LogSink* logSink) const;
521 
528  void stripPerHopHeaders();
529 
531  return strippedPerHopHeaders_;
532  }
533 
534  void setSecure(bool secure) { secure_ = secure; }
535  bool isSecure() const { return secure_; }
536  int getSecureVersion() const { return sslVersion_; }
537  const char* getSecureCipher() const { return sslCipher_; }
538  void setSecureInfo(int ver, const char* cipher) {
539  // cipher is a static const char* provided and managed by openssl lib
540  sslVersion_ = ver; sslCipher_ = cipher;
541  }
542  void setAdvancedProtocolString(const std::string& protocol) {
543  protoStr_ = &protocol;
544  }
545  bool isAdvancedProto() const {
546  return protoStr_ != nullptr;
547  }
549  return protoStr_;
550  }
551 
559  if (isAdvancedProto()) {
560  return *protoStr_;
561  }
562 
563  return versionStr_;
564  }
565 
566  /* Setter and getter for the SPDY priority value (0 - 7). When serialized
567  * to SPDY/2, Codecs will collpase 0,1 -> 0, 2,3 -> 1, etc.
568  *
569  * Negative values of pri are interpreted much like negative array
570  * indexes in python, so -1 will be the largest numerical priority
571  * value for this SPDY version (i.e. 3 for SPDY/2 or 7 for SPDY/3),
572  * -2 the second largest (i.e. 2 for SPDY/2 or 6 for SPDY/3).
573  */
574  const static int8_t kMaxPriority;
575 
577  if (pri > kMaxPriority || pri < -kMaxPriority) {
578  // outside [-7, 7] => highest priority
579  return kMaxPriority;
580  } else if (pri < 0) {
581  return pri + kMaxPriority + 1;
582  }
583  return pri;
584  }
585 
586  void setPriority(int8_t pri) {
587  pri_ = normalizePriority(pri);
589  }
590  uint8_t getPriority() const { return pri_; }
591 
592  using HTTPPriority = std::tuple<uint32_t, bool, uint8_t>;
593 
595  const {
596  return h2Pri_;
597  }
598 
600  h2Pri_ = h2Pri;
601  }
602 
606  void setSeqNo(int32_t seqNo) { seqNo_ = seqNo; }
607  int32_t getSeqNo() const { return seqNo_; }
608 
613  size_ = size;
614  }
616  return size_;
617  }
618 
622  TimePoint getStartTime() const { return startTime_; }
623  void setStartTime(const TimePoint& startTime) { startTime_ = startTime; }
624 
630  bool checkForHeaderToken(const HTTPHeaderCode headerCode,
631  char const* token,
632  bool caseSensitive) const;
633 
642  void unparseCookies() const;
643 
650  static const char* getDefaultReason(uint16_t status);
651 
656  bool computeKeepalive() const;
657 
661  bool isRequest() const {
662  return fields_.which() == 1;
663  }
664 
668  bool isResponse() const {
669  return fields_.which() == 2;
670  }
671 
677  static void splitNameValuePieces(
678  const std::string& input,
679  char pairDelim,
680  char valueDelim,
681  std::function<void(folly::StringPiece, folly::StringPiece)> callback);
682 
683  static void splitNameValue(
684  const std::string& input,
685  char pairDelim,
686  char valueDelim,
687  std::function<void(std::string&&, std::string&&)> callback);
688 
693  static std::string createUrl(const folly::StringPiece scheme,
694  const folly::StringPiece authority,
695  const folly::StringPiece path,
696  const folly::StringPiece query,
697  const folly::StringPiece fragment);
698 
704  const std::map<std::string, std::string>& params, uint32_t maxSize);
705 
706  protected:
707  // Message start time, in msec since the epoch.
710 
711  private:
712 
713  void parseCookies() const;
714 
715  void parseQueryParams() const;
716  void unparseQueryParams();
717 
719  const HTTPHeaderCode headerCode,
720  char const* token,
721  bool caseSensitive) const;
722 
727 
733  struct Request {
737  mutable boost::variant<boost::blank, std::string, HTTPMethod> method_;
741 
744  };
745 
746  struct Response {
750  };
751 
755 
758 
759  mutable boost::variant<boost::blank, Request, Response> fields_;
760 
762  DCHECK(fields_.which() == 0 || fields_.which() == 1) << fields_.which();
763  if (fields_.which() == 0) {
764  fields_ = Request();
765  }
766 
767  return boost::get<Request>(fields_);
768  }
769 
770  const Request& request() const {
771  DCHECK(fields_.which() == 0 || fields_.which() == 1) << fields_.which();
772  if (fields_.which() == 0) {
773  fields_ = Request();
774  }
775 
776  return boost::get<const Request>(fields_);
777  }
778 
780  DCHECK(fields_.which() == 0 || fields_.which() == 2) << fields_.which();
781  if (fields_.which() == 0) {
782  fields_ = Response();
783  }
784 
785  return boost::get<Response>(fields_);
786  }
787 
788  const Response& response() const {
789  DCHECK(fields_.which() == 0 || fields_.which() == 2) << fields_.which();
790  if (fields_.which() == 0) {
791  fields_ = Response();
792  }
793 
794  return boost::get<const Response>(fields_);
795  }
796 
797  /*
798  * Cookies and query parameters
799  * These are mutable since we parse them lazily in getCookie() and
800  * getQueryParam()
801  */
802  mutable std::map<folly::StringPiece, folly::StringPiece> cookies_;
803  // TODO: use StringPiece for queryParams_ and delete splitNameValue()
804  mutable std::map<std::string, std::string> queryParams_;
805 
806  std::pair<uint8_t, uint8_t> version_;
810  std::unique_ptr<HTTPHeaders> trailers_;
811 
813  const char* sslCipher_;
817 
818  mutable bool parsedCookies_:1;
819  mutable bool parsedQueryParams_:1;
820  bool chunked_:1;
821  bool upgraded_:1;
824 
825  // Whether the message is received in HTTPS.
826  bool secure_:1;
827 
828  // used by atomicDumpMessage
830 
832  std::unique_ptr<std::string> upgradeProtocol_;
833 };
834 
835 std::ostream& operator<<(std::ostream& os, const HTTPMessage& msg);
836 
841 template<typename Str>
842 std::string stripCntrlChars(const Str& str) {
843  std::string res;
844  res.reserve(str.length());
845  for (size_t i = 0; i < str.size(); ++i) {
846  if (!(str[i] <= 0x1F || str[i] == 0x7F)) {
847  res += str[i];
848  }
849  }
850  return res;
851 }
852 
853 } // proxygen
void setIngressHeaderSize(const HTTPHeaderSize &size)
Definition: HTTPMessage.h:612
static void splitNameValuePieces(const std::string &input, char pairDelim, char valueDelim, std::function< void(folly::StringPiece, folly::StringPiece)> callback)
int verbosity
Definition: upload.py:59
HTTPHeaders strippedPerHopHeaders_
Definition: HTTPMessage.h:808
folly::SocketAddress clientAddress_
Definition: HTTPMessage.h:734
#define T(v)
Definition: http_parser.c:233
Definition: test.c:42
std::unique_ptr< HTTPHeaders > trailers_
Definition: HTTPMessage.h:810
std::string stripCntrlChars(const Str &str)
Definition: HTTPMessage.h:842
const std::string & getLocalIp() const
Definition: HTTPMessage.h:151
spdy::GoawayStatusCode statusCode
Definition: SPDYCodec.cpp:110
folly::StringPiece query() const
Definition: ParseURL.h:72
void atomicDumpMessage(int verbosity) const
std::string str() const
Definition: Range.h:591
void setWantsKeepalive(bool wantsKeepaliveVal)
Definition: HTTPMessage.h:343
void setTrailers(std::unique_ptr< HTTPHeaders > &&trailers)
Definition: HTTPMessage.h:292
static const std::pair< uint8_t, uint8_t > kHTTPVersion10
Definition: HTTPMessage.h:229
const std::string & getPath() const
Definition: HTTPMessage.h:215
const Response & response() const
Definition: HTTPMessage.h:788
std::ostream & operator<<(std::ostream &os, const HeaderTable &table)
bool isHTTP1_1() const
const std::string * getUpgradeProtocol() const
Definition: HTTPMessage.h:378
std::unique_ptr< std::string > upgradeProtocol_
Definition: HTTPMessage.h:832
const std::string & getStatusMessage() const
Definition: HTTPMessage.h:245
static folly::StringPiece trim(folly::StringPiece sp)
static std::string createQueryString(const std::map< std::string, std::string > &params, uint32_t maxSize)
const HTTPHeaders & getHeaders() const
Definition: HTTPMessage.h:274
void setIngressWebsocketUpgrade()
Definition: HTTPMessage.h:63
void setStatusMessage(T &&msg)
Definition: HTTPMessage.h:242
const folly::SocketAddress & getDstAddress() const
Definition: HTTPMessage.h:132
uint16_t getStatusCode() const
const folly::SocketAddress & getClientAddress() const
Definition: HTTPMessage.h:104
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
const std::string * protoStr_
Definition: HTTPMessage.h:814
bool doHeaderTokenCheck(const HTTPHeaders &headers_, const HTTPHeaderCode headerCode, char const *token, bool caseSensitive) const
void setDstAddress(const folly::SocketAddress &addr, std::string addressStr=empty_string, std::string portStr=empty_string)
Definition: HTTPMessage.h:119
static std::string formatDateHeader()
bool is1xxResponse() const
Definition: HTTPMessage.h:316
void setVersionString(const std::string &ver)
Definition: HTTPMessage.h:259
uint16_t getPort() const
const HTTPHeaders * getTrailers() const
Definition: HTTPMessage.h:287
const HTTPHeaderSize & getIngressHeaderSize() const
Definition: HTTPMessage.h:615
uint8_t getPriority() const
Definition: HTTPMessage.h:590
boost::variant< boost::blank, std::string, HTTPMethod > method_
Definition: HTTPMessage.h:737
requires E e noexcept(noexcept(s.error(std::move(e))))
bool is5xxResponse() const
Definition: HTTPMessage.h:326
const HTTPHeaders & getStrippedPerHopHeaders() const
Definition: HTTPMessage.h:530
void setAdvancedProtocolString(const std::string &protocol)
Definition: HTTPMessage.h:542
static void splitNameValue(const std::string &input, char pairDelim, char valueDelim, std::function< void(std::string &&, std::string &&)> callback)
void setPushStatusCode(const uint16_t status)
CipherSuite cipher
void setLocalIp(T &&ip)
Definition: HTTPMessage.h:148
void constructDirectResponse(const std::pair< uint8_t, uint8_t > &version, const int statusCode, const std::string &statusMsg, int contentLength=0)
TimePoint getStartTime() const
Definition: HTTPMessage.h:622
int getSecureVersion() const
Definition: HTTPMessage.h:536
void dumpMessageToSink(google::LogSink *logSink) const
bool computeKeepalive() const
ProtocolVersion version
int32_t getSeqNo() const
Definition: HTTPMessage.h:607
const std::string & getQueryString() const
Definition: HTTPMessage.h:222
void setIsChunked(bool chunked)
Definition: HTTPMessage.h:79
const char * name
Definition: http_parser.c:437
const Request & request() const
Definition: HTTPMessage.h:770
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
const folly::StringPiece getCookie(const std::string &name) const
const std::string & getQueryParam(const std::string &name) const
void setSeqNo(int32_t seqNo)
Definition: HTTPMessage.h:606
bool checkForHeaderToken(const HTTPHeaderCode headerCode, char const *token, bool caseSensitive) const
constexpr Params params[]
bool trailersAllowed() const
Definition: HTTPMessage.h:354
void setSecure(bool secure)
Definition: HTTPMessage.h:534
ParseURL setURL(T &&url)
Definition: HTTPMessage.h:183
bool getIsChunked() const
Definition: HTTPMessage.h:80
void setHTTP2Priority(HTTPPriority h2Pri)
Definition: HTTPMessage.h:599
WebSocketUpgrade upgradeWebsocket_
Definition: HTTPMessage.h:831
folly::Optional< HTTPPriority > h2Pri_
Definition: HTTPMessage.h:816
void parseCookies() const
const char * sslCipher_
Definition: HTTPMessage.h:813
const std::string * getQueryParamPtr(const std::string &name) const
std::pair< uint8_t, uint8_t > version_
Definition: HTTPMessage.h:806
HTTPHeaders && extractHeaders()
Definition: HTTPMessage.h:279
std::map< folly::StringPiece, folly::StringPiece > cookies_
Definition: HTTPMessage.h:802
uint16_t getPushStatusCode() const
folly::StringPiece path() const
Definition: ParseURL.h:68
static const std::pair< uint8_t, uint8_t > kHTTPVersion11
Definition: HTTPMessage.h:230
const std::string & getClientIP() const
Definition: HTTPMessage.h:108
void rawSetMethod(const std::string &method)
Definition: HTTPMessage.h:160
void setStartTime(const TimePoint &startTime)
Definition: HTTPMessage.h:623
void setUpgradeProtocol(std::string protocol)
Definition: HTTPMessage.h:375
void setSecureInfo(int ver, const char *cipher)
Definition: HTTPMessage.h:538
folly::Optional< HTTPPriority > getHTTP2Priority() const
Definition: HTTPMessage.h:594
const std::string * getAdvancedProtocolString() const
Definition: HTTPMessage.h:548
const char * getSecureCipher() const
Definition: HTTPMessage.h:537
int getIntQueryParam(const std::string &name) const
std::string versionStr_
Definition: HTTPMessage.h:757
void setURL(const char *url)
Definition: HTTPMessage.h:202
static const char *const value
Definition: Conv.cpp:50
static const int8_t kMaxPriority
Definition: HTTPMessage.h:574
bool setQueryParam(const std::string &name, const std::string &value)
HTTPHeaders & getHeaders()
Definition: HTTPMessage.h:273
bool is4xxResponse() const
Definition: HTTPMessage.h:321
static std::string createUrl(const folly::StringPiece scheme, const folly::StringPiece authority, const folly::StringPiece path, const folly::StringPiece query, const folly::StringPiece fragment)
const std::string & getDstPort() const
Definition: HTTPMessage.h:140
void setIsUpgraded(bool upgraded)
Definition: HTTPMessage.h:85
std::string dstPort_
Definition: HTTPMessage.h:754
void setPriority(int8_t pri)
Definition: HTTPMessage.h:586
const std::string & getPushStatusStr() const
bool setQueryString(const std::string &query)
std::string localIP_
Definition: HTTPMessage.h:756
void setMethod(HTTPMethod method)
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
bool isResponse() const
Definition: HTTPMessage.h:668
bool valid() const
Definition: ParseURL.h:80
std::string getDecodedQueryParam(const std::string &name) const
std::tuple< uint32_t, bool, uint8_t > HTTPPriority
Definition: HTTPMessage.h:592
SteadyClock::time_point TimePoint
Definition: Time.h:25
void describe(std::ostream &os) const
const std::string empty_string
Definition: HTTPHeaders.cpp:23
std::mutex mutex
bool removeQueryParam(const std::string &name)
const char * string
Definition: Conv.cpp:212
folly::SocketAddress dstAddress_
Definition: HTTPMessage.h:752
bool hasQueryParam(const std::string &name) const
const std::string & getClientPort() const
Definition: HTTPMessage.h:112
HTTPHeaders * getTrailers()
Definition: HTTPMessage.h:286
void parseQueryParams() const
const
Definition: upload.py:398
const std::string & getMethodString() const
void setHTTPVersion(uint8_t major, uint8_t minor)
void setTrailersAllowed(bool trailersAllowedVal)
Definition: HTTPMessage.h:358
Response & response()
Definition: HTTPMessage.h:779
bool isHTTP1_0() const
void rawSetStatusMessage(std::string msg)
Definition: HTTPMessage.h:248
bool isSecure() const
Definition: HTTPMessage.h:535
std::map< std::string, std::string > queryParams_
Definition: HTTPMessage.h:804
bool isIngressWebsocketUpgrade() const
Definition: HTTPMessage.h:69
void rawSetURL(const std::string &url)
Definition: HTTPMessage.h:208
bool hasTrailers() const
Definition: HTTPMessage.h:365
bool isRequest() const
Definition: HTTPMessage.h:661
static const char * getDefaultReason(uint16_t status)
bool isAdvancedProto() const
Definition: HTTPMessage.h:545
folly::Optional< HTTPMethod > getMethod() const
void setEgressWebsocketUpgrade()
Definition: HTTPMessage.h:66
static uint8_t normalizePriority(int8_t pri)
Definition: HTTPMessage.h:576
const std::string & getProtocolString() const
Definition: HTTPMessage.h:558
const std::map< std::string, std::string > & getQueryParams() const
const std::string & getURL() const
Definition: HTTPMessage.h:205
static std::mutex mutexDump_
Definition: HTTPMessage.h:829
ThreadPoolListHook * addr
void dumpMessage(int verbosity) const
bool getIsUpgraded() const
Definition: HTTPMessage.h:86
const std::string & getVersionString() const
Definition: HTTPMessage.h:256
Chunked chunked(const Container &container, int chunkSize=256)
Definition: Parallel.h:49
void unparseCookies() const
HTTPHeaders headers_
Definition: HTTPMessage.h:807
void setClientAddress(const folly::SocketAddress &addr, std::string ipStr=empty_string, std::string portStr=empty_string)
Definition: HTTPMessage.h:91
bool isEgressWebsocketUpgrade() const
Definition: HTTPMessage.h:72
HTTPHeaderSize size_
Definition: HTTPMessage.h:809
constexpr None none
Definition: Optional.h:87
const std::string & getDstIP() const
Definition: HTTPMessage.h:136
std::string getAddressStr() const
bool wantsKeepalive() const
Definition: HTTPMessage.h:346
const std::pair< uint8_t, uint8_t > & getHTTPVersion() const
void setStatusCode(uint16_t status)