本文整理汇总了C++中CAtlList::AddTail方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlList::AddTail方法的具体用法?C++ CAtlList::AddTail怎么用?C++ CAtlList::AddTail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAtlList
的用法示例。
在下文中一共展示了CAtlList::AddTail方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CallCGI
bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& body, CStringA& mime)
{
CString path = pClient->m_path, redir = path;
if(!ToLocalPath(path, redir)) return false;
CString ext = CPath(path).GetExtension().MakeLower();
CPath dir(path);
dir.RemoveFileSpec();
CString cgi;
if(!m_cgi.Lookup(ext, cgi) || !CPath(cgi).FileExists())
return false;
HANDLE hProcess = GetCurrentProcess();
HANDLE hChildStdinRd, hChildStdinWr, hChildStdinWrDup = NULL;
HANDLE hChildStdoutRd, hChildStdoutWr, hChildStdoutRdDup = NULL;
SECURITY_ATTRIBUTES saAttr;
ZeroMemory(&saAttr, sizeof(saAttr));
saAttr.nLength = sizeof(saAttr);
saAttr.bInheritHandle = TRUE;
if(CreatePipe(&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0))
{
BOOL fSuccess = DuplicateHandle(hProcess, hChildStdoutRd, hProcess, &hChildStdoutRdDup, 0, FALSE, DUPLICATE_SAME_ACCESS);
CloseHandle(hChildStdoutRd);
}
if(CreatePipe(&hChildStdinRd, &hChildStdinWr, &saAttr, 0))
{
BOOL fSuccess = DuplicateHandle(hProcess, hChildStdinWr, hProcess, &hChildStdinWrDup, 0, FALSE, DUPLICATE_SAME_ACCESS);
CloseHandle(hChildStdinWr);
}
STARTUPINFO siStartInfo;
ZeroMemory(&siStartInfo, sizeof(siStartInfo));
siStartInfo.cb = sizeof(siStartInfo);
siStartInfo.hStdError = hChildStdoutWr;
siStartInfo.hStdOutput = hChildStdoutWr;
siStartInfo.hStdInput = hChildStdinRd;
siStartInfo.dwFlags |= STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
siStartInfo.wShowWindow = SW_HIDE;
PROCESS_INFORMATION piProcInfo;
ZeroMemory(&piProcInfo, sizeof(piProcInfo));
CStringA envstr;
if(LPVOID lpvEnv = GetEnvironmentStrings())
{
CString str;
CAtlList<CString> env;
for(LPTSTR lpszVariable = (LPTSTR)lpvEnv; *lpszVariable; lpszVariable += _tcslen(lpszVariable)+1)
if(lpszVariable != (LPTSTR)lpvEnv)
env.AddTail(lpszVariable);
env.AddTail(_T("GATEWAY_INTERFACE=CGI/1.1"));
env.AddTail(_T("SERVER_SOFTWARE=Media Player Classic/6.4.x.y"));
env.AddTail(_T("SERVER_PROTOCOL=") + pClient->m_ver);
env.AddTail(_T("REQUEST_METHOD=") + pClient->m_cmd);
env.AddTail(_T("PATH_INFO=") + redir);
env.AddTail(_T("PATH_TRANSLATED=") + path);
env.AddTail(_T("SCRIPT_NAME=") + redir);
env.AddTail(_T("QUERY_STRING=") + pClient->m_query);
if(pClient->m_hdrlines.Lookup(_T("content-type"), str))
env.AddTail(_T("CONTENT_TYPE=") + str);
if(pClient->m_hdrlines.Lookup(_T("content-length"), str))
env.AddTail(_T("CONTENT_LENGTH=") + str);
POSITION pos = pClient->m_hdrlines.GetStartPosition();
while(pos)
{
CString key = pClient->m_hdrlines.GetKeyAt(pos);
CString value = pClient->m_hdrlines.GetNextValue(pos);
key.Replace(_T("-"), _T("_"));
key.MakeUpper();
env.AddTail(_T("HTTP_") + key + _T("=") + value);
}
CString name;
UINT port;
if(pClient->GetPeerName(name, port))
{
str.Format(_T("%d"), port);
env.AddTail(_T("REMOTE_ADDR=")+name);
env.AddTail(_T("REMOTE_HOST=")+name);
env.AddTail(_T("REMOTE_PORT=")+str);
}
if(pClient->GetSockName(name, port))
{
str.Format(_T("%d"), port);
env.AddTail(_T("SERVER_NAME=")+name);
env.AddTail(_T("SERVER_PORT=")+str);
}
env.AddTail(_T("\0"));
//.........这里部分代码省略.........