summaryrefslogtreecommitdiff
path: root/src/HttpServerCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-08-30 13:15:22 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2009-08-30 13:15:22 +0000
commit01af9a5df0120e1b8dfaf841ccb29e51d38f0e08 (patch)
treeab2b8bad6aeebdbe1cb7bfe6d417c40aeaf344be /src/HttpServerCommand.cc
parent0c3dc00d68e58eaab3b3764f8a104e1f3adc222e (diff)
2009-08-30 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that XML-RPC authorization might be done before HTTP request header is fully received. * src/HttpServerCommand.cc
Diffstat (limited to 'src/HttpServerCommand.cc')
-rw-r--r--src/HttpServerCommand.cc25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/HttpServerCommand.cc b/src/HttpServerCommand.cc
index 38b9bdee..74518f42 100644
--- a/src/HttpServerCommand.cc
+++ b/src/HttpServerCommand.cc
@@ -91,6 +91,11 @@ bool HttpServerCommand::execute()
SharedHandle<HttpHeader> header;
header = _httpServer->receiveRequest();
+
+ if(header.isNull()) {
+ _e->commands.push_back(this);
+ return false;
+ }
if(!_httpServer->authenticate()) {
_httpServer->disableKeepAlive();
_httpServer->feedResponse("401 Unauthorized",
@@ -102,24 +107,20 @@ bool HttpServerCommand::execute()
_e->setNoWait(true);
return true;
}
- if(header.isNull()) {
- _e->commands.push_back(this);
- return false;
- } else if(static_cast<uint64_t>
- (_e->option->getAsInt(PREF_XML_RPC_MAX_REQUEST_SIZE)) <
- _httpServer->getContentLength()) {
+ if(static_cast<uint64_t>
+ (_e->option->getAsInt(PREF_XML_RPC_MAX_REQUEST_SIZE)) <
+ _httpServer->getContentLength()) {
logger->info("Request too long. ContentLength=%s."
" See --xml-rpc-max-request-size option to loose"
" this limitation.",
Util::uitos(_httpServer->getContentLength()).c_str());
return true;
- } else {
- Command* command = new HttpServerBodyCommand(cuid, _httpServer, _e,
- _socket);
- _e->commands.push_back(command);
- _e->setNoWait(true);
- return true;
}
+ Command* command = new HttpServerBodyCommand(cuid, _httpServer, _e,
+ _socket);
+ _e->commands.push_back(command);
+ _e->setNoWait(true);
+ return true;
} else {
if(_timeout.elapsed(30)) {
logger->info("HTTP request timeout.");