Skip to content

Commit

Permalink
Remove custom response writer
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo committed Jul 20, 2023
1 parent 1cf9771 commit 59721e3
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 214 deletions.
14 changes: 0 additions & 14 deletions p2p/http/libp2phttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,6 @@ func (h *HTTPHost) SetHttpHandlerAtPath(p protocol.ID, path string, handler http
h.rootHandler.Handle(path, handler)
}

// TODO do we need this? Kind of complicated. We could the same with http.Serve and a custom libp2p listener.
// SetCustomHTTPHandler sets a custom HTTP handler for all HTTP over libp2p
// streams. It is up to the user to make sure the well-known mapping is set up
// correctly (NewWellKnownHandler could be helpful). This is useful if you're
// bringing in an existing HTTP ServeMux (or similar) to be used on top of
// libp2p streams.
// Use host.RemoveStreamHandler(libp2phttp.ProtocolIDForMultistreamSelect) to remove this handler.
func SetCustomHTTPHandler(streamHost host.Host, handler http.Handler) {
streamHost.SetStreamHandler(ProtocolIDForMultistreamSelect, func(s network.Stream) {
defer s.Close()
ServeReadWriter(s, handler)
})
}

type roundTripperOpts struct {
// todo SkipClientAuth bool
preferHTTPTransport bool
Expand Down
138 changes: 0 additions & 138 deletions p2p/http/responsewriter.go

This file was deleted.

62 changes: 0 additions & 62 deletions p2p/http/responsewriter_test.go

This file was deleted.

0 comments on commit 59721e3

Please sign in to comment.