mirror of
https://github.com/curl/curl.git
synced 2026-05-30 11:27:29 +03:00
tests: add %AMP macro, use it in two tests
To allow replacing `&` characters in `tests/data/test*` files for
XML-compliance.
Also:
- document `%GT`, `%LT`
Follow-up to de49cc89ab #19470
Closes #19824
This commit is contained in:
parent
0417d323c9
commit
004f41c186
4 changed files with 15 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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: */*
|
||||
|
|
|
|||
|
|
@ -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: */*
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue