Fixed bug in POST by keeping track of buffer in member var

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@425 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2005-07-10 17:56:51 +00:00
parent 0f5e0d6a71
commit c0ed0b4cb5
2 changed files with 17 additions and 6 deletions

View File

@@ -23,11 +23,16 @@ CHTTPSock::~CHTTPSock() {}
void CHTTPSock::ReadData(const char* data, int len) {
if (m_bGotHeader && m_bPost) {
const CString& sBuf = GetInternalBuffer();
if (sBuf.size() >= m_uPostLen) {
ParseParams(sBuf);
GetPage();
}
m_sPostData.append(data, len);
CheckPost();
}
}
void CHTTPSock::CheckPost() {
if (m_sPostData.size() >= m_uPostLen) {
ParseParams(m_sPostData.Left(m_uPostLen));
GetPage();
m_sPostData.clear();
}
}
@@ -59,8 +64,12 @@ void CHTTPSock::ReadLine(const CString& sData) {
m_uPostLen = sLine.Token(1).ToULong();
} else if (sLine.empty()) {
m_bGotHeader = true;
DisableReadLine();
if (!m_bPost) {
if (m_bPost) {
m_sPostData = GetInternalBuffer();
CheckPost();
} else {
GetPage();
}
}

View File

@@ -27,6 +27,7 @@ public:
virtual bool OnLogin(const CString& sUser, const CString& sPass);
// !Hooks
void CheckPost();
bool SentHeader() const;
bool PrintHeader(unsigned long uContentLength, const CString& sContentType = "text/html", unsigned int uStatusId = 200, const CString& sStatusMsg = "OK");
void AddHeader(const CString& sName, const CString& sValue);
@@ -56,6 +57,7 @@ protected:
bool m_bLoggedIn;
bool m_bPost;
unsigned long m_uPostLen;
CString m_sPostData;
CString m_sURI;
CString m_sUser;
CString m_sPass;