Opened 13 years ago

Closed 13 years ago

#17684 closed Bug (wontfix)

URLValidator: Validation fails when URL requires User-Agent header

Reported by: Raymond Penners Owned by: nobody
Component: Core (URLs) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The following example shows a link that returns a 403 in case no user agent is passed. When passed, a proper 200 is returned. However, this does not seem to work with the URLValidator. The ValidationError is unexpected here...

>>> import django
>>> django.VERSION
(1, 3, 1, 'final', 0)
>>> import requests
>>> from django.core.validators import URLValidator
>>> ua = 'foobar'
>>> requests.get('http://www.autoedizione.nl/feed/')
<Response [403]>
>>> requests.get('http://www.autoedizione.nl/feed/', headers={ 'User-Agent': ua})
<Response [200]>
>>> URLValidator(verify_exists=True, validator_user_agent=ua)('http://www.autoedizione.nl/feed/')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "...HIDDEN.../django/django/core/validators.py", line 121, in __call__
    raise broken_error
ValidationError: [u'This URL appears to be a broken link.']

(Python 2.6.5)

Change History (1)

comment:1 by Aymeric Augustin, 13 years ago

Resolution: wontfix
Status: newclosed

Thanks for reporting this bug. However, the URL verification feature was removed in Django 1.4, thus "resolving" the issue. See r16760

Note: See TracTickets for help on using tickets.
Back to Top