|
|
@@ -76,6 +76,11 @@ def esegue_conversione(inputfile):
|
|
|
r.close()
|
|
|
risultato[k] = {'file':"{}/out/{}.pdf".format(MEDIA_ROOT,k),'pagine':listapagine[k]}
|
|
|
|
|
|
+ '''
|
|
|
+ fino a qui e' tutto chiaro.
|
|
|
+ il file elaborato viene salvato in out denetro la cartella MEDIA_ROOT
|
|
|
+ '''
|
|
|
+
|
|
|
|
|
|
else: risultato['errore']=[]
|
|
|
|
|
|
@@ -87,14 +92,21 @@ def esegue_conversione(inputfile):
|
|
|
|
|
|
@csrf_exempt
|
|
|
def frontpage(request):
|
|
|
+ print(__name__)
|
|
|
listaccepted = list()
|
|
|
listaccepted.append('195.110.154.210')
|
|
|
listaccepted.append('195.110.154.213')
|
|
|
+ listaccepted.append('127.0.0.1')
|
|
|
+
|
|
|
|
|
|
- print('x_real_ip',request.META['HTTP_X_REAL_IP'])
|
|
|
- print('http_host',request.META['HTTP_HOST'])
|
|
|
+ print(request.META)
|
|
|
+ if 'x_real_ip'.upper() in request.META:
|
|
|
+ print('x_real_ip',request.META['HTTP_X_REAL_IP'])
|
|
|
+ if 'http_host'.upper() in request.META:
|
|
|
+ print('http_host',request.META['HTTP_HOST'])
|
|
|
+ if 'remote_address'.upper() in request.META:
|
|
|
+ print('remote_addrews',request.META['REMOTE_ADDR'])
|
|
|
|
|
|
- '''
|
|
|
auth = False
|
|
|
|
|
|
if 'HTTP_X_REAL_IP' in request.META:
|
|
|
@@ -102,14 +114,18 @@ def frontpage(request):
|
|
|
if request.META['HTTP_X_REAL_IP'] in listaccepted:
|
|
|
print('found presente X_REAL_IP',request.META['HTTP_X_REAL_IP'])
|
|
|
auth = True
|
|
|
- else:
|
|
|
- if 'HTTP_HOST' in request.META:
|
|
|
- if request.META['HTTP_HOST'] in listaccepted:
|
|
|
- auth = True
|
|
|
+ if 'HTTP_HOST' in request.META:
|
|
|
+ if request.META['HTTP_HOST'] in listaccepted:
|
|
|
+ print('found presente HTTP_HOST',request.META['HTTP_HOST'])
|
|
|
+ auth = True
|
|
|
+ if 'REMOTE_ADDR' in request.META:
|
|
|
+ if request.META['REMOTE_ADDR'] in listaccepted:
|
|
|
+ print('found presente REMOTE_ADDR',request.META['REMOTE_ADDR'])
|
|
|
+ auth = True
|
|
|
+
|
|
|
|
|
|
if not auth:
|
|
|
return HttpResponse("Accesso Non Autorizzato", status=503, headers={})
|
|
|
- '''
|
|
|
|
|
|
data = {}
|
|
|
print('request.method',request.method)
|