[Django] #21242: Allow more IANA schemes in URLValidator

19 views
Skip to first unread message

Django

unread,
Oct 8, 2013, 4:40:01 AM10/8/13
to django-...@googlegroups.com
#21242: Allow more IANA schemes in URLValidator
-------------------------------+--------------------
Reporter: saschpe | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.5
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Currently, URLValidator only allows the following schemes: http(s) and
ftp(s). Since the formal definition of URL (being a subset of URI)
includes many more valid schemes [1], URLValidator should be expanded to
allow those. Of course Django users could create their own validator but
this seems to be a rather common task it's probably better to have that in
core Django.

An alternative solution would be to provide an URIValidator which allows
more schemes than what we currently have in URLValidator. However, since
sth. like ssh://example.com is not only a valid URI but also a valid URL
[2] it doesn't seem to make sense to differentiate URI and URL.

Related to that, #15229 already added support for ftp(s)


[1] https://en.wikipedia.org/wiki/URI_scheme#Official_IANA-
registered_schemes
[2] https://tools.ietf.org/html/rfc3986

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

Django

unread,
Oct 8, 2013, 4:55:33 AM10/8/13
to django-...@googlegroups.com
#21242: Allow more IANA schemes in URLValidator
-------------------------------+--------------------------------------

Reporter: saschpe | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.5
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

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


Comment:

So https://github.com/django/django/pull/1717 addresses at least the ssh
example, but I'd rather want to generalize URLValidator further.

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

Django

unread,
Oct 8, 2013, 8:39:38 AM10/8/13
to django-...@googlegroups.com
#21242: Allow more IANA schemes in URLValidator
------------------------------+------------------------------------
Reporter: saschpe | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

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

* needs_better_patch: 0 => 1
* component: Uncategorized => Core (Other)
* version: 1.5 => master
* has_patch: 0 => 1
* type: Uncategorized => New feature
* stage: Unreviewed => Accepted


Comment:

Yes, this might be interesting, but only if we generalize accepted
schemes. We should probably add a new `scheme` init parameter allowing to
specify a scheme list (defaulting to ['http', 'https', 'ftp', 'ftps']),
and then check for valid schemes in `__call__`.

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

Django

unread,
Oct 16, 2013, 7:57:51 AM10/16/13
to django-...@googlegroups.com
#21242: Allow more IANA schemes in URLValidator
------------------------------+------------------------------------
Reporter: saschpe | Owner: saschpe
Type: New feature | Status: assigned

Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by saschpe):

* owner: nobody => saschpe
* status: new => assigned


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

Django

unread,
Nov 7, 2013, 8:04:44 AM11/7/13
to django-...@googlegroups.com
#21242: Allow more IANA schemes in URLValidator
------------------------------+------------------------------------
Reporter: saschpe | Owner: saschpe
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------

Comment (by saschpe):

It's now https://github.com/django/django/pull/1759

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

Django

unread,
Dec 21, 2013, 3:58:07 AM12/21/13
to django-...@googlegroups.com
#21242: Allow more IANA schemes in URLValidator
------------------------------+------------------------------------
Reporter: saschpe | Owner: saschpe
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* needs_better_patch: 1 => 0


Comment:

I've provided an alternative patch, based on Sascha's patch:
https://github.com/django/django/pull/2099

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

Django

unread,
Dec 28, 2013, 1:50:36 PM12/28/13
to django-...@googlegroups.com
#21242: Allow more IANA schemes in URLValidator
-------------------------------------+-------------------------------------

Reporter: saschpe | Owner: saschpe
Type: New feature | Status: assigned
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timo):

* stage: Accepted => Ready for checkin


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

Django

unread,
Dec 28, 2013, 3:26:03 PM12/28/13
to django-...@googlegroups.com
#21242: Allow more IANA schemes in URLValidator
-------------------------------------+-------------------------------------
Reporter: saschpe | Owner: saschpe
Type: New feature | Status: closed

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

Keywords: | Triage Stage: Ready for
Has patch: 1 | checkin
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

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


Comment:

In [changeset:"6d66ba59488bbd0d4f0c2f32b2921f1512301143"]:
{{{
#!CommitTicketReference repository=""
revision="6d66ba59488bbd0d4f0c2f32b2921f1512301143"
Fixed #21242 -- Allowed more IANA schemes in URLValidator

Thanks Sascha Peilicke for the report and initial patch, and
Tim Graham for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21242#comment:7>

Reply all
Reply to author
Forward
0 new messages