[Django] #25635: URLValidator regex is not allowing '+' character in scheme and also scheme part is optional

4 views
Skip to first unread message

Django

unread,
Oct 29, 2015, 11:24:28 AM10/29/15
to django-...@googlegroups.com
#25635: URLValidator regex is not allowing '+' character in scheme and also scheme
part is optional
--------------------------------+------------------------------------------
Reporter: | Owner: nobody
DheerendraRathor |
Type: Bug | Status: new
Component: Core (Other) | Version: 1.8
Severity: Normal | Keywords: urlvalidator, regexvalidator
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Quoting w3's url-spec
A complete URL consists of a naming scheme specifier followed by a string
whose format is a function of the naming scheme.
and
Within the URL of a object, the first element is the name of the scheme,
separated from the rest of the object by a colon. The rest of the URL
follows the colon in a format depending on the scheme.

So basically scheme should be present in URL syntax. Current scheme regex
is `^(?:[a-z0-9\.\-]*)://` which allows empty schemes.

Also schemes should allow alphanumeric characters with `-`, `.` and `+`
([https://tools.ietf.org/html/rfc1738#section-2.1 rfc1738]).

--
Ticket URL: <https://code.djangoproject.com/ticket/25635>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 29, 2015, 12:26:16 PM10/29/15
to django-...@googlegroups.com
#25635: URLValidator regex is not allowing '+' character in scheme and also scheme
part is optional
-------------------------------------+-------------------------------------
Reporter: DheerendraRathor | Owner: nobody

Type: Bug | Status: new
Component: Core (Other) | Version: 1.8
Severity: Normal | Resolution:
Keywords: urlvalidator, | Triage Stage:
regexvalidator | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

When does a plus sign appear in the scheme in practice? I think schema
validation is handled outside of the regular expression. Could you give an
example of unexpected behavior with actual inputs?

--
Ticket URL: <https://code.djangoproject.com/ticket/25635#comment:1>

Django

unread,
Oct 29, 2015, 1:08:02 PM10/29/15
to django-...@googlegroups.com
#25635: URLValidator regex is not allowing '+' character in scheme and also scheme
part is optional
-------------------------------------+-------------------------------------
Reporter: DheerendraRathor | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.8
Severity: Normal | Resolution:
Keywords: urlvalidator, | Triage Stage:
regexvalidator | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by DheerendraRathor):

The very common example is git with ssh i.e. using `git+ssh` in scheme
name. Hg-Git plugin uses this scheme http://hg-git.github.io/. Yeah they
are somewhat rarely used. I guess Phabricator default ssh clone URL is
also git+ssh.

--
Ticket URL: <https://code.djangoproject.com/ticket/25635#comment:2>

Django

unread,
Oct 29, 2015, 2:14:57 PM10/29/15
to django-...@googlegroups.com
#25635: URLValidator regex is not allowing '+' character in scheme and also scheme
part is optional
-------------------------------------+-------------------------------------
Reporter: DheerendraRathor | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.8
Severity: Normal | Resolution:
Keywords: urlvalidator, | Triage Stage: Accepted
regexvalidator |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* stage: Unreviewed => Accepted


Comment:

[https://github.com/django/django/pull/5504 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/25635#comment:3>

Django

unread,
Oct 31, 2015, 5:36:51 PM10/31/15
to django-...@googlegroups.com
#25635: Fix URLValidator to allow the '+' character in URL scheme

-------------------------------------+-------------------------------------
Reporter: DheerendraRathor | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.8
Severity: Normal | Resolution:
Keywords: urlvalidator, | Triage Stage: Ready for
regexvalidator | checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/25635#comment:4>

Django

unread,
Oct 31, 2015, 5:52:27 PM10/31/15
to django-...@googlegroups.com
#25635: Fix URLValidator to allow the '+' character in URL scheme
-------------------------------------+-------------------------------------
Reporter: DheerendraRathor | Owner: nobody
Type: Bug | Status: closed

Component: Core (Other) | Version: 1.8
Severity: Normal | Resolution: fixed

Keywords: urlvalidator, | Triage Stage: Ready for
regexvalidator | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"06627ef2caa6854540b50b6f6309c7d12ccfb56a" 06627ef]:
{{{
#!CommitTicketReference repository=""
revision="06627ef2caa6854540b50b6f6309c7d12ccfb56a"
Fixed #25635 -- Made URLValidator allow '+' in scheme.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25635#comment:5>

Django

unread,
Nov 2, 2015, 11:47:21 AM11/2/15
to django-...@googlegroups.com
#25635: Fix URLValidator to allow the '+' character in URL scheme
-------------------------------------+-------------------------------------
Reporter: DheerendraRathor | Owner: nobody
Type: Bug | Status: closed
Component: Core (Other) | Version: 1.8
Severity: Normal | Resolution: fixed
Keywords: urlvalidator, | Triage Stage: Ready for
regexvalidator | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by zborboa-google):

* cc: zborboa@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/25635#comment:6>

Reply all
Reply to author
Forward
0 new messages