Browse Source

- -

pull/455/head
丁超 9 years ago
parent
commit
0e06e33f0a
  1. 4
      weed/server/filer_server_handlers_read.go
  2. 4
      weed/server/volume_server_handlers_read.go

4
weed/server/filer_server_handlers_read.go

@ -91,6 +91,10 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque
} }
func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request, isGetMethod bool) { func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request, isGetMethod bool) {
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "GET")
w.Header().Set("Access-Control-Max-Age", "1000")
if strings.HasSuffix(r.URL.Path, "/") { if strings.HasSuffix(r.URL.Path, "/") {
if fs.disableDirListing { if fs.disableDirListing {
w.WriteHeader(http.StatusMethodNotAllowed) w.WriteHeader(http.StatusMethodNotAllowed)

4
weed/server/volume_server_handlers_read.go

@ -33,6 +33,10 @@ type JsonEncode struct {
} }
func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) { func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "GET")
w.Header().Set("Access-Control-Max-Age", "1000")
n := new(storage.Needle) n := new(storage.Needle)
vid, fid, filename, ext, _ := parseURLPath(r.URL.Path) vid, fid, filename, ext, _ := parseURLPath(r.URL.Path)
volumeId, err := storage.NewVolumeId(vid) volumeId, err := storage.NewVolumeId(vid)

Loading…
Cancel
Save