Opened 17 years ago

Closed 16 years ago

Last modified 13 years ago

#7494 closed (fixed)

build_absolute_url method of the HttpRequest class fails with urls with : in their path

Reported by: tom@… Owned by: RobotAdam
Component: HTTP handling Version: dev
Severity: Keywords: aug22sprint
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

When build_absolute_url is called for a location that should contain a ":" character in it's path it fails to add the "http://www.example.com" part.

This is because off line 76 of django/http/init.py where "if not ':' in location:" is used to check if the location is already absolute.

According to http://www.faqs.org/rfcs/rfc1738.html it is perfectly valid to have a ":" in the path part of a HTTP url.

Attachments (2)

fix_absolute_url_check_in_get_absolute_url.diff (890 bytes ) - added by tom@… 17 years ago.
Patch that fixes the problem
fix_absolute_url_check_with_tests.diff (1.5 KB ) - added by RobotAdam 16 years ago.
Updated patch including tests

Download all attachments as: .zip

Change History (10)

by tom@…, 17 years ago

Patch that fixes the problem

comment:1 by anonymous, 17 years ago

Component: UncategorizedHTTP handling

comment:2 by Eric Holscher, 16 years ago

milestone: 1.0
Needs tests: set
Owner: changed from nobody to Eric Holscher
Patch needs improvement: set
Status: newassigned

The https:// shouldn't be hard coded in. This looks like it is a bug though.

comment:3 by Eric Holscher, 16 years ago

Triage Stage: UnreviewedAccepted

comment:4 by Eric Holscher, 16 years ago

Owner: Eric Holscher removed
Status: assignednew

by RobotAdam, 16 years ago

Updated patch including tests

comment:5 by RobotAdam, 16 years ago

Keywords: aug22sprint added
Owner: set to RobotAdam
Status: newassigned

The "https?" in the regexp is correct with the question mark. I've updated the patch with tests that confirm it.

comment:6 by RobotAdam, 16 years ago

Needs tests: unset

comment:7 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: assignedclosed

(In [8490]) Fixed #7494 -- Fixed build_absolute_url() for some types of (uncommon) URLs.
Patch from tom@… and RobotAdam.

comment:8 by Jacob, 13 years ago

milestone: 1.0

Milestone 1.0 deleted

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