00001 #pragma once 00002 00003 class CWebServer; 00004 00005 class CWebClientSocket : public CAsyncSocket 00006 { 00007 CWebServer* m_pWebServer; 00008 CMainFrame* m_pMainFrame; 00009 00010 CString m_hdr; 00011 00012 struct cookie_attribs {CString path, expire, domain;}; 00013 CAtlMap<CString, cookie_attribs, CStringElementTraits<CString> > m_cookieattribs; 00014 00015 void Clear(); 00016 void Header(); 00017 00018 protected: 00019 void OnReceive(int nErrorCode); 00020 void OnClose(int nErrorCode); 00021 00022 public: 00023 CWebClientSocket(CWebServer* pWebServer, CMainFrame* pMainFrame); 00024 virtual ~CWebClientSocket(); 00025 00026 bool SetCookie(CString name, CString value = _T(""), __time64_t expire = -1, CString path = _T("/"), CString domain = _T("")); 00027 00028 typedef CAtlMap<CString, CString, CStringElementTraits<CString>, CStringElementTraits<CString> > CAtlStringMap; 00029 00030 CString m_sessid; 00031 CString m_cmd, m_path, m_query, m_ver; 00032 CStringA m_data; 00033 CAtlStringMap m_hdrlines; 00034 CAtlStringMap m_get, m_post, m_cookie; 00035 CAtlStringMap m_request; 00036 00037 bool OnCommand(CStringA& hdr, CStringA& body, CStringA& mime); 00038 bool OnIndex(CStringA& hdr, CStringA& body, CStringA& mime); 00039 bool OnBrowser(CStringA& hdr, CStringA& body, CStringA& mime); 00040 bool OnControls(CStringA& hdr, CStringA& body, CStringA& mime); 00041 bool OnStatus(CStringA& hdr, CStringA& body, CStringA& mime); 00042 bool OnError404(CStringA& hdr, CStringA& body, CStringA& mime); 00043 bool OnPlayer(CStringA& hdr, CStringA& body, CStringA& mime); 00044 bool OnSnapShotJpeg(CStringA& hdr, CStringA& body, CStringA& mime); 00045 bool OnConvRes(CStringA& hdr, CStringA& body, CStringA& mime); 00046 };