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

Improve path handling in pushgateway client #220

Merged
merged 5 commits into from
Jun 9, 2021

Conversation

Sinjo
Copy link
Member

@Sinjo Sinjo commented Mar 27, 2021

This implements some of the changes from #186. This is an intermediate PR to avoid building up too many unmerged commits.

@Sinjo Sinjo added this to the v3.0.0 milestone Mar 27, 2021
@Sinjo Sinjo force-pushed the sinjo-improve-path-handling branch from 4bc8b43 to 100b55e Compare March 27, 2021 00:50
@Sinjo Sinjo self-assigned this Mar 27, 2021
@coveralls
Copy link

coveralls commented Mar 27, 2021

Coverage Status

Coverage remained the same at 100.0% when pulling ec5c5aa on sinjo-improve-path-handling into 9c79b94 on master.

Sinjo added 4 commits June 6, 2021 13:50
Signed-off-by: Chris Sinjakli <chris@sinjakli.co.uk>
Signed-off-by: Chris Sinjakli <chris@sinjakli.co.uk>
Signed-off-by: Chris Sinjakli <chris@sinjakli.co.uk>
Signed-off-by: Chris Sinjakli <chris@sinjakli.co.uk>
@Sinjo Sinjo force-pushed the sinjo-improve-path-handling branch from 8137703 to dfa5f90 Compare June 6, 2021 16:57
@Sinjo Sinjo mentioned this pull request Jun 8, 2021
19 tasks
When `URI.escape` was deprecated, we switched to using `CGI.escape` to
construct the request path in push.rb.

The problem with that is that it mishandles spaces, encoding them as `+`
rather than `%20`. This leads to literal `+` characters in metric
labels, which is a bug.

This commit uses `ERB::Util.url_encode` instead, which gives us the
behaviour we want.

It's not the part of the standard library I expected to use for this,
but it's the only one that seems to have the behaviour we want and that
hasn't disappeared in Ruby 3.0. `WEBrick::HTTPUtils.escape` seems
similar on the surface, but doesn't encode `&`. Presumably it's intended
as a best-effort way to encode an entire URL, and has to assume that any
`&` character is a separator between query params.

Signed-off-by: Chris Sinjakli <chris@sinjakli.co.uk>
@Sinjo Sinjo force-pushed the sinjo-improve-path-handling branch from 7b86c47 to ec5c5aa Compare June 9, 2021 17:34
Copy link
Collaborator

@dmagliola dmagliola left a comment

Choose a reason for hiding this comment

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

❤️

@Sinjo Sinjo marked this pull request as ready for review June 9, 2021 22:57
@Sinjo
Copy link
Member Author

Sinjo commented Jun 9, 2021

Merging this since you've already reviewed, and it's nice not to have any more commits build up on this branch! Will spin up another branch to finish the work for #186.

@Sinjo Sinjo merged commit 45571a9 into master Jun 9, 2021
@Sinjo Sinjo deleted the sinjo-improve-path-handling branch June 9, 2021 22:58
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.

None yet

3 participants