I've been debugging some weirdness with deliverance 0.3 in front of 
repoze.vhm and the vhm_xhosts middleware, which specifically happens 
when the VHM host has a port in it (e.g. localhost:8000).

Basically, Deliverance uses webob.Request, and in particular its 'url' 
property to construct some URLs. After repoze.vhm does its thing, the 
URL loses the port part.

It seems that before repoze.vhm kicks in, environ['HTTP_HOST'] is e.g. 
'localhost:8000'. Afterwards, it's just 'localhost'.

This is done here, in middleware.py:

             environ['SERVER_NAME'] = host
             environ['HTTP_HOST'] = host
             environ['SERVER_PORT'] = port
             environ['SCRIPT_NAME'] = path

If I change this to the following, the url comes through correctly in 

             environ['SERVER_NAME'] = host
             environ['HTTP_HOST'] = "%s:%s" % (host, port,)
             environ['SERVER_PORT'] = port
             environ['SCRIPT_NAME'] = path

Would it be OK to change repoze.vhm to do this (and get a new release)? 
Or is there something more sinister going on?


Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

Repoze-dev mailing list

Reply via email to