Re: RFC: ETag support for zope.browserresource

Sidnei da Silva <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
On Tue, Aug 10, 2010 at 12:42 PM, Marius Gedminas <[email protected]> wrote:
> How would you like that to be configured?
>
> Option #1:
>
>  <browser:resource/resourceDirectory etags="off" /> ?
>
> Option #2:
>
>  getMultiAdapter((resource, request), IETag).computeETag() ?
>
>  This is maybe a bit problematic, because the actual File object that
>  contains all the data--such as filename--doesn't implement any
>  interfaces.  And neither does FileResource.
>

So maybe Option #1?

>> I see that your implementation uses last-modified + size, which should
>> generally be fine. However if you're load-balancing across two
>> different servers and the timestamps don't match then the ETag is
>> useless.
>
> Would you prefer a sha1 checksum?

As a default? I'd say last-modified + size is OK.

>> On a completely different note, I see that the File object reads the
>> whole file into memory.
>
> And it does that twice for every request that results in a 200 response:
> once to auto-detect the content-type, the second time to return the
> actual data.

Ouch. That sounds pretty bad. I thought it kept the data in-memory
(didn't look close enough at the source).

-- Sidnei
_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.