proxygen
proxygen::HTTPMessage Class Reference

#include <HTTPMessage.h>

Classes

struct  Request
 
struct  Response
 

Public Types

enum  WebSocketUpgrade { NONE, INGRESS, EGRESS }
 
using HTTPPriority = std::tuple< uint32_t, bool, uint8_t >
 

Public Member Functions

 HTTPMessage ()
 
 ~HTTPMessage ()
 
 HTTPMessage (HTTPMessage &&message) noexcept
 
 HTTPMessage (const HTTPMessage &message)
 
HTTPMessageoperator= (const HTTPMessage &message)
 
HTTPMessageoperator= (HTTPMessage &&message)
 
void setIngressWebsocketUpgrade ()
 
void setEgressWebsocketUpgrade ()
 
bool isIngressWebsocketUpgrade () const
 
bool isEgressWebsocketUpgrade () const
 
void setIsChunked (bool chunked)
 
bool getIsChunked () const
 
void setIsUpgraded (bool upgraded)
 
bool getIsUpgraded () const
 
void setClientAddress (const folly::SocketAddress &addr, std::string ipStr=empty_string, std::string portStr=empty_string)
 
const folly::SocketAddressgetClientAddress () const
 
const std::stringgetClientIP () const
 
const std::stringgetClientPort () const
 
void setDstAddress (const folly::SocketAddress &addr, std::string addressStr=empty_string, std::string portStr=empty_string)
 
const folly::SocketAddressgetDstAddress () const
 
const std::stringgetDstIP () const
 
const std::stringgetDstPort () const
 
template<typename T >
void setLocalIp (T &&ip)
 
const std::stringgetLocalIp () const
 
void setMethod (HTTPMethod method)
 
void setMethod (folly::StringPiece method)
 
void rawSetMethod (const std::string &method)
 
folly::Optional< HTTPMethodgetMethod () const
 
const std::stringgetMethodString () const
 
template<typename T >
ParseURL setURL (T &&url)
 
void setURL (const char *url)
 
const std::stringgetURL () const
 
void rawSetURL (const std::string &url)
 
const std::stringgetPath () const
 
const std::stringgetQueryString () const
 
void setHTTPVersion (uint8_t major, uint8_t minor)
 
const std::pair< uint8_t, uint8_t > & getHTTPVersion () const
 
template<typename T >
void setStatusMessage (T &&msg)
 
const std::stringgetStatusMessage () const
 
void rawSetStatusMessage (std::string msg)
 
const std::stringgetVersionString () const
 
void setVersionString (const std::string &ver)
 
HTTPHeadersgetHeaders ()
 
const HTTPHeadersgetHeaders () const
 
HTTPHeaders && extractHeaders ()
 
HTTPHeadersgetTrailers ()
 
const HTTPHeadersgetTrailers () const
 
void setTrailers (std::unique_ptr< HTTPHeaders > &&trailers)
 
int processMaxForwards ()
 
bool isHTTP1_0 () const
 
bool isHTTP1_1 () const
 
bool is1xxResponse () const
 
bool is4xxResponse () const
 
bool is5xxResponse () const
 
void ensureHostHeader ()
 
void setWantsKeepalive (bool wantsKeepaliveVal)
 
bool wantsKeepalive () const
 
bool trailersAllowed () const
 
void setTrailersAllowed (bool trailersAllowedVal)
 
bool hasTrailers () const
 
void setStatusCode (uint16_t status)
 
uint16_t getStatusCode () const
 
void setUpgradeProtocol (std::string protocol)
 
const std::stringgetUpgradeProtocol () const
 
void setPushStatusCode (const uint16_t status)
 
const std::stringgetPushStatusStr () const
 
uint16_t getPushStatusCode () const
 
void constructDirectResponse (const std::pair< uint8_t, uint8_t > &version, const int statusCode, const std::string &statusMsg, int contentLength=0)
 
void constructDirectResponse (const std::pair< uint8_t, uint8_t > &version, int contentLength=0)
 
bool hasQueryParam (const std::string &name) const
 
const std::stringgetQueryParamPtr (const std::string &name) const
 
const std::stringgetQueryParam (const std::string &name) const
 
int getIntQueryParam (const std::string &name) const
 
int getIntQueryParam (const std::string &name, int defval) const
 
std::string getDecodedQueryParam (const std::string &name) const
 
const std::map< std::string, std::string > & getQueryParams () const
 
bool setQueryString (const std::string &query)
 
bool removeQueryParam (const std::string &name)
 
bool setQueryParam (const std::string &name, const std::string &value)
 
const folly::StringPiece getCookie (const std::string &name) const
 
void dumpMessage (int verbosity) const
 
void describe (std::ostream &os) const
 
void atomicDumpMessage (int verbosity) const
 
void dumpMessageToSink (google::LogSink *logSink) const
 
void stripPerHopHeaders ()
 
const HTTPHeadersgetStrippedPerHopHeaders () const
 
void setSecure (bool secure)
 
bool isSecure () const
 
int getSecureVersion () const
 
const char * getSecureCipher () const
 
void setSecureInfo (int ver, const char *cipher)
 
void setAdvancedProtocolString (const std::string &protocol)
 
bool isAdvancedProto () const
 
const std::stringgetAdvancedProtocolString () const
 
const std::stringgetProtocolString () const
 
void setPriority (int8_t pri)
 
uint8_t getPriority () const
 
folly::Optional< HTTPPrioritygetHTTP2Priority () const
 
void setHTTP2Priority (HTTPPriority h2Pri)
 
void setSeqNo (int32_t seqNo)
 
int32_t getSeqNo () const
 
void setIngressHeaderSize (const HTTPHeaderSize &size)
 
const HTTPHeaderSizegetIngressHeaderSize () const
 
TimePoint getStartTime () const
 
void setStartTime (const TimePoint &startTime)
 
bool checkForHeaderToken (const HTTPHeaderCode headerCode, char const *token, bool caseSensitive) const
 
void unparseCookies () const
 
bool computeKeepalive () const
 
bool isRequest () const
 
bool isResponse () const
 

Static Public Member Functions

static std::string formatDateHeader ()
 
static uint8_t normalizePriority (int8_t pri)
 
static const char * getDefaultReason (uint16_t status)
 
static void splitNameValuePieces (const std::string &input, char pairDelim, char valueDelim, std::function< void(folly::StringPiece, folly::StringPiece)> callback)
 
static void splitNameValue (const std::string &input, char pairDelim, char valueDelim, std::function< void(std::string &&, std::string &&)> callback)
 
static std::string createUrl (const folly::StringPiece scheme, const folly::StringPiece authority, const folly::StringPiece path, const folly::StringPiece query, const folly::StringPiece fragment)
 
static std::string createQueryString (const std::map< std::string, std::string > &params, uint32_t maxSize)
 

Static Public Attributes

static const std::pair< uint8_t, uint8_tkHTTPVersion10
 
static const std::pair< uint8_t, uint8_tkHTTPVersion11
 
static const int8_t kMaxPriority = 7
 

Protected Attributes

TimePoint startTime_
 
int32_t seqNo_
 

Private Member Functions

void parseCookies () const
 
void parseQueryParams () const
 
void unparseQueryParams ()
 
bool doHeaderTokenCheck (const HTTPHeaders &headers_, const HTTPHeaderCode headerCode, char const *token, bool caseSensitive) const
 
Requestrequest ()
 
const Requestrequest () const
 
Responseresponse ()
 
const Responseresponse () const
 

Static Private Member Functions

static folly::StringPiece trim (folly::StringPiece sp)
 

Private Attributes

folly::SocketAddress dstAddress_
 
std::string dstIP_
 
std::string dstPort_
 
std::string localIP_
 
std::string versionStr_
 
boost::variant< boost::blank, Request, Responsefields_
 
std::map< folly::StringPiece, folly::StringPiececookies_
 
std::map< std::string, std::stringqueryParams_
 
std::pair< uint8_t, uint8_tversion_
 
HTTPHeaders headers_
 
HTTPHeaders strippedPerHopHeaders_
 
HTTPHeaderSize size_
 
std::unique_ptr< HTTPHeaderstrailers_
 
int sslVersion_
 
const char * sslCipher_
 
const std::stringprotoStr_
 
uint8_t pri_
 
folly::Optional< HTTPPriorityh2Pri_
 
bool parsedCookies_:1
 
bool parsedQueryParams_:1
 
bool chunked_:1
 
bool upgraded_:1
 
bool wantsKeepalive_:1
 
bool trailersAllowed_:1
 
bool secure_:1
 
WebSocketUpgrade upgradeWebsocket_
 
std::unique_ptr< std::stringupgradeProtocol_
 

Static Private Attributes

static std::mutex mutexDump_
 

Detailed Description

An HTTP request or response minus the body.

Some of the methods on this class will assert if called from the wrong context since they only make sense for a request or response. Make sure you know what type of HTTPMessage this is before calling such methods.

All header names stored in this class are case-insensitive.

Definition at line 39 of file HTTPMessage.h.

Member Typedef Documentation

Definition at line 592 of file HTTPMessage.h.

Member Enumeration Documentation

Enumerator
NONE 
INGRESS 
EGRESS 

Definition at line 42 of file HTTPMessage.h.

Constructor & Destructor Documentation

proxygen::HTTPMessage::HTTPMessage ( )

Definition at line 63 of file HTTPMessage.cpp.

63  :
65  seqNo_(-1),
66  localIP_(),
67  versionStr_("1.0"),
68  fields_(),
69  version_(1,0),
70  sslVersion_(0), sslCipher_(nullptr), protoStr_(nullptr), pri_(0),
71  parsedCookies_(false), parsedQueryParams_(false),
72  chunked_(false), upgraded_(false), wantsKeepalive_(true),
73  trailersAllowed_(false), secure_(false),
74  upgradeWebsocket_(HTTPMessage::WebSocketUpgrade::NONE) {
75 }
const std::string * protoStr_
Definition: HTTPMessage.h:814
WebSocketUpgrade upgradeWebsocket_
Definition: HTTPMessage.h:831
const char * sslCipher_
Definition: HTTPMessage.h:813
std::pair< uint8_t, uint8_t > version_
Definition: HTTPMessage.h:806
std::string versionStr_
Definition: HTTPMessage.h:757
std::string localIP_
Definition: HTTPMessage.h:756
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
std::chrono::time_point< ClockType > getCurrentTime()
Definition: Time.h:41
proxygen::HTTPMessage::~HTTPMessage ( )

Definition at line 77 of file HTTPMessage.cpp.

77  {
78 }
proxygen::HTTPMessage::HTTPMessage ( HTTPMessage &&  message)
noexcept

Definition at line 112 of file HTTPMessage.cpp.

112  :
113  startTime_(message.startTime_),
114  seqNo_(message.seqNo_),
115  dstAddress_(std::move(message.dstAddress_)),
116  dstIP_(std::move(message.dstIP_)),
117  dstPort_(message.dstPort_),
118  localIP_(std::move(message.localIP_)),
119  versionStr_(std::move(message.versionStr_)),
120  fields_(std::move(message.fields_)),
121  cookies_(std::move(message.cookies_)),
122  queryParams_(std::move(message.queryParams_)),
123  version_(message.version_),
124  headers_(std::move(message.headers_)),
125  strippedPerHopHeaders_(std::move(message.strippedPerHopHeaders_)),
126  trailers_(std::move(message.trailers_)),
127  sslVersion_(message.sslVersion_),
128  sslCipher_(message.sslCipher_),
129  protoStr_(message.protoStr_),
130  pri_(message.pri_),
131  h2Pri_(message.h2Pri_),
132  parsedCookies_(message.parsedCookies_),
133  parsedQueryParams_(message.parsedQueryParams_),
134  chunked_(message.chunked_),
135  upgraded_(message.upgraded_),
136  wantsKeepalive_(message.wantsKeepalive_),
137  trailersAllowed_(message.trailersAllowed_),
138  secure_(message.secure_),
139  upgradeWebsocket_(message.upgradeWebsocket_) {
140 }
HTTPHeaders strippedPerHopHeaders_
Definition: HTTPMessage.h:808
Definition: test.c:42
std::unique_ptr< HTTPHeaders > trailers_
Definition: HTTPMessage.h:810
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
const std::string * protoStr_
Definition: HTTPMessage.h:814
WebSocketUpgrade upgradeWebsocket_
Definition: HTTPMessage.h:831
folly::Optional< HTTPPriority > h2Pri_
Definition: HTTPMessage.h:816
const char * sslCipher_
Definition: HTTPMessage.h:813
std::pair< uint8_t, uint8_t > version_
Definition: HTTPMessage.h:806
std::map< folly::StringPiece, folly::StringPiece > cookies_
Definition: HTTPMessage.h:802
std::string versionStr_
Definition: HTTPMessage.h:757
std::string dstPort_
Definition: HTTPMessage.h:754
std::string localIP_
Definition: HTTPMessage.h:756
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
folly::SocketAddress dstAddress_
Definition: HTTPMessage.h:752
std::map< std::string, std::string > queryParams_
Definition: HTTPMessage.h:804
HTTPHeaders headers_
Definition: HTTPMessage.h:807
proxygen::HTTPMessage::HTTPMessage ( const HTTPMessage message)

Definition at line 80 of file HTTPMessage.cpp.

References trailers_.

80  :
81  startTime_(message.startTime_),
82  seqNo_(message.seqNo_),
83  dstAddress_(message.dstAddress_),
84  dstIP_(message.dstIP_),
85  dstPort_(message.dstPort_),
86  localIP_(message.localIP_),
87  versionStr_(message.versionStr_),
88  fields_(message.fields_),
89  cookies_(message.cookies_),
90  queryParams_(message.queryParams_),
91  version_(message.version_),
92  headers_(message.headers_),
93  strippedPerHopHeaders_(message.strippedPerHopHeaders_),
94  sslVersion_(message.sslVersion_),
95  sslCipher_(message.sslCipher_),
96  protoStr_(message.protoStr_),
97  pri_(message.pri_),
98  h2Pri_(message.h2Pri_),
99  parsedCookies_(message.parsedCookies_),
100  parsedQueryParams_(message.parsedQueryParams_),
101  chunked_(message.chunked_),
102  upgraded_(message.upgraded_),
103  wantsKeepalive_(message.wantsKeepalive_),
104  trailersAllowed_(message.trailersAllowed_),
105  secure_(message.secure_),
106  upgradeWebsocket_(message.upgradeWebsocket_) {
107  if (message.trailers_) {
108  trailers_ = std::make_unique<HTTPHeaders>(*message.trailers_);
109  }
110 }
HTTPHeaders strippedPerHopHeaders_
Definition: HTTPMessage.h:808
Definition: test.c:42
std::unique_ptr< HTTPHeaders > trailers_
Definition: HTTPMessage.h:810
const std::string * protoStr_
Definition: HTTPMessage.h:814
WebSocketUpgrade upgradeWebsocket_
Definition: HTTPMessage.h:831
folly::Optional< HTTPPriority > h2Pri_
Definition: HTTPMessage.h:816
const char * sslCipher_
Definition: HTTPMessage.h:813
std::pair< uint8_t, uint8_t > version_
Definition: HTTPMessage.h:806
std::map< folly::StringPiece, folly::StringPiece > cookies_
Definition: HTTPMessage.h:802
std::string versionStr_
Definition: HTTPMessage.h:757
std::string dstPort_
Definition: HTTPMessage.h:754
std::string localIP_
Definition: HTTPMessage.h:756
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
folly::SocketAddress dstAddress_
Definition: HTTPMessage.h:752
std::map< std::string, std::string > queryParams_
Definition: HTTPMessage.h:804
HTTPHeaders headers_
Definition: HTTPMessage.h:807

Member Function Documentation

void proxygen::HTTPMessage::atomicDumpMessage ( int  verbosity) const

Print the message out, serializes through mutex Used in shutdown path

Definition at line 731 of file HTTPMessage.cpp.

References dumpMessage(), g(), and mutexDump_.

Referenced by getUpgradeProtocol().

731  {
732  std::lock_guard<std::mutex> g(mutexDump_);
733  dumpMessage(vlogLevel);
734 }
g_t g(f_t)
static std::mutex mutexDump_
Definition: HTTPMessage.h:829
void dumpMessage(int verbosity) const
bool proxygen::HTTPMessage::checkForHeaderToken ( const HTTPHeaderCode  headerCode,
char const *  token,
bool  caseSensitive 
) const

Check if a particular token value is present in a header that consists of a list of comma separated tokens. (e.g., a header with a #rule body as specified in the RFC 2616 BNF notation.)

Definition at line 782 of file HTTPMessage.cpp.

References doHeaderTokenCheck(), and headers_.

Referenced by computeKeepalive(), ZlibServerFilterTest::exercise_compression(), proxygen::HTTP2Codec::requestUpgrade(), setStartTime(), stripPerHopHeaders(), TEST(), and TEST_F().

784  {
785  return doHeaderTokenCheck(headers_, headerCode, token, caseSensitive);
786 }
bool doHeaderTokenCheck(const HTTPHeaders &headers_, const HTTPHeaderCode headerCode, char const *token, bool caseSensitive) const
HTTPHeaders headers_
Definition: HTTPMessage.h:807
bool proxygen::HTTPMessage::computeKeepalive ( ) const

Computes whether the state of this message is compatible with keepalive. Changing the headers, version, etc can change the result.

Definition at line 740 of file HTTPMessage.cpp.

References checkForHeaderToken(), doHeaderTokenCheck(), proxygen::HTTP_HEADER_CONNECTION, kHTTPVersion10, string, strippedPerHopHeaders_, and version_.

Referenced by setStartTime(), and TEST().

740  {
741  if (version_.first < 1) {
742  return false;
743  }
744 
745  // RFC 2616 isn't explicitly clear about whether "close" is case-sensitive.
746  // Section 2.1 states that literal tokens in the BNF are case-insensitive
747  // unless stated otherwise. The "close" token isn't explicitly mentioned
748  // in the BNF, but other header fields such as the character set and
749  // content coding are explicitly called out as being case insensitive.
750  //
751  // We'll treat the "close" token case-insensitively. This is the most
752  // conservative approach, since disabling keepalive when it was requested
753  // is better than enabling keepalive for a client that didn't expect it.
754  //
755  // Note that we only perform ASCII lowering here. This is good enough,
756  // since the token we are looking for is ASCII.
757  if (checkForHeaderToken(HTTP_HEADER_CONNECTION, "close", false)) {
758  // The Connection header contained a "close" token, so keepalive
759  // is disabled.
760  return false;
761  }
762 
763  const std::string kKeepAliveConnToken = "keep-alive";
764  if (version_ == kHTTPVersion10) {
765  // HTTP 1.0 persistent connections require a Connection: Keep-Alive
766  // header to be present for the connection to be persistent.
768  HTTP_HEADER_CONNECTION, kKeepAliveConnToken.c_str(), false) ||
771  kKeepAliveConnToken.c_str(),
772  false)) {
773  return true;
774  }
775  return false;
776  }
777 
778  // It's a keepalive connection.
779  return true;
780 }
HTTPHeaders strippedPerHopHeaders_
Definition: HTTPMessage.h:808
static const std::pair< uint8_t, uint8_t > kHTTPVersion10
Definition: HTTPMessage.h:229
bool doHeaderTokenCheck(const HTTPHeaders &headers_, const HTTPHeaderCode headerCode, char const *token, bool caseSensitive) const
bool checkForHeaderToken(const HTTPHeaderCode headerCode, char const *token, bool caseSensitive) const
std::pair< uint8_t, uint8_t > version_
Definition: HTTPMessage.h:806
const char * string
Definition: Conv.cpp:212
void proxygen::HTTPMessage::constructDirectResponse ( const std::pair< uint8_t, uint8_t > &  version,
const int  statusCode,
const std::string statusMsg,
int  contentLength = 0 
)

Fill in the fields for a response message header that the server will send directly to the client.

Parameters
versionHTTP version (major, minor)
statusCodeHTTP status code to respond with
msgtextual message to embed in "message" status field
contentLengththe length of the data to be written out through this message

Definition at line 358 of file HTTPMessage.cpp.

References setStatusCode(), and setStatusMessage().

Referenced by getUpgradeProtocol().

361  {
363  setStatusMessage(statusMsg);
364  constructDirectResponse(version, contentLength);
365 }
spdy::GoawayStatusCode statusCode
Definition: SPDYCodec.cpp:110
void setStatusMessage(T &&msg)
Definition: HTTPMessage.h:242
void constructDirectResponse(const std::pair< uint8_t, uint8_t > &version, const int statusCode, const std::string &statusMsg, int contentLength=0)
ProtocolVersion version
void setStatusCode(uint16_t status)
void proxygen::HTTPMessage::constructDirectResponse ( const std::pair< uint8_t, uint8_t > &  version,
int  contentLength = 0 
)

Fill in the fields for a response message header that the server will send directly to the client. This function assumes the status code and status message have already been set on this HTTPMessage object

Parameters
versionHTTP version (major, minor)
contentLengththe length of the data to be written out through this message

Definition at line 368 of file HTTPMessage.cpp.

References proxygen::HTTPHeaders::add(), proxygen::HTTPHeaders::exists(), headers_, proxygen::HTTP_HEADER_CONTENT_LENGTH, proxygen::HTTP_HEADER_CONTENT_TYPE, proxygen::HTTPHeaders::set(), setHTTPVersion(), setIsChunked(), and setIsUpgraded().

369  {
370  setHTTPVersion(version.first, version.second);
371 
372  headers_.set(HTTP_HEADER_CONTENT_LENGTH, folly::to<string>(contentLength));
373 
375  headers_.add(HTTP_HEADER_CONTENT_TYPE, "text/plain");
376  }
377  setIsChunked(false);
378  setIsUpgraded(false);
379 }
bool exists(folly::StringPiece name) const
Definition: HTTPHeaders.cpp:86
ProtocolVersion version
void setIsChunked(bool chunked)
Definition: HTTPMessage.h:79
void set(folly::StringPiece name, const std::string &value)
Definition: HTTPHeaders.h:119
void setIsUpgraded(bool upgraded)
Definition: HTTPMessage.h:85
void setHTTPVersion(uint8_t major, uint8_t minor)
void add(folly::StringPiece name, folly::StringPiece value)
Definition: HTTPHeaders.cpp:52
HTTPHeaders headers_
Definition: HTTPMessage.h:807
std::string proxygen::HTTPMessage::createQueryString ( const std::map< std::string, std::string > &  params,
uint32_t  maxSize 
)
static

Create a query string from the query parameters map containing the name-value pairs.

Definition at line 547 of file HTTPMessage.cpp.

References string.

Referenced by isResponse(), removeQueryParam(), and setQueryParam().

548  {
549  std::string query;
550  query.reserve(maxLength);
551  for (auto it = params.begin(); it != params.end(); it++) {
552  if (it != params.begin()) {
553  query.append("&");
554  }
555  query.append(it->first + "=" + it->second);
556  }
557  query.shrink_to_fit();
558  return query;
559 }
const char * string
Definition: Conv.cpp:212
std::string proxygen::HTTPMessage::createUrl ( const folly::StringPiece  scheme,
const folly::StringPiece  authority,
const folly::StringPiece  path,
const folly::StringPiece  query,
const folly::StringPiece  fragment 
)
static

Form the URL from the individual components. url -> {scheme}://{authority}{path}?{query}#{fragment}

Definition at line 561 of file HTTPMessage.cpp.

References folly::Range< Iter >::empty(), folly::Range< Iter >::size(), folly::Range< Iter >::str(), string, and folly::toAppend().

Referenced by PushService::generateUrl(), isResponse(), and setQueryString().

565  {
566  std::string url;
567  url.reserve(scheme.size() + authority.size() + path.size() + query.size() +
568  fragment.size() + 5); // 5 chars for ://,? and #
569  if (!scheme.empty()) {
570  folly::toAppend(scheme.str(), "://", &url);
571  }
572  folly::toAppend(authority, path, &url);
573  if (!query.empty()) {
574  folly::toAppend('?', query, &url);
575  }
576  if (!fragment.empty()) {
577  folly::toAppend('#', fragment, &url);
578  }
579  url.shrink_to_fit();
580  return url;
581 }
std::string str() const
Definition: Range.h:591
constexpr size_type size() const
Definition: Range.h:431
constexpr bool empty() const
Definition: Range.h:443
void toAppend(char value, Tgt *result)
Definition: Conv.h:406
const char * string
Definition: Conv.cpp:212
void proxygen::HTTPMessage::describe ( std::ostream &  os) const

Definition at line 680 of file HTTPMessage.cpp.

References chunked_, proxygen::HTTPMessage::Request::clientIP_, proxygen::HTTPMessage::Request::clientPort_, dstIP_, dstPort_, folly::gen::field(), fields_, proxygen::HTTPHeaders::forEach(), getMethodString(), h, headers_, localIP_, proxygen::HTTPMessage::Request::path_, proxygen::HTTPMessage::Request::pushStatusStr_, proxygen::HTTPMessage::Request::query_, request(), response(), proxygen::HTTPHeaders::size(), proxygen::HTTPMessage::Response::statusMsg_, proxygen::HTTPMessage::Response::statusStr_, proxygen::stripCntrlChars(), strippedPerHopHeaders_, upgraded_, proxygen::HTTPMessage::Request::url_, and versionStr_.

Referenced by getUpgradeProtocol(), and proxygen::operator<<().

680  {
681  os << ", chunked: " << chunked_
682  << ", upgraded: " << upgraded_
683  << ", Fields for message:" << std::endl;
684 
685  // Common fields to both requests and responses.
686  std::vector<std::pair<const char*, const std::string*>> fields {{
687  {"local_ip", &localIP_},
688  {"version", &versionStr_},
689  {"dst_ip", &dstIP_},
690  {"dst_port", &dstPort_},
691  }};
692 
693  if (fields_.type() == typeid(Request)) {
694  // Request fields.
695  const Request& req = request();
696  fields.push_back(make_pair("client_ip", &req.clientIP_));
697  fields.push_back(make_pair("client_port", &req.clientPort_));
698  fields.push_back(make_pair("method", &getMethodString()));
699  fields.push_back(make_pair("path", &req.path_));
700  fields.push_back(make_pair("query", &req.query_));
701  fields.push_back(make_pair("url", &req.url_));
702  fields.push_back(make_pair("push_status", &req.pushStatusStr_));
703  } else if (fields_.type() == typeid(Response)) {
704  // Response fields.
705  const Response& resp = response();
706  fields.push_back(make_pair("status", &resp.statusStr_));
707  fields.push_back(make_pair("status_msg", &resp.statusMsg_));
708  }
709 
710  for (auto field : fields) {
711  if (!field.second->empty()) {
712  os << " " << field.first
713  << ":" << stripCntrlChars(*field.second) << std::endl;
714  }
715  }
716 
717  headers_.forEach([&] (const string& h, const string& v) {
718  os << " " << stripCntrlChars(h) << ": "
719  << stripCntrlChars(v) << std::endl;
720  });
721  if (strippedPerHopHeaders_.size() > 0) {
722  os << "Per-Hop Headers" << std::endl;
723  strippedPerHopHeaders_.forEach([&] (const string& h, const string& v) {
724  os << " " << stripCntrlChars(h) << ": "
725  << stripCntrlChars(v) << std::endl;
726  });
727  }
728 }
HTTPHeaders strippedPerHopHeaders_
Definition: HTTPMessage.h:808
std::string stripCntrlChars(const Str &str)
Definition: HTTPMessage.h:842
*than *hazptr_holder h
Definition: Hazptr.h:116
Map field(FieldType Class::*field)
Definition: Base.h:641
void forEach(LAMBDA func) const
Definition: HTTPHeaders.h:337
std::string versionStr_
Definition: HTTPMessage.h:757
std::string dstPort_
Definition: HTTPMessage.h:754
std::string localIP_
Definition: HTTPMessage.h:756
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
size_t size() const
const std::string & getMethodString() const
Response & response()
Definition: HTTPMessage.h:779
HTTPHeaders headers_
Definition: HTTPMessage.h:807
bool proxygen::HTTPMessage::doHeaderTokenCheck ( const HTTPHeaders headers_,
const HTTPHeaderCode  headerCode,
char const *  token,
bool  caseSensitive 
) const
private

Definition at line 788 of file HTTPMessage.cpp.

References c, folly::test::end(), proxygen::HTTPHeaders::forEachValueOfHeader(), proxygen::isLWS(), cpp.ast::next(), folly::Range< Iter >::reset(), and value.

Referenced by checkForHeaderToken(), and computeKeepalive().

791  {
792  StringPiece tokenPiece(token);
793  string lowerToken;
794  if (!caseSensitive) {
795  lowerToken = token;
796  boost::to_lower(lowerToken, defaultLocale);
797  tokenPiece.reset(lowerToken);
798  }
799 
800  // Search through all of the headers with this name.
801  // forEachValueOfHeader will return true iff it was "broken" prematurely
802  // with "return true" in the lambda-function
803  return headers.forEachValueOfHeader(headerCode, [&] (const string& value) {
804  string lower;
805  // Use StringPiece, since it implements a faster find() than std::string
806  StringPiece headerValue;
807  if (caseSensitive) {
808  headerValue.reset(value);
809  } else {
810  // TODO: We only perform ASCII lowering right now. Technically the
811  // headers could contain data in other encodings, if encoded according
812  // to RFC 2047 (encoded strings will start with "=?").
813  lower = value;
814  boost::to_lower(lower, defaultLocale);
815  headerValue.reset(lower);
816  }
817 
818  // Look for the specified token
819  size_t idx = 0;
820  size_t end = headerValue.size();
821  while (idx < end) {
822  idx = headerValue.find(tokenPiece, idx);
823  if (idx == string::npos) {
824  break;
825  }
826 
827  // Search backwards to make sure we found the value at the beginning
828  // of a token.
829  bool at_token_start = false;
830  size_t prev = idx;
831  while (true) {
832  if (prev == 0) {
833  at_token_start = true;
834  break;
835  }
836  --prev;
837  char c = headerValue[prev];
838  if (c == ',') {
839  at_token_start = true;
840  break;
841  }
842  if (!isLWS(c)) {
843  // not at a token start
844  break;
845  }
846  }
847  if (!at_token_start) {
848  idx += 1;
849  continue;
850  }
851 
852  // Search forwards to see if we found the value at the end of a token
853  bool at_token_end = false;
854  size_t next = idx + tokenPiece.size();
855  while (true) {
856  if (next >= end) {
857  at_token_end = true;
858  break;
859  }
860  char c = headerValue[next];
861  if (c == ',') {
862  at_token_end = true;
863  break;
864  }
865  if (!isLWS(c)) {
866  // not at a token end
867  break;
868  }
869  ++next;
870  }
871  if (at_token_end) {
872  // We found the token we're looking for
873  return true;
874  }
875 
876  idx += 1;
877  }
878  return false; // keep processing
879  });
880 }
bool isLWS(char c)
Definition: HTTPHeaders.h:31
auto end(TestAdlIterable &instance)
Definition: ForeachTest.cpp:62
static const char *const value
Definition: Conv.cpp:50
Range< const char * > StringPiece
char c
void reset(Iter start, size_type size)
Definition: Range.h:421
def next(obj)
Definition: ast.py:58
void proxygen::HTTPMessage::dumpMessage ( int  verbosity) const

Print the message out.

Definition at line 676 of file HTTPMessage.cpp.

Referenced by atomicDumpMessage(), getUpgradeProtocol(), and CurlService::CurlClient::sendRequest().

676  {
677  VLOG(vlogLevel) << *this;
678 }
void proxygen::HTTPMessage::dumpMessageToSink ( google::LogSink *  logSink) const

Print the message out to logSink.

Definition at line 736 of file HTTPMessage.cpp.

Referenced by getUpgradeProtocol().

736  {
737  LOG_TO_SINK(logSink, INFO) << *this;
738 }
void proxygen::HTTPMessage::ensureHostHeader ( )

Ensures this HTTPMessage contains a host header, adding a default one with the destination address if necessary.

Definition at line 327 of file HTTPMessage.cpp.

References proxygen::HTTPHeaders::add(), proxygen::HTTPHeaders::exists(), getDstAddress(), getDstIP(), headers_, and proxygen::HTTP_HEADER_HOST.

Referenced by is5xxResponse(), and TEST().

327  {
330  getDstAddress().getFamily() == AF_INET6
331  ? '[' + getDstIP() + ']' : getDstIP());
332  }
333 }
bool exists(folly::StringPiece name) const
Definition: HTTPHeaders.cpp:86
const folly::SocketAddress & getDstAddress() const
Definition: HTTPMessage.h:132
void add(folly::StringPiece name, folly::StringPiece value)
Definition: HTTPHeaders.cpp:52
HTTPHeaders headers_
Definition: HTTPMessage.h:807
const std::string & getDstIP() const
Definition: HTTPMessage.h:136
HTTPHeaders&& proxygen::HTTPMessage::extractHeaders ( )
inline

Move headers out of current message (returns rvalue ref)

Definition at line 279 of file HTTPMessage.h.

References headers_, and folly::gen::move.

279  {
280  return std::move(headers_);
281  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
HTTPHeaders headers_
Definition: HTTPMessage.h:807
string proxygen::HTTPMessage::formatDateHeader ( )
static

Formats the current time appropriately for a Date header

Definition at line 321 of file HTTPMessage.cpp.

References folly::SingletonThreadLocal< T, Tag, Make, TLTag >::get().

Referenced by proxygen::HTTP1xCodec::addDateHeader(), is5xxResponse(), proxygen::CodecUtil::prepareMessageForCompression(), and proxygen::SPDYCodec::serializeResponseHeaders().

321  {
322  struct DateTag {};
324  return obj.formatDate();
325 }
FOLLY_EXPORT static FOLLY_ALWAYS_INLINE T & get()
const std::string* proxygen::HTTPMessage::getAdvancedProtocolString ( ) const
inline

Definition at line 548 of file HTTPMessage.h.

References protoStr_.

548  {
549  return protoStr_;
550  }
const std::string * protoStr_
Definition: HTTPMessage.h:814
const folly::SocketAddress& proxygen::HTTPMessage::getClientAddress ( ) const
inline

Definition at line 104 of file HTTPMessage.h.

References proxygen::HTTPMessage::Request::clientAddress_, and request().

104  {
105  return request().clientAddress_;
106  }
folly::SocketAddress clientAddress_
Definition: HTTPMessage.h:734
const std::string& proxygen::HTTPMessage::getClientIP ( ) const
inline

Definition at line 108 of file HTTPMessage.h.

References proxygen::HTTPMessage::Request::clientIP_, and request().

108  {
109  return request().clientIP_;
110  }
const std::string& proxygen::HTTPMessage::getClientPort ( ) const
inline

Definition at line 112 of file HTTPMessage.h.

References proxygen::HTTPMessage::Request::clientPort_, and request().

112  {
113  return request().clientPort_;
114  }
const StringPiece proxygen::HTTPMessage::getCookie ( const std::string name) const

Get the cookie with the specified name.

Returns a StringPiece to the cookie value, or an empty StringPiece if there is no cookie with the specified name. The returned cookie is only valid as long as the Cookie Header in HTTPMessage object exists. Applications should make sure they call unparseCookies() when editing the Cookie Header, so that the StringPiece references are cleared.

Definition at line 401 of file HTTPMessage.cpp.

References cookies_, parseCookies(), parsedCookies_, and unparseCookies().

Referenced by getUpgradeProtocol(), and TEST().

401  {
402  // clear previous parsed cookies. They might store raw pointers to a vector
403  // in headers_, which can resize on add()
404  // Parse the cookies if we haven't done so yet
405  unparseCookies();
406  if (!parsedCookies_) {
407  parseCookies();
408  }
409 
410  auto it = cookies_.find(name);
411  if (it == cookies_.end()) {
412  return StringPiece();
413  } else {
414  return it->second;
415  }
416 }
const char * name
Definition: http_parser.c:437
void parseCookies() const
std::map< folly::StringPiece, folly::StringPiece > cookies_
Definition: HTTPMessage.h:802
Range< const char * > StringPiece
void unparseCookies() const
std::string proxygen::HTTPMessage::getDecodedQueryParam ( const std::string name) const

Get the query parameter with the specified name after percent decoding.

Returns empty string if parameter is missing or folly::uriUnescape query param

Definition at line 482 of file HTTPMessage.cpp.

References folly::exceptionStr(), getQueryParam(), folly::QUERY, string, folly::uriUnescape(), and val.

Referenced by getUpgradeProtocol(), and TEST().

482  {
483  auto val = getQueryParam(name);
484 
485  std::string result;
486  try {
488  } catch (const std::exception& ex) {
489  LOG(WARNING) << "Invalid escaped query param: " << folly::exceptionStr(ex);
490  }
491  return result;
492 }
void uriUnescape(StringPiece str, String &out, UriEscapeMode mode)
Definition: String-inl.h:201
fbstring exceptionStr(const std::exception &e)
double val
Definition: String.cpp:273
const char * name
Definition: http_parser.c:437
const std::string & getQueryParam(const std::string &name) const
const char * string
Definition: Conv.cpp:212
const char * proxygen::HTTPMessage::getDefaultReason ( uint16_t  status)
static

Get the default reason string for a status code.

This returns the reason string for the specified status code as specified in RFC 2616. For unknown status codes, the string "-" is returned.

Definition at line 882 of file HTTPMessage.cpp.

Referenced by proxygen::HTTP1xCodec::generateHeader(), proxygen::HeaderDecodeInfo::onHeader(), proxygen::HTTPDirectResponseHandler::onHeadersComplete(), and setStartTime().

882  {
883  switch (status) {
884  case 100: return "Continue";
885  case 101: return "Switching Protocols";
886  case 200: return "OK";
887  case 201: return "Created";
888  case 202: return "Accepted";
889  case 203: return "Non-Authoritative Information";
890  case 204: return "No Content";
891  case 205: return "Reset Content";
892  case 206: return "Partial Content";
893  case 300: return "Multiple Choices";
894  case 301: return "Moved Permanently";
895  case 302: return "Found";
896  case 303: return "See Other";
897  case 304: return "Not Modified";
898  case 305: return "Use Proxy";
899  case 307: return "Temporary Redirect";
900  case 400: return "Bad Request";
901  case 401: return "Unauthorized";
902  case 402: return "Payment Required";
903  case 403: return "Forbidden";
904  case 404: return "Not Found";
905  case 405: return "Method Not Allowed";
906  case 406: return "Not Acceptable";
907  case 407: return "Proxy Authentication Required";
908  case 408: return "Request Timeout";
909  case 409: return "Conflict";
910  case 410: return "Gone";
911  case 411: return "Length Required";
912  case 412: return "Precondition Failed";
913  case 413: return "Request Entity Too Large";
914  case 414: return "Request-URI Too Long";
915  case 415: return "Unsupported Media Type";
916  case 416: return "Requested Range Not Satisfiable";
917  case 417: return "Expectation Failed";
918  case 418: return "I'm a teapot";
919  case 500: return "Internal Server Error";
920  case 501: return "Not Implemented";
921  case 502: return "Bad Gateway";
922  case 503: return "Service Unavailable";
923  case 504: return "Gateway Timeout";
924  case 505: return "HTTP Version Not Supported";
925  }
926 
927  // Note: Some Microsoft clients behave badly if the reason string
928  // is left empty. Therefore return a non-empty string here.
929  return "-";
930 }
const folly::SocketAddress& proxygen::HTTPMessage::getDstAddress ( ) const
inline

Definition at line 132 of file HTTPMessage.h.

References dstAddress_.

Referenced by ensureHostHeader().

132  {
133  return dstAddress_;
134  }
folly::SocketAddress dstAddress_
Definition: HTTPMessage.h:752
const std::string& proxygen::HTTPMessage::getDstIP ( ) const
inline

Definition at line 136 of file HTTPMessage.h.

References dstIP_.

Referenced by ensureHostHeader().

136  {
137  return dstIP_;
138  }
const std::string& proxygen::HTTPMessage::getDstPort ( ) const
inline

Definition at line 140 of file HTTPMessage.h.

References dstPort_.

140  {
141  return dstPort_;
142  }
std::string dstPort_
Definition: HTTPMessage.h:754
HTTPHeaders& proxygen::HTTPMessage::getHeaders ( )
inline

Access the headers (fpreq, fpres)

Definition at line 273 of file HTTPMessage.h.

References headers_.

Referenced by proxygen::HTTPArchive::convertToHPACK(), TestPriorityMapBuilder::createVirtualStreams(), CurlService::CurlClient::CurlClient(), doEmptyHeaderValueTest(), proxygen::SPDYCodec::encodeHeaders(), ZlibServerFilterTest::exercise_compression(), HTTPDownstreamTest< SPDY3_1CodecPair >::expect101(), proxygen::HTTPArchive::fromFile(), proxygen::HTTPArchive::fromPublicFile(), proxygen::HTTPChecks::generateHeader(), proxygen::HTTP1xCodec::generateHeader(), proxygen::HTTP2Codec::generateHeaderImpl(), PushService::generateUrl(), proxygen::getBigGetRequest(), proxygen::getChunkedPostRequest(), proxygen::getGetRequest(), proxygen::getPostRequest(), proxygen::getPubRequest(), proxygen::getResponse(), CurlService::CurlClient::getServerName(), proxygen::HTTPArchive::getSize(), getSynStream(), proxygen::getUpgradeRequest(), proxygen::compress::SimStreamingCallback::onHeader(), proxygen::HTTPDirectResponseHandler::onHeadersComplete(), proxygen::compress::SimStreamingCallback::onHeadersComplete(), proxygen::HTTP2Codec::onIngressUpgradeMessage(), proxygen::HTTPDownstreamSession::onNativeProtocolUpgrade(), proxygen::operator==(), proxygen::compress::prepareMessageForCompression(), proxygen::CodecUtil::prepareMessageForCompression(), proxygen::HTTP2Codec::requestUpgrade(), proxygen::HTTPHandlerBase::sendHeaders(), proxygen::HTTPTransaction::sendHeadersWithOptionalEOM(), proxygen::MockHTTPPushHandler::sendPushHeaders(), CurlService::CurlClient::sendRequest(), proxygen::SPDYCodec::serializeRequestHeaders(), proxygen::SPDYCodec::serializeResponseHeaders(), proxygen::HTTPRequestVerifier::setAuthority(), TEST(), TEST_F(), TEST_P(), HTTPUpstreamTest< C >::testBasicRequestHttp10(), and HTTP2CodecTest::testHeaderListSize().

273 { return headers_; }
HTTPHeaders headers_
Definition: HTTPMessage.h:807
const HTTPHeaders& proxygen::HTTPMessage::getHeaders ( ) const
inline

Definition at line 274 of file HTTPMessage.h.

References headers_.

274 { return headers_; }
HTTPHeaders headers_
Definition: HTTPMessage.h:807
folly::Optional<HTTPPriority> proxygen::HTTPMessage::getHTTP2Priority ( ) const
inline

Definition at line 594 of file HTTPMessage.h.

References h2Pri_.

Referenced by proxygen::HTTP2Codec::generateHeaderImpl(), and proxygen::HTTPSession::getMessagePriority().

595  {
596  return h2Pri_;
597  }
folly::Optional< HTTPPriority > h2Pri_
Definition: HTTPMessage.h:816
const pair< uint8_t, uint8_t > & proxygen::HTTPMessage::getHTTPVersion ( ) const

Definition at line 262 of file HTTPMessage.cpp.

References version_.

Referenced by proxygen::HTTP1xCodec::generateHeader().

262  {
263  return version_;
264 }
std::pair< uint8_t, uint8_t > version_
Definition: HTTPMessage.h:806
const HTTPHeaderSize& proxygen::HTTPMessage::getIngressHeaderSize ( ) const
inline

Definition at line 615 of file HTTPMessage.h.

References size_.

Referenced by HTTP1xCodecCallback::onHeadersComplete().

615  {
616  return size_;
617  }
HTTPHeaderSize size_
Definition: HTTPMessage.h:809
int proxygen::HTTPMessage::getIntQueryParam ( const std::string name) const

Get the query parameter with the specified name as int.

If the conversion fails, throws exception.

Definition at line 469 of file HTTPMessage.cpp.

References getQueryParam().

Referenced by getIntQueryParam(), getUpgradeProtocol(), and TEST().

469  {
470  return folly::to<int>(getQueryParam(name));
471 }
const char * name
Definition: http_parser.c:437
const std::string & getQueryParam(const std::string &name) const
int proxygen::HTTPMessage::getIntQueryParam ( const std::string name,
int  defval 
) const

Get the query parameter with the specified name as int.

Returns the query parameter if it can be parsed as int otherwise the default value.

Definition at line 473 of file HTTPMessage.cpp.

References getIntQueryParam().

473  {
474  try {
475  return getIntQueryParam(name);
476  } catch (const std::exception& ex) {
477  }
478 
479  return defval;
480 }
const char * name
Definition: http_parser.c:437
int getIntQueryParam(const std::string &name) const
bool proxygen::HTTPMessage::getIsChunked ( ) const
inline
bool proxygen::HTTPMessage::getIsUpgraded ( ) const
inline

Definition at line 86 of file HTTPMessage.h.

References upgraded_.

86 { return upgraded_; }
const std::string& proxygen::HTTPMessage::getLocalIp ( ) const
inline

Definition at line 151 of file HTTPMessage.h.

References localIP_, and setMethod().

151  {
152  return localIP_;
153  }
std::string localIP_
Definition: HTTPMessage.h:756
folly::Optional< HTTPMethod > proxygen::HTTPMessage::getMethod ( ) const

an HTTPMethod enum value representing the method if it is a standard request method, or else "none" if it is an extension method (fpreq)

Definition at line 235 of file HTTPMessage.cpp.

References folly::none, and request().

Referenced by proxygen::HTTPChecks::generateHeader(), proxygen::HTTP1xCodec::generateHeader(), proxygen::HTTP2Codec::onHeadersComplete(), proxygen::compress::prepareMessageForCompression(), proxygen::CodecUtil::prepareMessageForCompression(), processMaxForwards(), rawSetMethod(), proxygen::HTTPTransaction::sendHeadersWithOptionalEOM(), TEST(), and proxygen::HTTPRequestVerifier::validate().

235  {
236  const auto& req = request();
237  if (req.method_.which() == 2) {
238  return boost::get<HTTPMethod>(req.method_);
239  }
240  return folly::none;
241 }
constexpr None none
Definition: Optional.h:87
const std::string & proxygen::HTTPMessage::getMethodString ( ) const

a string representation of the request method (fpreq)

Definition at line 246 of file HTTPMessage.cpp.

References proxygen::empty_string, proxygen::methodToString(), and request().

Referenced by describe(), proxygen::HTTP1xCodec::generateHeader(), proxygen::operator==(), proxygen::compress::prepareMessageForCompression(), proxygen::CodecUtil::prepareMessageForCompression(), rawSetMethod(), proxygen::SPDYCodec::serializeRequestHeaders(), and TEST().

246  {
247  const auto& req = request();
248  if (req.method_.which() == 1) {
249  return boost::get<std::string>(req.method_);
250  } else if (req.method_.which() == 2) {
251  return methodToString(boost::get<HTTPMethod>(req.method_));
252  }
253  return empty_string;
254 }
const std::string & methodToString(HTTPMethod method)
Definition: HTTPMethod.cpp:46
const std::string empty_string
Definition: HTTPHeaders.cpp:23
const std::string& proxygen::HTTPMessage::getPath ( ) const
inline

Access the path component (fpreq)

Definition at line 215 of file HTTPMessage.h.

References proxygen::HTTPMessage::Request::path_, and request().

Referenced by testPathAndQuery().

215  {
216  return request().path_;
217  }
uint8_t proxygen::HTTPMessage::getPriority ( ) const
inline

Definition at line 590 of file HTTPMessage.h.

References pri_.

Referenced by proxygen::SPDYCodec::generateSynStream(), and proxygen::HTTPSession::getMessagePriority().

590 { return pri_; }
const std::string& proxygen::HTTPMessage::getProtocolString ( ) const
inline

Return the protocol string used by this HTTPMessage.

If this HTTP message is using an advanced protocol, the protocol string will be the advanced protocol. If not, it will simply be the HTTP version.

Definition at line 558 of file HTTPMessage.h.

References isAdvancedProto(), protoStr_, and versionStr_.

Referenced by TEST().

558  {
559  if (isAdvancedProto()) {
560  return *protoStr_;
561  }
562 
563  return versionStr_;
564  }
const std::string * protoStr_
Definition: HTTPMessage.h:814
std::string versionStr_
Definition: HTTPMessage.h:757
bool isAdvancedProto() const
Definition: HTTPMessage.h:545
uint16_t proxygen::HTTPMessage::getPushStatusCode ( ) const

Definition at line 353 of file HTTPMessage.cpp.

References proxygen::HTTPMessage::Request::pushStatus_, and request().

Referenced by getUpgradeProtocol().

353  {
354  return request().pushStatus_;
355 }
const std::string & proxygen::HTTPMessage::getPushStatusStr ( ) const
const string & proxygen::HTTPMessage::getQueryParam ( const std::string name) const

Get the query parameter with the specified name.

Returns a reference to the query parameter value, or proxygen::empty_string if there is no parameter with the specified name. The returned value is only valid as long as this HTTPMessage object.

Definition at line 464 of file HTTPMessage.cpp.

References proxygen::empty_string, and getQueryParamPtr().

Referenced by getDecodedQueryParam(), getIntQueryParam(), getUpgradeProtocol(), and TEST().

464  {
465  const string* ret = getQueryParamPtr(name);
466  return ret ? *ret : empty_string;
467 }
const char * name
Definition: http_parser.c:437
const std::string * getQueryParamPtr(const std::string &name) const
const std::string empty_string
Definition: HTTPHeaders.cpp:23
const string * proxygen::HTTPMessage::getQueryParamPtr ( const std::string name) const

Get the query parameter with the specified name.

Returns a pointer to the query parameter value, or nullptr if there is no parameter with the specified name. The returned value is only valid as long as this HTTPMessage object.

Definition at line 447 of file HTTPMessage.cpp.

References parsedQueryParams_, parseQueryParams(), and queryParams_.

Referenced by getQueryParam(), getUpgradeProtocol(), and hasQueryParam().

447  {
448  // Parse the query parameters if we haven't done so yet
449  if (!parsedQueryParams_) {
451  }
452 
453  auto it = queryParams_.find(name);
454  if (it == queryParams_.end()) {
455  return nullptr;
456  }
457  return &it->second;
458 }
const char * name
Definition: http_parser.c:437
void parseQueryParams() const
std::map< std::string, std::string > queryParams_
Definition: HTTPMessage.h:804
const std::map< std::string, std::string > & proxygen::HTTPMessage::getQueryParams ( ) const

Get all the query parameters.

Returns a reference to the query parameters map. The returned value is only valid as long as this HTTPMessage object.

Definition at line 494 of file HTTPMessage.cpp.

References parsedQueryParams_, parseQueryParams(), and queryParams_.

Referenced by getUpgradeProtocol().

494  {
495  // Parse the query parameters if we haven't done so yet
496  if (!parsedQueryParams_) {
498  }
499  return queryParams_;
500 }
void parseQueryParams() const
std::map< std::string, std::string > queryParams_
Definition: HTTPMessage.h:804
const std::string& proxygen::HTTPMessage::getQueryString ( ) const
inline

Access the query component (fpreq)

Definition at line 222 of file HTTPMessage.h.

References proxygen::HTTPMessage::Request::query_, and request().

Referenced by testPathAndQuery(), testRemoveQueryParam(), and testSetQueryParam().

222  {
223  return request().query_;
224  }
const char* proxygen::HTTPMessage::getSecureCipher ( ) const
inline

Definition at line 537 of file HTTPMessage.h.

References sslCipher_.

537 { return sslCipher_; }
const char * sslCipher_
Definition: HTTPMessage.h:813
int proxygen::HTTPMessage::getSecureVersion ( ) const
inline

Definition at line 536 of file HTTPMessage.h.

References sslVersion_.

536 { return sslVersion_; }
int32_t proxygen::HTTPMessage::getSeqNo ( ) const
inline

Definition at line 607 of file HTTPMessage.h.

References seqNo_.

607 { return seqNo_; }
TimePoint proxygen::HTTPMessage::getStartTime ( ) const
inline

Getter and setter for the time when the first byte of the message arrived

Definition at line 622 of file HTTPMessage.h.

References startTime_.

Referenced by proxygen::compress::CompressionSimulator::readInputFromFileAndSchedule().

622 { return startTime_; }
const std::string& proxygen::HTTPMessage::getStatusMessage ( ) const
inline
const HTTPHeaders& proxygen::HTTPMessage::getStrippedPerHopHeaders ( ) const
inline

Definition at line 530 of file HTTPMessage.h.

References strippedPerHopHeaders_.

Referenced by TEST().

530  {
531  return strippedPerHopHeaders_;
532  }
HTTPHeaders strippedPerHopHeaders_
Definition: HTTPMessage.h:808
HTTPHeaders* proxygen::HTTPMessage::getTrailers ( )
inline

Access the trailers

Definition at line 286 of file HTTPMessage.h.

References trailers_.

286 { return trailers_.get(); }
std::unique_ptr< HTTPHeaders > trailers_
Definition: HTTPMessage.h:810
const HTTPHeaders* proxygen::HTTPMessage::getTrailers ( ) const
inline

Definition at line 287 of file HTTPMessage.h.

References trailers_.

287 { return trailers_.get(); }
std::unique_ptr< HTTPHeaders > trailers_
Definition: HTTPMessage.h:810
const std::string& proxygen::HTTPMessage::getVersionString ( ) const
inline

Get/Set the HTTP version string (like "1.1"). XXX: Note we only support X.Y format while setting version.

Definition at line 256 of file HTTPMessage.h.

References versionStr_.

256  {
257  return versionStr_;
258  }
std::string versionStr_
Definition: HTTPMessage.h:757
bool proxygen::HTTPMessage::hasQueryParam ( const std::string name) const

Check if query parameter with the specified name exists.

Definition at line 460 of file HTTPMessage.cpp.

References getQueryParamPtr().

Referenced by getUpgradeProtocol(), and TEST().

460  {
461  return getQueryParamPtr(name) != nullptr;
462 }
const char * name
Definition: http_parser.c:437
const std::string * getQueryParamPtr(const std::string &name) const
bool proxygen::HTTPMessage::hasTrailers ( ) const
inline

Returns true if this message has trailers that need to be serialized

Definition at line 365 of file HTTPMessage.h.

References getStatusCode(), setStatusCode(), trailers_, trailersAllowed_, and uint16_t.

365  {
366  return trailersAllowed_ && trailers_ && trailers_->size() > 0;
367  }
std::unique_ptr< HTTPHeaders > trailers_
Definition: HTTPMessage.h:810
bool proxygen::HTTPMessage::is1xxResponse ( ) const
inline

Returns true if this is a 1xx response.

Definition at line 316 of file HTTPMessage.h.

References getStatusCode().

Referenced by proxygen::HTTP1xCodec::generateHeader().

316 { return (getStatusCode() / 100) == 1; }
uint16_t getStatusCode() const
bool proxygen::HTTPMessage::is4xxResponse ( ) const
inline

Returns true if this is a 4xx response.

Definition at line 321 of file HTTPMessage.h.

References getStatusCode().

321 { return (getStatusCode() / 100) == 4; }
uint16_t getStatusCode() const
bool proxygen::HTTPMessage::is5xxResponse ( ) const
inline

Returns true if this is a 5xx response.

Definition at line 326 of file HTTPMessage.h.

References ensureHostHeader(), formatDateHeader(), getStatusCode(), and string.

326 { return (getStatusCode() / 100) == 5; }
uint16_t getStatusCode() const
bool proxygen::HTTPMessage::isAdvancedProto ( ) const
inline

Definition at line 545 of file HTTPMessage.h.

References protoStr_.

Referenced by getProtocolString().

545  {
546  return protoStr_ != nullptr;
547  }
const std::string * protoStr_
Definition: HTTPMessage.h:814
bool proxygen::HTTPMessage::isEgressWebsocketUpgrade ( ) const
inline

Definition at line 72 of file HTTPMessage.h.

References upgradeWebsocket_.

Referenced by proxygen::HTTP1xCodec::generateHeader(), proxygen::HTTP2Codec::generateHeaderImpl(), and proxygen::CodecUtil::prepareMessageForCompression().

72  {
73  return upgradeWebsocket_ == WebSocketUpgrade::EGRESS;
74  }
WebSocketUpgrade upgradeWebsocket_
Definition: HTTPMessage.h:831
bool proxygen::HTTPMessage::isHTTP1_0 ( ) const

Returns true if the version of this message is HTTP/1.0

Definition at line 290 of file HTTPMessage.cpp.

References kHTTPVersion10, and version_.

Referenced by setTrailers().

290  {
291  return version_ == kHTTPVersion10;
292 }
static const std::pair< uint8_t, uint8_t > kHTTPVersion10
Definition: HTTPMessage.h:229
std::pair< uint8_t, uint8_t > version_
Definition: HTTPMessage.h:806
bool proxygen::HTTPMessage::isHTTP1_1 ( ) const

Returns true if the version of this message is HTTP/1.1

Definition at line 294 of file HTTPMessage.cpp.

References kHTTPVersion11, and version_.

Referenced by setTrailers().

294  {
295  return version_ == kHTTPVersion11;
296 }
std::pair< uint8_t, uint8_t > version_
Definition: HTTPMessage.h:806
static const std::pair< uint8_t, uint8_t > kHTTPVersion11
Definition: HTTPMessage.h:230
bool proxygen::HTTPMessage::isIngressWebsocketUpgrade ( ) const
inline

Definition at line 69 of file HTTPMessage.h.

References upgradeWebsocket_.

69  {
70  return upgradeWebsocket_ == WebSocketUpgrade::INGRESS;
71  }
WebSocketUpgrade upgradeWebsocket_
Definition: HTTPMessage.h:831
bool proxygen::HTTPMessage::isRequest ( ) const
inline
Returns
true if this HTTPMessage represents an HTTP request

Definition at line 661 of file HTTPMessage.h.

References fields_.

Referenced by proxygen::HTTPChecks::generateHeader(), proxygen::HTTP2Codec::generateHeaderImpl(), proxygen::CodecUtil::prepareMessageForCompression(), and proxygen::HTTPTransaction::sendHeadersWithOptionalEOM().

661  {
662  return fields_.which() == 1;
663  }
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
bool proxygen::HTTPMessage::isResponse ( ) const
inline
Returns
true if this HTTPMessage represents an HTTP response

Definition at line 668 of file HTTPMessage.h.

References createQueryString(), createUrl(), fields_, params, splitNameValue(), splitNameValuePieces(), string, and uint32_t.

Referenced by proxygen::CodecUtil::prepareMessageForCompression(), and proxygen::HTTPTransaction::sendHeadersWithOptionalEOM().

668  {
669  return fields_.which() == 2;
670  }
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
static uint8_t proxygen::HTTPMessage::normalizePriority ( int8_t  pri)
inlinestatic

Definition at line 576 of file HTTPMessage.h.

References kMaxPriority.

Referenced by setPriority(), and proxygen::HTTPTransaction::updateAndSendPriority().

576  {
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  }
static const int8_t kMaxPriority
Definition: HTTPMessage.h:574
HTTPMessage & proxygen::HTTPMessage::operator= ( const HTTPMessage message)

Definition at line 142 of file HTTPMessage.cpp.

References chunked_, cookies_, dstAddress_, dstIP_, dstPort_, fields_, h2Pri_, headers_, localIP_, parsedCookies_, parsedQueryParams_, pri_, protoStr_, queryParams_, secure_, seqNo_, sslCipher_, sslVersion_, startTime_, strippedPerHopHeaders_, trailers_, trailersAllowed_, upgraded_, upgradeWebsocket_, version_, versionStr_, and wantsKeepalive_.

142  {
143  if (&message == this) {
144  return *this;
145  }
146  startTime_ = message.startTime_;
147  seqNo_ = message.seqNo_;
148  dstAddress_ = message.dstAddress_;
149  dstIP_ = message.dstIP_;
150  dstPort_ = message.dstPort_;
151  localIP_ = message.localIP_;
152  versionStr_ = message.versionStr_;
153  fields_ = message.fields_;
154  cookies_ = message.cookies_;
155  queryParams_ = message.queryParams_;
156  version_ = message.version_;
157  headers_ = message.headers_;
158  strippedPerHopHeaders_ = message.strippedPerHopHeaders_;
159  sslVersion_ = message.sslVersion_;
160  sslCipher_ = message.sslCipher_;
161  protoStr_ = message.protoStr_;
162  pri_ = message.pri_;
163  h2Pri_ = message.h2Pri_;
164  parsedCookies_ = message.parsedCookies_;
165  parsedQueryParams_ = message.parsedQueryParams_;
166  chunked_ = message.chunked_;
167  upgraded_ = message.upgraded_;
168  wantsKeepalive_ = message.wantsKeepalive_;
169  trailersAllowed_ = message.trailersAllowed_;
170  secure_ = message.secure_;
171  upgradeWebsocket_ = message.upgradeWebsocket_;
172 
173  if (message.trailers_) {
174  trailers_ = std::make_unique<HTTPHeaders>(*message.trailers_);
175  } else {
176  trailers_.reset();
177  }
178  return *this;
179 }
HTTPHeaders strippedPerHopHeaders_
Definition: HTTPMessage.h:808
Definition: test.c:42
std::unique_ptr< HTTPHeaders > trailers_
Definition: HTTPMessage.h:810
const std::string * protoStr_
Definition: HTTPMessage.h:814
WebSocketUpgrade upgradeWebsocket_
Definition: HTTPMessage.h:831
folly::Optional< HTTPPriority > h2Pri_
Definition: HTTPMessage.h:816
const char * sslCipher_
Definition: HTTPMessage.h:813
std::pair< uint8_t, uint8_t > version_
Definition: HTTPMessage.h:806
std::map< folly::StringPiece, folly::StringPiece > cookies_
Definition: HTTPMessage.h:802
std::string versionStr_
Definition: HTTPMessage.h:757
std::string dstPort_
Definition: HTTPMessage.h:754
std::string localIP_
Definition: HTTPMessage.h:756
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
folly::SocketAddress dstAddress_
Definition: HTTPMessage.h:752
std::map< std::string, std::string > queryParams_
Definition: HTTPMessage.h:804
HTTPHeaders headers_
Definition: HTTPMessage.h:807
HTTPMessage & proxygen::HTTPMessage::operator= ( HTTPMessage &&  message)

Definition at line 181 of file HTTPMessage.cpp.

References chunked_, cookies_, dstAddress_, dstIP_, dstPort_, fields_, h2Pri_, headers_, localIP_, folly::gen::move, parsedCookies_, parsedQueryParams_, pri_, protoStr_, queryParams_, secure_, seqNo_, sslCipher_, sslVersion_, startTime_, strippedPerHopHeaders_, trailers_, trailersAllowed_, upgraded_, upgradeWebsocket_, version_, versionStr_, and wantsKeepalive_.

181  {
182  if (&message == this) {
183  return *this;
184  }
185  startTime_ = message.startTime_;
186  seqNo_ = message.seqNo_;
187  dstAddress_ = std::move(message.dstAddress_);
188  dstIP_ = std::move(message.dstIP_);
189  dstPort_ = message.dstPort_;
190  localIP_ = std::move(message.localIP_);
191  versionStr_ = std::move(message.versionStr_);
192  fields_ = std::move(message.fields_);
193  cookies_ = std::move(message.cookies_);
194  queryParams_ = std::move(message.queryParams_);
195  version_ = message.version_;
196  headers_ = std::move(message.headers_);
197  strippedPerHopHeaders_ = std::move(message.strippedPerHopHeaders_);
198  sslVersion_ = message.sslVersion_;
199  sslCipher_ = message.sslCipher_;
200  protoStr_ = message.protoStr_;
201  pri_ = message.pri_;
202  h2Pri_ = message.h2Pri_;
203  parsedCookies_ = message.parsedCookies_;
204  parsedQueryParams_ = message.parsedQueryParams_;
205  chunked_ = message.chunked_;
206  upgraded_ = message.upgraded_;
207  wantsKeepalive_ = message.wantsKeepalive_;
208  trailersAllowed_ = message.trailersAllowed_;
209  secure_ = message.secure_;
210  upgradeWebsocket_ = message.upgradeWebsocket_;
211 
212  trailers_ = std::move(message.trailers_);
213  return *this;
214 }
HTTPHeaders strippedPerHopHeaders_
Definition: HTTPMessage.h:808
Definition: test.c:42
std::unique_ptr< HTTPHeaders > trailers_
Definition: HTTPMessage.h:810
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
const std::string * protoStr_
Definition: HTTPMessage.h:814
WebSocketUpgrade upgradeWebsocket_
Definition: HTTPMessage.h:831
folly::Optional< HTTPPriority > h2Pri_
Definition: HTTPMessage.h:816
const char * sslCipher_
Definition: HTTPMessage.h:813
std::pair< uint8_t, uint8_t > version_
Definition: HTTPMessage.h:806
std::map< folly::StringPiece, folly::StringPiece > cookies_
Definition: HTTPMessage.h:802
std::string versionStr_
Definition: HTTPMessage.h:757
std::string dstPort_
Definition: HTTPMessage.h:754
std::string localIP_
Definition: HTTPMessage.h:756
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
folly::SocketAddress dstAddress_
Definition: HTTPMessage.h:752
std::map< std::string, std::string > queryParams_
Definition: HTTPMessage.h:804
HTTPHeaders headers_
Definition: HTTPMessage.h:807
void proxygen::HTTPMessage::parseCookies ( ) const
private

Definition at line 381 of file HTTPMessage.cpp.

References cookies_, proxygen::HTTPHeaders::forEachValueOfHeader(), headers_, proxygen::HTTP_HEADER_COOKIE, parsedCookies_, and splitNameValuePieces().

Referenced by getCookie().

381  {
382  DCHECK(!parsedCookies_);
383  parsedCookies_ = true;
384 
386  [&](const string& headerval) {
387  splitNameValuePieces(headerval, ';', '=',
388  [this](StringPiece cookieName, StringPiece cookieValue) {
389  cookies_.emplace(cookieName, cookieValue);
390  });
391 
392  return false; // continue processing "cookie" headers
393  });
394 }
static void splitNameValuePieces(const std::string &input, char pairDelim, char valueDelim, std::function< void(folly::StringPiece, folly::StringPiece)> callback)
bool forEachValueOfHeader(folly::StringPiece name, LAMBDA func) const
Definition: HTTPHeaders.h:355
std::map< folly::StringPiece, folly::StringPiece > cookies_
Definition: HTTPMessage.h:802
Range< const char * > StringPiece
HTTPHeaders headers_
Definition: HTTPMessage.h:807
void proxygen::HTTPMessage::parseQueryParams ( ) const
private

Definition at line 418 of file HTTPMessage.cpp.

References parsedQueryParams_, proxygen::HTTPMessage::Request::query_, request(), and splitNameValue().

Referenced by getQueryParamPtr(), getQueryParams(), removeQueryParam(), and setQueryParam().

418  {
419  DCHECK(!parsedQueryParams_);
420  const Request& req = request();
421 
422  parsedQueryParams_ = true;
423  if (req.query_.empty()) {
424  return;
425  }
426 
427  splitNameValue(req.query_, '&', '=',
428  [this] (string&& paramName, string&& paramValue) {
429 
430  auto it = queryParams_.find(paramName);
431  if (it == queryParams_.end()) {
432  queryParams_.emplace(std::move(paramName), std::move(paramValue));
433  } else {
434  // We have some unit tests that make sure we always return the last
435  // value when there are duplicate parameters. I don't think this really
436  // matters, but for now we might as well maintain the same behavior.
437  it->second = std::move(paramValue);
438  }
439  });
440 }
static void splitNameValue(const std::string &input, char pairDelim, char valueDelim, std::function< void(std::string &&, std::string &&)> callback)
int proxygen::HTTPMessage::processMaxForwards ( )

Decrements Max-Forwards header, when present on OPTIONS or TRACE methods.

Returns HTTP status code.

Definition at line 266 of file HTTPMessage.cpp.

References getMethod(), proxygen::HTTPHeaders::getSingleOrEmpty(), headers_, proxygen::HTTP_HEADER_MAX_FORWARDS, int64_t, proxygen::OPTIONS, proxygen::HTTPHeaders::set(), proxygen::TRACE, and value.

Referenced by setTrailers().

266  {
269  if (value.length() > 0) {
270  int64_t max_forwards = 0;
271  try {
272  max_forwards = folly::to<int64_t>(value);
273  } catch (const std::range_error& ex) {
274  return 400;
275  }
276 
277  if (max_forwards < 0) {
278  return 400;
279  } else if (max_forwards == 0) {
280  return 501;
281  } else {
283  folly::to<string>(max_forwards - 1));
284  }
285  }
286  }
287  return 0;
288 }
void set(folly::StringPiece name, const std::string &value)
Definition: HTTPHeaders.h:119
static const char *const value
Definition: Conv.cpp:50
const std::string & getSingleOrEmpty(const T &nameOrCode) const
Definition: HTTPHeaders.h:420
folly::Optional< HTTPMethod > getMethod() const
HTTPHeaders headers_
Definition: HTTPMessage.h:807
void proxygen::HTTPMessage::rawSetMethod ( const std::string method)
inline

Definition at line 160 of file HTTPMessage.h.

References getMethod(), getMethodString(), setMethod(), and string.

160  {
161  setMethod(method);
162  }
void setMethod(HTTPMethod method)
void proxygen::HTTPMessage::rawSetStatusMessage ( std::string  msg)
inline

Definition at line 248 of file HTTPMessage.h.

References setStatusMessage().

248  {
249  setStatusMessage(msg);
250  }
void setStatusMessage(T &&msg)
Definition: HTTPMessage.h:242
void proxygen::HTTPMessage::rawSetURL ( const std::string url)
inline

Definition at line 208 of file HTTPMessage.h.

References setURL().

208  {
209  setURL(url);
210  }
ParseURL setURL(T &&url)
Definition: HTTPMessage.h:183
bool proxygen::HTTPMessage::removeQueryParam ( const std::string name)

Remove the query parameter with the specified name.

Returns true if the query parameter was present and deleted.

Definition at line 520 of file HTTPMessage.cpp.

References createQueryString(), parsedQueryParams_, parseQueryParams(), queryParams_, request(), and setQueryString().

Referenced by getUpgradeProtocol(), and testRemoveQueryParam().

520  {
521  // Parse the query parameters if we haven't done so yet
522  if (!parsedQueryParams_) {
524  }
525 
526  if (!queryParams_.erase(name)) {
527  // Query param was not found.
528  return false;
529  }
530 
531  auto query = createQueryString(queryParams_, request().query_.length());
532  return setQueryString(query);
533 }
static std::string createQueryString(const std::map< std::string, std::string > &params, uint32_t maxSize)
const char * name
Definition: http_parser.c:437
bool setQueryString(const std::string &query)
void parseQueryParams() const
std::map< std::string, std::string > queryParams_
Definition: HTTPMessage.h:804
Request& proxygen::HTTPMessage::request ( )
inlineprivate

Definition at line 761 of file HTTPMessage.h.

References fields_.

Referenced by describe(), getClientAddress(), getClientIP(), getClientPort(), getMethod(), getMethodString(), getPath(), getPushStatusCode(), getPushStatusStr(), getQueryString(), getURL(), parseQueryParams(), removeQueryParam(), setClientAddress(), setMethod(), setPushStatusCode(), setQueryParam(), setQueryString(), and setURL().

761  {
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  }
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
const Request& proxygen::HTTPMessage::request ( ) const
inlineprivate

Definition at line 770 of file HTTPMessage.h.

References fields_.

770  {
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  }
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
Response& proxygen::HTTPMessage::response ( )
inlineprivate

Definition at line 779 of file HTTPMessage.h.

References fields_.

Referenced by describe(), getStatusCode(), getStatusMessage(), setStatusCode(), and setStatusMessage().

779  {
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  }
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
const Response& proxygen::HTTPMessage::response ( ) const
inlineprivate

Definition at line 788 of file HTTPMessage.h.

References fields_.

788  {
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  }
boost::variant< boost::blank, Request, Response > fields_
Definition: HTTPMessage.h:759
void proxygen::HTTPMessage::setAdvancedProtocolString ( const std::string protocol)
inline

Definition at line 542 of file HTTPMessage.h.

References protoStr_.

Referenced by TEST().

542  {
543  protoStr_ = &protocol;
544  }
const std::string * protoStr_
Definition: HTTPMessage.h:814
void proxygen::HTTPMessage::setClientAddress ( const folly::SocketAddress addr,
std::string  ipStr = empty_string,
std::string  portStr = empty_string 
)
inline

Set/Get client address

Definition at line 91 of file HTTPMessage.h.

References addr, proxygen::HTTPMessage::Request::clientAddress_, proxygen::HTTPMessage::Request::clientIP_, proxygen::HTTPMessage::Request::clientPort_, folly::SocketAddress::getAddressStr(), folly::SocketAddress::getPort(), folly::gen::move, and request().

93  {
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  }
folly::SocketAddress clientAddress_
Definition: HTTPMessage.h:734
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
uint16_t getPort() const
ThreadPoolListHook * addr
std::string getAddressStr() const
void proxygen::HTTPMessage::setDstAddress ( const folly::SocketAddress addr,
std::string  addressStr = empty_string,
std::string  portStr = empty_string 
)
inline

Set/Get destination (vip) address

Definition at line 119 of file HTTPMessage.h.

References addr, dstAddress_, dstIP_, dstPort_, folly::SocketAddress::getAddressStr(), folly::SocketAddress::getPort(), and folly::gen::move.

Referenced by TEST().

121  {
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  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
uint16_t getPort() const
std::string dstPort_
Definition: HTTPMessage.h:754
folly::SocketAddress dstAddress_
Definition: HTTPMessage.h:752
ThreadPoolListHook * addr
std::string getAddressStr() const
void proxygen::HTTPMessage::setEgressWebsocketUpgrade ( )
inline

Definition at line 66 of file HTTPMessage.h.

References upgradeWebsocket_.

Referenced by TEST(), and TEST_F().

66  {
67  upgradeWebsocket_ = WebSocketUpgrade::EGRESS;
68  }
WebSocketUpgrade upgradeWebsocket_
Definition: HTTPMessage.h:831
void proxygen::HTTPMessage::setHTTP2Priority ( HTTPPriority  h2Pri)
inline

Definition at line 599 of file HTTPMessage.h.

References h2Pri_.

Referenced by proxygen::MockHTTPPushHandler::sendPushHeaders(), and TEST_F().

599  {
600  h2Pri_ = h2Pri;
601  }
folly::Optional< HTTPPriority > h2Pri_
Definition: HTTPMessage.h:816
void proxygen::HTTPMessage::setIngressHeaderSize ( const HTTPHeaderSize size)
inline

getter and setter for size in serialized form

Definition at line 612 of file HTTPMessage.h.

References folly::size(), and size_.

612  {
613  size_ = size;
614  }
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45
HTTPHeaderSize size_
Definition: HTTPMessage.h:809
void proxygen::HTTPMessage::setIngressWebsocketUpgrade ( )
inline

Definition at line 63 of file HTTPMessage.h.

References upgradeWebsocket_.

Referenced by proxygen::HTTP2Codec::onHeadersComplete().

63  {
64  upgradeWebsocket_ = WebSocketUpgrade::INGRESS;
65  }
WebSocketUpgrade upgradeWebsocket_
Definition: HTTPMessage.h:831
void proxygen::HTTPMessage::setIsChunked ( bool  chunked)
inline

Is this a chunked message? (fpreq, fpresp)

Definition at line 79 of file HTTPMessage.h.

References folly::gen::chunked(), and chunked_.

Referenced by constructDirectResponse(), proxygen::getChunkedPostRequest(), proxygen::HTTPHandlerBase::sendChunkedReplyWithBody(), and TEST().

79 { chunked_ = chunked; }
Chunked chunked(const Container &container, int chunkSize=256)
Definition: Parallel.h:49
void proxygen::HTTPMessage::setIsUpgraded ( bool  upgraded)
inline

Is this an upgraded message? (fpreq, fpresp)

Definition at line 85 of file HTTPMessage.h.

References upgraded_.

Referenced by constructDirectResponse().

85 { upgraded_ = upgraded; }
template<typename T >
void proxygen::HTTPMessage::setLocalIp ( T &&  ip)
inline

Set/Get the local IP address

Definition at line 148 of file HTTPMessage.h.

References localIP_.

Referenced by TEST().

148  {
149  localIP_ = std::forward<T>(ip);
150  }
std::string localIP_
Definition: HTTPMessage.h:756
void proxygen::HTTPMessage::setMethod ( folly::StringPiece  method)

Definition at line 221 of file HTTPMessage.cpp.

References proxygen::HTTPMessage::Request::method_, request(), folly::Range< Iter >::str(), proxygen::stringToMethod(), and folly::pushmi::operators::transform.

221  {
222  VLOG(9) << "setMethod: " << method;
223  Request& req = request();
225  if (result) {
226  req.method_ = *result;
227  } else {
228  req.method_ = method.str();
229  auto& storedMethod = boost::get<std::string>(req.method_);
230  std::transform(storedMethod.begin(), storedMethod.end(),
231  storedMethod.begin(), ::toupper);
232  }
233 }
folly::Optional< HTTPMethod > stringToMethod(folly::StringPiece method)
Definition: HTTPMethod.cpp:37
std::string str() const
Definition: Range.h:591
PUSHMI_INLINE_VAR constexpr detail::transform_fn transform
Definition: transform.h:158
void proxygen::HTTPMessage::setPriority ( int8_t  pri)
inline

Definition at line 586 of file HTTPMessage.h.

References h2Pri_, folly::none, normalizePriority(), and pri_.

586  {
587  pri_ = normalizePriority(pri);
589  }
folly::Optional< HTTPPriority > h2Pri_
Definition: HTTPMessage.h:816
static uint8_t normalizePriority(int8_t pri)
Definition: HTTPMessage.h:576
constexpr None none
Definition: Optional.h:87
void proxygen::HTTPMessage::setPushStatusCode ( const uint16_t  status)

Access the push status code

Definition at line 344 of file HTTPMessage.cpp.

References proxygen::HTTPMessage::Request::pushStatus_, proxygen::HTTPMessage::Request::pushStatusStr_, and request().

Referenced by getUpgradeProtocol(), TEST(), and TEST_F().

344  {
345  request().pushStatus_ = status;
346  request().pushStatusStr_ = folly::to<string>(status);
347 }
bool proxygen::HTTPMessage::setQueryParam ( const std::string name,
const std::string value 
)

Sets the query parameter with the specified name to the specified value.

Returns true if the query parameter was successfully set.

Definition at line 535 of file HTTPMessage.cpp.

References createQueryString(), name, parsedQueryParams_, parseQueryParams(), queryParams_, request(), setQueryString(), and value.

Referenced by getUpgradeProtocol(), and testSetQueryParam().

536  {
537  // Parse the query parameters if we haven't done so yet
538  if (!parsedQueryParams_) {
540  }
541 
543  auto query = createQueryString(queryParams_, request().query_.length());
544  return setQueryString(query);
545 }
static std::string createQueryString(const std::map< std::string, std::string > &params, uint32_t maxSize)
const char * name
Definition: http_parser.c:437
static const char *const value
Definition: Conv.cpp:50
bool setQueryString(const std::string &query)
void parseQueryParams() const
std::map< std::string, std::string > queryParams_
Definition: HTTPMessage.h:804
bool proxygen::HTTPMessage::setQueryString ( const std::string query)

Set the query string to the specified value, and recreate the url_.

Returns true if the query string was changed successfully.

Definition at line 502 of file HTTPMessage.cpp.

References proxygen::ParseURL::authority(), createUrl(), proxygen::ParseURL::fragment(), proxygen::ParseURL::path(), proxygen::HTTPMessage::Request::query_, request(), proxygen::ParseURL::scheme(), proxygen::HTTPMessage::Request::url_, and proxygen::ParseURL::valid().

Referenced by getUpgradeProtocol(), removeQueryParam(), and setQueryParam().

502  {
503  ParseURL u(request().url_);
504 
505  if (u.valid()) {
506  // Recreate the URL by just changing the query string
507  request().url_ = createUrl(u.scheme(),
508  u.authority(),
509  u.path(),
510  query, // new query string
511  u.fragment());
512  request().query_ = query;
513  return true;
514  }
515 
516  VLOG(4) << "Error parsing URL during setQueryString: " << request().url_;
517  return false;
518 }
static std::string createUrl(const folly::StringPiece scheme, const folly::StringPiece authority, const folly::StringPiece path, const folly::StringPiece query, const folly::StringPiece fragment)
void proxygen::HTTPMessage::setSecure ( bool  secure)
inline
void proxygen::HTTPMessage::setSecureInfo ( int  ver,
const char *  cipher 
)
inline

Definition at line 538 of file HTTPMessage.h.

References cipher, sslCipher_, and sslVersion_.

538  {
539  // cipher is a static const char* provided and managed by openssl lib
540  sslVersion_ = ver; sslCipher_ = cipher;
541  }
CipherSuite cipher
const char * sslCipher_
Definition: HTTPMessage.h:813
void proxygen::HTTPMessage::setSeqNo ( int32_t  seqNo)
inline

get and setter for transaction sequence number

Definition at line 606 of file HTTPMessage.h.

References seqNo_.

606 { seqNo_ = seqNo; }
void proxygen::HTTPMessage::setStartTime ( const TimePoint startTime)
inline

Definition at line 623 of file HTTPMessage.h.

References checkForHeaderToken(), computeKeepalive(), getDefaultReason(), startTime_, uint16_t, and unparseCookies().

623 { startTime_ = startTime; }
template<typename T >
void proxygen::HTTPMessage::setStatusMessage ( T &&  msg)
inline
void proxygen::HTTPMessage::setTrailers ( std::unique_ptr< HTTPHeaders > &&  trailers)
inline

Set the trailers, replacing any that might already be present

Definition at line 292 of file HTTPMessage.h.

References isHTTP1_0(), isHTTP1_1(), folly::gen::move, processMaxForwards(), and trailers_.

292  {
293  trailers_ = std::move(trailers);
294  }
std::unique_ptr< HTTPHeaders > trailers_
Definition: HTTPMessage.h:810
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
void proxygen::HTTPMessage::setTrailersAllowed ( bool  trailersAllowedVal)
inline

Accessor to set whether trailers are allowed in the response

Definition at line 358 of file HTTPMessage.h.

References trailersAllowed_.

358  {
359  trailersAllowed_ = trailersAllowedVal;
360  }
void proxygen::HTTPMessage::setUpgradeProtocol ( std::string  protocol)
inline

Definition at line 375 of file HTTPMessage.h.

References folly::gen::move, and upgradeProtocol_.

Referenced by proxygen::HTTPRequestVerifier::setUpgradeProtocol().

375  {
376  upgradeProtocol_ = std::make_unique<std::string>(std::move(protocol));
377  }
std::unique_ptr< std::string > upgradeProtocol_
Definition: HTTPMessage.h:832
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
template<typename T >
ParseURL proxygen::HTTPMessage::setURL ( T &&  url)
inline

Access the URL component (fpreq)

The <url> component from the initial "METHOD <url> HTTP/..." line. When valid, this is a full URL, not just a path.

Definition at line 183 of file HTTPMessage.h.

References proxygen::ParseURL::path(), proxygen::HTTPMessage::Request::path_, proxygen::ParseURL::query(), proxygen::HTTPMessage::Request::query_, request(), folly::Range< Iter >::str(), unparseQueryParams(), proxygen::HTTPMessage::Request::url_, and proxygen::ParseURL::valid().

Referenced by doEmptyHeaderValueTest(), ZlibServerFilterTest::exercise_compression(), proxygen::getBigGetRequest(), proxygen::getChunkedPostRequest(), proxygen::getGetRequest(), proxygen::getPostRequest(), proxygen::getPubRequest(), getSynStream(), proxygen::compress::SimStreamingCallback::onHeader(), rawSetURL(), proxygen::MockHTTPPushHandler::sendPushHeaders(), CurlService::CurlClient::sendRequest(), proxygen::HTTPRequestVerifier::setPath(), setURL(), TEST(), TEST_F(), TEST_P(), testPathAndQuery(), testRemoveQueryParam(), and testSetQueryParam().

183  {
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  }
void proxygen::HTTPMessage::setURL ( const char *  url)
inline

Definition at line 202 of file HTTPMessage.h.

References setURL(), and string.

202  {
203  setURL(std::string(url));
204  }
ParseURL setURL(T &&url)
Definition: HTTPMessage.h:183
const char * string
Definition: Conv.cpp:212
void proxygen::HTTPMessage::setVersionString ( const std::string ver)
inline

Definition at line 259 of file HTTPMessage.h.

References setHTTPVersion().

259  {
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  }
void setHTTPVersion(uint8_t major, uint8_t minor)
void proxygen::HTTPMessage::setWantsKeepalive ( bool  wantsKeepaliveVal)
inline

Indicates if this request wants the connection to be kept-alive (default true). Not all codecs respect this option.

Definition at line 343 of file HTTPMessage.h.

References wantsKeepalive_.

Referenced by proxygen::HTTPHandlerBase::sendHeaders(), TEST(), and TEST_F().

343  {
344  wantsKeepalive_ = wantsKeepaliveVal;
345  }
void proxygen::HTTPMessage::splitNameValue ( const std::string input,
char  pairDelim,
char  valueDelim,
std::function< void(std::string &&, std::string &&)>  callback 
)
static

Definition at line 628 of file HTTPMessage.cpp.

References folly::Range< Iter >::advance(), folly::Range< Iter >::empty(), folly::Range< Iter >::find(), folly::gen::move, name, folly::Range< Iter >::size(), folly::Range< Iter >::str(), folly::Range< Iter >::subpiece(), and value.

Referenced by isResponse(), and parseQueryParams().

632  {
633 
634  folly::StringPiece sp(input);
635  while (!sp.empty()) {
636  size_t pairDelimPos = sp.find(pairDelim);
637  folly::StringPiece keyValue;
638 
639  if (pairDelimPos == string::npos) {
640  keyValue = sp;
641  sp.advance(sp.size());
642  } else {
643  keyValue = sp.subpiece(0, pairDelimPos);
644  // Skip '&' char
645  sp.advance(pairDelimPos + 1);
646  }
647 
648  if (keyValue.empty()) {
649  continue;
650  }
651 
652  size_t valueDelimPos = keyValue.find(valueDelim);
653  if (valueDelimPos == string::npos) {
654  // Key only query param
655  string name = keyValue.str();
656  string value;
657 
658  boost::trim(name, defaultLocale);
659  callback(std::move(name), std::move(value));
660  } else {
661  string name = keyValue.subpiece(0, valueDelimPos).str();
662  string value = keyValue.subpiece(valueDelimPos + 1).str();
663 
664  boost::trim(name, defaultLocale);
665  boost::trim(value, defaultLocale);
666  callback(std::move(name), std::move(value));
667  }
668  }
669 }
std::string str() const
Definition: Range.h:591
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
size_type find(const_range_type str) const
Definition: Range.h:721
void advance(size_type n)
Definition: Range.h:672
const char * name
Definition: http_parser.c:437
constexpr bool empty() const
Definition: Range.h:443
Range subpiece(size_type first, size_type length=npos) const
Definition: Range.h:686
static const char *const value
Definition: Conv.cpp:50
void proxygen::HTTPMessage::splitNameValuePieces ( const std::string input,
char  pairDelim,
char  valueDelim,
std::function< void(folly::StringPiece, folly::StringPiece)>  callback 
)
static

Assuming input contains <name><valueDelim>

(<pairDelim><name><valueDelim>

), invoke callback once with each name,value pair.

Definition at line 583 of file HTTPMessage.cpp.

References folly::Range< Iter >::advance(), name, trim(), and value.

Referenced by isResponse(), and parseCookies().

587  {
588 
589  StringPiece sp(input);
590  while (!sp.empty()) {
591  size_t pairDelimPos = sp.find(pairDelim);
592  StringPiece keyValue;
593 
594  if (pairDelimPos == string::npos) {
595  keyValue = sp;
596  sp.advance(sp.size());
597  } else {
598  keyValue = sp.subpiece(0, pairDelimPos);
599  // Skip '&' char
600  sp.advance(pairDelimPos + 1);
601  }
602 
603  if (keyValue.empty()) {
604  continue;
605  }
606 
607  size_t valueDelimPos = keyValue.find(valueDelim);
608  if (valueDelimPos == string::npos) {
609  // Key only query param
610  callback(trim(keyValue), StringPiece());
611  } else {
612  auto name = keyValue.subpiece(0, valueDelimPos);
613  auto value = keyValue.subpiece(valueDelimPos + 1);
614  callback(trim(name), trim(value));
615  }
616  }
617 }
static folly::StringPiece trim(folly::StringPiece sp)
void advance(size_type n)
Definition: Range.h:672
const char * name
Definition: http_parser.c:437
static const char *const value
Definition: Conv.cpp:50
Range< const char * > StringPiece
void proxygen::HTTPMessage::stripPerHopHeaders ( )

Interact with headers that are defined to be per-hop.

It is expected that during request processing, stripPerHopHeaders() will be called before the message is proxied to the other connection.

Definition at line 48 of file HTTPMessage.cpp.

References checkForHeaderToken(), headers_, proxygen::HTTP_HEADER_TE, proxygen::HTTPHeaders::removeAll(), strippedPerHopHeaders_, proxygen::HTTPHeaders::stripPerHopHeaders(), and trailersAllowed_.

Referenced by getUpgradeProtocol(), and TEST().

48  {
49  // Some code paths end up recyling a single HTTPMessage instance for multiple
50  // requests, and adding their own per-hop headers each time. In that case, we
51  // don't want to accumulate these headers.
53 
54  if (!trailersAllowed_) {
55  // Because stripPerHopHeaders can be called multiple times, don't
56  // let subsequent instances clear this flag
58  }
59 
61 }
HTTPHeaders strippedPerHopHeaders_
Definition: HTTPMessage.h:808
void stripPerHopHeaders(HTTPHeaders &strippedHeaders)
bool checkForHeaderToken(const HTTPHeaderCode headerCode, char const *token, bool caseSensitive) const
HTTPHeaders headers_
Definition: HTTPMessage.h:807
bool proxygen::HTTPMessage::trailersAllowed ( ) const
inline

Returns true if trailers are allowed on this message. Trailers are not allowed on responses unless the client is expecting them.

Definition at line 354 of file HTTPMessage.h.

References trailersAllowed_.

354 { return trailersAllowed_; }
StringPiece proxygen::HTTPMessage::trim ( folly::StringPiece  sp)
staticprivate

Trims whitespace from the beggining and end of the StringPiece.

Definition at line 619 of file HTTPMessage.cpp.

Referenced by splitNameValuePieces().

619  {
620  // TODO: use a library function from boost?
621  for (; !sp.empty() && sp.front() == ' '; sp.pop_front()) {
622  }
623  for (; !sp.empty() && sp.back() == ' '; sp.pop_back()) {
624  }
625  return sp;
626 }
void pop_front()
Definition: Range.h:710
void pop_back()
Definition: Range.h:715
constexpr bool empty() const
Definition: Range.h:443
value_type & front()
Definition: Range.h:464
value_type & back()
Definition: Range.h:468
void proxygen::HTTPMessage::unparseCookies ( ) const

Forget about the parsed cookies.

Ideally HTTPMessage should automatically forget about the current parsed cookie state whenever a Cookie header is changed. However, at the moment callers have to explicitly call unparseCookies() after modifying the cookie headers.

Definition at line 396 of file HTTPMessage.cpp.

References cookies_, and parsedCookies_.

Referenced by getCookie(), and setStartTime().

396  {
397  cookies_.clear();
398  parsedCookies_ = false;
399 }
std::map< folly::StringPiece, folly::StringPiece > cookies_
Definition: HTTPMessage.h:802
void proxygen::HTTPMessage::unparseQueryParams ( )
private

Definition at line 442 of file HTTPMessage.cpp.

References parsedQueryParams_, and queryParams_.

Referenced by setURL().

442  {
443  queryParams_.clear();
444  parsedQueryParams_ = false;
445 }
std::map< std::string, std::string > queryParams_
Definition: HTTPMessage.h:804
bool proxygen::HTTPMessage::wantsKeepalive ( ) const
inline

Definition at line 346 of file HTTPMessage.h.

References wantsKeepalive_.

Referenced by proxygen::HTTP1xCodec::generateHeader(), and TEST().

346  {
347  return wantsKeepalive_;
348  }

Member Data Documentation

bool proxygen::HTTPMessage::chunked_
private

Definition at line 820 of file HTTPMessage.h.

Referenced by describe(), getIsChunked(), operator=(), and setIsChunked().

std::map<folly::StringPiece, folly::StringPiece> proxygen::HTTPMessage::cookies_
mutableprivate

Definition at line 802 of file HTTPMessage.h.

Referenced by getCookie(), operator=(), parseCookies(), and unparseCookies().

folly::SocketAddress proxygen::HTTPMessage::dstAddress_
private

Definition at line 752 of file HTTPMessage.h.

Referenced by getDstAddress(), operator=(), and setDstAddress().

std::string proxygen::HTTPMessage::dstIP_
private

Definition at line 753 of file HTTPMessage.h.

Referenced by describe(), getDstIP(), operator=(), and setDstAddress().

std::string proxygen::HTTPMessage::dstPort_
private

Definition at line 754 of file HTTPMessage.h.

Referenced by describe(), getDstPort(), operator=(), and setDstAddress().

boost::variant<boost::blank, Request, Response> proxygen::HTTPMessage::fields_
mutableprivate

Definition at line 759 of file HTTPMessage.h.

Referenced by describe(), isRequest(), isResponse(), operator=(), request(), and response().

folly::Optional<HTTPPriority> proxygen::HTTPMessage::h2Pri_
private

Definition at line 816 of file HTTPMessage.h.

Referenced by getHTTP2Priority(), operator=(), setHTTP2Priority(), and setPriority().

const pair< uint8_t, uint8_t > proxygen::HTTPMessage::kHTTPVersion10
static

Version constants

Definition at line 229 of file HTTPMessage.h.

Referenced by computeKeepalive(), proxygen::HTTP1xCodec::generateHeader(), and isHTTP1_0().

const pair< uint8_t, uint8_t > proxygen::HTTPMessage::kHTTPVersion11
static

Definition at line 230 of file HTTPMessage.h.

Referenced by proxygen::HTTP1xCodec::generateHeader(), and isHTTP1_1().

const int8_t proxygen::HTTPMessage::kMaxPriority = 7
static

Definition at line 574 of file HTTPMessage.h.

Referenced by normalizePriority().

std::string proxygen::HTTPMessage::localIP_
private

Definition at line 756 of file HTTPMessage.h.

Referenced by describe(), getLocalIp(), operator=(), and setLocalIp().

std::mutex proxygen::HTTPMessage::mutexDump_
staticprivate

Definition at line 829 of file HTTPMessage.h.

Referenced by atomicDumpMessage().

bool proxygen::HTTPMessage::parsedCookies_
mutableprivate

Definition at line 818 of file HTTPMessage.h.

Referenced by getCookie(), operator=(), parseCookies(), and unparseCookies().

bool proxygen::HTTPMessage::parsedQueryParams_
mutableprivate
uint8_t proxygen::HTTPMessage::pri_
private

Definition at line 815 of file HTTPMessage.h.

Referenced by getPriority(), operator=(), and setPriority().

const std::string* proxygen::HTTPMessage::protoStr_
private
std::map<std::string, std::string> proxygen::HTTPMessage::queryParams_
mutableprivate
bool proxygen::HTTPMessage::secure_
private

Definition at line 826 of file HTTPMessage.h.

Referenced by isSecure(), operator=(), and setSecure().

int32_t proxygen::HTTPMessage::seqNo_
protected

Definition at line 709 of file HTTPMessage.h.

Referenced by getSeqNo(), operator=(), and setSeqNo().

HTTPHeaderSize proxygen::HTTPMessage::size_
private

Definition at line 809 of file HTTPMessage.h.

Referenced by getIngressHeaderSize(), and setIngressHeaderSize().

const char* proxygen::HTTPMessage::sslCipher_
private

Definition at line 813 of file HTTPMessage.h.

Referenced by getSecureCipher(), operator=(), and setSecureInfo().

int proxygen::HTTPMessage::sslVersion_
private

Definition at line 812 of file HTTPMessage.h.

Referenced by getSecureVersion(), operator=(), and setSecureInfo().

TimePoint proxygen::HTTPMessage::startTime_
protected

Definition at line 708 of file HTTPMessage.h.

Referenced by getStartTime(), operator=(), and setStartTime().

HTTPHeaders proxygen::HTTPMessage::strippedPerHopHeaders_
private
std::unique_ptr<HTTPHeaders> proxygen::HTTPMessage::trailers_
private

Definition at line 810 of file HTTPMessage.h.

Referenced by getTrailers(), hasTrailers(), HTTPMessage(), operator=(), and setTrailers().

bool proxygen::HTTPMessage::trailersAllowed_
private
bool proxygen::HTTPMessage::upgraded_
private

Definition at line 821 of file HTTPMessage.h.

Referenced by describe(), getIsUpgraded(), operator=(), and setIsUpgraded().

std::unique_ptr<std::string> proxygen::HTTPMessage::upgradeProtocol_
private

Definition at line 832 of file HTTPMessage.h.

Referenced by getUpgradeProtocol(), and setUpgradeProtocol().

WebSocketUpgrade proxygen::HTTPMessage::upgradeWebsocket_
private
std::pair<uint8_t, uint8_t> proxygen::HTTPMessage::version_
private
std::string proxygen::HTTPMessage::versionStr_
private
bool proxygen::HTTPMessage::wantsKeepalive_
private

Definition at line 822 of file HTTPMessage.h.

Referenced by operator=(), setWantsKeepalive(), and wantsKeepalive().


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