← Commit list

004f41c186

Viktor Szakats
Viktor Szakats
2025-12-03
SUCCESS Duration: 162s

Subject

tests: add `%AMP` macro, use it in two tests

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

docs/tests/FILEFORMAT.md+8 -0
@@ -88,6 +88,14 @@ lines:
%SP - space
%TAB - horizontal tab
+## Special characters
+
+Macros to help keep data files XML-compliant:
+
+ %AMP - Ampersand: `&`
+ %GT - Greater-than sign: `>`
+ %LT - Less-than sign: `<`
+
## Insert capped epoch days
Mostly to test capped cookie expire dates: `%days[NUM]` inserts the number of
tests/data/test1524+3 -4
@@ -4,7 +4,6 @@
HTTP
HTTP PUT
followlocation
-notxml
</keywords>
</info>
#
@@ -12,7 +11,7 @@ notxml
<reply>
<data>
HTTP/1.1 303 OK swsclose
-Location: moo.html&testcase=/%TESTNUMBER0002
+Location: moo.html%AMPtestcase=/%TESTNUMBER0002
Connection: close
</data>
@@ -25,7 +24,7 @@ body
</data2>
<datacheck>
HTTP/1.1 303 OK swsclose
-Location: moo.html&testcase=/%TESTNUMBER0002
+Location: moo.html%AMPtestcase=/%TESTNUMBER0002
Connection: close
HTTP/1.1 200 OK swsclose
@@ -64,7 +63,7 @@ Accept: */*
Content-Length: 4
moo
-GET /blah/moo.html&testcase=/%TESTNUMBER0002 HTTP/1.1
+GET /blah/moo.html%AMPtestcase=/%TESTNUMBER0002 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
tests/data/test45+3 -4
@@ -4,7 +4,6 @@
HTTP
HTTP GET
followlocation
-notxml
</keywords>
</info>
# Server-side
@@ -13,7 +12,7 @@ notxml
HTTP/1.1 301 This is a weirdo text message swsclose
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
-Location: data.cgi?moo=http://&/%TESTNUMBER0002
+Location: data.cgi?moo=http://%AMP/%TESTNUMBER0002
Connection: close
This server reply is for testing a simple Location: following
@@ -32,7 +31,7 @@ If this is received, the location following worked
HTTP/1.1 301 This is a weirdo text message swsclose
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
-Location: data.cgi?moo=http://&/%TESTNUMBER0002
+Location: data.cgi?moo=http://%AMP/%TESTNUMBER0002
Connection: close
HTTP/1.1 200 Followed here fine swsclose
@@ -66,7 +65,7 @@ Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
-GET /want/data.cgi?moo=http://&/%TESTNUMBER0002 HTTP/1.1
+GET /want/data.cgi?moo=http://%AMP/%TESTNUMBER0002 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
tests/testutil.pm+1 -0
@@ -158,6 +158,7 @@ sub subbase64 {
$$thing =~ s/%CR/\r/g; # carriage return aka \r aka 0x0d
$$thing =~ s/%LT/</g;
$$thing =~ s/%GT/>/g;
+ $$thing =~ s/%AMP/&/g;
# include a file
$$thing =~ s/%include ([^%]*)%[\n\r]+/includefile($1, 0)/ge;