Mercurial > public > mercurial-scm > hg
comparison mercurial/url.py @ 13817:7f18bab2c0b0
url: abort on file:// URLs with non-localhost hosts
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Wed, 30 Mar 2011 20:01:31 -0700 |
parents | 2540f8087e02 |
children | bf6156bab41b |
comparison
equal
deleted
inserted
replaced
13816:2540f8087e02 | 13817:7f18bab2c0b0 |
---|---|
138 if (self.host and ':' in self.host and | 138 if (self.host and ':' in self.host and |
139 not (self.host.startswith('[') and self.host.endswith(']'))): | 139 not (self.host.startswith('[') and self.host.endswith(']'))): |
140 self.host, self.port = self.host.rsplit(':', 1) | 140 self.host, self.port = self.host.rsplit(':', 1) |
141 if not self.host: | 141 if not self.host: |
142 self.host = None | 142 self.host = None |
143 | |
144 if (self.host and self.scheme == 'file' and | |
145 self.host not in ('localhost', '127.0.0.1', '[::1]')): | |
146 raise util.Abort(_('file:// URLs can only refer to localhost')) | |
147 | |
143 self.path = path | 148 self.path = path |
144 | 149 |
145 for a in ('user', 'passwd', 'host', 'port', | 150 for a in ('user', 'passwd', 'host', 'port', |
146 'path', 'query', 'fragment'): | 151 'path', 'query', 'fragment'): |
147 v = getattr(self, a) | 152 v = getattr(self, a) |