Re: [Zope-dev] Re: bug in VirtualHostMonster in 2.5.0

2002-02-22 Thread Leonardo Rochael Almeida


The handling of string and non-string arguments in
HTTPRequest.setVirtualRoot() is indeed inconsistent, but it's obviously
possible to fix the double-root-slash problem by changing the way
VirtualHostMonster calls that method.

Actually, the difference in VirtualHostMonster.__call__ between both
versions is exactly that the new version does there what my patch does
inside HTTPRequest.setVirtualRoot, which is to filter all empty elements
out of the manipulated path before actually setting the virtual root.
Both fixes can be applied at the same time.

I'll even go out on a limb and say that I think my fix is a little more
correct in which it makes the behaviour of setVirtualRoot consistent but
the VHM fix is arguably safer, since it potentially causes less
"interference" :-). Of course, my patch could make setVirtualRoot
consistently wrong :-) but this is something only ZC folks could tell.

Cheers, Leo

On Thu, 2002-02-21 at 21:38, Adam Manock wrote:
> I tried out version 1.6 of:
> http://cvs.zope.org/Zope/lib/python/Products/SiteAccess/VirtualHostMonster.py
> dated 2002/02/15 21:20:33
> 
> It works!!
> 
> I got the correct:
> http://example.org/zopeRoot/p_/ZopeButton
> link on the page when I pointed my browser at:
> 
>http://localhost:8080/VirtualHostBase/http/example.org:80/VirtualHostRoot/_vh_zopeRoot/
> 
> I found no new versions of :
> http://cvs.zope.org/Zope/lib/python/ZPublisher/HTTPRequest.py
> in CVS added since 2.5.0 release.
> 
> So it's fixed, but.
> Which fix??? Leo's, or the one in CVS??
> The VirtualHostMonster.py mods are obviously less likely to break other 
> stuff, even if it may be "better" to fix the bug in HTTPRequest.py
> 
> "By fixing the non-string handling to be consistent with the string 
> handling, the VHM bug disapears"
>  Thanks Leo
> 
> Fri Feb 15 21:19:42 2002 UTC (6 days, 3 hours ago) by evan
> "Fix bugs with _vh_ and empty paths"
>  Thanks Evan
> 
> Gotta love the OSS community
> 
> What? You mean not only is the bug fixed, but now I have to choose which of 
> the different ways of fixing it I want?

-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Re: bug in VirtualHostMonster in 2.5.0

2002-02-21 Thread Adam Manock

I tried out version 1.6 of:
http://cvs.zope.org/Zope/lib/python/Products/SiteAccess/VirtualHostMonster.py
dated 2002/02/15 21:20:33

It works!!

I got the correct:
http://example.org/zopeRoot/p_/ZopeButton
link on the page when I pointed my browser at:
http://localhost:8080/VirtualHostBase/http/example.org:80/VirtualHostRoot/_vh_zopeRoot/

I found no new versions of :
http://cvs.zope.org/Zope/lib/python/ZPublisher/HTTPRequest.py
in CVS added since 2.5.0 release.

So it's fixed, but.
Which fix??? Leo's, or the one in CVS??
The VirtualHostMonster.py mods are obviously less likely to break other 
stuff, even if it may be "better" to fix the bug in HTTPRequest.py

"By fixing the non-string handling to be consistent with the string 
handling, the VHM bug disapears"
 Thanks Leo

Fri Feb 15 21:19:42 2002 UTC (6 days, 3 hours ago) by evan
"Fix bugs with _vh_ and empty paths"
 Thanks Evan

Gotta love the OSS community

What? You mean not only is the bug fixed, but now I have to choose which of 
the different ways of fixing it I want?


Adam




___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Re: bug in VirtualHostMonster in 2.5.0

2002-02-21 Thread Michael L. Dean

am I reading this right -- 2.5 is brooken?
- Original Message -
From: "Leonardo Rochael Almeida" <[EMAIL PROTECTED]>
To: "Zope Developers list" <[EMAIL PROTECTED]>
Sent: Thursday, February 21, 2002 10:57 AM
Subject: Re: [Zope-dev] Re: bug in VirtualHostMonster in 2.5.0


> On Thu, 2002-02-21 at 11:01, Adam Manock wrote:
> > I can confirm that throwing this at a Zope 2.5.0 root
VirtualHostMonster:
> >
> >
http://localhost:8080/VirtualHostBase/http/example.org:80/VirtualHostRoot/_v
h_zopeRoot/
> >
> > provides a page with this link:
> >
> > http://example.org//zopeRoot/p_/ZopeButton
> >
> > and on 2.4.4 you get:
> >
> > http://example.org/zopeRoot/p_/ZopeButton
> >
> >
> > This would suggest that VHM is indeed broken in 2.5.0, or at least the
> > combined result of VHM and HTTPRequest.py URL munging is broken.
>
> The patch I provided doesn't touch VHM, so I'm thinking more on the
> lines of your second conclusion.
>
> Now the funny thing is, the patch also applies to Zope 2.4.x (2.4.3,
> that I checked). Seems HTTPRequest.setVirtualRoot() was broken all
> along, it's just thatZope 2.4.x VHM doesn't call it when parsing a
> VirtualHostRoot directive, limiting itself to manipulate the path stack
> in the REQUEST (see VirtualHostMonster.__call__() method).
>
> Cheers, Leo
>
> --
> Ideas don't stay in some minds very long because they don't like
> solitary confinement.
>
>
> ___
> Zope-Dev maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
>


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Re: bug in VirtualHostMonster in 2.5.0

2002-02-21 Thread Leonardo Rochael Almeida

On Thu, 2002-02-21 at 11:01, Adam Manock wrote:
> I can confirm that throwing this at a Zope 2.5.0 root VirtualHostMonster:
> 
> 
>http://localhost:8080/VirtualHostBase/http/example.org:80/VirtualHostRoot/_vh_zopeRoot/
> 
> provides a page with this link:
> 
> http://example.org//zopeRoot/p_/ZopeButton
> 
> and on 2.4.4 you get:
> 
> http://example.org/zopeRoot/p_/ZopeButton
> 
> 
> This would suggest that VHM is indeed broken in 2.5.0, or at least the 
> combined result of VHM and HTTPRequest.py URL munging is broken.

The patch I provided doesn't touch VHM, so I'm thinking more on the
lines of your second conclusion.

Now the funny thing is, the patch also applies to Zope 2.4.x (2.4.3,
that I checked). Seems HTTPRequest.setVirtualRoot() was broken all
along, it's just thatZope 2.4.x VHM doesn't call it when parsing a
VirtualHostRoot directive, limiting itself to manipulate the path stack
in the REQUEST (see VirtualHostMonster.__call__() method).

Cheers, Leo

-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Re: bug in VirtualHostMonster in 2.5.0

2002-02-21 Thread Leonardo Rochael Almeida

On Thu, 2002-02-21 at 13:38, Chris Withers wrote:
> Collector it then :-)

As I mentioned in my first e-mail, it's 'collected' already :-), with
proposed fix and everything:

http://collector.zope.org/Zope/235

-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Re: bug in VirtualHostMonster in 2.5.0

2002-02-21 Thread Chris Withers

Collector it then :-)

cheers,

Chris

- Original Message -
From: "Adam Manock" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 21, 2002 2:01 PM
Subject: Re: [Zope-dev] Re: bug in VirtualHostMonster in 2.5.0


> I can confirm that throwing this at a Zope 2.5.0 root VirtualHostMonster:
>
>
http://localhost:8080/VirtualHostBase/http/example.org:80/VirtualHostRoot/_v
h_zopeRoot/
>
> provides a page with this link:
>
> http://example.org//zopeRoot/p_/ZopeButton
>
> and on 2.4.4 you get:
>
> http://example.org/zopeRoot/p_/ZopeButton
>
>
> This would suggest that VHM is indeed broken in 2.5.0, or at least the
> combined result of VHM and HTTPRequest.py URL munging is broken.
>
> Adam
>
>
> ___
> Zope-Dev maillist  -  [EMAIL PROTECTED]
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
>
>
>


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Re: bug in VirtualHostMonster in 2.5.0

2002-02-21 Thread Adam Manock

I can confirm that throwing this at a Zope 2.5.0 root VirtualHostMonster:

http://localhost:8080/VirtualHostBase/http/example.org:80/VirtualHostRoot/_vh_zopeRoot/

provides a page with this link:

http://example.org//zopeRoot/p_/ZopeButton

and on 2.4.4 you get:

http://example.org/zopeRoot/p_/ZopeButton


This would suggest that VHM is indeed broken in 2.5.0, or at least the 
combined result of VHM and HTTPRequest.py URL munging is broken.

Adam


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



Re: [Zope-dev] Re: bug in VirtualHostMonster in 2.5.0

2002-02-20 Thread Adam Manock

What info can you get from  , say in a dtml doc called 
"env_test" ??

eg:
ServerName newsite
ProxyPass / 
http://192.168.X.Y:8080/VirtualHostBase/http/newsite:80/newsite/VirtualHostRoot/
ProxyPassReverse / 
http://192.168.X.Y:8080/VirtualHostBase/http/newsite:80/newsite/VirtualHostRoot/
ProxyPass /misc_ http://192.168.X.Y:8080/misc_
ProxyPass /p_ http://192.168.X.Y:8080/p_

yields:

PATH_INFO 
'/VirtualHostBase/http/newsite:80/newsite/VirtualHostRoot/env_test'

and

PATH_TRANSLATED 
'/VirtualHostBase/http/newsite:80/newsite/VirtualHostRoot/env_test'

ProxyPass /newsite 
http://192.168.X.Y:8080/VirtualHostBase/http/newsite:80/newsite/VirtualHostRoot/_vh_newsite/
ProxyPassReverse /newsite 
http://192.168.X.Y:8080/VirtualHostBase/http/newsite:80/newsite/VirtualHostRoot/_vh_newsite/
ProxyPass /misc_ http://192.168.X.Y:8080/misc_
ProxyPass /p_ http://192.168.X.Y:8080/p_

yields

PATH_INFO 
'/VirtualHostBase/http/newsite:80/newsite/VirtualHostRoot/_vh_newsite//env_test' 


and

PATH_TRANSLATED 
'/VirtualHostBase/http/newsite:80/newsite/VirtualHostRoot/_vh_newsite/env_test' 


The above is how it works on Zope 2.4.3

I remember the second example being a pain to get working on 2.4.3, I think 
ZMI needed the extra trailing "/" on the proxypass statement in order to 
work right.


Adam

At 08:02 PM 2/20/2002 -0300, Leonardo Rochael Almeida wrote:
>Ok, I think I found a fix for it, but it's not a change in VHM.
>
>As I mentioned in a follow-up to Zope bug 235, there is an inconsistency
>in lib/python/ZPublisher/HTTPRequest.py in HTTPRequest.setVirtualRoot()
>
>The attached patch (also in the bug report) explains what this
>inconsistency is and seems to fix the VHM problem, but I don't know what
>other side-effects it has. The 'utilities/testrunner.py -a' seems to run
>ok.
>
>On Wed, 2002-02-20 at 16:29, Leonardo Rochael Almeida wrote:
> > Hi guys,
> >
> > I bring to your attention the bug
> > "235":http://collector.zope.org/Zope/235 in the Zope collector, which I
> > just posted.
> >
> > Apparently VHM is inserting exactly one spurious '/' in urls when the
> > _vh_folder syntax is used. The problem seems to be in the
> > VirtualHostMonster.__call__ method at
> > lib/python/Products/SiteAccess/VirtualHostMonster.py, which has changed
> > a lot relative to the 2.4.x version, however I couldn't make head or
> > tails of that algorithm, so I wouldn't know how to fix it.
> >
> > This problem is seriously hampering our deployment of Zope 2.5.0 on
> > clients, since most of the time we publish the root of the site from a
> > Zope Folder and need the _vh_folder syntax to access the real Zope root
> > for manteinance.
> >
> > Cheers, Leo
> >
> > PS: since we're talking about the collector, I'll also plug the other
> > but I posted there "http://collector.zope.org/Zope/167";, which talks
> > about a problem with SuperFind() and includes a simple fix. It's still
> > pending...
>
>--
>Ideas don't stay in some minds very long because they don't like
>solitary confinement.
>



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )



[Zope-dev] Re: bug in VirtualHostMonster in 2.5.0

2002-02-20 Thread Leonardo Rochael Almeida

Ok, I think I found a fix for it, but it's not a change in VHM.

As I mentioned in a follow-up to Zope bug 235, there is an inconsistency
in lib/python/ZPublisher/HTTPRequest.py in HTTPRequest.setVirtualRoot()

The attached patch (also in the bug report) explains what this
inconsistency is and seems to fix the VHM problem, but I don't know what
other side-effects it has. The 'utilities/testrunner.py -a' seems to run
ok.

On Wed, 2002-02-20 at 16:29, Leonardo Rochael Almeida wrote:
> Hi guys,
> 
> I bring to your attention the bug
> "235":http://collector.zope.org/Zope/235 in the Zope collector, which I
> just posted.
> 
> Apparently VHM is inserting exactly one spurious '/' in urls when the
> _vh_folder syntax is used. The problem seems to be in the
> VirtualHostMonster.__call__ method at
> lib/python/Products/SiteAccess/VirtualHostMonster.py, which has changed
> a lot relative to the 2.4.x version, however I couldn't make head or
> tails of that algorithm, so I wouldn't know how to fix it.
> 
> This problem is seriously hampering our deployment of Zope 2.5.0 on
> clients, since most of the time we publish the root of the site from a
> Zope Folder and need the _vh_folder syntax to access the real Zope root
> for manteinance.
> 
> Cheers, Leo
> 
> PS: since we're talking about the collector, I'll also plug the other
> but I posted there "http://collector.zope.org/Zope/167";, which talks
> about a problem with SuperFind() and includes a simple fix. It's still
> pending...

-- 
Ideas don't stay in some minds very long because they don't like
solitary confinement.



--- HTTPRequest.py.orig Wed Feb 20 19:14:20 2002
+++ HTTPRequest.py  Wed Feb 20 19:16:00 2002
@@ -158,7 +158,8 @@
 """ Treat the current publishing object as a VirtualRoot """
 other = self.other
 if type(path) is type(''):
-path = filter(None, path.split( '/'))
+path = path.split('/')
+path = filter(None, path)
 self._script[:] = map(quote, path)
 del self._steps[:]
 parents = other['PARENTS']