mirror of
https://github.com/znc/znc.git
synced 2026-05-06 13:32:36 +02:00
Limit the maximal read buffer space that is used for every socket
CSocket caches the data read from a socket and then looks for lines in there. If there is no line end, this buffer can grow quite large. This patch now closes sockets if they get a huge read buffer. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1233 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -19,6 +19,7 @@ CHTTPSock::CHTTPSock() : Csock() {
|
||||
m_bDone = false;
|
||||
m_uPostLen = 0;
|
||||
EnableReadLine();
|
||||
SetMaxBufferThreshold(10240);
|
||||
}
|
||||
|
||||
CHTTPSock::CHTTPSock(const CString& sHostname, unsigned short uPort, int iTimeout) : Csock(sHostname, uPort, iTimeout) {
|
||||
@@ -29,6 +30,7 @@ CHTTPSock::CHTTPSock(const CString& sHostname, unsigned short uPort, int iTimeou
|
||||
m_bDone = false;
|
||||
m_uPostLen = 0;
|
||||
EnableReadLine();
|
||||
SetMaxBufferThreshold(10240);
|
||||
}
|
||||
|
||||
CHTTPSock::~CHTTPSock() {}
|
||||
@@ -384,6 +386,11 @@ void CHTTPSock::Connected() {
|
||||
void CHTTPSock::Disconnected() {
|
||||
}
|
||||
|
||||
void CHTTPSock::ReachedMaxBuffer() {
|
||||
DEBUG_ONLY(cout << GetSockName() << " == ReachedMaxBuffer()" << endl);
|
||||
Close();
|
||||
}
|
||||
|
||||
Csock* CHTTPSock::GetSockObj(const CString& sHost, unsigned short uPort) {
|
||||
CHTTPSock* pSock = new CHTTPSock;
|
||||
pSock->SetSockName("HTTP::CLIENT");
|
||||
|
||||
Reference in New Issue
Block a user