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 }