summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-12-01 23:37:57 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-12-01 23:37:57 +0900
commit8ac433a8e9ab8bddd96c62db4bbeac3adce2b3ba (patch)
tree9b3e27376e480cd2edf1cfad0aad35e91e552194 /src
parent2cbdd8b8452f0946693b2a283f08f3de4a8f1eb1 (diff)
Fixed compile error without SSL/TLS librelease-1.16.0
Diffstat (limited to 'src')
-rw-r--r--src/HttpRequestCommand.cc2
-rw-r--r--src/HttpServerCommand.cc2
-rw-r--r--src/SocketCore.cc4
-rw-r--r--src/SocketCore.h9
4 files changed, 14 insertions, 3 deletions
diff --git a/src/HttpRequestCommand.cc b/src/HttpRequestCommand.cc
index e9e1f430..6a2a6aff 100644
--- a/src/HttpRequestCommand.cc
+++ b/src/HttpRequestCommand.cc
@@ -128,6 +128,7 @@ bool HttpRequestCommand::executeInternal() {
getRequest()->getConnectedAddr(), getRequest()->getConnectedPort())) {
return true;
}
+#ifdef ENABLE_SSL
if(getRequest()->getProtocol() == "https") {
if(!getSocket()->tlsConnect(getRequest()->getHost())) {
setReadCheckSocketIf(getSocket(), getSocket()->wantRead());
@@ -136,6 +137,7 @@ bool HttpRequestCommand::executeInternal() {
return false;
}
}
+#endif // ENABLE_SSL
if(getSegments().empty()) {
SharedHandle<HttpRequest> httpRequest
(createHttpRequest(getRequest(),
diff --git a/src/HttpServerCommand.cc b/src/HttpServerCommand.cc
index e87b6e9e..c367e2df 100644
--- a/src/HttpServerCommand.cc
+++ b/src/HttpServerCommand.cc
@@ -178,6 +178,7 @@ bool HttpServerCommand::execute()
!httpServer_->getSocketRecvBuffer()->bufferEmpty()) {
timeoutTimer_ = global::wallclock();
+#ifdef ENABLE_SSL
if(httpServer_->getSecure()) {
// tlsAccept() just returns true if handshake has already
// finished.
@@ -187,6 +188,7 @@ bool HttpServerCommand::execute()
return false;
}
}
+#endif // ENABLE_SSL
SharedHandle<HttpHeader> header;
header = httpServer_->receiveRequest();
diff --git a/src/SocketCore.cc b/src/SocketCore.cc
index 9bac58d4..9a138a54 100644
--- a/src/SocketCore.cc
+++ b/src/SocketCore.cc
@@ -829,6 +829,8 @@ void SocketCore::readData(char* data, size_t& len)
len = ret;
}
+#ifdef ENABLE_SSL
+
bool SocketCore::tlsAccept()
{
return tlsHandshake(svTlsContext_.get(), A2STR::NIL);
@@ -1162,6 +1164,8 @@ bool SocketCore::tlsHandshake(TLSContext* tlsctx, const std::string& hostname)
return true;
}
+#endif // ENABLE_SSL
+
ssize_t SocketCore::writeData(const char* data, size_t len,
const std::string& host, uint16_t port)
{
diff --git a/src/SocketCore.h b/src/SocketCore.h
index 5efea0ce..2c943c3b 100644
--- a/src/SocketCore.h
+++ b/src/SocketCore.h
@@ -109,14 +109,15 @@ private:
void setSockOpt(int level, int optname, void* optval, socklen_t optlen);
+#ifdef ENABLE_SSL
/**
- * Makes this socket secure.
- * If the system has not OpenSSL, then this method do nothing.
- * connection must be established before calling this method.
+ * Makes this socket secure. The connection must be established
+ * before calling this method.
*
* If you are going to verify peer's certificate, hostname must be supplied.
*/
bool tlsHandshake(TLSContext* tlsctx, const std::string& hostname);
+#endif // ENABLE_SSL
SocketCore(sock_t sockfd, int sockType);
public:
@@ -305,6 +306,7 @@ public:
return readDataFrom(reinterpret_cast<char*>(data), len, sender);
}
+#ifdef ENABLE_SSL
// Performs TLS server side handshake. If handshake is completed,
// returns true. If handshake has not been done yet, returns false.
bool tlsAccept();
@@ -315,6 +317,7 @@ public:
// If you are going to verify peer's certificate, hostname must be
// supplied.
bool tlsConnect(const std::string& hostname);
+#endif // ENABLE_SSL
bool operator==(const SocketCore& s) {
return sockfd_ == s.sockfd_;