mirror of
https://github.com/Fishwaldo/minihttp.git
synced 2025-07-13 00:08:43 +00:00
Finish incomplete requests if the socket gets closed unexpectedly
This commit is contained in:
parent
31e904abbb
commit
7c56a6606c
2 changed files with 9 additions and 3 deletions
|
@ -744,6 +744,12 @@ void HttpSocket::_OnData(void)
|
||||||
// otherwise, the server sent just the header, with the data following in the next packet
|
// 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)
|
void HttpSocket::_OnRecvInternal(char *buf, unsigned int size)
|
||||||
{
|
{
|
||||||
if(_status == 200 || _alwaysHandle)
|
if(_status == 200 || _alwaysHandle)
|
||||||
|
|
|
@ -141,6 +141,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
virtual void _OnClose();
|
||||||
virtual void _OnData(); // data received callback. Internal, should only be overloaded to call _OnRecv()
|
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 _OnRecv(char *buf, unsigned int size) = 0;
|
||||||
virtual void _OnOpen(); // called when opene
|
virtual void _OnOpen(); // called when opene
|
||||||
|
@ -218,10 +219,9 @@ protected:
|
||||||
Store _store;
|
Store _store;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
} // end namespace minihttp
|
} // end namespace minihttp
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue