Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
436462c8
Commit
436462c8
authored
10 years ago
by
Matt Bell
Committed by
Juan Batiz-Benet
10 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server/http: Fixed build error
parent
063cb536
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
server/http/http.go
server/http/http.go
+6
-8
No files found.
server/http/http.go
View file @
436462c8
...
...
@@ -5,7 +5,6 @@ import (
"fmt"
"io"
"net/http"
"strings"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/gorilla/mux"
ma
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
...
...
@@ -15,18 +14,17 @@ import (
core
"github.com/jbenet/go-ipfs/core"
)
type
objectH
andler
struct
{
type
h
andler
struct
{
ipfs
}
// Serve starts the http server
func
Serve
(
address
ma
.
Multiaddr
,
node
*
core
.
IpfsNode
)
error
{
r
:=
mux
.
NewRouter
()
objectHandler
:=
&
objectHandler
{
&
ipfsHandler
{
node
}}
apiHandler
:=
&
apiHandler
{}
handler
:=
&
handler
{
&
ipfsHandler
{
node
}}
r
.
HandleFunc
(
"/ipfs/"
,
objectH
andler
.
postHandler
)
.
Methods
(
"POST"
)
r
.
PathPrefix
(
"/ipfs/"
)
.
Handler
(
objectH
andler
)
.
Methods
(
"GET"
)
r
.
HandleFunc
(
"/ipfs/"
,
h
andler
.
postHandler
)
.
Methods
(
"POST"
)
r
.
PathPrefix
(
"/ipfs/"
)
.
Handler
(
h
andler
)
.
Methods
(
"GET"
)
http
.
Handle
(
"/"
,
r
)
...
...
@@ -38,7 +36,7 @@ func Serve(address ma.Multiaddr, node *core.IpfsNode) error {
return
http
.
ListenAndServe
(
host
,
nil
)
}
func
(
i
*
objectH
andler
)
ServeHTTP
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
func
(
i
*
h
andler
)
ServeHTTP
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
path
:=
r
.
URL
.
Path
[
5
:
]
nd
,
err
:=
i
.
ResolvePath
(
path
)
...
...
@@ -59,7 +57,7 @@ func (i *objectHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
io
.
Copy
(
w
,
dr
)
}
func
(
i
*
objectH
andler
)
postHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
func
(
i
*
h
andler
)
postHandler
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
nd
,
err
:=
i
.
NewDagFromReader
(
r
.
Body
)
if
err
!=
nil
{
w
.
WriteHeader
(
http
.
StatusInternalServerError
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment