SNode.C
Loading...
Searching...
No Matches
web::http::client::Response Class Reference

#include <Response.h>

Collaboration diagram for web::http::client::Response:

Public Member Functions

 Response ()=default
 
 Response (Response &)=delete
 
 Response (Response &&) noexcept=default
 
Responseoperator= (Response &)=delete
 
Responseoperator= (Response &&) noexcept=delete
 
const std::string & get (const std::string &key, int i=0) const
 
const std::string & cookie (const std::string &key) const
 

Public Attributes

std::string httpVersion
 
std::string statusCode
 
std::string reason
 
int httpMajor = 0
 
int httpMinor = 0
 
CiStringMap< std::string > headers
 
CiStringMap< CookieOptionscookies
 
std::vector< char > body
 

Protected Attributes

ConnectionState connectionState = ConnectionState::Default
 

Private Attributes

std::string nullstr
 

Friends

class SocketContext
 
class ResponseParser
 

Detailed Description

Definition at line 60 of file Response.h.

Constructor & Destructor Documentation

◆ Response() [1/3]

web::http::client::Response::Response ( )
default

◆ Response() [2/3]

web::http::client::Response::Response ( Response )
explicitdelete

◆ Response() [3/3]

web::http::client::Response::Response ( Response &&  )
explicitdefaultnoexcept

Member Function Documentation

◆ cookie()

const std::string & web::http::client::Response::cookie ( const std::string &  key) const

Definition at line 69 of file Response.cpp.

69 {
70 const CiStringMap<CookieOptions>::const_iterator it = cookies.find(key);
71
72 if (it != cookies.end()) {
73 return it->second.getValue();
74 }
75
76 return nullstr;
77 }
CiStringMap< CookieOptions > cookies
Definition Response.h:85

References cookies, web::http::CookieOptions::getValue(), and nullstr.

Here is the call graph for this function:

◆ get()

const std::string & web::http::client::Response::get ( const std::string &  key,
int  i = 0 
) const

Definition at line 53 of file Response.cpp.

53 {
54 if (headers.find(key) != headers.end()) {
55 std::pair<std::multimap<std::string, std::string>::const_iterator, std::multimap<std::string, std::string>::const_iterator>
56 range = headers.equal_range(key);
57
58 if (std::distance(range.first, range.second) >= i) {
59 std::advance(range.first, i);
60 return (*(range.first)).second;
61 }
62
63 return nullstr;
64 }
65
66 return nullstr;
67 }
CiStringMap< std::string > headers
Definition Response.h:84

References headers, and nullstr.

Referenced by web::websocket::client::SocketContextUpgradeFactory::create(), web::http::client::SocketContextUpgradeFactorySelector::select(), and web::http::client::Request::upgrade().

Here is the caller graph for this function:

◆ operator=() [1/2]

Response & web::http::client::Response::operator= ( Response &&  )
deletenoexcept

◆ operator=() [2/2]

Response & web::http::client::Response::operator= ( Response )
delete

Friends And Related Symbol Documentation

◆ ResponseParser

friend class ResponseParser
friend

Definition at line 93 of file Response.h.

◆ SocketContext

friend class SocketContext
friend

Definition at line 91 of file Response.h.

Member Data Documentation

◆ body

std::vector<char> web::http::client::Response::body

◆ connectionState

ConnectionState web::http::client::Response::connectionState = ConnectionState::Default
protected

◆ cookies

CiStringMap<CookieOptions> web::http::client::Response::cookies

Definition at line 85 of file Response.h.

Referenced by web::http::client::ResponseParser::analyzeHeader(), cookie(), and main().

◆ headers

CiStringMap<std::string> web::http::client::Response::headers

Definition at line 84 of file Response.h.

Referenced by get(), main(), and web::http::client::ResponseParser::parsingFinished().

◆ httpMajor

int web::http::client::Response::httpMajor = 0

◆ httpMinor

int web::http::client::Response::httpMinor = 0

◆ httpVersion

std::string web::http::client::Response::httpVersion

Definition at line 78 of file Response.h.

Referenced by main(), and web::http::client::ResponseParser::parseStartLine().

◆ nullstr

std::string web::http::client::Response::nullstr
private

Definition at line 89 of file Response.h.

Referenced by cookie(), and get().

◆ reason

std::string web::http::client::Response::reason

Definition at line 80 of file Response.h.

Referenced by main(), and web::http::client::ResponseParser::parseStartLine().

◆ statusCode

std::string web::http::client::Response::statusCode

Definition at line 79 of file Response.h.

Referenced by main(), and web::http::client::ResponseParser::parseStartLine().


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