From a987655b295385605e0c0acc793fe475fb193917 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 26 May 2020 01:22:28 +0000 Subject: [PATCH] changed a test program slightly --- mio/bin/t01.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mio/bin/t01.c b/mio/bin/t01.c index 4a65a8d..51d4a28 100644 --- a/mio/bin/t01.c +++ b/mio/bin/t01.c @@ -823,7 +823,21 @@ static void on_htts_thr_request (mio_t* mio, mio_dev_thr_iopair_t* iop, mio_svc_ FILE* fp; int i; + if (tfi->req_method != MIO_HTTP_GET) + { + write (iop->wfd, "Status: 405\r\n\r\n", 15); /* method not allowed */ + return; + } + fp = fdopen(iop->wfd, "w"); + if (!fp) + { + write (iop->wfd, "Status: 500\r\n\r\n", 15); /* internal server error */ + return; + } + + fprintf (fp, "Content-Type: text/html\r\n\r\n"); + fprintf (fp, "Status: 201\r\n"); fprintf (fp, "Content-Type: text/html\r\n\r\n");