'updates the collection with the provided header value
This method replaces (in-place when possible) all occurrences of
the given header with the provided value.  If no value is
provided, this is the same as ``remove`` (note that this case
can only occur if the target is a collection w/o a corresponding
header value). The return value is the new header value (which
could be a list for ``_MultiEntryHeader`` instances).'

def update(self, collection, *args, **kwargs):

    value = self.__call__(*args, **kwargs)
    if (not value):
        self.delete(collection)
        return
    if (type(collection) == dict):
        collection[self._environ_name] = value
        return
    assert (list == type(collection))
    i = 0
    found = False
    while (i < len(collection)):
        if (collection[i][0].lower() == self._headers_name):
            if found:
                del collection[i]
                continue
            collection[i] = (self.name, value)
            found = True
        i += 1
    if (not found):
        collection.append((self.name, value))
