Wrong <base href=""> for .HTM file
Look at this pywatch output below. When I request a file that ends in .HTM the <base> tag ends with a / which confuses the browser. The browser makes all relative references in the .HTM file (<img> tags for example) relative to http://localhost/Engineering/LSFReports/cibhrm6.HTM/ not to http://localhost/Engineering/LSFReports/ as you would expect. When I try this with a file that is named with a lowercase .htm extension, no <base> is generated, and the browser fetches all relative <img> tags just fine. I tried to figure out what HTTPResponse.py is doing with <base> but didn't get far. Does anyone else understand what's happening? -- Thanks -- Loren ==> GET /Engineering/LSFReports/cibhrm6.HTM HTTP/1.1 ==> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/pdf, */* ==> Accept-Language: en-us,ko;q=0.5 ==> Accept-Encoding: gzip, deflate ==> User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0) ==> Host: localhost ==> Connection: Keep-Alive ==> [0.030 - Server connected] <== HTTP/1.1 200 OK <== Server: Zope/Zope 2.2.4 (binary release, python 1.5.2, win32-x86) ZServer/1.1b1 <== Date: Thu, 26 Apr 2001 01:40:34 GMT <== Content-Type: text/html <== Content-Length: 13850 <== Last-Modified: Wed, 25 Apr 2001 23:41:43 GMT <== <== <HTML> <== <HEAD> <== <base href="http://localhost/Engineering/LSFReports/cibhrm6.HTM/" /> <== <== </HEAD> <== <BODY BGCOLOR="FFFFFF">
I forgot to mention, in case it's relevant, that I'm using Zope 2.2.4 with LocalFS, and /Engineering/LSFReports/ is a LocalFS folder. -- Loren
-----Original Message----- From: Loren Stafford [mailto:lstafford@morphics.com] Sent: Wednesday, April 25, 2001 19:06 To: zope@zope.org Subject: Wrong <base href=""> for .HTM file
Look at this pywatch output below. When I request a file that ends in .HTM the <base> tag ends with a / which confuses the browser. The browser makes all relative references in the .HTM file (<img> tags for example) relative to http://localhost/Engineering/LSFReports/cibhrm6.HTM/ not to http://localhost/Engineering/LSFReports/ as you would expect.
When I try this with a file that is named with a lowercase .htm extension, no <base> is generated, and the browser fetches all relative <img> tags just fine.
I tried to figure out what HTTPResponse.py is doing with <base> but didn't get far. Does anyone else understand what's happening?
-- Thanks -- Loren
==> GET /Engineering/LSFReports/cibhrm6.HTM HTTP/1.1 ==> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/pdf, */* ==> Accept-Language: en-us,ko;q=0.5 ==> Accept-Encoding: gzip, deflate ==> User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0) ==> Host: localhost ==> Connection: Keep-Alive ==> [0.030 - Server connected] <== HTTP/1.1 200 OK <== Server: Zope/Zope 2.2.4 (binary release, python 1.5.2, win32-x86) ZServer/1.1b1 <== Date: Thu, 26 Apr 2001 01:40:34 GMT <== Content-Type: text/html <== Content-Length: 13850 <== Last-Modified: Wed, 25 Apr 2001 23:41:43 GMT <== <== <HTML> <== <HEAD> <== <base href="http://localhost/Engineering/LSFReports/cibhrm6.HTM/" /> <== <== </HEAD> <== <BODY BGCOLOR="FFFFFF">
From: "Loren Stafford" <lstafford@morphics.com>
I forgot to mention, in case it's relevant, that I'm using Zope 2.2.4 with LocalFS, and /Engineering/LSFReports/ is a LocalFS folder.
It is possible that the uppercase extension is breaking some special-case handling in LocalFS. The only time that a <base> tag should be added is when a request for an object ends up using an index_html attribute to render it, as with Folders. Cheers, Evan @ digicool
Can you point me to where the publisher decides whether to use a <base> for the object returned by LocalFS. I'm having trouble finding it. I'm looking at insertBase in HTTPResponse.py, but I can't figure out how LocalFS can influence its decisions. Am I looking in the right area? -- Thanks -- Loren
-----Original Message----- From: Evan Simpson [mailto:evan@digicool.com] Sent: Wednesday, April 25, 2001 20:24 To: Loren Stafford; zope@zope.org Subject: Re: [Zope] RE: Wrong <base href=""> for .HTM file
From: "Loren Stafford" <lstafford@morphics.com>
I forgot to mention, in case it's relevant, that I'm using Zope 2.2.4 with LocalFS, and /Engineering/LSFReports/ is a LocalFS folder.
It is possible that the uppercase extension is breaking some special-case handling in LocalFS. The only time that a <base> tag should be added is when a request for an object ends up using an index_html attribute to render it, as with Folders.
Cheers,
Evan @ digicool
From: "Loren Stafford" <lstafford@morphics.com>
I'm looking at insertBase in HTTPResponse.py, but I can't figure out how LocalFS can influence its decisions. Am I looking in the right area?
Sort of. It's unpleasantly complex. RESPONSE.setBase gets called by REQUEST.traverse after the last step in traversal, when it notices that REQUEST._hacked_path is set. This gets set the target of the URL is reached, and it has an 'index_html' attribute. Does LocalFS handle rendering of file proxy objects with an index_html method? Cheers, Evan @ digicool
Thanks Evan. We're getting warmer. The URL: http://localhost:80/Engineering/LSFReports/cibhrm6.HTM/index_html yields the same result as the URL: http://localhost/Engineering/LSFReports/cibhrm6.HTM However, the URL: http://morphicsweb/Engineering/LSFReports/cicl54y.htm/index_html yields a NOT FOUND error, even tho http://morphicsweb/Engineering/LSFReports/cicl54y.htm works normally. So, the Local File object has an index_html method if it ends with .HTM !!! Now, to find out why.... -- Loren
-----Original Message----- From: Evan Simpson [mailto:evan@digicool.com] Sent: Thursday, April 26, 2001 12:41 To: Loren Stafford; zope@zope.org Subject: Re: [Zope] RE: Wrong <base href=""> for .HTM file
From: "Loren Stafford" <lstafford@morphics.com>
I'm looking at insertBase in HTTPResponse.py, but I can't figure out how LocalFS can influence its decisions. Am I looking in the right area?
Sort of. It's unpleasantly complex. RESPONSE.setBase gets called by REQUEST.traverse after the last step in traversal, when it notices that REQUEST._hacked_path is set. This gets set the target of the URL is reached, and it has an 'index_html' attribute. Does LocalFS handle rendering of file proxy objects with an index_html method?
Cheers,
Evan @ digicool
I can't believe that no one encountered this before. LocalFS simply was not making case-insensitive lookups into its file type table. I fixed it by making the following change to LocalFS.py WAS: def _get_content_type(ext, _type_map): try: return _type_map[ext] except KeyError: return (None, None) CHANGED TO: def _get_content_type(ext, _type_map): try: return _type_map[string.lower(ext)] except KeyError: return (None, None) Thanks, Evan and Dieter, for your tips. -- Loren
Thanks for tracking this down, Loren. I'll be sure this gets into the next release. --jfarr ----- Original Message ----- From: "Loren Stafford" <lstafford@morphics.com> To: "Jonothan Farr" <jfarr@speakeasy.org> Cc: <zope@zope.org>; "Evan Simpson" <evan@digicool.com>; "Dieter Maurer" <dieter@handshake.de> Sent: Thursday, April 26, 2001 2:05 PM Subject: RE: [Zope] Wrong <base href=""> for .HTM file in LocalFS
I can't believe that no one encountered this before.
LocalFS simply was not making case-insensitive lookups into its file type table.
I fixed it by making the following change to LocalFS.py
WAS:
def _get_content_type(ext, _type_map): try: return _type_map[ext] except KeyError: return (None, None)
CHANGED TO:
def _get_content_type(ext, _type_map): try: return _type_map[string.lower(ext)] except KeyError: return (None, None)
Thanks, Evan and Dieter, for your tips.
-- Loren
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hi Loren, beside this, why do you use these file-extensions anyway :-) Regards Tino --On Mittwoch, 25. April 2001 19:06 -0700 Loren Stafford <lstafford@morphics.com> wrote:
Look at this pywatch output below. When I request a file that ends in .HTM the <base> tag ends with a / which confuses the browser. The browser makes all relative references in the .HTM file (<img> tags for example) relative to http://localhost/Engineering/LSFReports/cibhrm6.HTM/ not to http://localhost/Engineering/LSFReports/ as you would expect.
When I try this with a file that is named with a lowercase .htm extension, no <base> is generated, and the browser fetches all relative <img> tags just fine.
I tried to figure out what HTTPResponse.py is doing with <base> but didn't get far. Does anyone else understand what's happening?
-- Thanks -- Loren
==> GET /Engineering/LSFReports/cibhrm6.HTM HTTP/1.1 ==> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/pdf, */* ==> Accept-Language: en-us,ko;q=0.5 ==> Accept-Encoding: gzip, deflate ==> User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0) ==> Host: localhost ==> Connection: Keep-Alive ==> [0.030 - Server connected] <== HTTP/1.1 200 OK <== Server: Zope/Zope 2.2.4 (binary release, python 1.5.2, win32-x86) ZServer/1.1b1 <== Date: Thu, 26 Apr 2001 01:40:34 GMT <== Content-Type: text/html <== Content-Length: 13850 <== Last-Modified: Wed, 25 Apr 2001 23:41:43 GMT <== <== <HTML> <== <HEAD> <== <base href="http://localhost/Engineering/LSFReports/cibhrm6.HTM/" /> <== <== </HEAD> <== <BODY BGCOLOR="FFFFFF">
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hi Chris, --On Donnerstag, 26. April 2001 11:30 +0100 Chris Withers <chrisw@nipltd.com> wrote:
Tino Wildenhain wrote:
Hi Loren,
beside this, why do you use these file-extensions anyway :-)
Search engines like them...
Search engines dont care about extensions ;) They also index folders without extensions ;)) (Yes, they can read mime-types too ;))
cheers,
Chris
Tino Wildenhain wrote:
Search engines dont care about extensions ;) They also index folders without extensions ;)) (Yes, they can read mime-types too ;))
Not all of them, nto all of the time. Read http://www.searchenginewatch.com (IIRC) cheers, Chris
These files are in on the file system, accessed thru LocalFS. They are generated by some application over which I have no control. -- Loren
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Tino Wildenhain Sent: Thursday, April 26, 2001 00:04 To: Loren Stafford; zope@zope.org Subject: Re: [Zope] Wrong <base href=""> for .HTM file
Hi Loren,
beside this, why do you use these file-extensions anyway :-)
Regards Tino
--On Mittwoch, 25. April 2001 19:06 -0700 Loren Stafford <lstafford@morphics.com> wrote:
Look at this pywatch output below. When I request a file that ends in .HTM the <base> tag ends with a / which confuses the browser. The browser makes all relative references in the .HTM file (<img> tags for example) relative to http://localhost/Engineering/LSFReports/cibhrm6.HTM/ not to http://localhost/Engineering/LSFReports/ as you would expect.
When I try this with a file that is named with a lowercase .htm extension, no <base> is generated, and the browser fetches all relative <img> tags just fine.
I tried to figure out what HTTPResponse.py is doing with <base> but didn't get far. Does anyone else understand what's happening?
-- Thanks -- Loren
==> GET /Engineering/LSFReports/cibhrm6.HTM HTTP/1.1 ==> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/pdf, */* ==> Accept-Language: en-us,ko;q=0.5 ==> Accept-Encoding: gzip, deflate ==> User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0) ==> Host: localhost ==> Connection: Keep-Alive ==> [0.030 - Server connected] <== HTTP/1.1 200 OK <== Server: Zope/Zope 2.2.4 (binary release, python 1.5.2, win32-x86) ZServer/1.1b1 <== Date: Thu, 26 Apr 2001 01:40:34 GMT <== Content-Type: text/html <== Content-Length: 13850 <== Last-Modified: Wed, 25 Apr 2001 23:41:43 GMT <== <== <HTML> <== <HEAD> <== <base href="http://localhost/Engineering/LSFReports/cibhrm6.HTM/" /> <== <== </HEAD> <== <BODY BGCOLOR="FFFFFF">
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (5)
-
Chris Withers -
Evan Simpson -
Jonothan Farr -
Loren Stafford -
Tino Wildenhain