diff options
Diffstat (limited to 'lib/httpserver/HTTPResponse.h')
-rw-r--r-- | lib/httpserver/HTTPResponse.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/httpserver/HTTPResponse.h b/lib/httpserver/HTTPResponse.h index 04051958..f39825d9 100644 --- a/lib/httpserver/HTTPResponse.h +++ b/lib/httpserver/HTTPResponse.h @@ -63,9 +63,10 @@ public: typedef std::pair<std::string, std::string> Header; void SetResponseCode(int Code); - int GetResponseCode() { return mResponseCode; } + int GetResponseCode() const { return mResponseCode; } void SetContentType(const char *ContentType); const std::string& GetContentType() { return mContentType; } + int64_t GetContentLength() { return mContentLength; } void SetAsRedirect(const char *RedirectTo, bool IsLocalURI = true); void SetAsNotFound(const char *URI); @@ -107,6 +108,7 @@ public: void SetResponseIsDynamicContent(bool IsDynamic) {mResponseIsDynamicContent = IsDynamic;} // Set keep alive control, default is to mark as to be closed void SetKeepAlive(bool KeepAlive) {mKeepAlive = KeepAlive;} + bool IsKeepAlive() {return mKeepAlive;} void SetCookie(const char *Name, const char *Value, const char *Path = "/", int ExpiresAt = 0); @@ -127,7 +129,7 @@ public: }; static const char *ResponseCodeToString(int ResponseCode); - + void WriteStringDefang(const char *String, unsigned int StringLen); void WriteStringDefang(const std::string &rString) {WriteStringDefang(rString.c_str(), rString.size());} @@ -163,9 +165,9 @@ private: bool mKeepAlive; std::string mContentType; std::vector<Header> mExtraHeaders; - int mContentLength; // only used when reading response from stream + int64_t mContentLength; // only used when reading response from stream IOStream* mpStreamToSendTo; // nonzero only when constructed with a stream - + static std::string msDefaultURIPrefix; void ParseHeaders(IOStreamGetLine &rGetLine, int Timeout); |