File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 66 "github.com/GuoYuefei/DOStorage1/distributed/interface/heartbeat"
77 "github.com/GuoYuefei/DOStorage1/distributed/interface/locate"
88 "github.com/GuoYuefei/DOStorage1/distributed/interface/objects"
9+ "github.com/GuoYuefei/DOStorage1/distributed/interface/temp"
910 "github.com/GuoYuefei/DOStorage1/distributed/interface/versions"
1011 "github.com/GuoYuefei/DOStorage1/distributed/utils"
1112 "net/http"
@@ -17,6 +18,7 @@ func main() {
1718 configs () // 配置文件
1819 go heartbeat .ListenHeartbeat ()
1920 http .HandleFunc ("/objects/" , objects .Handler )
21+ http .HandleFunc ("/temp/" , temp .Handler )
2022 http .HandleFunc ("/locate/" , locate .Handler )
2123 http .HandleFunc ("/versions/" , versions .Handler )
2224 utils .Log .Println (utils .Info , "interface server will run in " , config .ServerInf .LISTEN_ADDRESS )
Original file line number Diff line number Diff line change @@ -11,6 +11,11 @@ func Handler(w http.ResponseWriter, r *http.Request) {
1111 return
1212 }
1313
14+ if m == http .MethodPut {
15+ post (w , r )
16+ return
17+ }
18+
1419 if m == http .MethodPut {
1520 put (w , r )
1621 return
Original file line number Diff line number Diff line change 11package temp
2+
3+ import "net/http"
4+
5+ func Handler (w http.ResponseWriter , r * http.Request ) {
6+ m := r .Method
7+
8+ if m == http .MethodPut {
9+ put (w , r )
10+ return
11+ }
12+
13+ if m == http .MethodHead {
14+ head (w , r )
15+ return
16+ }
17+
18+ w .WriteHeader (http .StatusMethodNotAllowed )
19+ }
You can’t perform that action at this time.
0 commit comments