Looking at this a bit more....

So it seems that VIRTUAL_URL and ACTUAL_URL end up being exactly the same in
this setup.

Also, I'm looking at the tests in the repoze.vhm package, and it seems the
only reason why the tests pass is because they are using an
incorrect PATH_INFO. I'll try and setup an example and show what I mean,

vhm host = http://example.com/

vhm root = /example


> request = http://example.com/a/b/c/d


> PATH_INFO should be "/a/b/c/d" right?

The way the tests are set up, they would show "/example/a/b/c/d"


The reason this is a problem is because the "repoze.vhm.virtual_url" value
which makes the VIRTUAL_URL which makes the ACTUAL_URL is made from the
PATH_INFO, and if you're assuming the PATH_INFO to be something that it is
not, you're just writing passing tests instead of writing tests.

What ends up happening in the current situation is that a url of "/a/b/c/d"
get chopped off to something like "/b/c/d" NOT including the virtual root.

I hate to go through it like this. I don't have svn access though and either
I'm completely misunderstanding something or this is a rather ugly bug.

I doubt that. I think I added the 'if vroot_path' bit to fix a similar

bug, if not the same bug, when using vhm_path. You'll need to svn blame

it and look at what tests were added at the same time, though.

I blame'd it and it seems that the change was introduced with the things
needed for the repoze.zope2 1.0.2 release which relied gave more credence to
repoze.vhm if I understand it correctly. Nothing in the log or tests, as far
as I can tell, explains that it fixes a bug though.

I wish I had more time to do a better job with this. All of your continued
guidance is appreciated.


Thanks,
Nathan

On Mon, Dec 28, 2009 at 4:40 AM, Martin Aspeli
<optilude+li...@gmail.com<optilude%2bli...@gmail.com>
> wrote:

> Hi Nathan,
>
> > is_view_template is not working correctly because the VIRTUAL_URL is not
> > getting set correctly in repoze.vhm. Basically, repoze.zope2 uses the
> > environ value of "repoze.vhm.virtual_url" to generate the VIRTUAL_URL.
> > Then the actual url is grabbed from that VIRTUAL_URL.
> >
> > As far as I can understand, in repoze.vhm.middleware.munge, the lines,
> >
> >              real_path = environ['PATH_INFO'].split('/')
> >
> >              if vroot_path:
> >
> >                  virtual_url_parts += real_path[len(vroot_path):]
> >
> >              else:
> >
> >                  virtual_url_parts += real_path[1:]
> >
> >
> > should simply be,
> >
> >              real_path = environ['PATH_INFO'].split('/')
> >
> >              virtual_url_parts += real_path[1:]
>
> I doubt that. I think I added the 'if vroot_path' bit to fix a similar
> bug, if not the same bug, when using vhm_path. You'll need to svn blame
> it and look at what tests were added at the same time, though.
>
> > I'm probably missing something obvious though. If this is actually an
> > issue that isn't specific to my setup, I find it difficult that no one
> > else has noticed it prior.
>
> I suspect most people will have used vhm_path instead of vhm_xheaders.
>
> Or it could've been a regression I introduced when fixing this issue
> (and other issues) for the vhm_path use case. :)
>
> 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
>
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to