[master] d127ca6e6 Discontinue support for 'scientific notation'.

Poul-Henning Kamp phk at FreeBSD.org
Wed May 19 07:41:06 UTC 2021


commit d127ca6e63da6e58adca569466b2b56e00b6d528
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed May 19 07:37:41 2021 +0000

    Discontinue support for 'scientific notation'.
    
    Considerable work went into RFC8941 to establish that there is
    neither a nead nor a reason to support parsing scientific notation
    in HTTP header context.

diff --git a/doc/changes.rst b/doc/changes.rst
index aa6e744d6..92f3c533e 100644
--- a/doc/changes.rst
+++ b/doc/changes.rst
@@ -35,6 +35,11 @@ release process.
 Varnish Cache 7.x.x (2021-09-15)
 ================================
 
+* 'Scientific Notation' numbers like 6.62607004e-34 are no longer
+  supported in VCL.  (The preparation of RFC8941 made it clear that
+  there are neither reason nor any need to support scientific notation
+  in context of HTTP headers.
+
 * Accept-Ranges headers are no longer generated for passed objects,
   but must either come from the backend or be created in `vcl_deliver{}`
 
diff --git a/lib/libvarnish/vnum.c b/lib/libvarnish/vnum.c
index 4e0d004f0..84b2acff8 100644
--- a/lib/libvarnish/vnum.c
+++ b/lib/libvarnish/vnum.c
@@ -83,15 +83,6 @@ VNUMpfx(const char *p, const char **t)
 	}
 	if (e > 0.0)
 		return (nan(""));		// No digits
-	if (*p == 'e' || *p == 'E') {
-		p++;
-		if (*p == '-' || *p == '+')
-			es = (*p++ == '-' ? -1.0 : 1.0);
-		if (!vct_isdigit(*p))
-			return (nan(""));
-		for (; vct_isdigit(*p); p++)
-			ee = ee * 10. + *p - '0';
-	}
 	while (vct_issp(*p))
 		p++;
 	if (*p != '\0')
@@ -245,7 +236,10 @@ VNUM_2bytes(const char *p, uintmax_t *r, uintmax_t rel)
 }
 
 #ifdef NUM_C_TEST
-/* Compile with: "cc -o foo -DNUM_C_TEST -I../.. -I../../include num.c -lm" */
+/*
+ * Compile with:
+ *     cc -o foo -DNUM_C_TEST -I../.. -I../../include vnum.c vas.c vct.c -lm
+ */
 
 static struct test_case {
 	const char *str;
@@ -315,11 +309,11 @@ static const char *vec[] = {
 	" 12.",
 	" 12.3",
 	" 12.34",
-	" 12.34e-3",
-	" 12.34e3",
-	" 12.34e+3",
-	" +12.34e-3",
-	" -12.34e3",
+	"N12.34e-3",
+	"N12.34e3",
+	"N12.34e+3",
+	"N+12.34e-3",
+	"N-12.34e3",
 	"N.",
 	"N.12.",
 	"N12..",


More information about the varnish-commit mailing list