]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
test696: decouple from test556 data
authorViktor Szakats <commit@vsz.me>
Sun, 2 Nov 2025 15:00:24 +0000 (16:00 +0100)
committerViktor Szakats <commit@vsz.me>
Mon, 3 Nov 2025 11:19:03 +0000 (12:19 +0100)
Test 696 and 556 share the same libtest code. Make sure to issue
the `GET` request to the correct runtime test number instead of using
the hard-wired "556".

It makes the `sws` test server read the response string from `test696`
`<data>` section, instead of reading it from `test556`. To avoid this
hidden interaction between test data.

AFAICS there is no other similar hard-coded string in reused libtests.

Ref: https://github.com/curl/curl/pull/19313#issuecomment-3477448933
Follow-up to be82a3605a4b539580b3de776ffcca25b8770e43 #16003
Closes #19329

tests/data/test696
tests/libtest/lib556.c

index 8862b163f23eb1d19292f175bc0d70c177e28e52..c0c316111dadc51d853028668e7731ec7785e9e4 100644 (file)
@@ -55,10 +55,10 @@ Connection: close
 -foo-
 </stdout>
 <protocol crlf="yes">
-GET /556 HTTP/1.1
+GET /%TESTNUMBER HTTP/1.1
 Host: ninja
 
-GET /556 HTTP/1.1
+GET /%TESTNUMBER HTTP/1.1
 Host: ninja
 
 </protocol>
index 8239d2603480bd5e3063d1989230b3812dc1e7da..78b89975e8ac522047fb0035f714020239576879 100644 (file)
@@ -53,13 +53,15 @@ again:
 
   if(!res) {
     /* we are connected, now get an HTTP document the raw way */
-    static const char *request =
-      "GET /556 HTTP/1.1\r\n"
-      "Host: ninja\r\n\r\n";
+    char request[64];
     const char *sbuf = request;
-    size_t sblen = strlen(request);
+    size_t sblen;
     size_t nwritten = 0, nread = 0;
 
+    sblen = curl_msnprintf(request, sizeof(request),
+                           "GET /%d HTTP/1.1\r\n"
+                           "Host: ninja\r\n\r\n", testnum);
+
     do {
       char buf[1024];