(ctx context.Context, conn net.Conn)
| 73 | } |
| 74 | |
| 75 | func (s *proxyServer) handleConn(ctx context.Context, conn net.Conn) { |
| 76 | defer conn.Close() |
| 77 | |
| 78 | br := bufio.NewReader(conn) |
| 79 | req, err := http.ReadRequest(br) |
| 80 | if err != nil { |
| 81 | return |
| 82 | } |
| 83 | |
| 84 | if req.Method == http.MethodConnect { |
| 85 | s.handleConnect(ctx, conn, req) |
| 86 | } else { |
| 87 | s.handleHTTP(ctx, conn, req) |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | // handleConnect handles HTTPS CONNECT tunneling with MITM. |
| 92 | func (s *proxyServer) handleConnect(ctx context.Context, conn net.Conn, connectReq *http.Request) { |
no test coverage detected