1 #ifndef __HTTPSERV_HPP__ 2 #define __HTTPSERV_HPP__ 30 if ( this->_cacheLifeTime < 1 )
39 time_t cacheFileMTime = this->_cacheItems.at(cacheName).timeStamp;
52 return this->_cacheItems.at(cacheName);
61 item = &this->_cacheItems[cacheName];
63 item->
mime = std::move(mime);
64 item->
content = std::move(content);
71 this->_cacheLifeTime = lifeTime;
76 return this->_cacheLifeTime;
79 time_t _cacheLifeTime;
80 CacheItemsMap _cacheItems;
120 std::map< winux::String, winux::String >
mime;
134 double serverWait = 0.002,
135 double verboseInterval = 0.01,
137 int cacheLifeTime = 86400
149 double serverWait = 0.002,
150 double verboseInterval = 0.01,
152 int cacheLifeTime = 86400
179 std::map< winux::String, winux::String >
mime;
195 :
ClientCtx( clientId, clientEpStr, clientSockPtr ), url(
http::Url::urlSimple), config(nullptr)
200 if ( !this->config || this->config->outputVerbose )
217 #define RESPONSE_HANDLER_PARAMS eiennet::old_v1::HttpServer::ClientCtxSharedPointer & clientCtxPtr, http::Header const & reqHdr, http::Url const & url, http::Header & rspHdr, std::ostream & rspOut 244 std::map< winux::String, ResponseHandlerFunction > _handlers;
254 #endif // __HTTPSERV_HPP__ XString< char > AnsiString
CacheItem & writeCache(winux::String const &cacheName, winux::String mime, winux::Buffer content)
int sockTimeout
套接字超时时间(整数秒)
winux::GrowBuffer requestBody
winux::uint64 getLifeTime() const
winux::Configure const * constConfObj
double verboseInterval
verbose信息刷新间隔(小数秒)
static void ColorOutput(winux::ConsoleAttr const &ca, _ArgType &&...arg)
std::map< winux::String, winux::String > mime
一些静态文件的MIME
winux::AnsiString requestHeaderStr
void setLifeTime(winux::uint64 lifeTime=0)
std::map< winux::String, winux::String > mime
winux::ConfigureSettings const * confSettings
DataRecvSendCtx forClient
std::map< String, String > StringStringMap
winux::StringStringMap errorPages
错误页
HttpServerConfig config
配置参数
double serverWait
服务器IO等待间隔时间(小数秒)
std::function< void(eiennet::old_v1::HttpServer::ClientCtxSharedPointer &clientCtxPtr, http::Header const &reqHdr, http::Url const &url, http::Header &rspHdr, std::ostream &rspOut) > ResponseHandlerFunction
StaticFileMemoryCache(time_t lifeTime=0)
http::Header requestHeader
缓冲区,表示内存中一块二进制数据(利用malloc/realloc进行内存分配)
time_t GetUtcTime(void)
获取UTC时间秒数,或者调用CRT的time(NULL)
winux::StringArray documentIndex
文档首页
winux::String serverIp
服务器IP,可留空
winux::ushort serverPort
服务器监听端口
winux::String documentRoot
文档根目录
bool isset(_MAP const &m, _KEY const &k)
检测map中是否有该键的值
winux::String documentRoot
winux::String serverName
服务器名,可留空
void setHandler(winux::String const &urlPath, ResponseHandlerFunction handler)
设置动态页面处理
bool hasCache(winux::String const &cacheName) const
HttpServerConfig * config
winux::String documentIndex
std::map< winux::String, CacheItem > CacheItemsMap
HttpClientCtx(winux::uint64 clientId, winux::String clientEpStr, winux::SharedPointer< ip::tcp::Socket > clientSockPtr)
XStringArray< tchar > StringArray
int cacheLifeTime
静态文件缓存生命期