http code for content too large

This commit is contained in:
bashrc committed 2026-10-14 13:12:24 +01:00
1 parent e186b953cf
commit 56bea68f2f
35 files changed
+119 -30

No files matched your search

+2 -1
View File
@@ -99,6 +99,7 @@ from src.httpcodes import http_403
from src.httpcodes import http_404
from src.httpcodes import http_304
from src.httpcodes import http_400
from src.httpcodes import http_413
from src.httpcodes import write2
from src.httpheaders import set_headers
from src.daemon_utils import load_known_epicyon_instances
@@ -151,7 +152,7 @@ class PubServer(BaseHTTPRequestHandler):
if length > self.server.max_post_length:
print(endpoint_type.upper() +
' request size too large ' + self.path)
http_400(self)
http_413(self)
return
if not self.path.startswith('/calendars/'):
print(endpoint_type.upper() + ' without /calendars ' + self.path)
+7 -1
View File
@@ -42,6 +42,7 @@ from src.httpcodes import http_402
from src.httpcodes import http_403
from src.httpcodes import http_404
from src.httpcodes import http_503
from src.httpcodes import http_413
from src.httpheaders import contains_suspicious_headers
from src.httpheaders import update_headers_catalog
from src.httpheaders import redirect_headers
@@ -1217,6 +1218,7 @@ def daemon_http_post(self) -> None:
'application/activity+json',
'application/ld+json')):
print("POST is not json: " + self.headers['Content-type'])
http_code_returned: bool = False
if self.server.debug:
print(str(self.headers).replace('\n', ' '))
length = int(self.headers['Content-length'])
@@ -1241,7 +1243,11 @@ def daemon_http_post(self) -> None:
self.server.postreq_busy = False
return
print(str(unknown_post))
http_400(self)
else:
http_413(self)
http_code_returned = True
if not http_code_returned:
http_400(self)
self.server.postreq_busy = False
return
+2
View File
@@ -89,6 +89,8 @@ def set_hashtag_category2(self, calling_domain: str, cookie: str,
if length > max_post_length:
print('Maximum links data length exceeded ' + str(length))
redirect_headers(self, tag_screen_str, cookie, calling_domain, 303)
self.send_response(413)
self.end_headers()
self.server.postreq_busy = False
return
+2
View File
@@ -148,6 +148,8 @@ def links_update(self, calling_domain: str, cookie: str,
if length > max_post_length:
print('Maximum links data length exceeded ' + str(length))
redirect_headers(self, actor_str, cookie, calling_domain, 303)
self.send_response(413)
self.end_headers()
self.server.postreq_busy = False
return
+6
View File
@@ -76,6 +76,8 @@ def newswire_update(self, calling_domain: str, cookie: str,
if length > max_post_length:
print('Maximum newswire data length exceeded ' + str(length))
redirect_headers(self, actor_str, cookie, calling_domain, 303)
self.send_response(413)
self.end_headers()
self.server.postreq_busy = False
return
@@ -239,6 +241,8 @@ def citations_update(self, calling_domain: str, cookie: str,
if length > max_post_length:
print('Maximum citations data length exceeded ' + str(length))
redirect_headers(self, actor_str, cookie, calling_domain, 303)
self.send_response(413)
self.end_headers()
self.server.postreq_busy = False
return
@@ -351,6 +355,8 @@ def news_post_edit(self, calling_domain: str, cookie: str,
else:
redirect_headers(self, actor_str + '/tlnews',
cookie, calling_domain, 303)
self.send_response(413)
self.end_headers()
self.server.postreq_busy = False
return
+2
View File
@@ -2812,6 +2812,8 @@ def profile_edit(self, calling_domain: str, cookie: str,
print('Maximum profile data length exceeded ' +
str(length))
redirect_headers(self, actor_str, cookie, calling_domain, 303)
self.send_response(413)
self.end_headers()
self.server.postreq_busy = False
return
+14
View File
@@ -199,3 +199,17 @@ def http_503(self) -> None:
_http_return_code(self, 503, 'Unavailable',
'The server is busy. Please try again ' +
'later', None)
def http_413(self) -> None:
"""HTTP code 413
"""
if self.server.translate:
busy_str = \
self.server.translate["Ain't no way no how"]
_http_return_code(self, 413,
self.server.translate['Content is too large'],
busy_str, None)
else:
_http_return_code(self, 413, 'Content is too large',
"Ain't no way no how", None)
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "السماح بإضافة هذا الحساب إلى القوائم",
"Apply dithering to images.": "طبّق تقنية التدرج النقطي (dithering) على الصور.",
"Replace dashes with em dashes": "استبدل الشرطات (-) بشرطات طويلة (—)",
"Content labels": "تصنيفات المحتوى"
"Content labels": "تصنيفات المحتوى",
"Content is too large": "المحتوى كبير جداً",
"Ain't no way no how": "لا سبيل بأي حال من الأحوال"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "এই অ্যাকাউন্টটিকে তালিকায় যুক্ত করার অনুমতি দিন",
"Apply dithering to images.": "ছবিতে ডিদারিং প্রয়োগ করুন।",
"Replace dashes with em dashes": "ড্যাশগুলোকে এম-ড্যাশ (em dashes) দিয়ে প্রতিস্থাপন করুন।",
"Content labels": "বিষয়বস্তুর লেবেল"
"Content labels": "বিষয়বস্তুর লেবেল",
"Content is too large": "বিষয়বস্তু অত্যধিক বড়",
"Ain't no way no how": "কোনোভাবেই সম্ভব না।"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Permet que aquest compte s'afegeixi a les llistes",
"Apply dithering to images.": "Aplica el dithering a les imatges.",
"Replace dashes with em dashes": "Substitueix els guions per guions circulars",
"Content labels": "Etiquetes de contingut"
"Content labels": "Etiquetes de contingut",
"Content is too large": "El contingut és massa gran.",
"Ain't no way no how": "No hi ha manera de com"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Caniatáu i'r cyfrif hwn gael ei ychwanegu at restrau",
"Apply dithering to images.": "Cymhwyso dithering i ddelweddau.",
"Replace dashes with em dashes": "Disodli llinellau byr gyda llinellau byr em",
"Content labels": "Labeli cynnwys"
"Content labels": "Labeli cynnwys",
"Content is too large": "Mae'r cynnwys yn rhy fawr",
"Ain't no way no how": "Does dim ffordd, dim sut"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Erlauben, dass dieses Konto zu Listen hinzugefügt wird",
"Apply dithering to images.": "Wenden Sie Dithering auf Bilder an.",
"Replace dashes with em dashes": "Ersetzen Sie Bindestriche durch Geviertstriche.",
"Content labels": "Inhaltsbezeichnungen"
"Content labels": "Inhaltsbezeichnungen",
"Content is too large": "Der Inhalt ist zu groß.",
"Ain't no way no how": "Das geht auf keinen Fall!"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Να επιτρέπεται η προσθήκη αυτού του λογαριασμού σε λίστες",
"Apply dithering to images.": "Εφαρμογή πρόσμειξης σε εικόνες.",
"Replace dashes with em dashes": "Αντικαταστήστε τις παύλες με παύλες em",
"Content labels": "Ετικέτες περιεχομένου"
"Content labels": "Ετικέτες περιεχομένου",
"Content is too large": "Το περιεχόμενο είναι πολύ μεγάλο",
"Ain't no way no how": "Δεν υπάρχει τρόπος, ούτε πώς"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Allow this account to be added to lists",
"Apply dithering to images.": "Apply dithering to images.",
"Replace dashes with em dashes": "Replace dashes with em dashes",
"Content labels": "Content labels"
"Content labels": "Content labels",
"Content is too large": "Content is too large",
"Ain't no way no how": "Ain't no way no how"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Permitir que esta cuenta se añada a listas",
"Apply dithering to images.": "Aplica tramado a las imágenes.",
"Replace dashes with em dashes": "Reemplaza los guiones por rayas.",
"Content labels": "Etiquetas de contenido"
"Content labels": "Etiquetas de contenido",
"Content is too large": "El contenido es demasiado grande.",
"Ain't no way no how": "No hay manera de cómo"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "اجازه دهید این حساب به لیست‌ها اضافه شود",
"Apply dithering to images.": "اعمال لرزش (dithering) روی تصاویر",
"Replace dashes with em dashes": "خط تیره را با خط تیره em جایگزین کنید",
"Content labels": "برچسب‌های محتوا"
"Content labels": "برچسب‌های محتوا",
"Content is too large": "محتوا بیش از حد حجیم است.",
"Ain't no way no how": "به هیچ وجه، نه، چطور؟"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Salli tämän tilin lisääminen listoihin",
"Apply dithering to images.": "Käytä kuviin rasterointia.",
"Replace dashes with em dashes": "Korvaa viivat em-viivoilla",
"Content labels": "Sisältötunnisteet"
"Content labels": "Sisältötunnisteet",
"Content is too large": "Sisältö on liian suuri.",
"Ain't no way no how": "Ei mitenkään, ei miten"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Autoriser l'ajout de ce compte à des listes",
"Apply dithering to images.": "Appliquez le tramage aux images.",
"Replace dashes with em dashes": "Remplacez les tirets par des tirets cadratins.",
"Content labels": "Étiquettes de contenu"
"Content labels": "Étiquettes de contenu",
"Content is too large": "Le contenu est trop volumineux.",
"Ain't no way no how": "C'est absolument impossible."
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Ceadaigh an cuntas seo a chur le liostaí",
"Apply dithering to images.": "Cuir díodrú i bhfeidhm ar íomhánna.",
"Replace dashes with em dashes": "Cuir fleascáin em in ionad fleascáin",
"Content labels": "Lipéid ábhair"
"Content labels": "Lipéid ábhair",
"Content is too large": "Tá an t-ábhar ró-mhór",
"Ain't no way no how": "Níl aon bhealach ar bith ná conas"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "אפשר הוספת חשבון זה לרשימות",
"Apply dithering to images.": "החלת דיטרינג על תמונות.",
"Replace dashes with em dashes": "החלפת מקפים במקפים em",
"Content labels": "תוויות תוכן"
"Content labels": "תוויות תוכן",
"Content is too large": "התוכן גדול מדי",
"Ain't no way no how": "אין סיכוי, אין איך"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "इस अकाउंट को लिस्ट में जोड़ने की अनुमति दें",
"Apply dithering to images.": "इमेज पर डिथरिंग लागू करें।",
"Replace dashes with em dashes": "डैश की जगह एम-डैश (em dashes) का इस्तेमाल करें।",
"Content labels": "कंटेंट लेबल"
"Content labels": "कंटेंट लेबल",
"Content is too large": "कंटेंट बहुत बड़ा है",
"Ain't no way no how": "कोई रास्ता नहीं है, कोई तरीका नहीं है"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Consenti l'aggiunta di questo account agli elenchi",
"Apply dithering to images.": "Applica il dithering alle immagini.",
"Replace dashes with em dashes": "Sostituisci i trattini con i trattini lunghi.",
"Content labels": "Etichette dei contenuti"
"Content labels": "Etichette dei contenuti",
"Content is too large": "Il contenuto è troppo grande",
"Ain't no way no how": "Non c'è modo, in nessun modo"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "このアカウントをリストに追加できるようにする",
"Apply dithering to images.": "画像にディザリングを適用します。",
"Replace dashes with em dashes": "ダッシュをemダッシュに置き換えてください",
"Content labels": "コンテンツラベル"
"Content labels": "コンテンツラベル",
"Content is too large": "コンテンツが大きすぎます",
"Ain't no way no how": "絶対に無理だ"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "이 계정을 목록에 추가할 수 있도록 허용",
"Apply dithering to images.": "이미지에 디더링을 적용합니다.",
"Replace dashes with em dashes": "대시를 엠 대시로 바꾸세요.",
"Content labels": "콘텐츠 라벨"
"Content labels": "콘텐츠 라벨",
"Content is too large": "콘텐츠가 너무 큽니다.",
"Ain't no way no how": "절대 불가능해"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Destûrê bide ku ev hesab li navnîşan were zêdekirin",
"Apply dithering to images.": "Ditheringê li ser wêneyan bicîh bîne.",
"Replace dashes with em dashes": "Xêzên xêzkirî bi xêzên em biguherînin",
"Content labels": "Etîketên naverokê"
"Content labels": "Etîketên naverokê",
"Content is too large": "Naverok pir mezin e",
"Ain't no way no how": "Ne rê, ne çawa heye"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Toestaan ​​dat dit account aan lijsten wordt toegevoegd",
"Apply dithering to images.": "Pas dithering toe op afbeeldingen.",
"Replace dashes with em dashes": "Vervang koppeltekens door kastlijntjes.",
"Content labels": "Inhoudslabels"
"Content labels": "Inhoudslabels",
"Content is too large": "De inhoud is te groot.",
"Ain't no way no how": "Absoluut onmogelijk."
}
+3 -1
View File
@@ -771,5 +771,7 @@
"Allow this account to be added to lists": "Autorizar aqueste compte a èsser apondut a las listas",
"Apply dithering to images.": "Aplicar lo tremolament a d'imatges.",
"Replace dashes with em dashes": "Remplaçatz los tirets per de tirets em",
"Content labels": "Etiquetas de contengut"
"Content labels": "Etiquetas de contengut",
"Content is too large": "Lo contengut es tròp grand",
"Ain't no way no how": "Es pas cap de biais non cossí"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Zezwól na dodawanie tego konta do list",
"Apply dithering to images.": "Zastosuj dithering do obrazów.",
"Replace dashes with em dashes": "Zastąp myślniki pauzami.",
"Content labels": "Etykiety zawartości"
"Content labels": "Etykiety zawartości",
"Content is too large": "Zawartość jest zbyt duża",
"Ain't no way no how": "Nie ma mowy, nie ma jak"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Permitir que esta conta seja adicionada às listas",
"Apply dithering to images.": "Aplicar dithering às imagens.",
"Replace dashes with em dashes": "Substitua os travessões por travessões longos.",
"Content labels": "Rótulos de conteúdo"
"Content labels": "Rótulos de conteúdo",
"Content is too large": "O conteúdo é muito grande.",
"Ain't no way no how": "De maneira nenhuma."
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Разрешить добавление этого аккаунта в списки",
"Apply dithering to images.": "Примените дизеринг к изображениям.",
"Replace dashes with em dashes": "Замените дефисы на тире.",
"Content labels": "Метки контента"
"Content labels": "Метки контента",
"Content is too large": "Объем содержимого слишком велик",
"Ain't no way no how": "Ни за что!"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Ruhusu akaunti hii iongezwe kwenye orodha",
"Apply dithering to images.": "Weka upau wa kuchorea kwenye picha.",
"Replace dashes with em dashes": "Badilisha dashibodi na dashibodi za em",
"Content labels": "Lebo za maudhui"
"Content labels": "Lebo za maudhui",
"Content is too large": "Maudhui ni makubwa mno",
"Ain't no way no how": "Hakuna njia wala jinsi"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Bu hesabın listelere eklenmesine izin ver",
"Apply dithering to images.": "Görüntülere dithering uygulayın.",
"Replace dashes with em dashes": "Kısa çizgileri uzun çizgilerle (em dash) değiştirin.",
"Content labels": "İçerik etiketleri"
"Content labels": "İçerik etiketleri",
"Content is too large": "İçerik çok büyük",
"Ain't no way no how": "Hiçbir şekilde mümkün değil"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "Дозволити додавання цього облікового запису до списків",
"Apply dithering to images.": "Застосуйте дизеринг до зображень.",
"Replace dashes with em dashes": "Замініть тире довгими тире",
"Content labels": "Мітки контенту"
"Content labels": "Мітки контенту",
"Content is too large": "Вміст завеликий",
"Ain't no way no how": "Ні в якому разі, ні як"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "ערלויבן דעם חשבון צו ווערן צוגעגעבן צו ליסטעס",
"Apply dithering to images.": "צולייגן דיטערינג צו בילדער.",
"Replace dashes with em dashes": "פֿאַרבײַטן די שטריכלעך מיט עמ־שטרייכלעך",
"Content labels": "אינהאַלט עטיקעטן"
"Content labels": "אינהאַלט עטיקעטן",
"Content is too large": "דער אינהאַלט איז צו גרויס",
"Ain't no way no how": "נישט קיין וועג נישט ווי"
}
+3 -1
View File
@@ -775,5 +775,7 @@
"Allow this account to be added to lists": "允许将此帐户添加到列表中",
"Apply dithering to images.": "对图像应用抖动处理。",
"Replace dashes with em dashes": "将连字符替换为长破折号",
"Content labels": "内容标签"
"Content labels": "内容标签",
"Content is too large": "内容过大",
"Ain't no way no how": "绝对没有办法"
}