File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -427,7 +427,7 @@ def request_time(self):
427
427
else :
428
428
return self ._finish_time - self ._start_time
429
429
430
- def get_ssl_certificate (self ):
430
+ def get_ssl_certificate (self , binary_form = False ):
431
431
"""Returns the client's SSL certificate, if any.
432
432
433
433
To use client certificates, the HTTPServer must have been constructed
@@ -440,12 +440,16 @@ def get_ssl_certificate(self):
440
440
cert_reqs=ssl.CERT_REQUIRED,
441
441
ca_certs="cacert.crt"))
442
442
443
- The return value is a dictionary, see SSLSocket.getpeercert() in
444
- the standard library for more details.
443
+ By default, the return value is a dictionary (or None, if no
444
+ client certificate is present). If ``binary_form`` is true, a
445
+ DER-encoded form of the certificate is returned instead. See
446
+ SSLSocket.getpeercert() in the standard library for more
447
+ details.
445
448
http://docs.python.org/library/ssl.html#sslsocket-objects
446
449
"""
447
450
try :
448
- return self .connection .stream .socket .getpeercert ()
451
+ return self .connection .stream .socket .getpeercert (
452
+ binary_form = binary_form )
449
453
except ssl .SSLError :
450
454
return None
451
455
You can’t perform that action at this time.
0 commit comments