Merged revisions 77263-77264 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77263 | gregory.p.smith | 2010-01-02 17:29:44 -0800 (Sat, 02 Jan 2010) | 4 lines

  Adds an optional source_address parameter to socket.create_connection().

  For use by issue3972.
........
  r77264 | gregory.p.smith | 2010-01-02 18:06:07 -0800 (Sat, 02 Jan 2010) | 5 lines

  issue3972: HTTPConnection and HTTPSConnection now support a
  source_address parameter.

  Also cleans up an annotation in the socket documentation.
........
This commit is contained in:
Gregory P. Smith 2010-01-03 03:28:29 +00:00
parent 91ae4a1404
commit b4066374db
7 changed files with 89 additions and 14 deletions

View file

@ -194,7 +194,7 @@ The module :mod:`socket` exports the following constants and functions:
this platform.
.. function:: create_connection(address[, timeout])
.. function:: create_connection(address[, timeout[, source_address]])
Convenience function. Connect to *address* (a 2-tuple ``(host, port)``),
and return the socket object. Passing the optional *timeout* parameter will
@ -202,6 +202,13 @@ The module :mod:`socket` exports the following constants and functions:
*timeout* is supplied, the global default timeout setting returned by
:func:`getdefaulttimeout` is used.
If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the
socket to bind to as its source address before connecting. If host or port
are '' or 0 respectively the OS default behavior will be used.
.. versionchanged:: 3.2
*source_address* was added.
.. function:: getaddrinfo(host, port[, family[, socktype[, proto[, flags]]]])