SNode.C
|
#include <SocketContext.h>
Public Member Functions | |
SocketContext (core::socket::stream::SocketConnection *socketConnection, const std::function< void(const std::shared_ptr< Request > &)> &onRequestBegin, const std::function< void(const std::shared_ptr< Request > &)> &onRequestEnd, bool pipelinedRequests) | |
~SocketContext () override | |
![]() | |
SocketContext (core::socket::stream::SocketConnection *socketConnection) | |
void | sendToPeer (const char *chunk, std::size_t chunkLen) const final |
bool | streamToPeer (core::pipe::Source *source) const |
void | streamEof () |
std::size_t | readFromPeer (char *chunk, std::size_t chunklen) const final |
void | setTimeout (const utils::Timeval &timeout) final |
void | shutdownRead () |
void | shutdownWrite (bool forceClose=false) |
void | close () override |
SocketConnection * | getSocketConnection () const |
virtual void | switchSocketContext (SocketContext *newSocketContext) |
void | sendToPeer (const std::string &data) const |
![]() | |
SocketContext (const SocketContext &)=delete | |
SocketContext (SocketContext &&)=delete | |
SocketContext & | operator= (const SocketContext &)=delete |
SocketContext & | operator= (SocketContext &&)=delete |
void | sendToPeer (const std::string &data) const |
Private Types | |
enum | Flags { NONE = 0b00000000 , HTTP10 = 0b00000001 , HTTP11 = 0b00000010 , KEEPALIVE = 0b00000100 , CLOSE = 0b00001000 } |
using | Super = core::socket::stream::SocketContext |
using | Request = web::http::client::Request |
using | Response = web::http::client::Response |
Private Member Functions | |
void | requestPrepared (Request &&request) |
void | initiateRequest (Request &request) |
void | requestDelivered (Request &&request, bool success) |
void | responseStarted () |
void | deliverResponse (Response &&response) |
void | deliverResponseParseError (int status, const std::string &reason) |
void | responseDelivered (bool httpClose) |
void | onConnected () override |
std::size_t | onReceivedFromPeer () override |
void | onDisconnected () override |
bool | onSignal (int signum) override |
void | onWriteError (int errnum) override |
Private Attributes | |
std::function< void(const std::shared_ptr< Request > &)> | onRequestBegin |
std::function< void(const std::shared_ptr< Request > &)> | onRequestEnd |
std::list< Request > | pendingRequests |
std::list< Request > | deliveredRequests |
bool | pipelinedRequests = false |
std::shared_ptr< Request > | currentRequest = nullptr |
std::shared_ptr< Request > | masterRequest |
ResponseParser | parser |
int | flags = Flags::NONE |
Friends | |
class | web::http::client::Request |
Additional Inherited Members | |
![]() | |
void | onReadError (int errnum) override |
![]() | |
SocketContext ()=default | |
Definition at line 43 of file SocketContext.h.
|
private |
Definition at line 47 of file SocketContext.h.
Definition at line 48 of file SocketContext.h.
Definition at line 45 of file SocketContext.h.
|
private |
web::http::client::SocketContext::SocketContext | ( | core::socket::stream::SocketConnection * | socketConnection, |
const std::function< void(const std::shared_ptr< Request > &)> & | onRequestBegin, | ||
const std::function< void(const std::shared_ptr< Request > &)> & | onRequestEnd, | ||
bool | pipelinedRequests ) |
Definition at line 39 of file SocketContext.cpp.
References pipelinedRequests, and SocketContext().
Referenced by SocketContext().
|
overridevirtual |
Reimplemented from core::socket::SocketContext.
Definition at line 65 of file SocketContext.cpp.
|
private |
Definition at line 201 of file SocketContext.cpp.
References responseDelivered().
|
private |
Definition at line 227 of file SocketContext.cpp.
|
private |
Definition at line 112 of file SocketContext.cpp.
Referenced by requestPrepared().
|
overrideprivatevirtual |
Implements core::socket::stream::SocketContext.
Definition at line 271 of file SocketContext.cpp.
|
overrideprivatevirtual |
Implements core::socket::stream::SocketContext.
Definition at line 287 of file SocketContext.cpp.
References web::http::client::Request::httpMajor, and web::http::client::Request::httpMinor.
|
overrideprivatevirtual |
Implements core::socket::SocketContext.
Definition at line 277 of file SocketContext.cpp.
|
overrideprivatevirtual |
Implements core::socket::SocketContext.
Definition at line 300 of file SocketContext.cpp.
|
overrideprivatevirtual |
Reimplemented from core::socket::stream::SocketContext.
Definition at line 306 of file SocketContext.cpp.
|
private |
Definition at line 146 of file SocketContext.cpp.
References pipelinedRequests.
|
private |
Definition at line 81 of file SocketContext.cpp.
References CLOSE, flags, HTTP10, HTTP11, web::http::client::Request::httpMajor, web::http::client::Request::httpMinor, initiateRequest(), KEEPALIVE, and NONE.
|
private |
Definition at line 245 of file SocketContext.cpp.
References pipelinedRequests.
Referenced by deliverResponse().
|
private |
Definition at line 184 of file SocketContext.cpp.
|
friend |
Definition at line 95 of file SocketContext.h.
|
private |
Definition at line 81 of file SocketContext.h.
|
private |
Definition at line 77 of file SocketContext.h.
|
private |
Definition at line 93 of file SocketContext.h.
Referenced by requestPrepared().
|
private |
Definition at line 82 of file SocketContext.h.
|
private |
Definition at line 67 of file SocketContext.h.
|
private |
Definition at line 68 of file SocketContext.h.
|
private |
Definition at line 84 of file SocketContext.h.
|
private |
Definition at line 76 of file SocketContext.h.
|
private |
Definition at line 79 of file SocketContext.h.
Referenced by requestDelivered(), responseDelivered(), and SocketContext().