summaryrefslogtreecommitdiff
path: root/src/HttpServer.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-09-30 00:50:14 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-09-30 00:50:14 +0900
commit90515dfa50c676df37f440893de6e344fbfd2cdc (patch)
tree257d86e0614b6eb0ea8e9384af3269d60a53dbbc /src/HttpServer.cc
parent4b94ede268ff2ff793b22a0730dcbda09d280618 (diff)
RPC over SSL/TLS transport
To enable RPC over SSL/TLS, specify server certificate and private key using --rpc-certificate and --rpc-private-key options and enable --rpc-secure option. After the encryption is enabled, use https and wss scheme to access RPC server.
Diffstat (limited to 'src/HttpServer.cc')
-rw-r--r--src/HttpServer.cc27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/HttpServer.cc b/src/HttpServer.cc
index afb1ab45..bfabb08e 100644
--- a/src/HttpServer.cc
+++ b/src/HttpServer.cc
@@ -148,13 +148,16 @@ SharedHandle<HttpHeader> HttpServer::receiveRequest()
if(setupResponseRecv() < 0) {
A2_LOG_INFO("Request path is invaild. Ignore the request body.");
}
- if(!util::parseLLIntNoThrow(lastContentLength_,
- lastRequestHeader_->
- find(HttpHeader::CONTENT_LENGTH)) ||
- lastContentLength_ < 0) {
- throw DL_ABORT_EX(fmt("Invalid Content-Length=%s",
- lastRequestHeader_->
- find(HttpHeader::CONTENT_LENGTH).c_str()));
+ const std::string& contentLengthHdr = lastRequestHeader_->
+ find(HttpHeader::CONTENT_LENGTH);
+ if(!contentLengthHdr.empty()) {
+ if(!util::parseLLIntNoThrow(lastContentLength_, contentLengthHdr) ||
+ lastContentLength_ < 0) {
+ throw DL_ABORT_EX(fmt("Invalid Content-Length=%s",
+ contentLengthHdr.c_str()));
+ }
+ } else {
+ lastContentLength_ = 0;
}
headerProcessor_->clear();
@@ -386,4 +389,14 @@ bool HttpServer::supportsPersistentConnection() const
lastRequestHeader_ && lastRequestHeader_->isKeepAlive();
}
+bool HttpServer::wantRead() const
+{
+ return socket_->wantRead();
+}
+
+bool HttpServer::wantWrite() const
+{
+ return socket_->wantWrite();
+}
+
} // namespace aria2