Wrong mime type sent by Zope on every page
Hello: It was just brought to my attention that Zope (using Zserver) is sending the wrong MIME type of all its pages. Here is the header from zope: (some lines have been cut) ------------------ HTTP/1.0 200 OK Server: Zope/Zope 2.1.6 (source release, python 1.5.2, linux2) ZServer/1.1b1 Date: Thu, 08 Jun 2000 15:45:23 GMT Ms-Author-Via: DAV Content-Type: application/octet-stream Last-Modified: Thu, 8 Jun 2000 15:45:07 GMT Here is one from apache: ------------------------- HTTP/1.1 400 Bad Request Date: Thu, 08 Jun 2000 15:29:59 GMT Server: Apache/1.3.6 (Unix) Content-Type: text/html I want Zope to be sending text/html, as some browsers want to download the page rather than view it. I haven't discovered anywhere to configure this. I read the Setting the MIME Type of a DTML Method http://www.zope.org/Members/anser/howto_dtml_mimetype which claims that you can set the mime type of a method by putting it at the top of the method. I did this on a test page, but still received the same header from Zope. Can someone shed some light on this? 1. how to set the mime type for all methods and documents of Zope 2. What is the Ms-Author-Via: DAV in the Zope header? WebDAV? thanks, andy diller
On Thu, Jun 08, 2000 at 11:51:03AM -0400, Andrew Diller wrote:
It was just brought to my attention that Zope (using Zserver) is sending the wrong MIME type of all its pages.
Here is the header from zope: (some lines have been cut) ------------------
HTTP/1.0 200 OK Server: Zope/Zope 2.1.6 (source release, python 1.5.2, linux2) ZServer/1.1b1 Date: Thu, 08 Jun 2000 15:45:23 GMT Ms-Author-Via: DAV Content-Type: application/octet-stream Last-Modified: Thu, 8 Jun 2000 15:45:07 GMT
Here is one from apache: -------------------------
HTTP/1.1 400 Bad Request Date: Thu, 08 Jun 2000 15:29:59 GMT Server: Apache/1.3.6 (Unix) Content-Type: text/html
I want Zope to be sending text/html, as some browsers want to download the page rather than view it.
You probably did a 'HEAD' request, at which point Zope doesn't render the page, but rather only acknowledges it's existence by returning above (bogus) response. If you do a 'GET' on your Zope resource, it _will_ be called, at which point Zope can determine what content type to send. Zope will guess the content type for you, usually this is text/html, but you can use the How-To you mentioned to tell Zope otherwise. -- Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ | The Open Source Web Application Server ---------------------------------------------
Martijn Pieters wrote:
You probably did a 'HEAD' request, at which point Zope doesn't render the page, but rather only acknowledges it's existence by returning above (bogus) response.
That's not very search engine friendly :( The head should return the same type as the real document otherwise what's the point of returning a head at all?! I think this is in the collector already, but if it isn't, it should be... cheers, Chris
On Thu, Jun 08, 2000 at 06:59:29PM +0100, Chris Withers wrote:
Martijn Pieters wrote:
You probably did a 'HEAD' request, at which point Zope doesn't render the page, but rather only acknowledges it's existence by returning above (bogus) response.
That's not very search engine friendly :( The head should return the same type as the real document otherwise what's the point of returning a head at all?!
But what if there are side effects to calling the document? What should happen? I don't want a counter to go up or anything just because a HEAD was called on the object. This is not as black-and-white and simple an issue. -- Martijn Pieters | Software Engineer mailto:mj@digicool.com | Digital Creations http://www.digicool.com/ | Creators of Zope http://www.zope.org/ | The Open Source Web Application Server ---------------------------------------------
Martijn Pieters wrote:
But what if there are side effects to calling the document? What should happen? I don't want a counter to go up or anything just because a HEAD was called on the object.
This is not as black-and-white and simple an issue.
The web is an imperfect medium, but returning a junk content type isn't good. I don't know the answer to the sideeffects thing, but I would come down on the site of 'if you expose something through the web, you should expect to have it spidered...' but that's cause I value search engine hits a lot. The trick would be to set the content type when the object is created and have it stored in the object, not computed for each request. Would a property suffice for that? Then, say, if you knew your DTML method was going to return plain text, you could set the content-type property to text/plain. Thsi could be returned in the head without having to evaluate the object to return the head, which is a bit innefficient. I'm sure that's possible and better than it is now, but at the absolute least the junk should cover the most likely outcome, ie text/html instead of application/octet-stream, which is possibly the worst one I can think to choose ;-) cheers, Chris
You are correct. I see it now: 3:56pm imp:[~] : %; telnet www.HOST.upenn.edu 8080 Trying XXX.91.72.121... Connected to XXX.XXX.UPENN.EDU (XXX.91.72.121). Escape character is '^]'. GET /pn21/secnet/section_text HTTP/1.0 HTTP/1.0 200 OK Server: Zope/Zope 2.1.6 (source release, python 1.5.2, linux2) ZServer/1.1b1 Date: Thu, 08 Jun 2000 19:56:24 GMT Connection: close Content-Type: text/html Content-Length: 27119 Why does Server: return linux2? This is an Compaq Alpha running Tru64!?! -andy On Thu, Jun 08, 2000 at 07:33:47PM +0200, Martijn Pieters wrote:
On Thu, Jun 08, 2000 at 11:51:03AM -0400, Andrew Diller wrote:
It was just brought to my attention that Zope (using Zserver) is sending the wrong MIME type of all its pages.
Here is the header from zope: (some lines have been cut) ------------------
HTTP/1.0 200 OK Server: Zope/Zope 2.1.6 (source release, python 1.5.2, linux2) ZServer/1.1b1 Date: Thu, 08 Jun 2000 15:45:23 GMT Ms-Author-Via: DAV Content-Type: application/octet-stream Last-Modified: Thu, 8 Jun 2000 15:45:07 GMT
Here is one from apache: -------------------------
HTTP/1.1 400 Bad Request Date: Thu, 08 Jun 2000 15:29:59 GMT Server: Apache/1.3.6 (Unix) Content-Type: text/html
I want Zope to be sending text/html, as some browsers want to download the page rather than view it.
You probably did a 'HEAD' request, at which point Zope doesn't render the page, but rather only acknowledges it's existence by returning above (bogus) response.
If you do a 'GET' on your Zope resource, it _will_ be called, at which point Zope can determine what content type to send. Zope will guess the content type for you, usually this is text/html, but you can use the How-To you mentioned to tell Zope otherwise.
On Thu, 8 Jun 2000, Andrew Diller wrote:
Server: Zope/Zope 2.1.6 (source release, python 1.5.2, linux2) ZServer/1.1b1
Why does Server: return linux2? This is an Compaq Alpha running Tru64!?!
No. That's what you are told it is. In fact it's an i386 under GNU/Linux ;-)) bye, Jerome ALET - alet@unice.fr - http://cortex.unice.fr/~jerome Faculte de Medecine de Nice - http://noe.unice.fr - Tel: 04 93 37 76 30 28 Avenue de Valombrose - 06107 NICE Cedex 2 - FRANCE
participants (4)
-
Chris Withers -
dillera@isc.upenn.edu -
Jerome Alet -
Martijn Pieters