Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to http request #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion loop.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type Channel struct {

server *Server
ip string
requestHeader http.Header
request *http.Request
}

/**
Expand Down
15 changes: 11 additions & 4 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand Down Expand Up @@ -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{
Expand All @@ -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
Expand All @@ -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)
}

Expand Down