From e130fdc60f3affdac3f366d784fc35ffea7c5322 Mon Sep 17 00:00:00 2001 From: mkwcat Date: Tue, 19 Dec 2023 00:18:45 -0500 Subject: [PATCH] NAS: Reply HTML page to conntest --- nas/conntest.go | 24 ++++++++++++++++++++++++ nas/main.go | 5 ++--- 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 nas/conntest.go diff --git a/nas/conntest.go b/nas/conntest.go new file mode 100644 index 0000000..91b5628 --- /dev/null +++ b/nas/conntest.go @@ -0,0 +1,24 @@ +package nas + +import ( + "net/http" + "strconv" +) + +func handleConnectionTest(w http.ResponseWriter) { + response := "\n" + response += ` ` + "\n" + response += ` ` + "\n" + response += ` ` + "\n" + response += ` HTML Page` + "\n" + response += ` ` + "\n" + response += ` ` + "\n" + response += ` This is test.html page` + "\n" + response += ` ` + "\n" + response += ` ` + "\n" + + w.Header().Set("Content-Type", "text/html") + w.Header().Set("Content-Length", strconv.Itoa(len(response))) + w.WriteHeader(200) + w.Write([]byte(response)) +} diff --git a/nas/main.go b/nas/main.go index f93fd6c..7439d3b 100644 --- a/nas/main.go +++ b/nas/main.go @@ -87,10 +87,9 @@ func handleRequest(w http.ResponseWriter, r *http.Request) { return } - // Reply 200 to conntest + // Handle conntest server if strings.HasPrefix(r.Host, "conntest.") { - // Respond with a 200 status code - replyHTTPError(w, 200, "ok") + handleConnectionTest(w) return }