-
Notifications
You must be signed in to change notification settings - Fork 17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
forward/fwd.go
Outdated
@@ -318,9 +316,13 @@ func (f *websocketForwarder) copyRequest(req *http.Request, u *url.URL) (outReq | |||
outReq.URL.Scheme = "ws" | |||
} | |||
|
|||
requestURI, err := url.ParseRequestURI(outReq.RequestURI) | |||
if err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be merged with the previous line to scope requestURI
to the if block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To follow the best practice of reducing variable scopes to the least minimum. Just like you wouldn't reach out for global variables unless you needed too.
} | ||
defer conn.Close() | ||
c.Assert(r.URL.Query().Get("query"), Equals, "test") | ||
for { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we busy-waiting here consuming lots of CPU possibly?
Is there a risk we never finish the for loop in case of a bug and have to wait until a timeout hits?
I'm lacking web-socket knowledge, so basically just uttering vague concerns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, the ReadMessage block until a message is received or the connection is closed so, it will not consume CPU etc...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. 👍
b17f655
to
9ef894a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
3ab2b48
to
59d6481
Compare
Query params were encoded when call was made to the backend.
Related to traefik/traefik#1930