mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-08-24 01:24:16 -05:00
NAS: Reply HTML page to conntest
This commit is contained in:
24
nas/conntest.go
Normal file
24
nas/conntest.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package nas
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func handleConnectionTest(w http.ResponseWriter) {
|
||||
response := "\n"
|
||||
response += ` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">` + "\n"
|
||||
response += ` <html>` + "\n"
|
||||
response += ` <head>` + "\n"
|
||||
response += ` <title>HTML Page</title>` + "\n"
|
||||
response += ` </head>` + "\n"
|
||||
response += ` <body bgcolor="#FFFFFF">` + "\n"
|
||||
response += ` This is test.html page` + "\n"
|
||||
response += ` </body>` + "\n"
|
||||
response += ` </html>` + "\n"
|
||||
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
w.Header().Set("Content-Length", strconv.Itoa(len(response)))
|
||||
w.WriteHeader(200)
|
||||
w.Write([]byte(response))
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user