Revision 44e0514f pithos/api/util.py
b/pithos/api/util.py | ||
---|---|---|
79 | 79 |
def get_header_prefix(request, prefix): |
80 | 80 |
"""Get all prefix-* request headers in a dict. Reformat keys with format_header_key().""" |
81 | 81 |
|
82 |
# TODO: Check that returned values are compliant with [\w-]+ regexp. |
|
82 | 83 |
prefix = 'HTTP_' + prefix.upper().replace('-', '_') |
83 | 84 |
# TODO: Document or remove '~' replacing. |
84 | 85 |
return dict([(format_header_key(k[5:]), v.replace('~', '')) for k, v in request.META.iteritems() if k.startswith(prefix) and len(k) > len(prefix)]) |
Also available in: Unified diff