Mercurial > public > mercurial-scm > hg
comparison tests/test-url.py @ 13848:b2798c1defff
url: be stricter about detecting schemes
While the URL parser is very forgiving about what characters are
allowed in each component, it's useful to be strict about the scheme
so we don't accidentally interpret local paths with colons as URLs.
This restricts schemes to containing alphanumeric characters, dashes,
pluses, and dots (as specified in RFC 2396).
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Thu, 31 Mar 2011 17:37:33 -0700 |
parents | f1823b9f073b |
children | 924c82157d46 |
comparison
equal
deleted
inserted
replaced
13845:ddcb57a2eaeb | 13848:b2798c1defff |
---|---|
155 | 155 |
156 >>> url('a/b/c/d.g.f') | 156 >>> url('a/b/c/d.g.f') |
157 <url path: 'a/b/c/d.g.f'> | 157 <url path: 'a/b/c/d.g.f'> |
158 >>> url('/x///z/y/') | 158 >>> url('/x///z/y/') |
159 <url path: '/x///z/y/'> | 159 <url path: '/x///z/y/'> |
160 >>> url('/foo:bar') | |
161 <url path: '/foo:bar'> | |
162 >>> url('\\\\foo:bar') | |
163 <url path: '\\\\foo:bar'> | |
164 >>> url('./foo:bar') | |
165 <url path: './foo:bar'> | |
160 | 166 |
161 Non-localhost file URL: | 167 Non-localhost file URL: |
162 | 168 |
163 >>> u = url('file://mercurial.selenic.com/foo') | 169 >>> u = url('file://mercurial.selenic.com/foo') |
164 Traceback (most recent call last): | 170 Traceback (most recent call last): |