Browse code

client: fix hijackedconn reading from buffer

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>

Tonis Tiigi authored on 2018/03/22 07:29:44
Showing 1 changed files
... ...
@@ -192,7 +192,7 @@ func (cli *Client) setupHijackConn(req *http.Request, proto string) (net.Conn, e
192 192
 		// object that implements CloseWrite iff the underlying connection
193 193
 		// implements it.
194 194
 		if _, ok := c.(types.CloseWriter); ok {
195
-			c = &hijackedConnCloseWriter{c, br}
195
+			c = &hijackedConnCloseWriter{&hijackedConn{c, br}}
196 196
 		} else {
197 197
 			c = &hijackedConn{c, br}
198 198
 		}
... ...
@@ -220,7 +220,9 @@ func (c *hijackedConn) Read(b []byte) (int, error) {
220 220
 // CloseWrite().  It is returned by setupHijackConn in the case that a) there
221 221
 // was already buffered data in the http layer when Hijack() was called, and b)
222 222
 // the underlying net.Conn *does* implement CloseWrite().
223
-type hijackedConnCloseWriter hijackedConn
223
+type hijackedConnCloseWriter struct {
224
+	*hijackedConn
225
+}
224 226
 
225 227
 var _ types.CloseWriter = &hijackedConnCloseWriter{}
226 228