commit ae992540454231dbc3ea87e99721e7f7f35a329e
parent c9623549c337f39c6f81a8b25f87f1b1d8265071
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Wed, 31 Dec 2025 18:21:18 +0100
test_incompatible.c: enabled more tests, added comments
Diffstat:
1 file changed, 47 insertions(+), 35 deletions(-)
diff --git a/src/tests/raw/test_incompatible.c b/src/tests/raw/test_incompatible.c
@@ -121,7 +121,7 @@ static struct Test tests_must[] = {
.upload = "GET / HTTP/1.1\r\nHost Name: example.com\r\n\r\n",
// RFC 9110 Section 5.1: Field names must be tokens (no spaces allowed)
},
-#if QUESTIONABLE
+#ifdef MORE_PEER_VALIDATION
{
.name = "Header field name with colon",
.upload = "GET / HTTP/1.1\r\nHost:Name: example.com\r\n\r\n",
@@ -166,7 +166,7 @@ static struct Test tests_must[] = {
"POST / HTTP/1.1\r\nHost: example.com\r\nContent-Length: 5\r\nContent-Length: 10\r\n\r\n",
// RFC 9110 Section 8.6: Multiple Content-Length values must be identical
},
-#if BUG
+#ifdef MORE_PEER_VALIDATION
{
.name = "Invalid method with control character",
.upload = "GET\x01 / HTTP/1.1\r\nHost: example.com\r\n\r\n",
@@ -183,13 +183,11 @@ static struct Test tests_must[] = {
.upload = "GET /\r\nHost: example.com\r\n\r\n",
// RFC 9112 Section 2.3: HTTP/0.9 requests must not have headers
},
-#if BUG_HANGS
{
.name = "Missing final CRLF after headers",
.upload = "GET / HTTP/1.1\r\nHost: example.com\r\n",
// RFC 9112 Section 6.1: Empty line (CRLF) required after headers
},
-#endif
{
.name = "Whitespace before header field name",
.upload = "GET / HTTP/1.1\r\n Host: example.com\r\n\r\n",
@@ -232,27 +230,28 @@ static struct Test tests_must[] = {
.upload = "GET / HTTP/1.A\r\nHost: example.com\r\n\r\n",
// RFC 9112 Section 2.3: Version numbers must be digits
},
-#if QUESTIONABLE
+#ifdef NOT_A_BUG
{
.name = "Method with lowercase letters",
.upload = "get / HTTP/1.1\r\nHost: example.com\r\n\r\n",
// RFC 9110 Section 9.1: Method is case-sensitive
- // Alas, we may consider this a non-standard method? :-)
+ /* This a valid non-standard ("custom") method. */
},
#endif
-#if BUG
+#ifdef MORE_PEER_VALIDATION
{
.name = "Request-target with fragment identifier",
.upload = "GET /path#fragment HTTP/1.1\r\nHost: example.com\r\n\r\n",
// RFC 9112 Section 3.2.1: Fragment must not be sent in request-target
},
#endif
-#if BUG
+#ifdef OTHER_USES
{
.name = "Absolute-form with userinfo in HTTP/1.1",
.upload =
"GET http://user:pass@example.com/ HTTP/1.1\r\nHost: example.com\r\n\r\n",
// RFC 9110 Section 4.2.4: Userinfo (and its "@" delimiter) is now disallowed
+ /* This is a valid string for HTTP proxy */
},
#endif
{
@@ -294,14 +293,14 @@ static struct Test tests_must[] = {
"POST / HTTP/1.1\r\nHost: example.com\r\nContent-Length: 99999999999999999999999999999\r\n\r\n",
// RFC 9110 Section 8.6: Content-Length must be valid decimal integer
},
-#if BUG
+#ifdef MORE_PEER_VALIDATION
{
.name = "Request with vertical tab in header",
.upload = "GET / HTTP/1.1\r\nHost: example.com\r\nX-Custom:\vvalue\r\n\r\n",
// RFC 9110 Section 5.5: Only HTAB, SP, and VCHAR allowed in field values (VT is 0x0B)
},
#endif
-#if BUG
+#ifdef MORE_PEER_VALIDATION
{
.name = "Request with form feed in header value",
.upload =
@@ -321,22 +320,24 @@ static struct Test tests_must[] = {
"POST / HTTP/1.1\r\nHost: example.com\r\nTransfer-Encoding: chunked, gzip\r\n\r\n",
// RFC 9112 Section 6.1: 'chunked' must be last when present
},
-#if MINOR_BUG
+#ifdef SPECIAL_STRICT_PEER_CHECKING
{
.name = "HTTP/1.0 with Transfer-Encoding",
.upload =
"POST / HTTP/1.0\r\nHost: example.com\r\nTransfer-Encoding: chunked\r\n\r\n0\r\n\r\n",
// RFC 9112 Section 6.1: Transfer-Encoding must not be sent in HTTP/1.0
+ /* RFC does not enforce the server to reject such requests. "Must not be sent" != "Must be rejected" */
},
#endif
-#if BUG
+#ifdef NOT_A_BUG
{
.name = "POST without Content-Length or Transfer-Encoding",
.upload = "POST / HTTP/1.1\r\nHost: example.com\r\n\r\n",
// RFC 9112 Section 6.3: Message with body must have Content-Length or Transfer-Encoding
+ /* This is a perfectly valid request with an empty body. */
},
#endif
-#if BUG
+#ifdef MORE_PEER_VALIDATION
{
.name = "Request with CTL character in header name",
.upload =
@@ -344,7 +345,7 @@ static struct Test tests_must[] = {
// RFC 9110 Section 5.1: Field names must be tokens, CTL chars not allowed
},
#endif
-#if BUG
+#ifdef MORE_PEER_VALIDATION
{
.name = "Request with DEL character in header name",
.upload =
@@ -352,35 +353,33 @@ static struct Test tests_must[] = {
// RFC 9110 Section 5.1: DEL (0x7F) not allowed in field names
},
#endif
-#if BUG
+#ifdef MORE_PEER_VALIDATION
{
.name = "Request with non-ASCII in header name",
.upload = "GET / HTTP/1.1\r\nHost: example.com\r\nX-Cüstom: value\r\n\r\n",
// RFC 9110 Section 5.1: Field names must be ASCII tokens
},
#endif
-#if BUG
+#ifdef SPECIAL_STRICT_PEER_CHECKING
{
.name = "Request-target as asterisk for non-OPTIONS",
.upload = "GET * HTTP/1.1\r\nHost: example.com\r\n\r\n",
// RFC 9112 Section 3.2.4: Asterisk form only valid for OPTIONS
},
#endif
-#if BUG
+#ifdef MORE_PEER_VALIDATION
{
.name = "Authority-form for non-CONNECT",
.upload = "GET example.com:80 HTTP/1.1\r\nHost: example.com\r\n\r\n",
// RFC 9112 Section 3.2.3: Authority-form only valid for CONNECT
},
#endif
-#if BUG
{
.name = "HTTP/1.1 GET with empty Host header",
.upload = "GET / HTTP/1.1\r\nHost: \r\n\r\n",
// RFC 9112 Section 3.2: Empty Host header is invalid for this target form
},
-#endif
-#if BUG
+#ifdef MORE_PEER_VALIDATION
{
.name = "Request with quoted string in field name",
.upload =
@@ -403,7 +402,7 @@ static struct Test tests_must[] = {
.upload = " / HTTP/1.1\r\nHost: example.com\r\n\r\n",
// RFC 9112 Section 3: Method is required
},
-#if BUG
+#ifdef MORE_PEER_VALIDATION
{
.name = "Method with special character",
.upload = "GET/ / HTTP/1.1\r\nHost: example.com\r\n\r\n",
@@ -457,28 +456,24 @@ static struct Test tests_must_upload[] = {
"POST / HTTP/1.1\r\nHost: example.com\r\nTransfer-Encoding: chunked\r\n\r\n5\r\nhello0\r\n\r\n",
// RFC 9112 Section 7.1: CRLF required after chunk-data
},
-#if BAD_HANGS
{
.name = "Chunked with no final chunk",
.upload =
"POST / HTTP/1.1\r\nHost: example.com\r\nTransfer-Encoding: chunked\r\n\r\n5\r\nhello\r\n",
// RFC 9112 Section 7.1: Last chunk (size 0) is required
},
-#endif
{
.name = "Chunk size with leading whitespace",
.upload =
"POST / HTTP/1.1\r\nHost: example.com\r\nTransfer-Encoding: chunked\r\n\r\n 5\r\nhello\r\n0\r\n\r\n",
// RFC 9112 Section 7.1: No whitespace before chunk-size
},
-#if BAD_HANGS
{
.name = "Chunk size exceeding data provided",
.upload =
"POST / HTTP/1.1\r\nHost: example.com\r\nTransfer-Encoding: chunked\r\n\r\nA\r\nhello\r\n0\r\n\r\n",
// RFC 9112 Section 7.1: Chunk-size must match chunk-data length (10 bytes expected, 5 provided)
},
-#endif
{
.name = NULL,
}
@@ -500,55 +495,70 @@ static struct Test tests_should[] = {
.upload = "GET / HTTP/1.1\r\nHost: example.com\r\n continuation\r\n\r\n",
// RFC 9112 Section 5.2: Line folding is obsolete, recipients SHOULD reject or replace with SP
},
-#if MINOR_BUG
+#ifdef NOT_A_BUG
{
.name = "Multiple spaces after colon in header",
.upload = "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n",
- // RFC 9110 Section 5.3: Senders SHOULD NOT generate optional whitespace except as SP
+ // RFC 9110 Section 5.6.3: Senders SHOULD NOT generate optional whitespace except as SP
+ /* RFC 9110 Section 5.6.3: "OWS and RWS have the same semantics as a single SP."
+ * RFC 9112 Section 5.1: "A field line value might be preceded and/or followed by optional whitespace (OWS)"
+ * The server must parse this value as a correct value. */
},
#endif
-#if MINOR_BUG
+#ifdef NOT_A_BUG
{
.name = "Trailing whitespace in header value",
.upload = "GET / HTTP/1.1\r\nHost: example.com \r\n\r\n",
// RFC 9110 Section 5.3: Trailing whitespace should be stripped
+ /* RFC 9112 Section 5.1: "OWS occurring before the first non-whitespace octet of the field line value,
+ or after the last non-whitespace octet of the field line value, is excluded
+ by parsers when extracting the field line value from a field line."
+ * This is a valid request. */
},
#endif
-#if MINOR_BUG
+#ifdef NOT_A_BUG
{
.name = "Leading whitespace in header value",
.upload = "GET / HTTP/1.1\r\nHost: example.com\r\n\r\n",
// RFC 9110 Section 5.3: Leading whitespace should be stripped
+ /* RFC 9112 Section 5.1: "OWS occurring before the first non-whitespace octet of the field line value,
+ or after the last non-whitespace octet of the field line value, is excluded
+ by parsers when extracting the field line value from a field line."
+ * This is a valid request. */
},
#endif
-#if BUG
+#ifdef NOT_A_BUG
{
.name = "Chunk extension with whitespace",
.upload =
"POST / HTTP/1.1\r\nHost: example.com\r\nTransfer-Encoding: chunked\r\n\r\n5 ; ext=val\r\nhello\r\n0\r\n\r\n",
// RFC 9112 Section 7.1.1: Whitespace in chunk extensions should be minimal
+ /* This is a valid request. */
},
#endif
-#if BUG
+#ifdef NOT_A_BUG
{
.name = "Chunked with uppercase hex digits",
.upload =
"POST / HTTP/1.1\r\nHost: example.com\r\nTransfer-Encoding: chunked\r\n\r\n5\r\nhello\r\n0\r\n\r\n",
// RFC 9112 Section 7.1: Senders SHOULD use lowercase for hex digits (though uppercase is valid)
+ /* This is a valid request. It must be parsed. */
},
#endif
-#if QUESTIONABLE
+#ifdef NOT_A_BUG
{
.name = "Empty header field value",
.upload = "GET / HTTP/1.1\r\nHost: example.com\r\nX-Empty:\r\n\r\n",
// RFC 9110 Section 5.3: Empty field values are valid but some implementations may reject
+ /* This is a valid request. It must be parsed. */
},
#endif
-#if MINOR_BUG
+#ifdef NOT_A_BUG
{
.name = "Header field name with uppercase and lowercase",
.upload = "GET / HTTP/1.1\r\nHoSt: example.com\r\n\r\n",
// RFC 9110 Section 5.1: Field names are case-insensitive, but conventional capitalization SHOULD be used
+ /* This is a valid request. It must be parsed. */
},
#endif
{
@@ -556,20 +566,22 @@ static struct Test tests_should[] = {
.upload = "GET / HTTP/1.1 \r\nHost: example.com\r\n\r\n",
// RFC 9112 Section 3: Trailing whitespace in request-line should not be present
},
-#if MINOR_BUG
+#ifdef NOT_A_BUG
{
.name = "Content-Length with leading zeros",
.upload =
"POST / HTTP/1.1\r\nHost: example.com\r\nContent-Length: 0005\r\n\r\nhello",
// RFC 9110 Section 8.6: Leading zeros should not be sent
+ /* This is a valid request. It must be parsed. */
},
#endif
-#if BUG
+#ifdef NOT_A_BUG
{
.name = "Cookie header with invalid encoding in value",
.upload =
"GET / HTTP/1.1\r\nHost: example.com\r\nCookie: name=val ue\r\n\r\n",
// RFC 6265 Section 4.2: Cookie values should be properly encoded, spaces require encoding
+ /* Rejected completely on stricter level. On default level valid part "name=val" is used. */
},
#endif
{