Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker/nginx/addons.conf.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
client_max_body_size 50m;
client_max_body_size 200m;
etag off;
merge_slashes off;

Expand Down Expand Up @@ -49,7 +49,7 @@ server {
try_files $uri @olympia;
}

location ~ ^/(__version__|__heartbeat__|services/monitor.json)(\?.*)?$ {
location ~ ^/(__version__|__heartbeat__|services).*$ {
try_files $uri @olympia;
}

Expand Down
1 change: 1 addition & 0 deletions src/olympia/amo/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# which is useful to reach those services from an API request, to make them
# work with services.a.m.o. or test their behavior with request.is_api
# being True.
re_path(r'^dummy_upload', views.dummy_upload, name='amo.dummy_upload'),
re_path(r'^client_info', views.client_info, name='amo.client_info'),
re_path(r'^403', views.handler403),
re_path(r'^404', views.handler404),
Expand Down
22 changes: 22 additions & 0 deletions src/olympia/amo/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import os
import re
import time

from django.conf import settings
from django.contrib.auth.models import AnonymousUser
Expand Down Expand Up @@ -73,6 +74,27 @@ def services_monitor(request):
)


@csrf_exempt
@non_atomic_requests
def dummy_upload(request):
if getattr(settings, 'ENV', None) == 'prod':
raise PermissionDenied
# dd if=/dev/urandom of=/tmp/test.img bs=100M count=1
# curl -F parse=1 -F upload=@/tmp/test.img <host>/services/dummy_upload
if request.POST.get('parse') and 'upload' in request.FILES:
buf = request.FILES['upload'].read()
else:
buf = ''

return JsonResponse(
{
# request._start_time is set by GraphiteRequestTimingMiddleware
'elapsed_in_app': int((time.time() - request._start_time) * 1000),
'buf_size': len(buf),
}
)


@never_cache
@csrf_exempt
@non_atomic_requests
Expand Down
Loading