NCBI C++ ToolKit
|
Search Toolkit Book for CHttpReply
#include "http_reply.hpp"
(Private to src/app/pubseq_gateway/server
.)
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 | |
CHttpReply & | operator= (const CHttpReply &)=delete |
CHttpReply & | operator= (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) |
CHttpConnection * | GetHttpConnection (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< CCassDataCallbackReceiver > | GetDataReadyCB (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 |
SRespGenerator * | m_RespGenerator |
size_t | m_RequestId |
bool | m_OutputIsReady |
bool | m_OutputFinished |
bool | m_Postponed |
bool | m_Canceled |
bool | m_Completed |
EReplyState | m_State |
CHttpProto * | m_HttpProto |
CHttpConnection * | m_HttpConn |
list< shared_ptr< CPendingOperation > > | m_PendingReqs |
shared_ptr< CDataTrigger > | m_DataReady |
EPSGS_ReplyMimeType | m_ReplyContentType |
const char * | m_CdUid |
Definition at line 72 of file http_reply.hpp.
Enumerator | |
---|---|
eReplyInitialized | |
eReplyStarted | |
eReplyFinished |
Definition at line 75 of file http_reply.hpp.
|
inline |
Definition at line 81 of file http_reply.hpp.
|
delete |
|
delete |
|
inline |
Definition at line 107 of file http_reply.hpp.
|
inlineprivate |
Definition at line 340 of file http_reply.hpp.
References SRespGenerator::m_Generator, SRespGenerator::m_HttpReply, m_Req, SRespGenerator::m_RequestId, m_RequestId, m_RespGenerator, PSG_ERROR, s_GeneratorDisposalCB(), s_ProceedCB(), and s_StopCB().
Referenced by x_HandleConnectionState().
|
inline |
Definition at line 113 of file http_reply.hpp.
References m_PendingReqs.
Definition at line 241 of file http_reply.hpp.
References m_Postponed, NCBI_THROW, and x_DoCancel().
Referenced by Error().
|
inline |
Definition at line 291 of file http_reply.hpp.
References m_DataReady.
|
inline |
Definition at line 294 of file http_reply.hpp.
References CancelPending(), ePSGS_UnknownError, eReplyInitialized, eReplyStarted, m_State, Send(), and x_SendPsg503().
Referenced by PeekPending().
|
inline |
Definition at line 148 of file http_reply.hpp.
References m_Req.
Referenced by CPSGS_Reply::GetBytesSent().
|
inline |
Definition at line 308 of file http_reply.hpp.
References m_DataReady.
Referenced by CPSGS_Reply::GetDataReadyCB().
bool CHttpReply::GetExceedSoftLimitFlag | ( | void | ) | const |
Definition at line 89 of file http_reply.cpp.
References CHttpConnection::GetExceedSoftLimitFlag(), and m_HttpConn.
Referenced by CPSGS_Reply::GetExceedSoftLimitFlag().
|
inline |
Definition at line 222 of file http_reply.hpp.
References m_HttpConn.
|
inline |
Definition at line 273 of file http_reply.hpp.
References m_PendingReqs, and NCBI_THROW.
|
inline |
Definition at line 251 of file http_reply.hpp.
References m_State.
bool CHttpReply::IsClosed | ( | void | ) | const |
Definition at line 73 of file http_reply.cpp.
References CHttpConnection::IsClosed(), and m_HttpConn.
Referenced by CPSGS_Reply::IsClosed(), and CPSGS_Reply::PrepareReplyCompletion().
|
inline |
Definition at line 265 of file http_reply.hpp.
References m_Completed.
Referenced by CPSGS_Reply::IsCompleted().
|
inline |
Definition at line 254 of file http_reply.hpp.
References eReplyFinished, and m_State.
Referenced by CPSGS_Reply::IsFinished().
|
inline |
Definition at line 257 of file http_reply.hpp.
References m_OutputIsReady.
Referenced by CPSGS_Reply::Flush(), and CPSGS_Reply::IsOutputReady().
|
inline |
Definition at line 260 of file http_reply.hpp.
References m_Postponed.
|
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().
|
inline |
Definition at line 187 of file http_reply.hpp.
References eReplyFinished, and m_State.
Referenced by CPSGS_Reply::ConnectionCancel().
|
delete |
|
delete |
|
inline |
Definition at line 225 of file http_reply.hpp.
References Error(), m_PendingReqs, m_Postponed, and NCBI_THROW.
Referenced by NeedOutput().
Definition at line 281 of file http_reply.hpp.
References data, m_Req, NCBI_THROW, and ncbi::grid::netcache::search::fields::size.
Referenced by CPSGS_Reply::PrepareAccVerHistoryData(), CPSGS_Reply::PrepareBioseqCompletion(), CPSGS_Reply::PrepareBioseqData(), CPSGS_Reply::PrepareBioseqMessage(), CPSGS_Reply::PrepareBlobCompletion(), CPSGS_Reply::PrepareBlobData(), CPSGS_Reply::PrepareBlobExcluded(), CPSGS_Reply::PrepareBlobMessage(), CPSGS_Reply::PrepareBlobPropCompletion(), CPSGS_Reply::PrepareBlobPropData(), CPSGS_Reply::PrepareBlobPropMessage(), CPSGS_Reply::PrepareIPGInfoMessageAndMeta(), CPSGS_Reply::PrepareIPGResolveData(), CPSGS_Reply::PrepareNamedAnnotationData(), CPSGS_Reply::PrepareProcessorMessage(), CPSGS_Reply::PrepareProcessorProgressMessage(), CPSGS_Reply::PreparePublicComment(), CPSGS_Reply::PrepareReplyCompletion(), CPSGS_Reply::PrepareReplyMessage(), CPSGS_Reply::PrepareRequestTimeoutMessage(), CPSGS_Reply::PrepareTSEBlobCompletion(), CPSGS_Reply::PrepareTSEBlobData(), CPSGS_Reply::PrepareTSEBlobExcluded(), CPSGS_Reply::PrepareTSEBlobPropData(), CPSGS_Reply::SendPerNamedAnnotationResults(), CPSGS_Reply::x_PrepareTSEBlobMessage(), CPSGS_Reply::x_PrepareTSEBlobPropCompletion(), and CPSGS_Reply::x_PrepareTSEBlobPropMessage().
|
inlineprivate |
Definition at line 382 of file http_reply.hpp.
References m_OutputIsReady, NeedOutput(), and PSG_TRACE.
Referenced by s_ProceedCB().
|
inline |
Definition at line 120 of file http_reply.hpp.
References m_PendingReqs.
|
inlinestaticprivate |
Definition at line 405 of file http_reply.hpp.
References gen, SRespGenerator::m_RequestId, and OnLibh2oFinished().
Referenced by AssignGenerator().
|
inlinestaticprivate |
Definition at line 397 of file http_reply.hpp.
References gen, and ProceedCB().
Referenced by AssignGenerator().
|
inlinestaticprivate |
Definition at line 389 of file http_reply.hpp.
Referenced by AssignGenerator().
|
inline |
Definition at line 155 of file http_reply.hpp.
References m_Req, and x_DoSend().
Referenced by Error(), CPSGS_Reply::Flush(), and SendOk().
|
inline |
Definition at line 176 of file http_reply.hpp.
References x_DoSend().
|
inline |
Definition at line 195 of file http_reply.hpp.
References k_ReasonAccepted, m_Req, and x_DoSend().
Referenced by CPSGS_Reply::Send202().
|
inline |
Definition at line 201 of file http_reply.hpp.
References k_BadRequest, and x_GenericSendError().
Referenced by CPSGS_Reply::Send400().
|
inline |
Definition at line 204 of file http_reply.hpp.
References k_Unauthorized, and x_GenericSendError().
Referenced by CPSGS_Reply::Send401().
|
inline |
Definition at line 207 of file http_reply.hpp.
References k_NotFound, and x_GenericSendError().
Referenced by CPSGS_Reply::Send404().
|
inline |
Definition at line 210 of file http_reply.hpp.
References k_Conflict, and x_GenericSendError().
Referenced by CPSGS_Reply::Send409().
|
inline |
Definition at line 213 of file http_reply.hpp.
References k_InternalServerError, and x_GenericSendError().
Referenced by CPSGS_Reply::Send500().
|
inline |
Definition at line 216 of file http_reply.hpp.
References k_BadGateway, and x_GenericSendError().
Referenced by CPSGS_Reply::Send502().
|
inline |
Definition at line 219 of file http_reply.hpp.
References k_ServiceUnavailable, and x_GenericSendError().
Referenced by CPSGS_Reply::Send503().
Definition at line 192 of file http_reply.hpp.
References Send().
Referenced by CPSGS_Reply::SendOk().
void CHttpReply::SetCompleted | ( | void | ) |
Definition at line 79 of file http_reply.cpp.
References m_Completed, m_HttpConn, and CHttpConnection::ScheduleMaintain().
Referenced by CPSGS_Reply::Send202(), CPSGS_Reply::Send400(), CPSGS_Reply::Send401(), CPSGS_Reply::Send404(), CPSGS_Reply::Send409(), CPSGS_Reply::Send500(), CPSGS_Reply::Send502(), CPSGS_Reply::Send503(), CPSGS_Reply::SendOk(), and CPSGS_Reply::SetCompleted().
|
inline |
Definition at line 128 of file http_reply.hpp.
References eReplyInitialized, m_Req, m_State, and NCBI_THROW.
Referenced by CPSGS_Reply::SetContentLength().
|
inline |
Definition at line 143 of file http_reply.hpp.
References m_ReplyContentType.
Referenced by CPSGS_Reply::SetContentType().
|
inline |
Definition at line 270 of file http_reply.hpp.
References m_Postponed.
|
inline |
Definition at line 138 of file http_reply.hpp.
References m_RequestId.
Referenced by CPSGS_Reply::SetRequestId().
|
inlineprivate |
Definition at line 362 of file http_reply.hpp.
References eReplyFinished, SRespGenerator::m_Generator, m_OutputFinished, m_OutputIsReady, m_Req, m_RespGenerator, m_State, NeedOutput(), PSG_TRACE, and x_DoCancel().
Referenced by s_StopCB().
|
inlineprivate |
Definition at line 559 of file http_reply.hpp.
References ePSGS_NotSet, eReplyInitialized, m_Canceled, m_Completed, m_HttpConn, m_HttpProto, m_OutputFinished, m_OutputIsReady, m_PendingReqs, m_Postponed, m_ReplyContentType, m_Req, and m_State.
Referenced by ~CHttpReply().
Definition at line 46 of file http_reply.cpp.
References count, eReplyFinished, CHttpConnection::IsClosed(), m_HttpConn, m_OutputFinished, m_OutputIsReady, m_State, NCBI_THROW, PSG_ERROR, and x_DoCancel().
Referenced by x_DoSend().
|
private |
Definition at line 97 of file http_reply.cpp.
References CHttpConnection::IsClosed(), m_Canceled, m_HttpConn, m_OutputFinished, m_OutputIsReady, m_PendingReqs, and x_SendCanceled().
Referenced by CancelPending(), StopCB(), and x_ConnectionPrecheck().
|
inlineprivate |
Definition at line 439 of file http_reply.hpp.
References count, eReplyFinished, m_Canceled, m_OutputFinished, m_OutputIsReady, m_Req, m_State, PSG_TRACE, x_ConnectionPrecheck(), x_HandleConnectionState(), and x_SendCanceled().
Definition at line 110 of file http_reply.cpp.
References eReplyFinished, eReplyInitialized, head, CHttpConnection::IsClosed(), m_HttpConn, m_OutputFinished, m_OutputIsReady, m_Req, m_State, NCBI_THROW, x_SetCdUid(), and x_SetContentType().
Referenced by Send400(), Send401(), Send404(), Send409(), Send500(), Send502(), and Send503().
Definition at line 415 of file http_reply.hpp.
References AssignGenerator(), eReplyFinished, eReplyInitialized, eReplyStarted, m_Canceled, SRespGenerator::m_Generator, m_OutputIsReady, m_Req, m_RespGenerator, m_State, NCBI_THROW, x_SetCdUid(), and x_SetContentType().
Referenced by x_DoSend().
|
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().
|
inlineprivate |
Definition at line 465 of file http_reply.hpp.
References CRequestStatus::e503_ServiceUnavailable, eDiag_Error, CPSGS_Reply::ePSGS_SendAndFinish, CPSGS_Reply::Flush(), m_PendingReqs, msg(), CPSGS_Reply::PrepareReplyCompletion(), CPSGS_Reply::PrepareReplyMessage(), and CPSGS_Reply::SetCompleted().
Referenced by Error(), and x_SendCanceled().
|
inlineprivate |
Definition at line 549 of file http_reply.hpp.
References m_CdUid, m_Req, and NULL.
Referenced by x_GenericSendError(), and x_HandleConnectionState().
|
inlineprivate |
Definition at line 496 of file http_reply.hpp.
References ePSGS_BinaryMime, ePSGS_HtmlMime, ePSGS_ImageMime, ePSGS_JsonMime, ePSGS_NotSet, ePSGS_PlainTextMime, ePSGS_PSGMime, eReplyInitialized, m_ReplyContentType, m_Req, m_State, NCBI_THROW, NULL, and PSG_WARNING.
Referenced by x_GenericSendError(), and x_HandleConnectionState().
|
private |
Definition at line 588 of file http_reply.hpp.
Referenced by x_Clear(), x_DoCancel(), x_DoSend(), x_HandleConnectionState(), and x_SendCanceled().
|
private |
Definition at line 598 of file http_reply.hpp.
Referenced by x_SetCdUid().
|
private |
Definition at line 589 of file http_reply.hpp.
Referenced by IsCompleted(), SetCompleted(), and x_Clear().
|
private |
Definition at line 596 of file http_reply.hpp.
Referenced by CheckResetDataTriggered(), and GetDataReadyCB().
|
private |
Definition at line 592 of file http_reply.hpp.
Referenced by GetExceedSoftLimitFlag(), GetHttpConnection(), IsClosed(), SetCompleted(), x_Clear(), x_ConnectionPrecheck(), x_DoCancel(), and x_GenericSendError().
|
private |
Definition at line 591 of file http_reply.hpp.
Referenced by NeedOutput(), and x_Clear().
|
private |
Definition at line 586 of file http_reply.hpp.
Referenced by StopCB(), x_Clear(), x_ConnectionPrecheck(), x_DoCancel(), x_DoSend(), x_GenericSendError(), and x_SendCanceled().
|
private |
Definition at line 585 of file http_reply.hpp.
Referenced by IsOutputReady(), ProceedCB(), StopCB(), x_Clear(), x_ConnectionPrecheck(), x_DoCancel(), x_DoSend(), x_GenericSendError(), x_HandleConnectionState(), and x_SendCanceled().
|
private |
Definition at line 594 of file http_reply.hpp.
Referenced by AssignPendingReq(), GetPendingReqs(), PeekPending(), ResetPendingRequest(), x_Clear(), x_DoCancel(), and x_SendPsg503().
|
private |
Definition at line 587 of file http_reply.hpp.
Referenced by CancelPending(), IsPostponed(), PeekPending(), SetPostponed(), and x_Clear().
|
private |
Definition at line 597 of file http_reply.hpp.
Referenced by SetContentType(), x_Clear(), and x_SetContentType().
|
private |
Definition at line 578 of file http_reply.hpp.
Referenced by AssignGenerator(), GetBytesSent(), PrepareChunk(), Send(), Send202(), SetContentLength(), StopCB(), x_Clear(), x_DoSend(), x_GenericSendError(), x_HandleConnectionState(), x_SetCdUid(), and x_SetContentType().
|
private |
Definition at line 583 of file http_reply.hpp.
Referenced by AssignGenerator(), and SetRequestId().
|
private |
Definition at line 582 of file http_reply.hpp.
Referenced by AssignGenerator(), StopCB(), and x_HandleConnectionState().
|
private |
Definition at line 590 of file http_reply.hpp.
Referenced by Error(), GetState(), IsFinished(), NeedOutput(), NotifyClientConnectionDrop(), SetContentLength(), StopCB(), x_Clear(), x_ConnectionPrecheck(), x_DoSend(), x_GenericSendError(), x_HandleConnectionState(), and x_SetContentType().