[Zope-dev] ZServer should redirect for folder objects?
John Lim
zope@mail.jleh.com
Tue, 24 Jul 2001 12:39:24 -0400
Hi,
I've been doing some work with Zope and I've noticed strange behavior with
regards to ZServer and relative links.
When a client requests an object that is a folder and the request URL does
not have a trailing slash, the HTTP server should return an HTTP 301
Redirect to the correct URL with the slash, right?
As an example, if I'm connecting to an Apache server:
[headers not relevant to this discussion have been removed]
$ lynx -head -dump http://some.apache.server/admin
HTTP/1.1 301 Moved Permanently
Server: Apache/1.3.14 (Unix)
Location: http://some.apache.server/admin/
Content-Type: text/html
$ lynx -head -dump http://some.apache.server/admin/
HTTP/1.1 200 OK
Server: Apache/1.3.14 (Unix)
Content-Type: text/html
This is why if you send a request for http://some.apache.server/admin, when
your client is done loading the URL, it will actually show
http://some.apache.server/admin/.
However, ZServer doesn't seem to follow this behavior:
$ lynx -head -dump http://some.zope.zserver/admin
HTTP/1.0 200 OK
Server: Zope/Zope 2.3.3 (binary release, python 1.5.2, solaris-2.6-sparc)
ZServer/1.1b1
Content-Type: text/html
Content-Location: http://some.zope.zserver/admin/
$ lynx -head -dump http://some.zope.zserver/admin/
HTTP/1.0 200 OK
Server: Zope/Zope 2.3.3 (binary release, python 1.5.2, solaris-2.6-sparc)
ZServer/1.1b1
Content-Type: text/html
Note that ZServer is returning:
a) an HTTP 200 response
b) a "Content-Location" header
I looked up RFC 1945 (the HTTP/1.0 specification), and could not find any
mention of "Content-Location". Only "Location" is defined.
However, I also looked up RFC 2616 (HTTP/1.1), and there is mention of
"Content-Location" there. But ZServer tells the client that it's talking
HTTP/1.0, and yet returns a header from HTTP/1.1, so I believe this is
incorrect behavior?
This is important for relative links -- try this in ZServer. Make a /test
directory, and put an <A HREF> tag linking to another file in that
directory. E.g.
/test/index_html:
<A HREF="relative.html">relative link</A>
Now, try loading up http://some.zope.zserver/test. Since ZServer does not
redirect you, the URL remains as http://some.zope.zserver/test, and your
link is incorrectly rendered by your client as
http://some.zope.zserver/relative.html.
But if you load http://some.zope.zserver/test/, the link comes out as
http://some.zope.zserver/test/relative.html, which is right.
Comments?
Thanks!
---
John Lim