Commit 266f7f5f authored by Adam Blank's avatar Adam Blank
Browse files

Update test_server.c

parent 03e434fa
No related merge requests found
Showing with 27 additions and 0 deletions
+27 -0
......@@ -5,6 +5,32 @@
#include "network_util.h"
#include "server_test_util.h"
void test_long(const char *bin, int port) {
server_handle_t *h = server_spawn(bin, port);
const char REQUEST[] =
"GET /hello HTTP/1.1\r\n"
"Host: labradoodle.caltech.edu:10918\r\n"
"Cookie: _ga_R0G8HH0FKW=GS1.1.1744078038.1.1.1744079446.0.0.0; _ga_RHR25JXBQM=GS1.1.1744313683.1.1.1744313703.0.0.0; _ga_ZJLTP8D04M=GS1.1.1744313707.1.1.1744314889.0.0.0; _ga_S191CG4HJS=GS1.1.1744841044.1.1.1744841056.0.0.0; _ga_37STWSV9MD=GS1.1.1745034333.2.1.1745034372.0.0.0; _ga_68E24C55CC=GS1.1.1745034384.1.1.1745034463.0.0.0; _ga_ZNBMB6GSNZ=GS1.1.1745622505.1.1.1745622556.0.0.0; _ga_STJ2DN480K=GS1.1.1745622505.1.1.1745622556.0.0.0; _ga_G31WQ82140=GS1.1.1745622563.5.1.1745622636.0.0.0; _ga_9RFYMGV2SS=GS1.1.1745960593.7.0.1745960593.0.0.0; _ga_VJ863GWZ4Z=GS1.1.1746049539.5.1.1746049620.0.0.0; _ga_KDHV30NC26=GS1.1.1746106545.6.1.1746106934.0.0.0; _ga_7RL83EX4D4=GS1.1.1746128897.4.1.1746128899.0.0.0; _ga_EC025HJDTY=GS1.1.1746132827.2.1.1746132828.0.0.0; _ga_ZGEFJLNF3Q=GS1.1.1746150773.1.1.1746150789.0.0.0; _ga_ZH0LRM35DB=GS1.1.1746204046.1.0.1746204056.0.0.0; _ga=GA1.2.1646971239.1743629810; _ga_B6X5N53CTL=GS2.1.s1746220225$o4$g1$t1746220367$j0$l0$h0; _ga_YP15TXTX15=GS1.1.1746220226.4.1.1746220367.0.0.0\r\n"
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7\r\n"
"Accept-Language: en-US,en;q=0.9,nl;q=0.8\r\n"
"Connection: keep-alive\r\n"
"DNT: 1\r\n"
"Upgrade-Insecure-Requests: 1\r\n"
"User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36\r\n\r\n";
const char EXPECTED[] =
"HTTP/1.1 200 OK\r\n"
"Content-Type: text/html\r\n"
"Content-Length: 12\r\n"
"\r\n"
"Hello world!";
char *response = server_query(h, REQUEST);
char *r = response;
char *e = EXPECTED;
assert_streq(response, (char *) EXPECTED);
free(response);
server_kill(h);
}
void test_hello(const char *bin, int port) {
server_handle_t *h = server_spawn(bin, port);
const char REQUEST[] = "GET /hello HTTP/1.1\r\n\r\n";
......@@ -53,5 +79,6 @@ int main(int argc, char *argv[]) {
DO_TEST(test_hello, bin, port)
DO_TEST(test_multiple, bin, port)
DO_TEST(test_long, bin, port)
puts("test_server PASS");
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment