feat: Semaine 9

This commit is contained in:
gauvainboiche
2026-05-15 16:24:56 +02:00
parent 3315cb2336
commit ce1f0e513a
108 changed files with 3150 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import re # RegEx
def extract_header(payload):
try:
header_brut = payload[:payload.index(b"\r\n\r\n") + 2]
except ValueError:
return None
header = dict(re.findall(
r"(?P<cle>.*?): (?P<valeur>.*?)\r\n",
header_brut.decode(errors="ignore")
))
if "Content-Type" not in header:
return None
return header