From ca16e42ef8b48b61f7c9ae7c5cbebe3467532c5e Mon Sep 17 00:00:00 2001 From: Khalid MOUTAOUAKIL Date: Mon, 6 Apr 2026 23:52:55 +0200 Subject: [PATCH] =?UTF-8?q?Cache=2010min=20sur=20d=C3=A9tail=20vuln=C3=A9r?= =?UTF-8?q?abilit=C3=A9s=20(HTMX),=20indication=20(cache)=20affich=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- app/routers/qualys.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/routers/qualys.py b/app/routers/qualys.py index d17e4fe..fd266ad 100644 --- a/app/routers/qualys.py +++ b/app/routers/qualys.py @@ -464,6 +464,13 @@ async def qualys_vulns_detail(request: Request, ip: str, db=Depends(get_db)): if not user: return HTMLResponse("

Non autorise

") + # Cache 10 min + from ..services import cache as _cache + cache_key = f"qualys:vulndetail:{ip}" + cached_html = _cache.get(cache_key) + if cached_html is not None: + return HTMLResponse(cached_html + '

(cache 10 min)

') + from ..services.qualys_service import _get_qualys_creds, parse_xml import requests as _req, urllib3, re as _re urllib3.disable_warnings() @@ -604,6 +611,7 @@ async def qualys_vulns_detail(request: Request, ip: str, db=Depends(get_db)): html += '' html += '' + _cache.set(cache_key, html, 600) return HTMLResponse(html)