def strip_bom(data):
    for bom in (codecs.BOM_UTF32_BE,
                codecs.BOM_UTF32_LE,
                codecs.BOM_UTF16_BE,
                codecs.BOM_UTF16_LE,
                codecs.BOM_UTF8):
        if data.startswith(bom):
            data = data[len(bom):]
            break
    return data
Longer cookie headers can be indexed.
dataset/ETHPy150Open mozilla/addons-server/src/olympia/amo/utils.py/strip_bom--crossover with--dataset/ETHPy150Open python-hyper/hyper-h2/test/test_header_indexing.py/TestSecureHeaders.test_long_cookie_headers_can_be_indexed_push