From fba18ec5f654ed9443ab7f7ad23909ef4cd0ef54 Mon Sep 17 00:00:00 2001 From: Alexandr Mayorskiy Date: Wed, 14 Mar 2018 13:37:42 +0300 Subject: [PATCH] Change to http request --- loop.go | 2 +- server.go | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/loop.go b/loop.go index 5e73c5b..ff818df 100644 --- a/loop.go +++ b/loop.go @@ -50,7 +50,7 @@ type Channel struct { server *Server ip string - requestHeader http.Header + request *http.Request } /** diff --git a/server.go b/server.go index 7583633..3bb4cae 100644 --- a/server.go +++ b/server.go @@ -65,7 +65,14 @@ func (c *Channel) Ip() string { Get request header of this connection */ func (c *Channel) RequestHeader() http.Header { - return c.requestHeader + return c.request.Header +} + +/** +Get request +*/ +func (c *Channel) Request() *http.Request { + return c.request } /** @@ -304,7 +311,7 @@ func (s *Server) SendOpenSequence(c *Channel) { Setup event loop for given connection */ func (s *Server) SetupEventLoop(conn transport.Connection, remoteAddr string, - requestHeader http.Header) { + r *http.Request) { interval, timeout := conn.PingParams() hdr := Header{ @@ -317,7 +324,7 @@ func (s *Server) SetupEventLoop(conn transport.Connection, remoteAddr string, c := &Channel{} c.conn = conn c.ip = remoteAddr - c.requestHeader = requestHeader + c.request = r c.initChannel() c.server = s @@ -340,7 +347,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { return } - s.SetupEventLoop(conn, r.RemoteAddr, r.Header) + s.SetupEventLoop(conn, r.RemoteAddr, r) s.tr.Serve(w, r) }