Skip to content

Commit 99b16a7

Browse files
authored
修正 11.10 节的缩进
1 parent fd8832b commit 99b16a7

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

source/c11/p10_add_ssl_to_network_services.rst

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@
7878

7979
.. code-block:: python
8080
81-
import ssl
81+
import ssl
8282
83-
class SSLMixin:
84-
'''
85-
Mixin class that adds support for SSL to existing servers based
86-
on the socketserver module.
87-
'''
83+
class SSLMixin:
84+
'''
85+
Mixin class that adds support for SSL to existing servers based
86+
on the socketserver module.
87+
'''
8888
def __init__(self, *args,
8989
keyfile=None, certfile=None, ca_certs=None,
9090
cert_reqs=ssl.CERT_NONE,
@@ -253,7 +253,7 @@
253253
例如,web浏览器保存了主要的认证机构的证书,并使用它来为每一个HTTPS连接确认证书的合法性。
254254
对本小节示例而言,只是为了测试,我们可以创建自签名的证书,下面是主要步骤:
255255

256-
256+
::
257257
bash % openssl req -new -x509 -days 365 -nodes -out server_cert.pem \
258258
-keyout server_key.pem
259259
Generating a 1024 bit RSA private key
@@ -282,6 +282,7 @@
282282
在创建证书的时候,各个值的设定可以是任意的,但是”Common Name“的值通常要包含服务器的DNS主机名。
283283
如果你只是在本机测试,那么就使用”localhost“,否则使用服务器的域名。
284284

285+
::
285286
-----BEGIN RSA PRIVATE KEY-----
286287
MIICXQIBAAKBgQCZrCNLoEyAKF+f9UNcFaz5Osa6jf7qkbUl8si5xQrY3ZYC7juu
287288
nL1dZLn/VbEFIITaUOgvBtPv1qUWTJGwga62VSG1oFE0ODIx3g2Nh4sRf+rySsx2
@@ -300,6 +301,7 @@
300301

301302
服务器证书文件server_cert.pem内容类似下面这样:
302303

304+
::
303305
-----BEGIN CERTIFICATE-----
304306
MIIC+DCCAmGgAwIBAgIJAPMd+vi45js3MA0GCSqGSIb3DQEBBQUAMFwxCzAJBgNV
305307
BAYTAlVTMREwDwYDVQQIEwhJbGxpbm9pczEQMA4GA1UEBxMHQ2hpY2FnbzEUMBIG

0 commit comments

Comments
 (0)