Fastcgi ++是一个用于简化C++中fastcgi服务器实现的库.这是我想要做的非常简单的用例:检查文件是否存在,如果不存在,则生成一些错误消息.这是代码,寻找问号.
struct the_fastcgi_server_t: Fastcgipp::Request<char>
{
bool response()
{
using namespace Fastcgipp;
Fastcgipp::Http::Environment<char> const &env =
this->environment();
// Can I resolve the file?
std::string target_js;
try {
target_js = path_processor( env.scriptName );
} catch ( file_not_found_exc_t const& e )
{
// TODO How do I set a standard 404 here???!!
return true;
}
out << "Content-Type: text/javascript; charset=utf-8\r\n\r\n";
// ... Here I fill the response.
return true;
}
};
Run Code Online (Sandbox Code Playgroud)
有关如何设置响应类型的任何想法?