Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

fix problem with query params #22

Merged
merged 2 commits into from
Aug 17, 2017

Conversation

juliens
Copy link
Member

@juliens juliens commented Aug 7, 2017

Query params were encoded when call was made to the backend.

Related to traefik/traefik#1930

@juliens juliens added the bug label Aug 7, 2017
Copy link

@ldez ldez left a 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 {

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the point?

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 {

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.

Copy link
Member Author

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...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. 👍

Copy link
Member

@nmengin nmengin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants