mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
url: add trailing slashes to URLs with hostnames that don't have one
This works around a potential issue in Python 2.4 where cloning a repo with a URL like http://foo:8080 would cause urllib2 to query on http://foo:8080?cmd=capabilities instead of http://foo:8080/?cmd=capabilities. In the past, this issue has been masked by the fact that url.getauthinfo() added a trailing slash when it was missing.
This commit is contained in:
parent
193402d9df
commit
40c99bbacb
@ -156,7 +156,7 @@ class url(object):
|
|||||||
>>> str(url('http://localhost:80/'))
|
>>> str(url('http://localhost:80/'))
|
||||||
'http://localhost:80/'
|
'http://localhost:80/'
|
||||||
>>> str(url('http://localhost:80'))
|
>>> str(url('http://localhost:80'))
|
||||||
'http://localhost:80'
|
'http://localhost:80/'
|
||||||
>>> str(url('bundle:foo'))
|
>>> str(url('bundle:foo'))
|
||||||
'bundle:foo'
|
'bundle:foo'
|
||||||
>>> str(url('path'))
|
>>> str(url('path'))
|
||||||
@ -185,8 +185,7 @@ class url(object):
|
|||||||
s += self.host
|
s += self.host
|
||||||
if self.port:
|
if self.port:
|
||||||
s += ':' + urllib.quote(self.port)
|
s += ':' + urllib.quote(self.port)
|
||||||
if ((self.host and self.path is not None) or
|
if self.host:
|
||||||
(self.host and self.query or self.fragment)):
|
|
||||||
s += '/'
|
s += '/'
|
||||||
if self.path:
|
if self.path:
|
||||||
s += urllib.quote(self.path, safe=self._safepchars)
|
s += urllib.quote(self.path, safe=self._safepchars)
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
$ echo bar >> b/foo
|
$ echo bar >> b/foo
|
||||||
$ hg -R b ci -m bar
|
$ hg -R b ci -m bar
|
||||||
$ hg --encoding utf-8 -R b push
|
$ hg --encoding utf-8 -R b push
|
||||||
pushing to http://localhost:$HGPORT1
|
pushing to http://localhost:$HGPORT1/
|
||||||
searching for changes
|
searching for changes
|
||||||
remote: adding changesets
|
remote: adding changesets
|
||||||
remote: adding manifests
|
remote: adding manifests
|
||||||
|
@ -26,7 +26,7 @@ check that {1} syntax works
|
|||||||
$ hg incoming --debug parts://localhost
|
$ hg incoming --debug parts://localhost
|
||||||
using http://localhost:$HGPORT/
|
using http://localhost:$HGPORT/
|
||||||
sending capabilities command
|
sending capabilities command
|
||||||
comparing with parts://localhost
|
comparing with parts://localhost/
|
||||||
sending heads command
|
sending heads command
|
||||||
searching for changes
|
searching for changes
|
||||||
sending known command
|
sending known command
|
||||||
|
Loading…
Reference in New Issue
Block a user