Skip to content

修正 11.10 节的缩进 #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 1, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions source/c11/p10_add_ssl_to_network_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@

.. code-block:: python

import ssl
import ssl

class SSLMixin:
class SSLMixin:
'''
Mixin class that adds support for SSL to existing servers based
on the socketserver module.
Expand Down Expand Up @@ -253,7 +253,7 @@
例如,web浏览器保存了主要的认证机构的证书,并使用它来为每一个HTTPS连接确认证书的合法性。
对本小节示例而言,只是为了测试,我们可以创建自签名的证书,下面是主要步骤:


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

::
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQCZrCNLoEyAKF+f9UNcFaz5Osa6jf7qkbUl8si5xQrY3ZYC7juu
nL1dZLn/VbEFIITaUOgvBtPv1qUWTJGwga62VSG1oFE0ODIx3g2Nh4sRf+rySsx2
Expand All @@ -300,6 +301,7 @@

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

::
-----BEGIN CERTIFICATE-----
MIIC+DCCAmGgAwIBAgIJAPMd+vi45js3MA0GCSqGSIb3DQEBBQUAMFwxCzAJBgNV
BAYTAlVTMREwDwYDVQQIEwhJbGxpbm9pczEQMA4GA1UEBxMHQ2hpY2FnbzEUMBIG
Expand Down