poprawki
This commit is contained in:
8
app.py
8
app.py
@@ -6,6 +6,7 @@ import time
|
||||
import json
|
||||
import hashlib
|
||||
import ipaddress
|
||||
import hmac, ipaddress
|
||||
from datetime import datetime
|
||||
from urllib.parse import urlparse, quote, unquote, urljoin
|
||||
from functools import wraps
|
||||
@@ -387,7 +388,7 @@ def index():
|
||||
@app.route("/convert")
|
||||
@limiter.limit(config.RATE_LIMIT_CONVERT)
|
||||
def convert():
|
||||
import hmac, ipaddress
|
||||
|
||||
|
||||
def is_private_client_ip() -> bool:
|
||||
ip = get_client_ip()
|
||||
@@ -436,8 +437,8 @@ def convert():
|
||||
return resp
|
||||
|
||||
try:
|
||||
redis_client.incr("stats:convert_requests")
|
||||
add_recent_convert()
|
||||
redis_client.incr("stats:convert_requests")
|
||||
if debug_mode:
|
||||
d("Start /convert w trybie debug")
|
||||
|
||||
@@ -515,11 +516,13 @@ def convert():
|
||||
if debug_mode:
|
||||
d("Upstream 304 – zwracam 304")
|
||||
r.close()
|
||||
add_recent_convert()
|
||||
return debug_response(status=304)
|
||||
resp = Response(status=304)
|
||||
resp.headers.update(cache_headers(etag, r.headers.get("Last-Modified")))
|
||||
resp.direct_passthrough = True
|
||||
r.close()
|
||||
add_recent_convert()
|
||||
return resp
|
||||
|
||||
up_etag = r.headers.get("ETag")
|
||||
@@ -566,6 +569,7 @@ def convert():
|
||||
resp.headers.update(cache_headers(etag, up_lm))
|
||||
resp.direct_passthrough = True
|
||||
redis_client.incr("stats:conversions_success")
|
||||
add_recent_convert()
|
||||
return resp
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
|
Reference in New Issue
Block a user