Merge lp:~lifeless/bzr/bug-558343-wrong-host-with-proxy into lp:bzr
| Status: | Merged |
|---|---|
| Approved by: | Vincent Ladeuil on 2010-05-10 |
| Approved revision: | 5218 |
| Merged at revision: | 5220 |
| Proposed branch: | lp:~lifeless/bzr/bug-558343-wrong-host-with-proxy |
| Merge into: | lp:bzr |
| Diff against target: |
70 lines (+19/-13) 2 files modified
NEWS (+3/-0) bzrlib/transport/http/_urllib2_wrappers.py (+16/-13) |
| To merge this branch: | bzr merge lp:~lifeless/bzr/bug-558343-wrong-host-with-proxy |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Vincent Ladeuil | 2010-05-08 | Approve on 2010-05-10 | |
| bzr-core | 2010-05-08 | Pending | |
|
Review via email:
|
|||
Commit Message
Fix lp: urls behind an https proxy.
Description of the Change
This should fix using lp: urls from behind an https proxy; no tests - it appears remarkably opaque :(.
Would love vincent's opinion on it, as I think he knows urllib2 guts much better than I.
| Robert Collins (lifeless) wrote : | # |
| Vincent Ladeuil (vila) wrote : | # |
At first glance, the following line:
26 + self.add_
looks obvious.
From memory, I'm pretty sure the Host header is added just before sending the request
if it's not there already. Yet, I also have some vague feeling that playing with *this* header
led to trouble in the past (this fix could have avoid that may be).
I'd blame the lack of test for this omission. Am I right in thinking that
the bug requires a redirection behind the proxy to trigger ?
If yes, that could explain why we didn't get more reports (and the NEWS entry may
be more precise then).
Since proxy and redirection tests are pretty hackish so far, there may be a way to test
this with pre-canned responses (I think there is some test http
server than can be used for that).
I won't have time to look at it until UDS so let's talk about it there.
Otherwise, thanks for the cleanup, we may also want to use 'http' in debug_flags instead of
debug_level, that will help diagnosing issues in the future.
| Robert Collins (lifeless) wrote : | # |
Yes, when I stepped through the code, urllib2 adds a host header if
there isn't one, and its grabbing the wrong host value because
'has_proxy' is returning False.
And yes, you have to have an https proxy defined to trigger this - see
my comments in the bug about reproducing it.
Sounds like you think this is ok? Could you land it(I'm hopping on a
plane in a minute for the next leg).
Thanks,
Rob
| Vincent Ladeuil (vila) wrote : | # |
I found time to look at the code. There is already a huge list of missing tests under a FIXME there (including the one that is missing here).
And yes, the fix is right and urllib2 didn't have the bug because it didn't implement CONNECT anyway.
| Robert Collins (lifeless) wrote : | # |
submitted to PQM by hand.
| Robert Collins (lifeless) wrote : | # |
submitted to PQM by hand.
| Robert Collins (lifeless) wrote : | # |
submitted to PQM by hand.
| Robert Collins (lifeless) wrote : | # |
submitted to PQM by hand.
| Robert Collins (lifeless) wrote : | # |
submitted to PQM by hand.

Oh, and as I'm travelling to UDS, please land if its ok (or fix and land) - this is fairly high importance IMO.