|
|
|
@ -121,45 +121,47 @@ func (this *DavController) HandleRoutes(writer http.ResponseWriter, request *htt |
|
|
|
//完成系统安装
|
|
|
|
func (this *DavController) Index(writer http.ResponseWriter, request *http.Request, subPath string) { |
|
|
|
|
|
|
|
this.logger.Info("--------- URI: %s SUB_PATH: %s ---------", request.RequestURI, subPath) |
|
|
|
/*打印所有HEADER以及请求参数*/ |
|
|
|
|
|
|
|
//获取请求者
|
|
|
|
user := this.CheckCurrentUser(writer, request) |
|
|
|
|
|
|
|
method := request.Method |
|
|
|
if method == "PROPFIND" { |
|
|
|
fmt.Printf("\n------ 请求: %s -- %s ------\n", request.URL, subPath) |
|
|
|
|
|
|
|
this.davService.HandlePropfind(writer, request, user, subPath) |
|
|
|
fmt.Printf("\n------Method:------\n") |
|
|
|
fmt.Println(request.Method) |
|
|
|
|
|
|
|
} else { |
|
|
|
fmt.Printf("\n------Header:------\n") |
|
|
|
for key, value := range request.Header { |
|
|
|
fmt.Printf("%s = %s\n", key, value) |
|
|
|
} |
|
|
|
|
|
|
|
/*打印所有HEADER以及请求参数*/ |
|
|
|
fmt.Printf("\n------请求参数:------\n") |
|
|
|
for key, value := range request.Form { |
|
|
|
fmt.Printf("%s = %s\n", key, value) |
|
|
|
} |
|
|
|
|
|
|
|
fmt.Printf("\n------ 请求: %s ------\n", request.URL) |
|
|
|
fmt.Printf("\n------Body:------\n") |
|
|
|
body, err := ioutil.ReadAll(request.Body) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("读取body时出错" + err.Error()) |
|
|
|
} |
|
|
|
fmt.Println(string(body)) |
|
|
|
|
|
|
|
fmt.Printf("\n------Method:------\n") |
|
|
|
fmt.Println(request.Method) |
|
|
|
fmt.Println("------------------") |
|
|
|
|
|
|
|
fmt.Printf("\n------Header:------\n") |
|
|
|
for key, value := range request.Header { |
|
|
|
fmt.Printf("%s = %s\n", key, value) |
|
|
|
} |
|
|
|
//获取请求者
|
|
|
|
user := this.CheckCurrentUser(writer, request) |
|
|
|
|
|
|
|
fmt.Printf("\n------请求参数:------\n") |
|
|
|
for key, value := range request.Form { |
|
|
|
fmt.Printf("%s = %s\n", key, value) |
|
|
|
} |
|
|
|
method := request.Method |
|
|
|
if method == "PROPFIND" { |
|
|
|
//列出文件夹或者目录详情
|
|
|
|
this.davService.HandlePropfind(writer, request, user, subPath) |
|
|
|
|
|
|
|
fmt.Printf("\n------Body:------\n") |
|
|
|
body, err := ioutil.ReadAll(request.Body) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("读取body时出错" + err.Error()) |
|
|
|
} |
|
|
|
fmt.Println(string(body)) |
|
|
|
} else if method == "GET" { |
|
|
|
//请求文件详情(下载)
|
|
|
|
this.davService.HandleGet(writer, request, user, subPath) |
|
|
|
|
|
|
|
fmt.Println("------------------") |
|
|
|
} else { |
|
|
|
|
|
|
|
this.PanicBadRequest("该方法还不支持。") |
|
|
|
this.PanicBadRequest("该方法还不支持。%s", method) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|