diff --git a/src/HttpRequestCommand.cc b/src/HttpRequestCommand.cc index 0a3f0375..e9e1f430 100644 --- a/src/HttpRequestCommand.cc +++ b/src/HttpRequestCommand.cc @@ -122,21 +122,20 @@ createHttpRequest(const SharedHandle& req, bool HttpRequestCommand::executeInternal() { //socket->setBlockingMode(); - if(getRequest()->getProtocol() == "https") { - if(!getSocket()->tlsConnect(getRequest()->getHost())) { - setReadCheckSocketIf(getSocket(), getSocket()->wantRead()); - setWriteCheckSocketIf(getSocket(), getSocket()->wantWrite()); - getDownloadEngine()->addCommand(this); - return false; - } - } if(httpConnection_->sendBufferIsEmpty()) { if(!checkIfConnectionEstablished (getSocket(), getRequest()->getConnectedHostname(), getRequest()->getConnectedAddr(), getRequest()->getConnectedPort())) { return true; } - + if(getRequest()->getProtocol() == "https") { + if(!getSocket()->tlsConnect(getRequest()->getHost())) { + setReadCheckSocketIf(getSocket(), getSocket()->wantRead()); + setWriteCheckSocketIf(getSocket(), getSocket()->wantWrite()); + getDownloadEngine()->addCommand(this); + return false; + } + } if(getSegments().empty()) { SharedHandle httpRequest (createHttpRequest(getRequest(),