Commit 67a58cc5 authored by Richard Oudkerk's avatar Richard Oudkerk

Merge

parents d9a7e709 264e9ac5
...@@ -1207,10 +1207,10 @@ their parent process exits. The manager classes are defined in the ...@@ -1207,10 +1207,10 @@ their parent process exits. The manager classes are defined in the
*address* is the address on which the manager process listens for new *address* is the address on which the manager process listens for new
connections. If *address* is ``None`` then an arbitrary one is chosen. connections. If *address* is ``None`` then an arbitrary one is chosen.
*authkey* is the authentication key which will be used to check the validity *authkey* is the authentication key which will be used to check the
of incoming connections to the server process. If *authkey* is ``None`` then validity of incoming connections to the server process. If
``current_process().authkey``. Otherwise *authkey* is used and it *authkey* is ``None`` then ``current_process().authkey`` is used.
must be a string. Otherwise *authkey* is used and it must be a byte string.
.. method:: start([initializer[, initargs]]) .. method:: start([initializer[, initargs]])
...@@ -1224,7 +1224,7 @@ their parent process exits. The manager classes are defined in the ...@@ -1224,7 +1224,7 @@ their parent process exits. The manager classes are defined in the
:meth:`serve_forever` method:: :meth:`serve_forever` method::
>>> from multiprocessing.managers import BaseManager >>> from multiprocessing.managers import BaseManager
>>> manager = BaseManager(address=('', 50000), authkey='abc') >>> manager = BaseManager(address=('', 50000), authkey=b'abc')
>>> server = manager.get_server() >>> server = manager.get_server()
>>> server.serve_forever() >>> server.serve_forever()
...@@ -1235,7 +1235,7 @@ their parent process exits. The manager classes are defined in the ...@@ -1235,7 +1235,7 @@ their parent process exits. The manager classes are defined in the
Connect a local manager object to a remote manager process:: Connect a local manager object to a remote manager process::
>>> from multiprocessing.managers import BaseManager >>> from multiprocessing.managers import BaseManager
>>> m = BaseManager(address=('127.0.0.1', 5000), authkey='abc') >>> m = BaseManager(address=('127.0.0.1', 5000), authkey=b'abc')
>>> m.connect() >>> m.connect()
.. method:: shutdown() .. method:: shutdown()
...@@ -1454,7 +1454,7 @@ remote clients can access:: ...@@ -1454,7 +1454,7 @@ remote clients can access::
>>> queue = queue.Queue() >>> queue = queue.Queue()
>>> class QueueManager(BaseManager): pass >>> class QueueManager(BaseManager): pass
>>> QueueManager.register('get_queue', callable=lambda:queue) >>> QueueManager.register('get_queue', callable=lambda:queue)
>>> m = QueueManager(address=('', 50000), authkey='abracadabra') >>> m = QueueManager(address=('', 50000), authkey=b'abracadabra')
>>> s = m.get_server() >>> s = m.get_server()
>>> s.serve_forever() >>> s.serve_forever()
...@@ -1463,7 +1463,7 @@ One client can access the server as follows:: ...@@ -1463,7 +1463,7 @@ One client can access the server as follows::
>>> from multiprocessing.managers import BaseManager >>> from multiprocessing.managers import BaseManager
>>> class QueueManager(BaseManager): pass >>> class QueueManager(BaseManager): pass
>>> QueueManager.register('get_queue') >>> QueueManager.register('get_queue')
>>> m = QueueManager(address=('foo.bar.org', 50000), authkey='abracadabra') >>> m = QueueManager(address=('foo.bar.org', 50000), authkey=b'abracadabra')
>>> m.connect() >>> m.connect()
>>> queue = m.get_queue() >>> queue = m.get_queue()
>>> queue.put('hello') >>> queue.put('hello')
...@@ -1473,7 +1473,7 @@ Another client can also use it:: ...@@ -1473,7 +1473,7 @@ Another client can also use it::
>>> from multiprocessing.managers import BaseManager >>> from multiprocessing.managers import BaseManager
>>> class QueueManager(BaseManager): pass >>> class QueueManager(BaseManager): pass
>>> QueueManager.register('get_queue') >>> QueueManager.register('get_queue')
>>> m = QueueManager(address=('foo.bar.org', 50000), authkey='abracadabra') >>> m = QueueManager(address=('foo.bar.org', 50000), authkey=b'abracadabra')
>>> m.connect() >>> m.connect()
>>> queue = m.get_queue() >>> queue = m.get_queue()
>>> queue.get() >>> queue.get()
...@@ -1497,7 +1497,7 @@ client to access it remotely:: ...@@ -1497,7 +1497,7 @@ client to access it remotely::
>>> class QueueManager(BaseManager): pass >>> class QueueManager(BaseManager): pass
... ...
>>> QueueManager.register('get_queue', callable=lambda: queue) >>> QueueManager.register('get_queue', callable=lambda: queue)
>>> m = QueueManager(address=('', 50000), authkey='abracadabra') >>> m = QueueManager(address=('', 50000), authkey=b'abracadabra')
>>> s = m.get_server() >>> s = m.get_server()
>>> s.serve_forever() >>> s.serve_forever()
...@@ -1865,9 +1865,9 @@ multiple connections at the same time. ...@@ -1865,9 +1865,9 @@ multiple connections at the same time.
generally be omitted since it can usually be inferred from the format of generally be omitted since it can usually be inferred from the format of
*address*. (See :ref:`multiprocessing-address-formats`) *address*. (See :ref:`multiprocessing-address-formats`)
If *authenticate* is ``True`` or *authkey* is a string then digest If *authenticate* is ``True`` or *authkey* is a byte string then digest
authentication is used. The key used for authentication will be either authentication is used. The key used for authentication will be either
*authkey* or ``current_process().authkey)`` if *authkey* is ``None``. *authkey* or ``current_process().authkey`` if *authkey* is ``None``.
If authentication fails then If authentication fails then
:exc:`~multiprocessing.AuthenticationError` is raised. See :exc:`~multiprocessing.AuthenticationError` is raised. See
:ref:`multiprocessing-auth-keys`. :ref:`multiprocessing-auth-keys`.
...@@ -1903,8 +1903,8 @@ multiple connections at the same time. ...@@ -1903,8 +1903,8 @@ multiple connections at the same time.
If *authenticate* is ``True`` (``False`` by default) or *authkey* is not If *authenticate* is ``True`` (``False`` by default) or *authkey* is not
``None`` then digest authentication is used. ``None`` then digest authentication is used.
If *authkey* is a string then it will be used as the authentication key; If *authkey* is a byte string then it will be used as the
otherwise it must be *None*. authentication key; otherwise it must be *None*.
If *authkey* is ``None`` and *authenticate* is ``True`` then If *authkey* is ``None`` and *authenticate* is ``True`` then
``current_process().authkey`` is used as the authentication key. If ``current_process().authkey`` is used as the authentication key. If
...@@ -2081,12 +2081,13 @@ unpickled. Unfortunately unpickling data from an untrusted source is a security ...@@ -2081,12 +2081,13 @@ unpickled. Unfortunately unpickling data from an untrusted source is a security
risk. Therefore :class:`Listener` and :func:`Client` use the :mod:`hmac` module risk. Therefore :class:`Listener` and :func:`Client` use the :mod:`hmac` module
to provide digest authentication. to provide digest authentication.
An authentication key is a string which can be thought of as a password: once a An authentication key is a byte string which can be thought of as a
connection is established both ends will demand proof that the other knows the password: once a connection is established both ends will demand proof
authentication key. (Demonstrating that both ends are using the same key does that the other knows the authentication key. (Demonstrating that both
**not** involve sending the key over the connection.) ends are using the same key does **not** involve sending the key over
the connection.)
If authentication is requested but do authentication key is specified then the If authentication is requested but no authentication key is specified then the
return value of ``current_process().authkey`` is used (see return value of ``current_process().authkey`` is used (see
:class:`~multiprocessing.Process`). This value will automatically inherited by :class:`~multiprocessing.Process`). This value will automatically inherited by
any :class:`~multiprocessing.Process` object that the current process creates. any :class:`~multiprocessing.Process` object that the current process creates.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment