[Zope] VHM / traverse subpath interaction bug?

Tres Seaver tseaver at palladion.com
Fri Oct 3 12:20:25 EDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris Withers wrote:
> Dieter Maurer wrote:
>>> Worse yet, if you go to:
>>>
>>> http://localhost:8080/VirtualHostBase/https/example.com:443/test/VirtualHostRoot/_vh_something/x/y/z
>>>
>>> ...you get:
>>>
>>> ['virtual_hosting', '/something', 'x', 'y', 'z']
>>>
>>> Anyone got any ideas as to what's going on here?
>> It is very strange that you want to define a Python Script as
>> root of your site. This use case is simple not supported.
> 
> Who said anything about it being the root of a site? ;-)
> 
> I guess this wouldn't actually happen if the python script was after the 
>   vritual host's root...
> 
> I actually bumped into this trying to get the antique ZRoundup product 
> to work on Zope 2.11. The fix wasn't that pretty:
> 
> http://sourceforge.net/tracker/index.php?func=detail&aid=2141835&group_id=31577&atid=402788
> 
> (see the __before_traverse__ hook code)
> 
>>   A VHM needs to get control twice -- once to set things up
>>   and once to set the virtual root.
>>   It ensures to get control the second time by adding additional traversal
>>   steps.
> 
> I bet repoze's VHM replacement doesn't need this ;-)
> I wonder how they do it?

Two parts:

  - The first (WSGI middleware) uses either extra headers or the
    Zope2-style URL tokens to adjust the CGI environment variables
    (SERVER_NAME, HTTP_HOST, SCRIPT_NAME, and PATH_INFO), plus a
    stock WSGI environment variable ('wsgi.url_scheme'). See
    http://svn.repoze.org/repoze.vhm/trunk/repoze/vhm/middleware.py

  - The second part (in the application) just uses those values
    according to their "stock" CGI meanings, and sets the 'SERVER_URL'
    key in the request.  Once that is set, the stock ZPublisher
    virtual hosting machinery is neutered. ;)  See
    http://svn.repoze.org/repoze.zope2/trunk/repoze/zope2/z2bob.py


Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFI5kZJ+gerLs4ltQ4RAh/WAKDDoOzY16/EkHbnuxONqXpAzzH3vACeNtoP
tvirU7lgA2wzyo3KI4BCq9w=
=fHOB
-----END PGP SIGNATURE-----



More information about the Zope mailing list