mirror of https://github.com/aria2/aria2
2009-05-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Put a call to Socket::isReadable() in try block. * src/HttpServerBodyCommand.cc * src/HttpServerCommand.ccpull/1/head
parent
55c5cccf09
commit
64945c1f03
|
@ -1,3 +1,9 @@
|
||||||
|
2009-05-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Put a call to Socket::isReadable() in try block.
|
||||||
|
* src/HttpServerBodyCommand.cc
|
||||||
|
* src/HttpServerCommand.cc
|
||||||
|
|
||||||
2009-05-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-05-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Fixed segmentation fault error. SocketBuffer::sendResponse() may throw
|
Fixed segmentation fault error. SocketBuffer::sendResponse() may throw
|
||||||
|
|
|
@ -74,10 +74,10 @@ bool HttpServerBodyCommand::execute()
|
||||||
if(_e->_requestGroupMan->downloadFinished() || _e->isHaltRequested()) {
|
if(_e->_requestGroupMan->downloadFinished() || _e->isHaltRequested()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
if(_socket->isReadable(0) || _httpServer->getContentLength() == 0) {
|
if(_socket->isReadable(0) || _httpServer->getContentLength() == 0) {
|
||||||
_timeout.reset();
|
_timeout.reset();
|
||||||
|
|
||||||
try {
|
|
||||||
if(_httpServer->receiveBody()) {
|
if(_httpServer->receiveBody()) {
|
||||||
// Do something for requestpath and body
|
// Do something for requestpath and body
|
||||||
if(_httpServer->getRequestPath() == "/rpc") {
|
if(_httpServer->getRequestPath() == "/rpc") {
|
||||||
|
@ -101,11 +101,6 @@ bool HttpServerBodyCommand::execute()
|
||||||
_e->commands.push_back(this);
|
_e->commands.push_back(this);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch(RecoverableException& e) {
|
|
||||||
logger->info("CUID#%d - Error occurred while reading HTTP request body",
|
|
||||||
e, cuid);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if(_timeout.elapsed(30)) {
|
if(_timeout.elapsed(30)) {
|
||||||
logger->info("HTTP request body timeout.");
|
logger->info("HTTP request body timeout.");
|
||||||
|
@ -115,6 +110,12 @@ bool HttpServerBodyCommand::execute()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch(RecoverableException& e) {
|
||||||
|
logger->info("CUID#%d - Error occurred while reading HTTP request body",
|
||||||
|
e, cuid);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
|
@ -82,16 +82,12 @@ bool HttpServerCommand::execute()
|
||||||
if(_e->_requestGroupMan->downloadFinished() || _e->isHaltRequested()) {
|
if(_e->_requestGroupMan->downloadFinished() || _e->isHaltRequested()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
if(_socket->isReadable(0)) {
|
if(_socket->isReadable(0)) {
|
||||||
_timeout.reset();
|
_timeout.reset();
|
||||||
SharedHandle<HttpHeader> header;
|
SharedHandle<HttpHeader> header;
|
||||||
try {
|
|
||||||
header = _httpServer->receiveRequest();
|
header = _httpServer->receiveRequest();
|
||||||
} catch(RecoverableException& e) {
|
|
||||||
logger->info("CUID#%d - Error occurred while reading HTTP request",
|
|
||||||
e, cuid);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(!_httpServer->authenticate()) {
|
if(!_httpServer->authenticate()) {
|
||||||
_httpServer->disableKeepAlive();
|
_httpServer->disableKeepAlive();
|
||||||
_httpServer->feedResponse("401 Unauthorized",
|
_httpServer->feedResponse("401 Unauthorized",
|
||||||
|
@ -124,6 +120,12 @@ bool HttpServerCommand::execute()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch(RecoverableException& e) {
|
||||||
|
logger->info("CUID#%d - Error occurred while reading HTTP request",
|
||||||
|
e, cuid);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
Loading…
Reference in New Issue