SNode.C
Loading...
Searching...
No Matches
web::http Namespace Reference

Namespaces

namespace  client
namespace  legacy
namespace  tls
namespace  server
namespace  decoder

Classes

class  CookieOptions
class  StatusCode
class  Parser
class  ContentDecoder
class  MimeTypes
struct  ciLess
class  CiStringMap
class  SocketContextUpgrade
class  SocketContextUpgradeFactory
class  SocketContextUpgradeFactorySelector

Enumerations

enum  ConnectionState { Default , Keep , Close }
enum struct  TransferEncoding {
  HTTP10 , Identity , Chunked , Compressed ,
  GZip , Deflat
}
enum  ContentType { Normal , EventStream }

Functions

bool ciContains (const std::string &str1, const std::string &str2)
bool ciEquals (const std::string &str1, const std::string &str2)
static bool parseContentLengthStrict (const std::string &s, std::size_t &out)
static bool transferEncodingHasChunked (CiStringMap< std::string > &headers)
enum Parser::HTTPCompliance operator| (const enum Parser::HTTPCompliance &c1, const enum Parser::HTTPCompliance &c2)
enum Parser::HTTPCompliance operator& (const enum Parser::HTTPCompliance &c1, const enum Parser::HTTPCompliance &c2)

Enumeration Type Documentation

◆ ConnectionState

Enumerator
Default 
Keep 
Close 

Definition at line 51 of file ConnectionState.h.

◆ ContentType

Enumerator
Normal 
EventStream 

Definition at line 51 of file ContentType.h.

◆ TransferEncoding

Function Documentation

◆ ciContains()

bool web::http::ciContains ( const std::string & str1,
const std::string & str2 )

Definition at line 53 of file CiStringMap.cpp.

53 {
54 auto it = std::search(str1.begin(), str1.end(), str2.begin(), str2.end(), [](char ch1, char ch2) {
55 return std::tolower(ch1) == std::tolower(ch2);
56 });
57
58 return (it != str1.end());
59 }

Referenced by web::http::client::ResponseParser::analyzeHeader(), web::http::Parser::analyzeHeader(), web::http::server::RequestParser::analyzeHeader(), web::http::client::MasterRequest::requestEventSource(), web::http::client::SocketContext::requestPrepared(), web::http::server::SocketContext::responseStarted(), web::http::server::Response::sendFragment(), web::http::client::Request::set(), web::http::server::Response::set(), transferEncodingHasChunked(), web::http::client::Request::upgrade(), and web::http::server::Response::upgrade().

Here is the caller graph for this function:

◆ ciEquals()

bool web::http::ciEquals ( const std::string & str1,
const std::string & str2 )

Definition at line 61 of file CiStringMap.cpp.

61 {
62 return std::equal(str1.begin(), str1.end(), str2.begin(), str2.end(), [](char ch1, char ch2) {
63 return std::tolower(ch1) == std::tolower(ch2);
64 });
65 }

Referenced by web::http::client::Request::set(), and web::http::server::Response::set().

Here is the caller graph for this function:

◆ operator&()

enum Parser::HTTPCompliance web::http::operator& ( const enum Parser::HTTPCompliance & c1,
const enum Parser::HTTPCompliance & c2 )

Definition at line 309 of file Parser.cpp.

309 {
310 return static_cast<enum Parser::HTTPCompliance>(static_cast<unsigned short>(c1) & static_cast<unsigned short>(c2));
311 }

◆ operator|()

enum Parser::HTTPCompliance web::http::operator| ( const enum Parser::HTTPCompliance & c1,
const enum Parser::HTTPCompliance & c2 )

Definition at line 305 of file Parser.cpp.

305 {
306 return static_cast<enum Parser::HTTPCompliance>(static_cast<unsigned short>(c1) | static_cast<unsigned short>(c2));
307 }

◆ parseContentLengthStrict()

bool web::http::parseContentLengthStrict ( const std::string & s,
std::size_t & out )
static

Definition at line 63 of file Parser.cpp.

63 {
64 bool success = false;
65
66 unsigned long long value = 0;
67
68 if (!s.empty()) {
69 const char* first = s.data();
70 const char* last = s.data() + s.size();
71
72 const auto [ptr, ec] = std::from_chars(first, last, value, 10);
73
74 if (ec == std::errc{} && ptr == last && value <= static_cast<unsigned long long>(std::numeric_limits<std::size_t>::max())) {
75 out = static_cast<std::size_t>(value);
76 success = true;
77 }
78 }
79
80 return success;
81 }

Referenced by web::http::Parser::analyzeHeader().

Here is the caller graph for this function:

◆ transferEncodingHasChunked()

bool web::http::transferEncodingHasChunked ( CiStringMap< std::string > & headers)
static

Definition at line 83 of file Parser.cpp.

83 {
84 bool hasChunked = false;
85
86 if (headers.contains("Transfer-Encoding")) {
87 const std::string& encoding = headers["Transfer-Encoding"];
88 hasChunked = web::http::ciContains(encoding, "chunked");
89 }
90
91 return hasChunked;
92 }
bool ciContains(const std::string &str1, const std::string &str2)

References ciContains().

Referenced by web::http::Parser::analyzeHeader().

Here is the call graph for this function:
Here is the caller graph for this function: