@@ -768,11 +768,11 @@ To test for the presence of SSL support in a Python installation, user code
768768should use the following idiom::
769769
770770 try:
771- import ssl
771+ import ssl
772772 except ImportError:
773- pass
773+ pass
774774 else:
775- [ do something that requires SSL support ]
775+ ... # do something that requires SSL support
776776
777777Client-side operation
778778^^^^^^^^^^^^^^^^^^^^^
@@ -883,26 +883,26 @@ new socket from the other end, and use the context's :meth:`SSLContext.wrap_sock
883883method to create a server-side SSL socket for the connection::
884884
885885 while True:
886- newsocket, fromaddr = bindsocket.accept()
887- connstream = context.wrap_socket(newsocket, server_side=True)
888- try:
889- deal_with_client(connstream)
890- finally:
891- connstream.close()
886+ newsocket, fromaddr = bindsocket.accept()
887+ connstream = context.wrap_socket(newsocket, server_side=True)
888+ try:
889+ deal_with_client(connstream)
890+ finally:
891+ connstream.close()
892892
893893Then you'll read data from the ``connstream `` and do something with it till you
894894are finished with the client (or the client is finished with you)::
895895
896896 def deal_with_client(connstream):
897- data = connstream.recv(1024)
898- # empty data means the client is finished with us
899- while data:
900- if not do_something(connstream, data):
901- # we'll assume do_something returns False
902- # when we're finished with client
903- break
904- data = connstream.recv(1024)
905- # finished with client
897+ data = connstream.recv(1024)
898+ # empty data means the client is finished with us
899+ while data:
900+ if not do_something(connstream, data):
901+ # we'll assume do_something returns False
902+ # when we're finished with client
903+ break
904+ data = connstream.recv(1024)
905+ # finished with client
906906
907907And go back to listening for new client connections (of course, a real server
908908would probably handle each client connection in a separate thread, or put
0 commit comments