NCBI C++ ToolKit
Classes | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
CHttpReply Class Reference

Search Toolkit Book for CHttpReply

#include "http_reply.hpp"
(Private to src/app/pubseq_gateway/server.)

+ Collaboration diagram for CHttpReply:

Classes

struct  CDataTrigger
 

Public Types

enum  EReplyState { eReplyInitialized , eReplyStarted , eReplyFinished }
 

Public Member Functions

 CHttpReply (h2o_req_t *req, CHttpProto *proto, CHttpConnection *http_conn, const char *cd_uid)
 
 CHttpReply (const CHttpReply &)=delete
 
 CHttpReply (CHttpReply &&)=delete
 
CHttpReplyoperator= (const CHttpReply &)=delete
 
CHttpReplyoperator= (CHttpReply &&)=delete
 
 ~CHttpReply ()
 
void AssignPendingReq (unique_ptr< CPendingOperation > pending_req)
 
void ResetPendingRequest (void)
 
void SetContentLength (uint64_t content_length)
 
void SetRequestId (size_t request_id)
 
void SetContentType (EPSGS_ReplyMimeType mime_type)
 
size_t GetBytesSent (void) const
 
void Send (const char *payload, size_t payload_len, bool is_persist, bool is_last)
 
void Send (std::vector< h2o_iovec_t > &payload, bool is_last)
 
void NotifyClientConnectionDrop (void)
 
void SendOk (const char *payload, size_t payload_len, bool is_persist)
 
void Send202 (const char *payload, size_t payload_len)
 
void Send400 (const char *payload)
 
void Send401 (const char *payload)
 
void Send404 (const char *payload)
 
void Send409 (const char *payload)
 
void Send500 (const char *payload)
 
void Send502 (const char *payload)
 
void Send503 (const char *payload)
 
CHttpConnectionGetHttpConnection (void)
 
void PeekPending (void)
 
void CancelPending (bool from_flush=false)
 
EReplyState GetState (void) const
 
bool IsFinished (void) const
 
bool IsOutputReady (void) const
 
bool IsPostponed (void) const
 
bool IsClosed (void) const
 
bool IsCompleted (void) const
 
void SetCompleted (void)
 
void SetPostponed (void)
 
list< shared_ptr< CPendingOperation > > & GetPendingReqs (void)
 
h2o_iovec_t PrepareChunk (const unsigned char *data, unsigned int size)
 
bool CheckResetDataTriggered (void)
 
void Error (const char *what)
 
shared_ptr< CCassDataCallbackReceiverGetDataReadyCB (void)
 
bool GetExceedSoftLimitFlag (void) const
 

Private Member Functions

void AssignGenerator (void)
 
void NeedOutput (void)
 
void StopCB (void)
 
void ProceedCB (void)
 
bool x_ConnectionPrecheck (size_t count, bool is_last)
 
void x_HandleConnectionState (int status, const char *reason)
 
void x_DoSend (h2o_iovec_t *vec, size_t count, bool is_last, int status=200, const char *reason=k_ReasonOK)
 
void x_SendPsg503 (const string &msg, EPSGS_PubseqGatewayErrorCode err_code)
 
void x_SendCanceled (void)
 
void x_DoCancel (void)
 
void x_GenericSendError (int status, const char *head, const char *payload)
 
void x_SetContentType (void)
 
void x_SetCdUid (void)
 
void x_Clear (void)
 

Static Private Member Functions

static void s_StopCB (h2o_generator_t *_generator, h2o_req_t *req)
 
static void s_ProceedCB (h2o_generator_t *_generator, h2o_req_t *req)
 
static void s_GeneratorDisposalCB (void *gen)
 

Private Attributes

h2o_req_t * m_Req
 
SRespGeneratorm_RespGenerator
 
size_t m_RequestId
 
bool m_OutputIsReady
 
bool m_OutputFinished
 
bool m_Postponed
 
bool m_Canceled
 
bool m_Completed
 
EReplyState m_State
 
CHttpProtom_HttpProto
 
CHttpConnectionm_HttpConn
 
list< shared_ptr< CPendingOperation > > m_PendingReqs
 
shared_ptr< CDataTriggerm_DataReady
 
EPSGS_ReplyMimeType m_ReplyContentType
 
const char * m_CdUid
 

Detailed Description

Definition at line 72 of file http_reply.hpp.

Member Enumeration Documentation

◆ EReplyState

Enumerator
eReplyInitialized 
eReplyStarted 
eReplyFinished 

Definition at line 75 of file http_reply.hpp.

Constructor & Destructor Documentation

◆ CHttpReply() [1/3]

CHttpReply::CHttpReply ( h2o_req_t *  req,
CHttpProto proto,
CHttpConnection http_conn,
const char *  cd_uid 
)
inline

Definition at line 81 of file http_reply.hpp.

◆ CHttpReply() [2/3]

CHttpReply::CHttpReply ( const CHttpReply )
delete

◆ CHttpReply() [3/3]

CHttpReply::CHttpReply ( CHttpReply &&  )
delete

◆ ~CHttpReply()

CHttpReply::~CHttpReply ( )
inline

Definition at line 107 of file http_reply.hpp.

References PSG_TRACE, and x_Clear().

Member Function Documentation

◆ AssignGenerator()

void CHttpReply::AssignGenerator ( void  )
inlineprivate

◆ AssignPendingReq()

void CHttpReply::AssignPendingReq ( unique_ptr< CPendingOperation pending_req)
inline

Definition at line 113 of file http_reply.hpp.

References m_PendingReqs.

◆ CancelPending()

void CHttpReply::CancelPending ( bool  from_flush = false)
inline

Definition at line 241 of file http_reply.hpp.

References m_Postponed, NCBI_THROW, and x_DoCancel().

Referenced by Error().

◆ CheckResetDataTriggered()

bool CHttpReply::CheckResetDataTriggered ( void  )
inline

Definition at line 291 of file http_reply.hpp.

References m_DataReady.

◆ Error()

void CHttpReply::Error ( const char *  what)
inline

◆ GetBytesSent()

size_t CHttpReply::GetBytesSent ( void  ) const
inline

Definition at line 148 of file http_reply.hpp.

References m_Req.

Referenced by CPSGS_Reply::GetBytesSent().

◆ GetDataReadyCB()

shared_ptr<CCassDataCallbackReceiver> CHttpReply::GetDataReadyCB ( void  )
inline

Definition at line 308 of file http_reply.hpp.

References m_DataReady.

Referenced by CPSGS_Reply::GetDataReadyCB().

◆ GetExceedSoftLimitFlag()

bool CHttpReply::GetExceedSoftLimitFlag ( void  ) const

◆ GetHttpConnection()

CHttpConnection* CHttpReply::GetHttpConnection ( void  )
inline

Definition at line 222 of file http_reply.hpp.

References m_HttpConn.

◆ GetPendingReqs()

list<shared_ptr<CPendingOperation> >& CHttpReply::GetPendingReqs ( void  )
inline

Definition at line 273 of file http_reply.hpp.

References m_PendingReqs, and NCBI_THROW.

◆ GetState()

EReplyState CHttpReply::GetState ( void  ) const
inline

Definition at line 251 of file http_reply.hpp.

References m_State.

◆ IsClosed()

bool CHttpReply::IsClosed ( void  ) const

◆ IsCompleted()

bool CHttpReply::IsCompleted ( void  ) const
inline

Definition at line 265 of file http_reply.hpp.

References m_Completed.

Referenced by CPSGS_Reply::IsCompleted().

◆ IsFinished()

bool CHttpReply::IsFinished ( void  ) const
inline

Definition at line 254 of file http_reply.hpp.

References eReplyFinished, and m_State.

Referenced by CPSGS_Reply::IsFinished().

◆ IsOutputReady()

bool CHttpReply::IsOutputReady ( void  ) const
inline

Definition at line 257 of file http_reply.hpp.

References m_OutputIsReady.

Referenced by CPSGS_Reply::Flush(), and CPSGS_Reply::IsOutputReady().

◆ IsPostponed()

bool CHttpReply::IsPostponed ( void  ) const
inline

Definition at line 260 of file http_reply.hpp.

References m_Postponed.

◆ NeedOutput()

void CHttpReply::NeedOutput ( void  )
private

Definition at line 169 of file http_reply.cpp.

References eReplyFinished, m_HttpProto, m_State, PeekPending(), PSG_TRACE, and CHttpProto::WakeWorker().

Referenced by ProceedCB(), and StopCB().

◆ NotifyClientConnectionDrop()

void CHttpReply::NotifyClientConnectionDrop ( void  )
inline

Definition at line 187 of file http_reply.hpp.

References eReplyFinished, and m_State.

Referenced by CPSGS_Reply::ConnectionCancel().

◆ operator=() [1/2]

CHttpReply& CHttpReply::operator= ( CHttpReply &&  )
delete

◆ operator=() [2/2]

CHttpReply& CHttpReply::operator= ( const CHttpReply )
delete

◆ PeekPending()

void CHttpReply::PeekPending ( void  )
inline

Definition at line 225 of file http_reply.hpp.

References Error(), m_PendingReqs, m_Postponed, and NCBI_THROW.

Referenced by NeedOutput().

◆ PrepareChunk()

h2o_iovec_t CHttpReply::PrepareChunk ( const unsigned char *  data,
unsigned int  size 
)
inline

◆ ProceedCB()

void CHttpReply::ProceedCB ( void  )
inlineprivate

Definition at line 382 of file http_reply.hpp.

References m_OutputIsReady, NeedOutput(), and PSG_TRACE.

Referenced by s_ProceedCB().

◆ ResetPendingRequest()

void CHttpReply::ResetPendingRequest ( void  )
inline

Definition at line 120 of file http_reply.hpp.

References m_PendingReqs.

◆ s_GeneratorDisposalCB()

static void CHttpReply::s_GeneratorDisposalCB ( void *  gen)
inlinestaticprivate

Definition at line 405 of file http_reply.hpp.

References gen, SRespGenerator::m_RequestId, and OnLibh2oFinished().

Referenced by AssignGenerator().

◆ s_ProceedCB()

static void CHttpReply::s_ProceedCB ( h2o_generator_t *  _generator,
h2o_req_t *  req 
)
inlinestaticprivate

Definition at line 397 of file http_reply.hpp.

References gen, and ProceedCB().

Referenced by AssignGenerator().

◆ s_StopCB()

static void CHttpReply::s_StopCB ( h2o_generator_t *  _generator,
h2o_req_t *  req 
)
inlinestaticprivate

Definition at line 389 of file http_reply.hpp.

References gen, and StopCB().

Referenced by AssignGenerator().

◆ Send() [1/2]

void CHttpReply::Send ( const char *  payload,
size_t  payload_len,
bool  is_persist,
bool  is_last 
)
inline

Definition at line 155 of file http_reply.hpp.

References m_Req, and x_DoSend().

Referenced by Error(), CPSGS_Reply::Flush(), and SendOk().

◆ Send() [2/2]

void CHttpReply::Send ( std::vector< h2o_iovec_t > &  payload,
bool  is_last 
)
inline

Definition at line 176 of file http_reply.hpp.

References x_DoSend().

◆ Send202()

void CHttpReply::Send202 ( const char *  payload,
size_t  payload_len 
)
inline

Definition at line 195 of file http_reply.hpp.

References k_ReasonAccepted, m_Req, and x_DoSend().

Referenced by CPSGS_Reply::Send202().

◆ Send400()

void CHttpReply::Send400 ( const char *  payload)
inline

Definition at line 201 of file http_reply.hpp.

References k_BadRequest, and x_GenericSendError().

Referenced by CPSGS_Reply::Send400().

◆ Send401()

void CHttpReply::Send401 ( const char *  payload)
inline

Definition at line 204 of file http_reply.hpp.

References k_Unauthorized, and x_GenericSendError().

Referenced by CPSGS_Reply::Send401().

◆ Send404()

void CHttpReply::Send404 ( const char *  payload)
inline

Definition at line 207 of file http_reply.hpp.

References k_NotFound, and x_GenericSendError().

Referenced by CPSGS_Reply::Send404().

◆ Send409()

void CHttpReply::Send409 ( const char *  payload)
inline

Definition at line 210 of file http_reply.hpp.

References k_Conflict, and x_GenericSendError().

Referenced by CPSGS_Reply::Send409().

◆ Send500()

void CHttpReply::Send500 ( const char *  payload)
inline

Definition at line 213 of file http_reply.hpp.

References k_InternalServerError, and x_GenericSendError().

Referenced by CPSGS_Reply::Send500().

◆ Send502()

void CHttpReply::Send502 ( const char *  payload)
inline

Definition at line 216 of file http_reply.hpp.

References k_BadGateway, and x_GenericSendError().

Referenced by CPSGS_Reply::Send502().

◆ Send503()

void CHttpReply::Send503 ( const char *  payload)
inline

Definition at line 219 of file http_reply.hpp.

References k_ServiceUnavailable, and x_GenericSendError().

Referenced by CPSGS_Reply::Send503().

◆ SendOk()

void CHttpReply::SendOk ( const char *  payload,
size_t  payload_len,
bool  is_persist 
)
inline

Definition at line 192 of file http_reply.hpp.

References Send().

Referenced by CPSGS_Reply::SendOk().

◆ SetCompleted()

void CHttpReply::SetCompleted ( void  )

◆ SetContentLength()

void CHttpReply::SetContentLength ( uint64_t  content_length)
inline

Definition at line 128 of file http_reply.hpp.

References eReplyInitialized, m_Req, m_State, and NCBI_THROW.

Referenced by CPSGS_Reply::SetContentLength().

◆ SetContentType()

void CHttpReply::SetContentType ( EPSGS_ReplyMimeType  mime_type)
inline

Definition at line 143 of file http_reply.hpp.

References m_ReplyContentType.

Referenced by CPSGS_Reply::SetContentType().

◆ SetPostponed()

void CHttpReply::SetPostponed ( void  )
inline

Definition at line 270 of file http_reply.hpp.

References m_Postponed.

◆ SetRequestId()

void CHttpReply::SetRequestId ( size_t  request_id)
inline

Definition at line 138 of file http_reply.hpp.

References m_RequestId.

Referenced by CPSGS_Reply::SetRequestId().

◆ StopCB()

void CHttpReply::StopCB ( void  )
inlineprivate

◆ x_Clear()

void CHttpReply::x_Clear ( void  )
inlineprivate

◆ x_ConnectionPrecheck()

bool CHttpReply::x_ConnectionPrecheck ( size_t  count,
bool  is_last 
)
private

◆ x_DoCancel()

void CHttpReply::x_DoCancel ( void  )
private

◆ x_DoSend()

void CHttpReply::x_DoSend ( h2o_iovec_t *  vec,
size_t  count,
bool  is_last,
int  status = 200,
const char *  reason = k_ReasonOK 
)
inlineprivate

◆ x_GenericSendError()

void CHttpReply::x_GenericSendError ( int  status,
const char *  head,
const char *  payload 
)
private

◆ x_HandleConnectionState()

void CHttpReply::x_HandleConnectionState ( int  status,
const char *  reason 
)
inlineprivate

◆ x_SendCanceled()

void CHttpReply::x_SendCanceled ( void  )
inlineprivate

Definition at line 485 of file http_reply.hpp.

References ePSGS_RequestCancelled, m_Canceled, m_OutputFinished, m_OutputIsReady, and x_SendPsg503().

Referenced by x_DoCancel(), and x_DoSend().

◆ x_SendPsg503()

void CHttpReply::x_SendPsg503 ( const string msg,
EPSGS_PubseqGatewayErrorCode  err_code 
)
inlineprivate

◆ x_SetCdUid()

void CHttpReply::x_SetCdUid ( void  )
inlineprivate

Definition at line 549 of file http_reply.hpp.

References m_CdUid, m_Req, and NULL.

Referenced by x_GenericSendError(), and x_HandleConnectionState().

◆ x_SetContentType()

void CHttpReply::x_SetContentType ( void  )
inlineprivate

Member Data Documentation

◆ m_Canceled

bool CHttpReply::m_Canceled
private

◆ m_CdUid

const char* CHttpReply::m_CdUid
private

Definition at line 598 of file http_reply.hpp.

Referenced by x_SetCdUid().

◆ m_Completed

bool CHttpReply::m_Completed
private

Definition at line 589 of file http_reply.hpp.

Referenced by IsCompleted(), SetCompleted(), and x_Clear().

◆ m_DataReady

shared_ptr<CDataTrigger> CHttpReply::m_DataReady
private

Definition at line 596 of file http_reply.hpp.

Referenced by CheckResetDataTriggered(), and GetDataReadyCB().

◆ m_HttpConn

CHttpConnection* CHttpReply::m_HttpConn
private

◆ m_HttpProto

CHttpProto* CHttpReply::m_HttpProto
private

Definition at line 591 of file http_reply.hpp.

Referenced by NeedOutput(), and x_Clear().

◆ m_OutputFinished

bool CHttpReply::m_OutputFinished
private

◆ m_OutputIsReady

bool CHttpReply::m_OutputIsReady
private

◆ m_PendingReqs

list<shared_ptr<CPendingOperation> > CHttpReply::m_PendingReqs
private

◆ m_Postponed

bool CHttpReply::m_Postponed
private

Definition at line 587 of file http_reply.hpp.

Referenced by CancelPending(), IsPostponed(), PeekPending(), SetPostponed(), and x_Clear().

◆ m_ReplyContentType

EPSGS_ReplyMimeType CHttpReply::m_ReplyContentType
private

Definition at line 597 of file http_reply.hpp.

Referenced by SetContentType(), x_Clear(), and x_SetContentType().

◆ m_Req

h2o_req_t* CHttpReply::m_Req
private

◆ m_RequestId

size_t CHttpReply::m_RequestId
private

Definition at line 583 of file http_reply.hpp.

Referenced by AssignGenerator(), and SetRequestId().

◆ m_RespGenerator

SRespGenerator* CHttpReply::m_RespGenerator
private

Definition at line 582 of file http_reply.hpp.

Referenced by AssignGenerator(), StopCB(), and x_HandleConnectionState().

◆ m_State

EReplyState CHttpReply::m_State
private

The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:58:10 2024 by modify_doxy.py rev. 669887