Issue5111
Created on 2009-01-30 16:48 by gdesmott, last changed 2009-07-02 17:56 by chkneo.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
5111.diff
|
chkneo,
2009-07-02 09:44
|
patch file |
|
|
|
5311_test.diff
|
chkneo,
2009-07-02 17:56
|
test_httplib patch |
|
|
|
msg80827 - (view) |
Author: Guillaume Desmottes (gdesmott) |
Date: 2009-01-30 16:48 |
|
To reproduce:
- Launch a HTTP server listening on an Inet6 socket on, say, port 5555
- Try to connect using the IPv6 loopback:
http = httplib.HTTPConnection('[::1]:5555')
http.request('GET', '/foo')
r = http.getresponse()
print r.status
- You get 400 (bad-request) instead of 404
It seems that's because the HTTP request is wrong. Python sends this header:
Host: ::1:5555
but it should be:
Host: [::1]:5555
I'm using python 2.5.2-1ubuntu1 on Intrepid.
|
|
msg80829 - (view) |
Author: Guillaume Desmottes (gdesmott) |
Date: 2009-01-30 17:06 |
|
Actually, this bug is present when you try to connect to any URL
containing an IP6 and a port.
So, we have the same problem when using, for example:
http = httplib.HTTPConnection('[2a01:8790:16d:0:218:de87:164:8745]:5555')
but
http = httplib.HTTPConnection('[2001:4860:0:1001::68]:80')
does work. Probably because we use the default HTTP port.
|
|
msg90005 - (view) |
Author: chkneo (chkneo) |
Date: 2009-07-02 09:30 |
|
As per the RFC 2732 host header should be wrapped with []. I am
attaching patch for this too which is applied on trunk(2.7)
|
|
msg90006 - (view) |
Author: chkneo (chkneo) |
Date: 2009-07-02 09:33 |
|
RFC 2732 Section three have the following details.
host = hostname | IPv4address | IPv6reference
ipv6reference = "[" IPv6address "]"
The patch contains check for : and adding the brackets
|
|
msg90016 - (view) |
Author: Antoine Pitrou (pitrou) |
Date: 2009-07-02 14:40 |
|
Thanks for the patch. It would be better if you also added a test to
Lib/test/test_httplib.py (unless for some reason it's technically
impossible to do so).
|
|
msg90028 - (view) |
Author: chkneo (chkneo) |
Date: 2009-07-02 17:56 |
|
Attaching the test patch
|
|
| Date |
User |
Action |
Args |
| 2009-07-02 17:56:33 | chkneo | set | files:
+ 5311_test.diff
messages:
+ msg90028 |
| 2009-07-02 14:40:03 | pitrou | set | nosy:
+ pitrou
messages:
+ msg90016 versions:
+ Python 2.6, Python 3.1, Python 2.7, Python 3.2, - Python 2.5 |
| 2009-07-02 09:44:18 | chkneo | set | files:
+ 5111.diff |
| 2009-07-02 09:44:08 | chkneo | set | files:
- 5111.diff |
| 2009-07-02 09:33:28 | chkneo | set | messages:
+ msg90006 |
| 2009-07-02 09:30:08 | chkneo | set | files:
+ 5111.diff
nosy:
+ chkneo messages:
+ msg90005
keywords:
+ patch type: behavior |
| 2009-03-31 17:40:43 | dmorr | set | nosy:
+ dmorr
|
| 2009-01-30 17:06:43 | gdesmott | set | messages:
+ msg80829 title: httplib: wrong Host header when connecting to IPv6 loopback -> httplib: wrong Host header when connecting to IPv6 litteral URL |
| 2009-01-30 16:48:57 | gdesmott | create | |
|