[New-bugs-announce] [issue3972] Add Option to Bind to a Local IP Address in httplib.py

Eldon Ziegler report at bugs.python.org
Fri Sep 26 11:58:52 CEST 2008

New submission from Eldon Ziegler <eldonz at atlanticdb.com>:

I updated httplib.py, python 2.4, to be able to bind to a specific IP
address when connecting to a remote site.

  conn = httplib.HTTPConnection('', 80)

will connect to '' using one of the local IP addresses. For
example, if a machine has an primary IP address and an alias such as


the outbound connection might use either eth0 or eth0:1. I'm not sure
how it picks now. I added a bind option both for http and https so we
can direct the connection through one or the other. For example,

  conn = httplib.HTTPConnection('', 80, None, None, None,

would make sure it used not

I ran into this on a server that is contacted by an external legacy
server which requires a reverse connection over the same IP address that
the original connection came in on.

components: Library (Lib)
files: httplib2.4.diff
keywords: patch
messages: 73840
nosy: eldonz at atlanticdb.com
severity: normal
status: open
title: Add Option to Bind to a Local IP Address in httplib.py
type: feature request
versions: Python 2.4, Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file11607/httplib2.4.diff

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list