Skip to content

Commit

Permalink
fix pipe close
Browse files Browse the repository at this point in the history
  • Loading branch information
rui.zheng committed Oct 12, 2016
1 parent 659dce0 commit 6ca1f4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/golang/glog"
"golang.org/x/net/http2"
"io"
"io/ioutil"
//"io/ioutil"
"net"
"net/http"
"net/http/httputil"
Expand Down Expand Up @@ -238,7 +238,7 @@ func (c *ProxyChain) getHttp2Conn(header http.Header) (net.Conn, error) {
Proto: "HTTP/2.0",
ProtoMajor: 2,
ProtoMinor: 0,
Body: ioutil.NopCloser(pr),
Body: pr,
Host: http2Node.Addr,
ContentLength: -1,
}
Expand Down
11 changes: 7 additions & 4 deletions http.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,14 @@ func (c *http2Conn) Write(b []byte) (n int, err error) {
return c.w.Write(b)
}

func (c *http2Conn) Close() error {
if rc, ok := c.r.(io.ReadCloser); ok {
return rc.Close()
func (c *http2Conn) Close() (err error) {
if rc, ok := c.r.(io.Closer); ok {
err = rc.Close()
}
return nil
if w, ok := c.w.(io.Closer); ok {
err = w.Close()
}
return
}

func (c *http2Conn) LocalAddr() net.Addr {
Expand Down

0 comments on commit 6ca1f4a

Please sign in to comment.