mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-21 14:42:51 +01:00
- fixed SF#3489816: MessageHeader::MAX_VALUE_LENGTH too small
- port rev. 1970 from 1.4.4: added timeout to SocketReactorTest::testSocketConnectorFail() to avoid the test from running for a very long time on Linux/OS X
This commit is contained in:
parent
a77bfefd69
commit
4652c7cb8b
@ -167,7 +167,7 @@ private:
|
|||||||
/// Limits for basic sanity checks when reading a header
|
/// Limits for basic sanity checks when reading a header
|
||||||
{
|
{
|
||||||
MAX_NAME_LENGTH = 256,
|
MAX_NAME_LENGTH = 256,
|
||||||
MAX_VALUE_LENGTH = 4096,
|
MAX_VALUE_LENGTH = 8192,
|
||||||
DFL_FIELD_LIMIT = 100
|
DFL_FIELD_LIMIT = 100
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ void MessageHeaderTest::testReadInvalid1()
|
|||||||
void MessageHeaderTest::testReadInvalid2()
|
void MessageHeaderTest::testReadInvalid2()
|
||||||
{
|
{
|
||||||
std::string s("name1: value1\r\nname2: ");
|
std::string s("name1: value1\r\nname2: ");
|
||||||
s.append(8000, 'x');
|
s.append(9000, 'x');
|
||||||
std::istringstream istr(s);
|
std::istringstream istr(s);
|
||||||
MessageHeader mh;
|
MessageHeader mh;
|
||||||
try
|
try
|
||||||
|
@ -264,6 +264,7 @@ namespace
|
|||||||
_failed(false),
|
_failed(false),
|
||||||
_shutdown(false)
|
_shutdown(false)
|
||||||
{
|
{
|
||||||
|
reactor.addEventHandler(socket(), Observer<FailConnector, TimeoutNotification>(*this, &FailConnector::onTimeout));
|
||||||
reactor.addEventHandler(socket(), Observer<FailConnector, ShutdownNotification>(*this, &FailConnector::onShutdown));
|
reactor.addEventHandler(socket(), Observer<FailConnector, ShutdownNotification>(*this, &FailConnector::onShutdown));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,6 +274,13 @@ namespace
|
|||||||
_shutdown = true;
|
_shutdown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onTimeout(TimeoutNotification* pNf)
|
||||||
|
{
|
||||||
|
pNf->release();
|
||||||
|
_failed = true;
|
||||||
|
reactor()->stop();
|
||||||
|
}
|
||||||
|
|
||||||
void onError(int error)
|
void onError(int error)
|
||||||
{
|
{
|
||||||
_failed = true;
|
_failed = true;
|
||||||
@ -326,6 +334,7 @@ void SocketReactorTest::testSocketReactor()
|
|||||||
void SocketReactorTest::testSocketConnectorFail()
|
void SocketReactorTest::testSocketConnectorFail()
|
||||||
{
|
{
|
||||||
SocketReactor reactor;
|
SocketReactor reactor;
|
||||||
|
reactor.setTimeout(Poco::Timespan(3, 0));
|
||||||
SocketAddress sa("192.168.168.192", 12345);
|
SocketAddress sa("192.168.168.192", 12345);
|
||||||
FailConnector connector(sa, reactor);
|
FailConnector connector(sa, reactor);
|
||||||
assert (!connector.failed());
|
assert (!connector.failed());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user