📄 warsvrprotocolhttp.h
字号:
/** */#if WAR_RFC2068#ifndef WAR_SVR_PROTOCOL_HTTP_H#define WAR_SVR_PROTOCOL_HTTP_H/* SYSTEM INCLUDES *//* PROJECT INCLUDES */#ifndef WAR_SVR_PROTOCOL_H# include "WarSvrProtocol.h"#endif#ifndef WAR_SVR_PROTOCOL_HTTP_ENUMS_H# include "WarSvrProtocolHttpEnums.h"#endif#ifndef WAR_SVR_PROTOCOL_HTTP_REPLY_H# include "WarSvrProtocolHttpReply.h"#endif#ifndef WAR_FIFO_BUFFER_H# include "WarFifoBuffer.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplusclass WarSvrProtocolHttp : public WarSvrProtocol,public WarSvrProtocolHttpEnums{public: typedef war_int64_t contentlen_t; typedef WarFifoBuffer<char> buffer_t; // LIFECYCLE WarSvrProtocolHttp(war_socket_io_ptr_t& companionPtr, WarSvrDefinition& svrDefinion); // OPERATORS // OPERATIONS virtual void Abort(const WarError& reason) throw(WarException); void CloseConnection(const WarError& reason) throw(WarException); void Reset(); // CALLBACK virtual void OnClientConnect(); virtual void OnReceived(const WarError& status, war_transfer_buffer_ptr_t& buffer); virtual void OnSent(const WarError& status, war_transfer_buffer_ptr_t& buffer); virtual void OnValidateHeaderLength(size_t currLen) throw(WarException); // ACCESS inline WarSvrProtocolHttpReply& GetReply() { return mReply; } inline WarSvrProtocolHttpHeader& GetHeader() { return mReply.GetHeader(); } // INQUIRY protected: ~WarSvrProtocolHttp(void); WarSvrProtocolHttpReply mReply; WarSvrProtocolHttpHeader mRequestHeader; contentlen_t mExpectedContentBytes; contentlen_t mReceivedContentBytes; war_svrfile_ptr_t mFilePtr; void WarSvrProtocolHttp::ProcessInput(war_transfer_buffer_ptr_t& buffer); // Override to implement agent/handlers virtual bool ProcessWithAgent(war_ccstr_t contentData, const contentlen_t contentLength) throw(WarException) {return false;} // Override to implement a custom HTTP Auth virtual void VerfiyHttpAuth() throw(WarException); virtual void VerfiyAnonymousAccess() throw(WarException); // Override to implement HTTP Request verification virtual void VerifyHttpRequest() const throw(WarException) {}; // Auth failed. Send WWW-Authenticate header and throw up! void AskForAuthentication() throw(WarException); virtual void OnTransferDone(const WarError& status); virtual void PreprocessInput(war_transfer_buffer_ptr_t& buffer); // HTTP request callbacks virtual void OnGetRequest(war_ccstr_t contentData, const contentlen_t contentLength) throw(WarException); virtual void OnOptionsRequest(war_ccstr_t contentData, const contentlen_t contentLength) throw(WarException); virtual void OnHeadRequest(war_ccstr_t contentData, const contentlen_t contentLength) throw(WarException); virtual void OnPostRequest(war_ccstr_t contentData, const contentlen_t contentLength) throw(WarException); virtual void OnPutRequest(war_ccstr_t contentData, const contentlen_t contentLength) throw(WarException); virtual void OnDeleteRequest(war_ccstr_t contentData, const contentlen_t contentLength) throw(WarException); virtual void OnTraceRequest(war_ccstr_t contentData, const contentlen_t contentLength) throw(WarException); virtual void OnInvalidRequest(war_ccstr_t contentData, const contentlen_t contentLength) throw(WarException); virtual void OnPageNotFound() throw(WarException); virtual bool DeduceRealUrl() throw(WarException); virtual void DeduceMimeType() throw(WarException); virtual void StartPageTransfer() throw(WarException); /** Override to support virtual hosts * Load options and paths for the virtual host */ virtual LoadVirtual(const WarUrl& forHost) {};private: buffer_t mInputBuffer; bool mHaveEndOfHeader; bool mRelayInput; // True when we are transfering data to client war_transfer_buffer_ptr_t mQueuedInput;};/* INLINE METHODS *//* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif /* WAR_SVR_PROTOCOL_HTTP_H_ */#endif // #if WAR_RFC2068
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -