Commit e284aa2a authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

pithos: Restrict request Content-Type header

Check for non ascii characters.
parent e44c85ba
......@@ -215,6 +215,13 @@ def put_container_headers(request, response, meta, policy):
def get_object_headers(request):
content_type = request.META.get('CONTENT_TYPE', None)
if content_type:
try:
content_type.decode('ascii')
# TODO: check format ?
except UnicodeDecodeError:
raise faults.BadRequest('Bad characters in Content-Type.')
meta = get_header_prefix(request, 'X-Object-Meta-')
check_meta_headers(meta)
if request.META.get('HTTP_CONTENT_ENCODING'):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment