本文整理汇总了C++中poco::net::HTTPServerRequest::getVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ HTTPServerRequest::getVersion方法的具体用法?C++ HTTPServerRequest::getVersion怎么用?C++ HTTPServerRequest::getVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类poco::net::HTTPServerRequest
的用法示例。
在下文中一共展示了HTTPServerRequest::getVersion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleRequest
void ShowCaptchaPage::handleRequest(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response)
{
m_log->trace("ShowCaptchaPage::handleRequest from "+request.clientAddress().toString());
std::map<std::string,QueryVar> queryvars;
CreateQueryVarMap(request,queryvars);
if(request.getVersion()==Poco::Net::HTTPRequest::HTTP_1_1)
{
response.setChunkedTransferEncoding(true);
}
std::string content="";
if(queryvars.find("UUID")!=queryvars.end())
{
std::string uuid=(*queryvars.find("UUID")).second.GetData();
SQLite3DB::Statement st=m_db->Prepare("SELECT MimeType,PuzzleData FROM tblIntroductionPuzzleRequests WHERE UUID=?;");
st.Bind(0,uuid);
st.Step();
if(st.RowReturned())
{
std::string mime;
std::string b64data;
std::vector<unsigned char> data;
st.ResultText(0,mime);
st.ResultText(1,b64data);
Base64::Decode(b64data,data);
// mime type should be short and have a / in it - otherwise skip
if(mime.size()<50 && mime.find('/')!=std::string::npos)
{
std::string fname(uuid);
if(mime=="image/bmp")
{
fname+=".bmp";
}
else if(mime=="audio/x-wav")
{
fname+=".wav";
}
response.setContentType(mime);
response.setContentLength(data.size());
response.set("Content-Disposition","attachment; filename="+fname);
content+=std::string(data.begin(),data.end());
}
}
}
std::ostream &ostr = response.send();
ostr << content;
}