瀏覽代碼

Fix segfault in webui when there is no authorization wrapper (#197)

When wrap is nil but isLocal is false, we segfault when we attempt to wrap mux handlers.
Ori Livneh 7 年之前
父節點
當前提交
9277d67572
共有 1 個檔案被更改,包括 7 行新增3 行删除
  1. 7
    3
      internal/driver/webui.go

+ 7
- 3
internal/driver/webui.go 查看文件

73
 
73
 
74
 	// authorization wrapper
74
 	// authorization wrapper
75
 	wrap := o.HTTPWrapper
75
 	wrap := o.HTTPWrapper
76
-	if wrap == nil && isLocal {
77
-		// Only allow requests from local host.
78
-		wrap = checkLocalHost
76
+	if wrap == nil {
77
+		if isLocal {
78
+			// Only allow requests from local host.
79
+			wrap = checkLocalHost
80
+		} else {
81
+			wrap = func(h http.Handler) http.Handler { return h }
82
+		}
79
 	}
83
 	}
80
 
84
 
81
 	mux := http.NewServeMux()
85
 	mux := http.NewServeMux()