]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
altsvc: only accept 17 byte dates from files
authorDaniel Stenberg <daniel@haxx.se>
Mon, 12 Jan 2026 07:05:49 +0000 (08:05 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 12 Jan 2026 12:49:57 +0000 (13:49 +0100)
Since the date format is fixed there is no need to accept more data.

Update test355 to verify reject of too long date in alt-svc file

This test case was originally supposed to verify alt-svc loading from a
file but never did because it was done incorrectly.

Now it verifies that a too long date in the input file makes curl
disregard the entry.

Closes #20259

lib/altsvc.c
tests/data/test355

index 108f5c09158a8220a1cb0f74049da923bc463030..cf6f754a045271df9cfd499e0b6b80fedc453811 100644 (file)
@@ -39,7 +39,7 @@
 #include "connect.h"
 
 #define MAX_ALTSVC_LINE    4095
-#define MAX_ALTSVC_DATELEN 256
+#define MAX_ALTSVC_DATELEN 17
 #define MAX_ALTSVC_HOSTLEN 2048
 #define MAX_ALTSVC_ALPNLEN 10
 
index 8cb29d37920be7b1c0c8bfc8294344cc893bb89b..5c74321ac25fdb2e0481fc218a13d7d23b8a3f61 100644 (file)
@@ -25,18 +25,22 @@ Funny-head: yesyes
 <client>
 <features>
 alt-svc
+Debug
 </features>
+<setenv>
+CURL_ALTSVC_HTTP=1
+</setenv>
 <server>
 http
 </server>
 <name>
-load Alt-Svc from file and use
+Alt-Svc from file with too long date
 </name>
 <command>
-http://%HOSTIP:%HTTPPORT/%TESTNUMBER --alt-svc ""
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER --alt-svc "%LOGDIR/altsvc-%TESTNUMBER"
 </command>
 <file name="%LOGDIR/altsvc-%TESTNUMBER">
-h1 example.com 80 h1 %HOSTIP %HTTPPORT "20290222 22:19:28" 0 0
+h1 %HOSTIP %HTTPPORT h1 example.com 80 "20290222 22:19:028" 0 0
 </file>
 </client>