Opened 17 years ago

Closed 16 years ago

#4986 closed (fixed)

get_host should fall back to building from SERVER_NAME/PORT if HTTP_HOST doesn't exist

Reported by: Chris Beaven Owned by: nobody
Component: HTTP handling Version: dev
Severity: Keywords:
Cc: smileychris+django@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The problem is that get_host currently relies on HTTP_HOST environ variable which may not exist.

Using a section of PEP333 as my muse, I rewrote get_host to fall back to creating the host based on SERVER_NAME and SERVER_PORT.

Attachments (1)

get_host.patch (854 bytes ) - added by Chris Beaven 17 years ago.

Download all attachments as: .zip

Change History (7)

by Chris Beaven, 17 years ago

Attachment: get_host.patch added

comment:1 by Chris Beaven, 17 years ago

When this is applied, #4951 can be upgraded to ready for checkin.

comment:2 by Chris Beaven, 17 years ago

Cc: smileychris+django@… added
Triage Stage: UnreviewedReady for checkin

comment:3 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

(In [6166]) Fixed #4986 -- Improved get_host() host detection. Thanks, SmileyChris.

comment:4 by Fraser Nevett, 17 years ago

Resolution: fixed
Status: closedreopened

The fix doesn't seem to be quite right as the value from HTTP_X_FORWARDED_HOST is now never used and is always overwritten.

comment:5 by anonymous, 17 years ago

Indeed, it doesn't look correct. My patch didn't do that ;)

comment:6 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: reopenedclosed

(In [6449]) Fixed #4986 -- Fixed a logic bug from [6166].

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