else:
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 threading.activeCount() > 1:
# libcurl/pycurl is not thread-safe by default. When multiple threads
# are used, signals should be disabled. This has the side effect
proxy_host=None, proxy_port=None, proxy_username=None,
proxy_password='', allow_nonstandard_methods=False,
validate_cert=True, ca_certs=None,
- allow_ipv6=None):
+ allow_ipv6=None,
+ client_key=None, client_cert=None):
"""Creates an `HTTPRequest`.
All parameters except `url` are optional.
to mix requests with ca_certs and requests that use the defaults.
:arg bool allow_ipv6: Use IPv6 when available? Default is false in
`simple_httpclient` and true in `curl_httpclient`
+ :arg string client_key: Filename for client SSL key, if any
+ :arg string client_cert: Filename for client SSL certificate, if any
"""
if headers is None:
headers = httputil.HTTPHeaders()
self.validate_cert = validate_cert
self.ca_certs = ca_certs
self.allow_ipv6 = allow_ipv6
+ self.client_key = client_key
+ self.client_cert = client_cert
self.start_time = time.time()
ssl_options["ca_certs"] = request.ca_certs
else:
ssl_options["ca_certs"] = _DEFAULT_CA_CERTS
+ if request.client_key is not None:
+ ssl_options["keyfile"] = request.client_key
+ if request.client_cert is not None:
+ ssl_options["certfile"] = request.client_cert
self.stream = SSLIOStream(socket.socket(af, socktype, proto),
io_loop=self.io_loop,
ssl_options=ssl_options)