apps/s_server: Correct s_server to return the correct file path
authorTianjia Zhang <tianjia.zhang@linux.alibaba.com>
Wed, 8 Dec 2021 07:53:49 +0000 (15:53 +0800)
committerTomas Mraz <tomas@openssl.org>
Fri, 10 Dec 2021 07:52:30 +0000 (08:52 +0100)
When s_server responds to a file data with the -WWW parameter, it
always gets a path named "GET". In this case, we need to skip the
"GET /" character to get the correct file path.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17231)

apps/s_server.c

index 6b0e013ca78af0d6bb3cc687edc0e8a30f1a1c93..e0a52287eec3a3ea6c0e8a1f3aa4027d542e0859 100644 (file)
@@ -3220,7 +3220,7 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
             }
             BIO_puts(io, "</pre></BODY></HTML>\r\n\r\n");
             break;
-        } else if ((www == 2 || www == 3) && HAS_PREFIX(p, "GET /")) {
+        } else if ((www == 2 || www == 3) && CHECK_AND_SKIP_PREFIX(p, "GET /")) {
             BIO *file;
             char *e;
             static const char *text =