Django

Code

Ticket #4986 (closed: fixed)

Opened 1 year ago

Last modified 9 months ago

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

Reported by: SmileyChris Assigned to: nobody
Milestone: Component: HTTP handling
Version: SVN Keywords:
Cc: smileychris+django@gmail.com Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

get_host.patch (0.8 kB) - added by SmileyChris on 07/26/07 21:44:06.

Change History

07/26/07 21:44:06 changed by SmileyChris

  • attachment get_host.patch added.

07/26/07 21:47:13 changed by SmileyChris

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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

07/29/07 19:04:51 changed by SmileyChris

  • cc set to smileychris+django@gmail.com.
  • stage changed from Unreviewed to Ready for checkin.

09/14/07 00:39:43 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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

09/19/07 16:50:01 changed by frasern

  • status changed from closed to reopened.
  • resolution deleted.

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.

09/19/07 17:04:34 changed by anonymous

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

10/03/07 17:21:44 changed by mtredinnick

  • status changed from reopened to closed.
  • resolution set to fixed.

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


Add/Change #4986 (get_host should fall back to building from SERVER_NAME/PORT if HTTP_HOST doesn't exist)




Change Properties
Action