Finish incomplete requests if the socket gets closed unexpectedly

This commit is contained in:
fgenesis 2012-05-23 20:51:24 +02:00
parent 31e904abbb
commit 7c56a6606c
2 changed files with 9 additions and 3 deletions

View file

@ -744,6 +744,12 @@ void HttpSocket::_OnData(void)
// otherwise, the server sent just the header, with the data following in the next packet
}
void HttpSocket::_OnClose()
{
if(!ExpectMoreData())
_FinishRequest();
}
void HttpSocket::_OnRecvInternal(char *buf, unsigned int size)
{
if(_status == 200 || _alwaysHandle)

View file

@ -141,6 +141,7 @@ public:
protected:
virtual void _OnClose();
virtual void _OnData(); // data received callback. Internal, should only be overloaded to call _OnRecv()
virtual void _OnRecv(char *buf, unsigned int size) = 0;
virtual void _OnOpen(); // called when opene
@ -218,10 +219,9 @@ protected:
Store _store;
};
#endif
} // end namespace minihttp
#endif
#endif