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

fix(ws client): use query part of URL. #429

Merged
merged 3 commits into from Aug 5, 2021
Merged

fix(ws client): use query part of URL. #429

merged 3 commits into from Aug 5, 2021

Conversation

niklasad1
Copy link
Member

Fixes #428, we didn't take that query part of the URL into account and it wasn't sent in GET request because of that.

Fixes #428, we didn't take that query part of the URL into account and it wasn't sent in GET request.
Comment on lines 299 to 302
if let Some(query) = url.query() {
path.push('?');
path.push_str(query);
}
Copy link
Collaborator

@jsdw jsdw Aug 4, 2021

Choose a reason for hiding this comment

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

This looks sane to me (without a wider context of how the path String that now contains the query part is used elsewhere)! I wonder whether it should be renamed path_and_query for clarity? Is there anywhere that will be surprised to now be getting a query string in here?

I was wondering whether percent-encoded URLs would end up being double percent-encoded when returned (because Url::query percent-encodes) but I did this:

use url::Url;

fn main() {
    let foo = Url::parse("ws://localhost/foo?bar=hello%20world").unwrap();
    println!("{:?}", foo.query());
}

in the rust playground and the output is "bar=hello%20world" as I'd hope for :)

Copy link
Member Author

@niklasad1 niklasad1 Aug 4, 2021

Choose a reason for hiding this comment

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

It's the same as soketto calls http resource but I like path_and_query better even if the query might be empty :P

Copy link
Member Author

@niklasad1 niklasad1 Aug 4, 2021

Choose a reason for hiding this comment

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

Further path_and_query is passed directly to soketto::Client::new(...) called resource there, it's used here

@niklasad1 niklasad1 merged commit 430dcfa into master Aug 5, 2021
@niklasad1 niklasad1 deleted the na-fix-428 branch August 5, 2021 12:46
niklasad1 added a commit that referenced this pull request Sep 17, 2021
* fix(ws client): use query part of URL.

Fixes #428, we didn't take that query part of the URL into account and it wasn't sent in GET request.

* add log when connecting to a target

* fix(grumbles): path -> path_and_query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Client seems to ignore the query parameters of a WSS address
2 participants