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

Referenced by web::http::client::SocketContext::onDisconnected().

Here is the caller graph for this function:

◆ 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:84

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:83

References headers, and nullstr.

Referenced by web::websocket::client::SocketContextUpgradeFactory::create(), main(), web::http::client::SocketContextUpgradeFactorySelector::select(), web::http::client::MasterRequest::upgrade(), 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

◆ ResponseParser

friend class ResponseParser
friend

Definition at line 92 of file Response.h.

◆ SocketContext

friend class SocketContext
friend

Definition at line 90 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

◆ headers

◆ httpMajor

◆ httpMinor

◆ httpVersion

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

◆ nullstr

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

Definition at line 88 of file Response.h.

Referenced by cookie(), and get().

◆ reason

◆ statusCode


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