From b089b35f35a14e85d89df69254cc61495d59d3dd Mon Sep 17 00:00:00 2001 From: Mikhail Osipov Date: Tue, 5 May 2020 20:10:08 +0300 Subject: add http connect proxy server --- pkg/server/hook/look-http.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'pkg/server/hook/look-http.go') diff --git a/pkg/server/hook/look-http.go b/pkg/server/hook/look-http.go index d467563..50ec663 100644 --- a/pkg/server/hook/look-http.go +++ b/pkg/server/hook/look-http.go @@ -2,7 +2,7 @@ package hook import ( "bufio" - "strings" + "tunnel/pkg/http" "tunnel/pkg/server/env" "tunnel/pkg/server/opts" "tunnel/pkg/server/queue" @@ -28,11 +28,8 @@ func (look *lookHttp) Send(rq, wq queue.Q) error { }() if s.Scan() { - if w := strings.Split(s.Text(), " "); len(w) > 1 { - switch m := strings.ToUpper(w[0]); m { - case "CONNECT", "GET", "POST": - look.env.Set("look.info", m+" "+w[1]) - } + if method, uri, _, ok := http.ParseRequestLine(s.Text()); ok { + look.env.Set("look.info", method+" "+uri) } } -- cgit v1.2.3-70-g09d2