#32930: URLValidator should accept urls with port number < 10
------------------------------+--------------------------------------
Reporter: Wu Haotian | Owner: Wu Haotian
Type: Bug | Status: assigned
Component: Core (Other) | Version: 3.2
Severity: Normal | Resolution:
Keywords: URLValidator | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by Nick Pope):
* stage: Unreviewed => Accepted
Comment:
So I looked into why it was added in
2e65d56156b622e2393dee1af66e9c799a51924f but the best I could come up with
is that is was copied from [https://gist.github.com/dperini/729294 this
gist]. There are unaddressed comments, e.g.
[https://gist.github.com/dperini/729294#gistcomment-1563577 this one],
about this issue with the port number and other things.
Note that
[https://github.com/django/django/commit/2e65d56156b622e2393dee1af66e9c799a51924f
#diff-d9609d8dc8482b30eac30df16213cba134562949fd62c97573927b89e880f85bR120
this line] is also affected and will need fixing.
We can change `(?::\d{2,5})?` to `(?::\d{1,5})?` to fix this naively.
Or we can be a little more strict as the port should only be a 16-bit
unsigned integer (0-65535) and use the following to disallow 65536 and
higher:
{{{
(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])?
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32930#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.4561c64f0310b014ed038f03f0f811d4%40djangoproject.com.