Skip to content

Commit

Permalink
draft fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Savely Krasovsky authored Aug 30, 2019
1 parent 878a05a commit 354563d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,11 @@ func (p *Proxy) handle(ctx *Context, conn net.Conn, brw *bufio.ReadWriter) error
return nil
}
res.ContentLength = -1
/*
if err := res.Write(brw); err != nil {
log.Errorf("martian: got error while writing response back to client: %v", err)
}
*/
if err := brw.Flush(); err != nil {
log.Errorf("martian: got error while flushing response back to client: %v", err)
}
Expand Down Expand Up @@ -571,17 +573,19 @@ func (p *Proxy) connect(req *http.Request) (*http.Response, net.Conn, error) {
return nil, nil, err
}
pbw := bufio.NewWriter(conn)
pbr := bufio.NewReader(conn)
//pbr := bufio.NewReader(conn)

req.Write(pbw)
pbw.Flush()

/*
res, err := http.ReadResponse(pbr, req)
if err != nil {
return nil, nil, err
}
*/

return res, conn, nil
return proxyutil.NewResponse(200, nil, req), conn, nil
}

log.Debugf("martian: CONNECT to host directly: %s", req.URL.Host)
Expand Down

0 comments on commit 354563d

Please sign in to comment.