canonicalize headers once, instead of calling to_lower lots of times