From 1157a55a44092bb8f8af00416f74025df8ec0ddb Mon Sep 17 00:00:00 2001 From: Gustav Rydstedt Date: Fri, 3 Feb 2012 15:28:31 -0800 Subject: [PATCH] Add support for client certificates in curl http client --- tornado/curl_httpclient.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tornado/curl_httpclient.py b/tornado/curl_httpclient.py index a338cb8d..9c100ceb 100644 --- a/tornado/curl_httpclient.py +++ b/tornado/curl_httpclient.py @@ -393,8 +393,11 @@ def _curl_setup_request(curl, request, buffer, headers): curl.unsetopt(pycurl.USERPWD) logging.debug("%s %s", request.method, request.url) - if request.client_key is not None or request.client_cert is not None: - raise ValueError("Client certificate not supported with curl_httpclient") + if request.client_cert is not None: + curl.setopt(pycurl.SSLCERT, request.client_cert) + + if request.client_key is not None: + curl.setopt(pycurl.SSLKEY, request.client_key) if threading.activeCount() > 1: # libcurl/pycurl is not thread-safe by default. When multiple threads