51 |
51 |
validate_modification_preconditions, validate_matching_preconditions, split_container_object_string,
|
52 |
52 |
copy_or_move_object, get_int_parameter, get_content_length, get_content_range, socket_read_iterator,
|
53 |
53 |
SaveToBackendHandler, object_data_response, put_object_block, hashmap_md5, simple_list_response, api_method)
|
54 |
|
from pithos.api.settings import AUTHENTICATION_URL, AUTHENTICATION_USERS
|
|
54 |
from pithos.api.settings import AUTHENTICATION_URL, AUTHENTICATION_USERS, COOKIE_NAME
|
55 |
55 |
|
56 |
56 |
from pithos.backends.base import NotAllowedError, QuotaError
|
57 |
57 |
from pithos.backends.filter import parse_filters
|
... | ... | |
103 |
103 |
|
104 |
104 |
@csrf_exempt
|
105 |
105 |
def object_demux(request, v_account, v_container, v_object):
|
106 |
|
get_user(request, AUTHENTICATION_URL, AUTHENTICATION_USERS)
|
|
106 |
# Helper to avoid placing the token in the URL when loading objects from a browser.
|
|
107 |
token = None
|
|
108 |
if request.method in ('HEAD', 'GET') and COOKIE_NAME in request.COOKIES:
|
|
109 |
cookie_value = unquote(request.COOKIES.get('COOKIE_NAME', ''))
|
|
110 |
if cookie_value and '|' in cookie_value:
|
|
111 |
token = cookie_value.split('|', 1)[1]
|
|
112 |
get_user(request, AUTHENTICATION_URL, AUTHENTICATION_USERS, token)
|
107 |
113 |
if request.method == 'HEAD':
|
108 |
114 |
return object_meta(request, v_account, v_container, v_object)
|
109 |
115 |
elif request.method == 'GET':
|