summaryrefslogtreecommitdiff
path: root/src/HttpServerBodyCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-01-16 17:52:18 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-01-16 17:52:18 +0900
commitb2f27e6548ec5f13a0f5776612cb512cb0d30d4e (patch)
tree122e2f32f2e899924d746e73bc442172fc1a7d8c /src/HttpServerBodyCommand.cc
parente60181d1ad73ef2ca873d8d2ba0e13a932f0751a (diff)
Check !SocketRecvBuffer::bufferEmpty() in ctor.
Also treat !SocketRecvBuffer::bufferEmpty() as data is available.
Diffstat (limited to 'src/HttpServerBodyCommand.cc')
-rw-r--r--src/HttpServerBodyCommand.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/HttpServerBodyCommand.cc b/src/HttpServerBodyCommand.cc
index 6febd3a8..e49c253c 100644
--- a/src/HttpServerBodyCommand.cc
+++ b/src/HttpServerBodyCommand.cc
@@ -53,6 +53,7 @@
#include "wallclock.h"
#include "util.h"
#include "fmt.h"
+#include "SocketRecvBuffer.h"
namespace aria2 {
@@ -66,8 +67,12 @@ HttpServerBodyCommand::HttpServerBodyCommand
socket_(socket),
httpServer_(httpServer)
{
+ // To handle Content-Length == 0 case
setStatus(Command::STATUS_ONESHOT_REALTIME);
e_->addSocketForReadCheck(socket_, this);
+ if(!httpServer_->getSocketRecvBuffer()->bufferEmpty()) {
+ e_->setNoWait(true);
+ }
}
HttpServerBodyCommand::~HttpServerBodyCommand()
@@ -81,7 +86,9 @@ bool HttpServerBodyCommand::execute()
return true;
}
try {
- if(socket_->isReadable(0) || httpServer_->getContentLength() == 0) {
+ if(socket_->isReadable(0) ||
+ !httpServer_->getSocketRecvBuffer()->bufferEmpty() ||
+ httpServer_->getContentLength() == 0) {
timeoutTimer_ = global::wallclock;
if(httpServer_->receiveBody()) {