From 4d9338323a74afbea0dac0d9aebdcddaaf8d7a75 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Wed, 10 Aug 2022 19:06:04 -0300 Subject: [PATCH] Add unit test for gzipped index when / is requested --- test/data/dredirgz/index.html.gz | Bin 0 -> 34 bytes test/unit_test.c | 4 ++++ 2 files changed, 4 insertions(+) create mode 100644 test/data/dredirgz/index.html.gz diff --git a/test/data/dredirgz/index.html.gz b/test/data/dredirgz/index.html.gz new file mode 100644 index 0000000000000000000000000000000000000000..8deb24e901a789a3935862333570916c11cb7f7d GIT binary patch literal 34 pcmb2|=HRH2`I5xIoSB!BTA`OwlAFVD`ot3^hN`Okx6BL-3;@Wn3v&Pf literal 0 HcmV?d00001 diff --git a/test/unit_test.c b/test/unit_test.c index b6f66038..f9b07119 100644 --- a/test/unit_test.c +++ b/test/unit_test.c @@ -650,6 +650,10 @@ static void test_http_server(void) { ASSERT(fetch(&mgr, buf, url, "GET /dredir/ HTTP/1.0\n\n") == 200); ASSERT(cmpbody(buf, "hi\n") == 0); + ASSERT(fetch(&mgr, buf, url, "GET /dredirgz/ HTTP/1.0\n\n") == 200); + ASSERT(cmpheader(buf, "Content-Type", "text/html; charset=utf-8")); + ASSERT(cmpheader(buf, "Content-Encoding", "gzip")); + ASSERT(fetch(&mgr, buf, url, "GET /..ddot HTTP/1.0\n\n") == 301); ASSERT(fetch(&mgr, buf, url, "GET /..ddot/ HTTP/1.0\n\n") == 200); ASSERT(cmpbody(buf, "hi\n") == 0);