@@ -83,6 +83,7 @@ class _NormalizedHeaderCache(dict):
8383 >>> normalized_headers["coNtent-TYPE"]
8484 'Content-Type'
8585 """
86+
8687 def __init__ (self , size ):
8788 super (_NormalizedHeaderCache , self ).__init__ ()
8889 self .size = size
@@ -132,6 +133,7 @@ class HTTPHeaders(collections.MutableMapping):
132133 Set-Cookie: A=B
133134 Set-Cookie: C=D
134135 """
136+
135137 def __init__ (self , * args , ** kwargs ):
136138 self ._dict = {} # type: typing.Dict[str, str]
137139 self ._as_list = {} # type: typing.Dict[str, typing.List[str]]
@@ -349,6 +351,7 @@ class HTTPServerRequest(object):
349351 .. versionchanged:: 4.0
350352 Moved from ``tornado.httpserver.HTTPRequest``.
351353 """
354+
352355 def __init__ (self , method = None , uri = None , version = "HTTP/1.0" , headers = None ,
353356 body = None , host = None , files = None , connection = None ,
354357 start_line = None , server_connection = None ):
@@ -451,30 +454,19 @@ def request_time(self):
451454 else :
452455 return self ._finish_time - self ._start_time
453456
454- def get_ssl_certificate (self , binary_form = False ):
457+ def get_ssl_certificate (self , ** kwargs ):
455458 """Returns the client's SSL certificate, if any.
459+ See the documentation of the IOStream method for details
456460
457- To use client certificates, the HTTPServer's
458- `ssl.SSLContext.verify_mode` field must be set, e.g.::
459-
460- ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
461- ssl_ctx.load_cert_chain("foo.crt", "foo.key")
462- ssl_ctx.load_verify_locations("cacerts.pem")
463- ssl_ctx.verify_mode = ssl.CERT_REQUIRED
464- server = HTTPServer(app, ssl_options=ssl_ctx)
465-
466- By default, the return value is a dictionary (or None, if no
467- client certificate is present). If ``binary_form`` is true, a
468- DER-encoded form of the certificate is returned instead. See
469- SSLSocket.getpeercert() in the standard library for more
470- details.
471- http://docs.python.org/library/ssl.html#sslsocket-objects
472461 """
473- try :
474- return self .connection .stream .socket .getpeercert (
475- binary_form = binary_form )
476- except SSLError :
477- return None
462+ return self .connection .stream .get_ssl_certificate (** kwargs )
463+
464+ def get_ssl_certificate_chain (self , ** kwargs ):
465+ """Returns the client's SSL certificate chain, if any.
466+ See the documentation of the IOStream method for details
467+
468+ """
469+ return self .connection .stream .get_ssl_certificate_chain (** kwargs )
478470
479471 def _parse_body (self ):
480472 parse_body_arguments (
@@ -513,6 +505,7 @@ class HTTPServerConnectionDelegate(object):
513505
514506 .. versionadded:: 4.0
515507 """
508+
516509 def start_request (self , server_conn , request_conn ):
517510 """This method is called by the server when a new request has started.
518511
@@ -539,6 +532,7 @@ class HTTPMessageDelegate(object):
539532
540533 .. versionadded:: 4.0
541534 """
535+
542536 def headers_received (self , start_line , headers ):
543537 """Called when the HTTP headers have been received and parsed.
544538
@@ -579,6 +573,7 @@ class HTTPConnection(object):
579573
580574 .. versionadded:: 4.0
581575 """
576+
582577 def write_headers (self , start_line , headers , chunk = None , callback = None ):
583578 """Write an HTTP header block.
584579
0 commit comments