1 #include "../../../include/http/pages/showcaptchapage.h"
\r
2 #include "../../../include/base64.h"
\r
3 #include "../../../include/stringfunctions.h"
\r
9 const std::string ShowCaptchaPage::GeneratePage(const std::string &method, const std::map<std::string,std::string> &queryvars)
\r
11 std::string content="HTTP/1.1 200 OK\r\n";
\r
12 if(queryvars.find("UUID")!=queryvars.end())
\r
14 SQLite3DB::Statement st=m_db->Prepare("SELECT MimeType,PuzzleData FROM tblIntroductionPuzzleRequests WHERE UUID=?;");
\r
15 st.Bind(0,(*queryvars.find("UUID")).second);
\r
18 if(st.RowReturned())
\r
21 std::string b64data;
\r
22 std::vector<unsigned char> data;
\r
25 st.ResultText(0,mime);
\r
26 st.ResultText(1,b64data);
\r
27 Base64::Decode(b64data,data);
\r
28 StringFunctions::Convert(data.size(),lenstr);
\r
30 content+="Content-Type: "+mime+"\r\n";
\r
31 content+="Content-Length: "+lenstr+"\r\n\r\n";
\r
32 content+=std::string(data.begin(),data.end());
\r
38 const bool ShowCaptchaPage::WillHandleURI(const std::string &uri)
\r
40 if(uri.find("showcaptcha.")!=std::string::npos)
\r