80/443端口的源站自动修正HTTP和HTTPS协议,防止有些小白用户不知道HTTP和HTTPS的区别

This commit is contained in:
刘祥超
2023-06-16 08:47:47 +08:00
parent 574b264a37
commit cd545b25c9

View File

@@ -27,6 +27,14 @@ type NetworkAddressConfig struct {
func (this *NetworkAddressConfig) Init() error { func (this *NetworkAddressConfig) Init() error {
this.hostHasVariables = configutils.HasVariables(this.Host) this.hostHasVariables = configutils.HasVariables(this.Host)
// 特殊端口自动修复防止有些小白用户不了解HTTP和HTTPS的区别而选择了错误的协议
if this.PortRange == "80" && this.Protocol == ProtocolHTTPS {
this.Protocol = ProtocolHTTP
}
if this.PortRange == "443" && this.Protocol == ProtocolHTTP {
this.Protocol = ProtocolHTTPS
}
// 8080 // 8080
if regexpSinglePort.MatchString(this.PortRange) { if regexpSinglePort.MatchString(this.PortRange) {
this.MinPort = types.Int(this.PortRange) this.MinPort = types.Int(this.PortRange)