def patch_vary_headers(response, newheaders):
    # Note that we need to keep the original order intact, because cache
    # implementations may rely on the order of the Vary contents in, say,
    # computing an MD5 hash.
    vary = []
    if response.has_header('Vary'):
        vary = vary_delim_re.split(response['Vary'])
    oldheaders = dict([(el.lower(), 1) for el in vary])
    for newheader in newheaders:
        if not newheader.lower() in oldheaders:
            vary.append(newheader)
    response['Vary'] = ', '.join(vary)
Adds (or updates) the "Vary" header in the given HttpResponse object.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-0.96/django/utils/cache.py/patch_vary_headers