⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 warsvrprotocolhttpreply.cpp

📁 ftpserver very good sample
💻 CPP
字号:
#include "StdAfx.h"#if WAR_RFC2068#include "WarSvrProtocolHttpReply.h"   // class implemented#ifndef WAR_SVR_PROTOCOL_HTTP_H#   include "WarSvrProtocolHttp.h"#endif/////////////////////////////// PUBLIC /////////////////////////////////////////============================= LIFECYCLE ====================================WarSvrProtocolHttpReply::WarSvrProtocolHttpReply(){    Reset();}// WarSvrProtocolHttpReplyWarSvrProtocolHttpReply::~WarSvrProtocolHttpReply(){}// ~WarSvrProtocolHttpReply//============================= OPERATORS ====================================//============================= OPERATIONS ===================================WarCollector<WarSvrProtocolHttpReply::type_t>& WarSvrProtocolHttpReply::AddEnumValue1(int enumValue)        throw(WarException){	if (mHaveReplied)		return *this; // We have already replied. This is probarbly just an				// error-message folklowing a throw up after the reply.    // Prepare reply    WarLog http_log(WARLOG_DEBUG_HTTP, "WarSvrProtocolHttpReply::AddEnumValue1()");        mHeader.SetReplyCode((HttpReplyCodeE)enumValue);    mHeader.SetContentLength(GetValue().size());    if (!mHeader.IsSet("Content-Type"))        mHeader.Set("Content-Type", "text/html");    // Reply    WarCollector<char> header_buffer;    mHeader.GetServerHeaders(header_buffer);    // Send header    GetServer().Send(header_buffer.GetValue());    if (http_log)    {        http_log << "Replying to client: "             << header_buffer.GetValue()             << war_endl;    }    // Send content    GetServer().Send(GetValue());	GetServer().FlushOut();	mHaveReplied = true;    return *this;}WarCollector<WarSvrProtocolHttpReply::type_t>& WarSvrProtocolHttpReply::AddEnumValue2(int enumValue)        throw(WarException){    mHeader.Set("Content-Type", "text/html");	WarCollector<type_t> out;	out << "<html>\r\n<title>Server Message</title>\r\n<body>\r\n"        << "<h2>Server Message</h2><hr>\r\n<strong>"		<<  GetMessages()[enumValue]		<< "</strong>\r\n</body>\r\n</html>\r\n";	Add(out.GetValue());    return *this;}void WarSvrProtocolHttpReply::Reset(){    mHeader.Reset();	collector_type_t::Reset();	mHaveReplied = false;}//============================= CALLBACK   ===================================//============================= ACCESS     ===================================//============================= INQUIRY    ===================================/////////////////////////////// PROTECTED  ////////////////////////////////////////////////////////////////// PRIVATE    ///////////////////////////////////#endif // #if WAR_RFC2068

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -