[ZCM] [ZC] 1906/ 3 Comment "Vary header not appended correctly"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Fri Sep 23 04:25:27 EDT 2005


Issue #1906 Update (Comment) "Vary header not appended correctly"
 Status Pending, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/1906

==============================================================
= Comment - Entry #3 by ajung on Sep 23, 2005 4:25 am

related issue: http://www.zope.org/Collectors/Zope/1864

________________________________________
= Comment - Entry #2 by tino on Sep 23, 2005 4:16 am

Does it? How so? Actually header names are case agnostic by definition. Capitalized Casing is however recommended. 

So the code looks good there.

If appendHeader() overwrites 'vary' with 'Vary'
it should be fixed in the first place, not the usecase you cited.

Since self.headers is a simple dictionary,

    def setHeader(self, name, value, literal=0):
        '''\
        Sets an HTTP return header "name" with value "value", clearing
        the previous value set for the header, if one exists. If the
        literal flag is true, the case of the header name is preserved,
        otherwise word-capitalization will be performed on the header
        name on output.'''
        name = str(name)
        value = str(value)
        key = name.lower()
        if accumulate_header(key):
            self.accumulated_headers = (
                "%s%s: %s\n" % (self.accumulated_headers, name, value))
            return
        name = literal and name or key
        self.headers[name] = value


indeed overwrites - or at least does not find the right header.
I Propose to fix there or use a key-case insensitive mapping
for headers instead of a simple dict.
________________________________________
= Request - Entry #1 by newbery on Sep 23, 2005 3:21 am

In HTTPResponse.py, line 379 looks like...
  
  self.appendHeader('Vary','Accept-Encoding')

It looks like it should be...
  
  self.appendHeader('vary','Accept-Encoding')
  
Or otherwise it will overwrite any Vary header previously set.

==============================================================



More information about the Zope-Collector-Monitor mailing list