mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-09 20:10:27 +08:00
优化内置的消息提示:增加连接信息方便诊断
This commit is contained in:
@@ -9,16 +9,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const httpStatusPageTemplate = `<!DOCTYPE html>
|
const httpStatusPageTemplate = `<!DOCTYPE html>
|
||||||
<html>
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>${status} ${statusMessage}</title>
|
<title>${status} ${statusMessage}</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
|
<style>
|
||||||
|
address { line-height: 1.8; }
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<h1>${status} ${statusMessage}</h1>
|
<h1>${status} ${statusMessage}</h1>
|
||||||
<p>${message}</p>
|
<p>${message}</p>
|
||||||
|
|
||||||
|
<address>Connection: ${remoteAddr} (Client) -> ${serverAddr} (Server)</address>
|
||||||
<address>Request ID: ${requestId}.</address>
|
<address>Request ID: ${requestId}.</address>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
@@ -39,8 +43,6 @@ func (this *HTTPRequest) writeCode(statusCode int, enMessage string, zhMessage s
|
|||||||
return types.String(statusCode)
|
return types.String(statusCode)
|
||||||
case "statusMessage":
|
case "statusMessage":
|
||||||
return http.StatusText(statusCode)
|
return http.StatusText(statusCode)
|
||||||
case "requestId":
|
|
||||||
return this.requestId
|
|
||||||
case "message":
|
case "message":
|
||||||
var acceptLanguages = this.RawReq.Header.Get("Accept-Language")
|
var acceptLanguages = this.RawReq.Header.Get("Accept-Language")
|
||||||
if len(acceptLanguages) > 0 {
|
if len(acceptLanguages) > 0 {
|
||||||
@@ -54,7 +56,7 @@ func (this *HTTPRequest) writeCode(statusCode int, enMessage string, zhMessage s
|
|||||||
}
|
}
|
||||||
return enMessage
|
return enMessage
|
||||||
}
|
}
|
||||||
return "${" + varName + "}"
|
return this.Format("${" + varName + "}")
|
||||||
})
|
})
|
||||||
|
|
||||||
this.ProcessResponseHeaders(this.writer.Header(), statusCode)
|
this.ProcessResponseHeaders(this.writer.Header(), statusCode)
|
||||||
@@ -107,7 +109,7 @@ func (this *HTTPRequest) write50x(err error, statusCode int, enMessage string, z
|
|||||||
}
|
}
|
||||||
return "The site is unavailable now, cause: " + enMessage + "."
|
return "The site is unavailable now, cause: " + enMessage + "."
|
||||||
}
|
}
|
||||||
return "${" + varName + "}"
|
return this.Format("${" + varName + "}")
|
||||||
})
|
})
|
||||||
|
|
||||||
this.ProcessResponseHeaders(this.writer.Header(), statusCode)
|
this.ProcessResponseHeaders(this.writer.Header(), statusCode)
|
||||||
|
|||||||
Reference in New Issue
Block a user