curl/tests/data/test3032
Jay Satiro 1a36923d73 tests: change the behavior of swsbounce
- Change the swsbounce keyword to override the part number on a
  subsequent request to the previous part number + 1.

Note the previous part number in this case is the part number that
was returned as a response to the previous request and contained
the swsbounce keyword.

Prior to this change swsbounce incremented the part number of the
subsequent request instead of overriding it, and did so in a more
limited fashion that prevented chaining swsbounce in multiple responses.

For example, if the test makes a request that causes the sws server to
return `<data>` as a response and that response contains `swsbounce`
then for the next response the sws server returns `<data1>`. If
`<data1>` also contains `swsbounce` then for the next response the sws
server now returns `<data2>` instead of the requested part.

Fixes https://github.com/curl/curl/discussions/16074
Closes https://github.com/curl/curl/pull/16085
2025-01-26 02:29:21 -05:00

113 lines
1.9 KiB
Plaintext

<testcase>
<info>
<keywords>
HTTP
--location
</keywords>
</info>
# Server-side
<reply>
<data>
HTTP/1.1 301 redirect swsbounce
Content-Length: 0
Location: http://%HOSTIP:%HTTPPORT/%TESTNUMBER
Part: data
</data>
<data1>
HTTP/1.1 301 redirect swsbounce
Content-Length: 0
Location: http://%HOSTIP:%HTTPPORT/%TESTNUMBER
Part: data1
</data1>
<data2>
HTTP/1.1 301 redirect swsbounce
Content-Length: 0
Location: http://%HOSTIP:%HTTPPORT/%TESTNUMBER
Part: data2
</data2>
<data3>
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 30
Part: data3
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
</data3>
<datacheck>
HTTP/1.1 301 redirect swsbounce
Content-Length: 0
Location: http://%HOSTIP:%HTTPPORT/%TESTNUMBER
Part: data
HTTP/1.1 301 redirect swsbounce
Content-Length: 0
Location: http://%HOSTIP:%HTTPPORT/%TESTNUMBER
Part: data1
HTTP/1.1 301 redirect swsbounce
Content-Length: 0
Location: http://%HOSTIP:%HTTPPORT/%TESTNUMBER
Part: data2
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 30
Part: data3
XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
</datacheck>
</reply>
# Client-side
<client>
<server>
http
</server>
# This is a test of the swsbounce keyword which is used during tests to
# override the data response number for the next request to the previous
# data response number + 1. eg data, data1, data2 etc.
<name>
HTTP redirect loop 3x swsbounce test
</name>
<command>
--location http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
</verify>
</testcase>