mirror of
https://github.com/fatedier/frp.git
synced 2026-03-20 16:59:18 +08:00
ci: add subdomain test case
This commit is contained in:
@@ -3,6 +3,7 @@ package tests
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -12,6 +13,18 @@ func StartHttpServer() {
|
||||
}
|
||||
|
||||
func request(w http.ResponseWriter, r *http.Request) {
|
||||
match, err := regexp.Match(`.*\.sub\.com`, []byte(r.Host))
|
||||
if err != nil {
|
||||
w.WriteHeader(500)
|
||||
return
|
||||
}
|
||||
|
||||
if match {
|
||||
w.WriteHeader(200)
|
||||
w.Write([]byte(r.Host))
|
||||
return
|
||||
}
|
||||
|
||||
if strings.Contains(r.Host, "127.0.0.1") || strings.Contains(r.Host, "test2.frp.com") ||
|
||||
strings.Contains(r.Host, "test5.frp.com") {
|
||||
w.WriteHeader(200)
|
||||
|
||||
Reference in New Issue
Block a user