Nathan Van Gheem wrote:
> Thanks for the feedback on this. I've set up some tests that I
> think illustrate what is going on pretty well.

 >> We can get you svn access for sure. :)
> How can I go about getting that?

Email Chris McDonough. At least that's what I did. ;)

> Here are the test results..
>
> I've included the apache configuration in there just so you can see what
> I'm up to.
>
>     Results
>
>     =======
>
>
>     all requests coming on http://example.com:8888/a/b/c/d/@@testing
>
>
>     Not using wsgi and virtual host monster
>
>     ---------------------------------------
>
>
>     <VirtualHost *:8888>
>
>          ServerName example.com <http://example.com>
>
>          ServerAlias example.com <http://example.com>
>
>
>          RewriteEngine On
>
>
>          RewriteRule ^/(.*)
>     
> http://127.0.0.1:8499/VirtualHostBase/http/example.com:8888/example/VirtualHostRoot/$1
>     [L,P]
>
>     </VirtualHost>
>
>
>
>     VIRTUAL_URL = http://example.com:8888/a/b/c/d/@@testing
>
>     PATH_INFO =
>     
> /VirtualHostBase/http/example.com:8888/example/VirtualHostRoot/a/b/c/d/@@testing
>     <http://example.com:8888/example/VirtualHostRoot/a/b/c/d/@@testing>
>
>     ACTUAL_URL = http://example.com:8888/a/b/c/d/@@testing
>
>     URL = http://example.com:8888/a/b/c/d/@@testing
>
>     SCRIPT_NAME =
>
>     repoze.vhm.virtual_root =
>
>     repoze.vhm.virtual_url =
>
>     repoze.vhm.virtual_host_base =
>
>     HTTP_X_VHM_HOST =
>
>     HTTP_X_VHM_ROOT =
>
>
>
>
>     Using wsgi with vhm_path
>
>     ------------------------
>
>     VIRTUAL_URL = http://example.com:8888/a/b/c/d/@@testing
>
>     PATH_INFO = /example/a/b/c/d/@@testing
>
>     ACTUAL_URL = http://example.com:8888/a/b/c/d/@@testing
>
>     URL = http://example.com:8888/a/b/c/d/@@testing
>
>     SCRIPT_NAME =
>
>     repoze.vhm.virtual_root = /example
>
>     repoze.vhm.virtual_url = http://example.com:8888/a/b/c/d/@@testing
>
>     repoze.vhm.virtual_host_base = example.com:8888
>     <http://example.com:8888>
>
>     HTTP_X_VHM_HOST =
>
>     HTTP_X_VHM_ROOT =

So - this looks identical to the "vanilla" example (VIRTUAL_URL, 
ACTUAL_URL, URL). Does this configuration work as expected?

>     Using wsgi with vhm_xheaders
>
>     ----------------------------
>
>     <VirtualHost *:8888>
>
>          ServerName example.com <http://example.com>
>
>          ServerAlias example.com <http://example.com>
>
>
>          RewriteEngine On
>
>
>          RewriteRule ^/(.*) http://127.0.0.1:8499/$1 [P,L]
>
>          RequestHeader add X-Vhm-Host http://example.com:8888
>
>          RequestHeader add X-Vhm-Root /example
>
>     </VirtualHost>
>
>
>     VIRTUAL_URL = http://example.com:8888/b/c/d/@@testing
>
>     PATH_INFO = /a/b/c/d/@@testing
>
>     ACTUAL_URL = http://example.com:8888/b/c/d/@@testing
>
>     URL = http://example.com:8888/a/b/c/d/@@testing
>
>     SCRIPT_NAME =
>
>     repoze.vhm.virtual_root = /example
>
>     repoze.vhm.virtual_url = http://example.com:8888/b/c/d/@@testing
>
>     repoze.vhm.virtual_host_base = example.com:8888
>     <http://example.com:8888>
>
>     HTTP_X_VHM_HOST = http://example.com:8888
>
>     HTTP_X_VHM_ROOT = /example
>
>
> It does seem like we have a problem here as its chopping off the first
> part of the path with the xheaders setup. I'm surprised that the site
> works as well as it does with this kind of issue.

That suggests that the number of elements chopped up is the same as the 
number of elements in X-VHM-Root. So, there is probably a bug in this 
scenario when:

  - repoze.vhm.virtual_url/VIRTUAL_URL/ACTUAL_URL is being set, and:
  - we have a repoze.vhm.virtual_root

I'd try to construct a test case for repoze.vhm that illustrates this.

I think you were right that the problem is here:

    virtual_url_parts += real_path[len(vroot_path):]

vroot_path is a list of the elements in the path given by X-VHM-Root, so 
that's where it's chopping off. real_path is a list of the elements in 
PATH_INFO.

This still looks fishy, though. PATH_INFO, as far as I recall, needs to 
contain the full path, from the Zope root. This is what repoze.zope2's 
z2bob is using to traverse (I think...). That code clearly assumes this 
is the case, and so lops off the prefix which should be hidden to the user.

In your case, PATH_INFO is /a/b/c/d/@@testing. I would've expected it to 
be /example/a/b/c/d/@@testing, as it is in the first two examples.

Perhaps repoze.zope2 has special handling for the case where 
repoze.vhm.virtual_root is set and prefixes that to PATH_INFO when it 
decides what to traverse to? That seems wrong But then, it's set in the 
vhm_path case too. It is possible that z2bob is doing that prefixing, 
and we're seeing a traversal like /example/example/a/b/c/d/@@testing, 
which would work because of acquisition, possibly.

Martin

-- 
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
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to