Commit 6ca1f4a9 authored by rui.zheng's avatar rui.zheng

fix pipe close

parent 659dce0e
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
"golang.org/x/net/http2" "golang.org/x/net/http2"
"io" "io"
"io/ioutil" //"io/ioutil"
"net" "net"
"net/http" "net/http"
"net/http/httputil" "net/http/httputil"
...@@ -238,7 +238,7 @@ func (c *ProxyChain) getHttp2Conn(header http.Header) (net.Conn, error) { ...@@ -238,7 +238,7 @@ func (c *ProxyChain) getHttp2Conn(header http.Header) (net.Conn, error) {
Proto: "HTTP/2.0", Proto: "HTTP/2.0",
ProtoMajor: 2, ProtoMajor: 2,
ProtoMinor: 0, ProtoMinor: 0,
Body: ioutil.NopCloser(pr), Body: pr,
Host: http2Node.Addr, Host: http2Node.Addr,
ContentLength: -1, ContentLength: -1,
} }
......
...@@ -311,11 +311,14 @@ func (c *http2Conn) Write(b []byte) (n int, err error) { ...@@ -311,11 +311,14 @@ func (c *http2Conn) Write(b []byte) (n int, err error) {
return c.w.Write(b) return c.w.Write(b)
} }
func (c *http2Conn) Close() error { func (c *http2Conn) Close() (err error) {
if rc, ok := c.r.(io.ReadCloser); ok { if rc, ok := c.r.(io.Closer); ok {
return rc.Close() err = rc.Close()
} }
return nil if w, ok := c.w.(io.Closer); ok {
err = w.Close()
}
return
} }
func (c *http2Conn) LocalAddr() net.Addr { func (c *http2Conn) LocalAddr() net.Addr {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment