Re: [Zope] Wrong mime type sent by Zope on every page

2000-06-08 Thread Martijn Pieters

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 Engineermailto:[EMAIL PROTECTED]
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
|   The Open Source Web Application Server
-

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Wrong mime type sent by Zope on every page

2000-06-08 Thread Chris Withers

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

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Wrong mime type sent by Zope on every page

2000-06-08 Thread Martijn Pieters

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 Engineermailto:[EMAIL PROTECTED]
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
|   The Open Source Web Application Server
-

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Wrong mime type sent by Zope on every page

2000-06-08 Thread Chris Withers

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

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Wrong mime type sent by Zope on every page

2000-06-08 Thread Andrew Diller

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.
> 

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




RE: [Zope] Wrong mime type sent by Zope on every page

2000-06-08 Thread Brian Lloyd

> > 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'll throw out a proposal on this. It also is not perfect, but 
seems to strike a happier balance. When HEAD is called on an 
object, what currently happens is:

  if a 'content_type' attribute exists, it is used

  else if the object's id seems to have a file extension
  (. in the id), try to use guess_content_type

  else fall back to the hated application/octet-stream 
   (or, I've seen x-unknown-content-type used before,
but I don't know if this is really any better).


What if we change this to:

  if a 'content_type' attribute exists, it is used

  else if the object's id seems to have a file extension
  (. in the id), try to use guess_content_type

>  else if there is a 'default_content_type' attribute, use that

  else fall back to the hated application/octet-stream 
   (or, I've seen x-unknown-content-type used before,
but I don't know if this is really any better).

Then we could put a 'default_content_type' attribute in the 
class of dtml documents and methods, which would take care of 
the most common case. Thoughts?

Brian Lloyd[EMAIL PROTECTED]
Software Engineer  540.371.6909  
Digital Creations  http://www.digicool.com 



___
Zope maillist  -  [EMAIL PROTECTED]
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 )




RE: [Zope] Wrong mime type sent by Zope on every page

2000-06-08 Thread Dan L. Pierson

Brian Lloyd writes:
 > What if we change this to:
 > 
 >   if a 'content_type' attribute exists, it is used
 > 
 >   else if the object's id seems to have a file extension
 >   (. in the id), try to use guess_content_type
 > 
 > >  else if there is a 'default_content_type' attribute, use that
 > 
 >   else fall back to the hated application/octet-stream 
 >(or, I've seen x-unknown-content-type used before,
 > but I don't know if this is really any better).
 > 
 > Then we could put a 'default_content_type' attribute in the 
 > class of dtml documents and methods, which would take care of 
 > the most common case. Thoughts?

Sounds pretty good.  Setting 'default_content_type' can then be
another item in the unwritten Guide to Writing a Zope Product.

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




RE: [Zope] Wrong mime type sent by Zope on every page

2000-06-08 Thread Brian Lloyd


> -Original Message-
> From: Dan L. Pierson [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 08, 2000 3:47 PM
> To: Brian Lloyd
> Cc: 'Chris Withers'; Martijn Pieters; Andrew Diller; [EMAIL PROTECTED]
> Subject: RE: [Zope] Wrong mime type sent by Zope on every page
> 
> Brian Lloyd writes:
>  > What if we change this to:
>  > 
>  >   if a 'content_type' attribute exists, it is used
>  > 
>  >   else if the object's id seems to have a file extension
>  >   (. in the id), try to use guess_content_type
>  > 
>  > >  else if there is a 'default_content_type' attribute, use that
>  > 
>  >   else fall back to the hated application/octet-stream 
>  >(or, I've seen x-unknown-content-type used before,
>  > but I don't know if this is really any better).
>  > 
>  > Then we could put a 'default_content_type' attribute in the 
>  > class of dtml documents and methods, which would take care of 
>  > the most common case. Thoughts?
> 
> Sounds pretty good.  Setting 'default_content_type' can then be
> another item in the unwritten Guide to Writing a Zope Product.

That's right - I expect that it could be useful for a few products. 
I can see XMLDocuments having a default of 'text/xml', but I suspect
that a lot of products won't really have to care. Things that have 
no real similarity to conventional "pages" (like database connection 
objects, etc.) are probably useless to a robot that works with "pages"
anyway, so they are better off sending a default non-committal 
response like "application/octet-stream".


Brian Lloyd[EMAIL PROTECTED]
Software Engineer  540.371.6909  
Digital Creations  http://www.digicool.com 




___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Wrong mime type sent by Zope on every page

2000-06-08 Thread Chris Withers

Brian Lloyd wrote:
> What if we change this to:
> 
>   if a 'content_type' attribute exists, it is used
> 
>   else if the object's id seems to have a file extension
>   (. in the id), try to use guess_content_type
> 
> >  else if there is a 'default_content_type' attribute, use that

It would be cool if this could be acquired :-)

> 
>   else fall back to the hated application/octet-stream
>(or, I've seen x-unknown-content-type used before,
> but I don't know if this is really any better).
> 
> Then we could put a 'default_content_type' attribute in the
> class of dtml documents and methods, which would take care of
> the most common case. Thoughts?

Looks great otherwise :-)

Chris

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] Wrong mime type sent by Zope on every page

2000-06-09 Thread Jerome Alet

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 - [EMAIL PROTECTED] - 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



___
Zope maillist  -  [EMAIL PROTECTED]
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 )




RE: [Zope] Wrong mime type sent by Zope on every page

2000-06-09 Thread Brian Lloyd

> Brian Lloyd wrote:
> > What if we change this to:
> > 
> >   if a 'content_type' attribute exists, it is used
> > 
> >   else if the object's id seems to have a file extension
> >   (. in the id), try to use guess_content_type
> > 
> > >  else if there is a 'default_content_type' attribute, use that
> 
> > 
> >   else fall back to the hated application/octet-stream
> >(or, I've seen x-unknown-content-type used before,
> > but I don't know if this is really any better).
> > 

FYI, for those interested I've checked this and another fix for 
HEAD handling on collections into CVS...


Brian Lloyd[EMAIL PROTECTED]
Software Engineer  540.371.6909  
Digital Creations  http://www.digicool.com 



___
Zope maillist  -  [EMAIL PROTECTED]
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 )