提交 08ea56ce 作者: Juan Batiz-Benet

Merge pull request #1191 from ipfs/refactor/httpGateway

Refactor/http gateway
...@@ -10,7 +10,6 @@ import ( ...@@ -10,7 +10,6 @@ import (
"strings" "strings"
"time" "time"
mh "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context" "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
core "github.com/ipfs/go-ipfs/core" core "github.com/ipfs/go-ipfs/core"
...@@ -234,9 +233,8 @@ func (i *gatewayHandler) postHandler(w http.ResponseWriter, r *http.Request) { ...@@ -234,9 +233,8 @@ func (i *gatewayHandler) postHandler(w http.ResponseWriter, r *http.Request) {
return return
} }
h := mh.Multihash(k).B58String() w.Header().Set("IPFS-Hash", k.String())
w.Header().Set("IPFS-Hash", h) http.Redirect(w, r, ipfsPathPrefix+k.String(), http.StatusCreated)
http.Redirect(w, r, ipfsPathPrefix+h, http.StatusCreated)
} }
func (i *gatewayHandler) putEmptyDirHandler(w http.ResponseWriter, r *http.Request) { func (i *gatewayHandler) putEmptyDirHandler(w http.ResponseWriter, r *http.Request) {
...@@ -253,7 +251,7 @@ func (i *gatewayHandler) putEmptyDirHandler(w http.ResponseWriter, r *http.Reque ...@@ -253,7 +251,7 @@ func (i *gatewayHandler) putEmptyDirHandler(w http.ResponseWriter, r *http.Reque
} }
func (i *gatewayHandler) putHandler(w http.ResponseWriter, r *http.Request) { func (i *gatewayHandler) putHandler(w http.ResponseWriter, r *http.Request) {
// TODO(cryptix): will be resolved in PR#1191 // TODO(cryptix): either ask mildred about the flow of this or rewrite it
webErrorWithCode(w, "Sorry, PUT is bugged right now, closing request", errors.New("handler disabled"), http.StatusInternalServerError) webErrorWithCode(w, "Sorry, PUT is bugged right now, closing request", errors.New("handler disabled"), http.StatusInternalServerError)
return return
urlPath := r.URL.Path urlPath := r.URL.Path
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论