launchpad proxy support

Gordon Tyler gordon at
Fri Oct 30 18:35:10 GMT 2009

Vincent Ladeuil wrote:
> Argh ! Gimme the headers ! :-)

Sorry, I didn't want to spam huge amounts of text. Here you go:

0.219  * About to connect() to localhost:3128(proxy for
0.234  > CONNECT
0.234  > Host: localhost:3128
 > Accept: */*
 > User-Agent: bzr/2.1.0dev2 (urllib)
 > Connection: Keep-Alive
 > Pragma: no-cache
 > Cache-Control: max-age=0

0.250  < HTTP/1.1 502 Proxy Error ( The parameter is incorrect.  )
0.250  < Via: 1.1 TORISAW01
< Connection: close
< Proxy-Connection: close
< Pragma: no-cache
< Cache-Control: no-cache
< Content-Type: text/html
< Content-Length: 2279

> We can ask the reverse question: how come some proxies connect
> successfully without the port explicitly mentioned ?
> I.e. on jaunty I see that same 'CONNECT
>' without port and the connection
> succeeds...

I was wondering that myself so I went and tested your branch on my 
debian box at home using tinyproxy and it worked. Color me extremely 
confused. When I tested my changes to use the _urllib2_wrappers but 
without the port correction, it was failing. There's something we're 
missing here...

> But anyway, those are just debug outputs they can lie :-)

The thought had occurred to me as well.

> I now understand the intent of that controversial code, I've just
> pushed the equivalent fix, can you retry ?

It appears to be working in both of my test environments. I noticed that 
in the tinyproxy environment, the tinyproxy log now shows:

CONNECT   Oct 30 14:20:18 [24520]: Request (file descriptor 7): CONNECT HTTP/1.1

So it wasn't lying earlier. Very strange.

By the way, I noticed that you're using self.port in the 
_urllib2_wrappers Request class to check if the URL contains a port. I 
could not find where that was being initialized when I was making my fix 
yesterday which is why I had that code wart to rip the port out of the 
original URL.


More information about the bazaar mailing list