filer add readonly public port
This commit is contained in:
@@ -57,7 +57,7 @@ type FilerServer struct {
|
||||
masterNodes *storage.MasterNodes
|
||||
}
|
||||
|
||||
func NewFilerServer(defaultMux *http.ServeMux, ip string, port int, master string, dir string, collection string,
|
||||
func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, ip string, port int, master string, dir string, collection string,
|
||||
replication string, redirectOnRead bool, disableDirListing bool,
|
||||
confFile string,
|
||||
maxMB int,
|
||||
@@ -111,6 +111,9 @@ func NewFilerServer(defaultMux *http.ServeMux, ip string, port int, master strin
|
||||
}
|
||||
|
||||
defaultMux.HandleFunc("/", fs.filerHandler)
|
||||
if defaultMux != readonlyMux {
|
||||
readonlyMux.HandleFunc("/", fs.readonlyFilerHandler)
|
||||
}
|
||||
|
||||
go func() {
|
||||
connected := true
|
||||
|
||||
@@ -18,3 +18,12 @@ func (fs *FilerServer) filerHandler(w http.ResponseWriter, r *http.Request) {
|
||||
fs.PostHandler(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
func (fs *FilerServer) readonlyFilerHandler(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.Method {
|
||||
case "GET":
|
||||
fs.GetOrHeadHandler(w, r, true)
|
||||
case "HEAD":
|
||||
fs.GetOrHeadHandler(w, r, false)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user