mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Replace "unix" by "http+unix" for PROTOCOL (#17771)
This commit is contained in:
		@@ -39,11 +39,11 @@ type Scheme string
 | 
			
		||||
 | 
			
		||||
// enumerates all the scheme types
 | 
			
		||||
const (
 | 
			
		||||
	HTTP       Scheme = "http"
 | 
			
		||||
	HTTPS      Scheme = "https"
 | 
			
		||||
	FCGI       Scheme = "fcgi"
 | 
			
		||||
	FCGIUnix   Scheme = "fcgi+unix"
 | 
			
		||||
	UnixSocket Scheme = "unix"
 | 
			
		||||
	HTTP     Scheme = "http"
 | 
			
		||||
	HTTPS    Scheme = "https"
 | 
			
		||||
	FCGI     Scheme = "fcgi"
 | 
			
		||||
	FCGIUnix Scheme = "fcgi+unix"
 | 
			
		||||
	HTTPUnix Scheme = "http+unix"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// LandingPage describes the default page
 | 
			
		||||
@@ -607,7 +607,8 @@ func loadFromConf(allowEmpty bool) {
 | 
			
		||||
	HTTPPort = sec.Key("HTTP_PORT").MustString("3000")
 | 
			
		||||
 | 
			
		||||
	Protocol = HTTP
 | 
			
		||||
	switch sec.Key("PROTOCOL").String() {
 | 
			
		||||
	protocolCfg := sec.Key("PROTOCOL").String()
 | 
			
		||||
	switch protocolCfg {
 | 
			
		||||
	case "https":
 | 
			
		||||
		Protocol = HTTPS
 | 
			
		||||
		CertFile = sec.Key("CERT_FILE").String()
 | 
			
		||||
@@ -620,24 +621,22 @@ func loadFromConf(allowEmpty bool) {
 | 
			
		||||
		}
 | 
			
		||||
	case "fcgi":
 | 
			
		||||
		Protocol = FCGI
 | 
			
		||||
	case "fcgi+unix":
 | 
			
		||||
		Protocol = FCGIUnix
 | 
			
		||||
		UnixSocketPermissionRaw := sec.Key("UNIX_SOCKET_PERMISSION").MustString("666")
 | 
			
		||||
		UnixSocketPermissionParsed, err := strconv.ParseUint(UnixSocketPermissionRaw, 8, 32)
 | 
			
		||||
		if err != nil || UnixSocketPermissionParsed > 0777 {
 | 
			
		||||
			log.Fatal("Failed to parse unixSocketPermission: %s", UnixSocketPermissionRaw)
 | 
			
		||||
		}
 | 
			
		||||
		UnixSocketPermission = uint32(UnixSocketPermissionParsed)
 | 
			
		||||
		if !filepath.IsAbs(HTTPAddr) {
 | 
			
		||||
			HTTPAddr = filepath.Join(AppWorkPath, HTTPAddr)
 | 
			
		||||
		}
 | 
			
		||||
	case "unix":
 | 
			
		||||
		Protocol = UnixSocket
 | 
			
		||||
	case "fcgi+unix", "unix", "http+unix":
 | 
			
		||||
		switch protocolCfg {
 | 
			
		||||
		case "fcgi+unix":
 | 
			
		||||
			Protocol = FCGIUnix
 | 
			
		||||
		case "unix":
 | 
			
		||||
			log.Warn("unix PROTOCOL value is deprecated, please use http+unix")
 | 
			
		||||
			fallthrough
 | 
			
		||||
		case "http+unix":
 | 
			
		||||
			Protocol = HTTPUnix
 | 
			
		||||
		}
 | 
			
		||||
		UnixSocketPermissionRaw := sec.Key("UNIX_SOCKET_PERMISSION").MustString("666")
 | 
			
		||||
		UnixSocketPermissionParsed, err := strconv.ParseUint(UnixSocketPermissionRaw, 8, 32)
 | 
			
		||||
		if err != nil || UnixSocketPermissionParsed > 0777 {
 | 
			
		||||
			log.Fatal("Failed to parse unixSocketPermission: %s", UnixSocketPermissionRaw)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		UnixSocketPermission = uint32(UnixSocketPermissionParsed)
 | 
			
		||||
		if !filepath.IsAbs(HTTPAddr) {
 | 
			
		||||
			HTTPAddr = filepath.Join(AppWorkPath, HTTPAddr)
 | 
			
		||||
@@ -692,7 +691,7 @@ func loadFromConf(allowEmpty bool) {
 | 
			
		||||
 | 
			
		||||
	var defaultLocalURL string
 | 
			
		||||
	switch Protocol {
 | 
			
		||||
	case UnixSocket:
 | 
			
		||||
	case HTTPUnix:
 | 
			
		||||
		defaultLocalURL = "http://unix/"
 | 
			
		||||
	case FCGI:
 | 
			
		||||
		defaultLocalURL = AppURL
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user