summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-01-02 19:07:51 (GMT)
committerGeorg Brandl <georg@python.org>2011-01-02 19:07:51 (GMT)
commit8a7e5daab20ba98c7d95b5843c6b8ae30e5e6667 (patch)
tree95835005d4b462905837b6b76af8220dc843d442 /Doc
parentd8f37ad196549edea3d877365eeedb010e18263f (diff)
downloadcpython-8a7e5daab20ba98c7d95b5843c6b8ae30e5e6667.zip
cpython-8a7e5daab20ba98c7d95b5843c6b8ae30e5e6667.tar.gz
cpython-8a7e5daab20ba98c7d95b5843c6b8ae30e5e6667.tar.bz2
Fix code indentation.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/ssl.rst36
1 files changed, 18 insertions, 18 deletions
diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
index b4139b8..a9daf16 100644
--- a/Doc/library/ssl.rst
+++ b/Doc/library/ssl.rst
@@ -768,11 +768,11 @@ To test for the presence of SSL support in a Python installation, user code
should use the following idiom::
try:
- import ssl
+ import ssl
except ImportError:
- pass
+ pass
else:
- [ do something that requires SSL support ]
+ ... # do something that requires SSL support
Client-side operation
^^^^^^^^^^^^^^^^^^^^^
@@ -883,26 +883,26 @@ new socket from the other end, and use the context's :meth:`SSLContext.wrap_sock
method to create a server-side SSL socket for the connection::
while True:
- newsocket, fromaddr = bindsocket.accept()
- connstream = context.wrap_socket(newsocket, server_side=True)
- try:
- deal_with_client(connstream)
- finally:
- connstream.close()
+ newsocket, fromaddr = bindsocket.accept()
+ connstream = context.wrap_socket(newsocket, server_side=True)
+ try:
+ deal_with_client(connstream)
+ finally:
+ connstream.close()
Then you'll read data from the ``connstream`` and do something with it till you
are finished with the client (or the client is finished with you)::
def deal_with_client(connstream):
- data = connstream.recv(1024)
- # empty data means the client is finished with us
- while data:
- if not do_something(connstream, data):
- # we'll assume do_something returns False
- # when we're finished with client
- break
- data = connstream.recv(1024)
- # finished with client
+ data = connstream.recv(1024)
+ # empty data means the client is finished with us
+ while data:
+ if not do_something(connstream, data):
+ # we'll assume do_something returns False
+ # when we're finished with client
+ break
+ data = connstream.recv(1024)
+ # finished with client
And go back to listening for new client connections (of course, a real server
would probably handle each client connection in a separate thread, or put