浏览代码

prevent using net.Conn.WriteTo()

Darien Raymond 8 年之前
父节点
当前提交
74327ea8ae
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      proxy/http/server.go

+ 5 - 1
proxy/http/server.go

@@ -86,8 +86,12 @@ func parseBasicAuth(auth string) (username, password string, ok bool) {
 	return cs[:s], cs[s+1:], true
 }
 
+type readerOnly struct {
+	io.Reader
+}
+
 func (s *Server) Process(ctx context.Context, network net.Network, conn internet.Connection, dispatcher dispatcher.Interface) error {
-	reader := bufio.NewReaderSize(conn, buf.Size)
+	reader := bufio.NewReaderSize(readerOnly{conn}, buf.Size)
 
 Start:
 	conn.SetReadDeadline(time.Now().Add(time.Second * 16))