Make NoVerifySSLCert work for all LLURLRequest
Moved CURLOPT_ENCODING from CurlEasyRequest::setPost_raw, and CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST from CurlResponderBuffer::prepRequest, to LLURLRequest::configure, enabling the debug setting NoVerifySSLCert for the latter two to work as follows: old behavior if "NoVerifySSLCert" is not set, and check neither if it is set. However, if the (new) bool mIsAuth is set the behavior of LLXMLRPCTransaction::Impl::init is used. This is so in a next commit we can replace LLXMLRPCTransaction with LLURLRequest: LLXMLRPCTransaction::Impl::init will be removed. For the same reason, when the new boolean mNoCompression is set then CURLOPT_ENCODING is set to "identity", otherwise the old behavior (of clearing it) is used.
This commit is contained in:
@@ -113,8 +113,10 @@ std::string LLURLRequest::actionAsVerb(LLURLRequest::ERequestAction action)
|
||||
}
|
||||
|
||||
// This might throw AICurlNoEasyHandle.
|
||||
LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action, std::string const& url, Injector* body, AICurlInterface::ResponderPtr responder, AIHTTPHeaders& headers) :
|
||||
AICurlEasyRequestStateMachine(true), mAction(action), mURL(url), mBody(body), mResponder(responder), mHeaders(headers)
|
||||
LLURLRequest::LLURLRequest(LLURLRequest::ERequestAction action, std::string const& url, Injector* body,
|
||||
AICurlInterface::ResponderPtr responder, AIHTTPHeaders& headers, bool is_auth, bool no_compression) :
|
||||
AICurlEasyRequestStateMachine(true), mAction(action), mURL(url), mIsAuth(is_auth), mNoCompression(no_compression),
|
||||
mBody(body), mResponder(responder), mHeaders(headers)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -507,7 +509,7 @@ bool LLURLRequest::configure(AICurlEasyRequest_wat const& curlEasyRequest_w)
|
||||
curlEasyRequest_w->setopt(CURLOPT_FOLLOWLOCATION, 1);
|
||||
|
||||
// Set Accept-Encoding to allow response compression
|
||||
curlEasyRequest_w->setoptString(CURLOPT_ENCODING, "");
|
||||
curlEasyRequest_w->setoptString(CURLOPT_ENCODING, mNoCompression ? "identity" : "");
|
||||
rv = true;
|
||||
break;
|
||||
|
||||
@@ -525,6 +527,9 @@ bool LLURLRequest::configure(AICurlEasyRequest_wat const& curlEasyRequest_w)
|
||||
{
|
||||
// Set the handle for an http post
|
||||
curlEasyRequest_w->setPost(mBodySize);
|
||||
|
||||
// Set Accept-Encoding to allow response compression
|
||||
curlEasyRequest_w->setoptString(CURLOPT_ENCODING, mNoCompression ? "identity" : "");
|
||||
rv = true;
|
||||
break;
|
||||
}
|
||||
@@ -546,6 +551,10 @@ bool LLURLRequest::configure(AICurlEasyRequest_wat const& curlEasyRequest_w)
|
||||
}
|
||||
if(rv)
|
||||
{
|
||||
curlEasyRequest_w->setopt(CURLOPT_SSL_VERIFYPEER, gNoVerifySSLCert ? 0L : 1L);
|
||||
// Don't verify host name if this is not an authentication request,
|
||||
// so urls with scrubbed host names will work (improves DNS performance).
|
||||
curlEasyRequest_w->setopt(CURLOPT_SSL_VERIFYHOST, (gNoVerifySSLCert || !mIsAuth) ? 0L : 2L);
|
||||
curlEasyRequest_w->finalizeRequest(mURL, mResponder->getHTTPTimeoutPolicy(), this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user