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

[RabbitMQ] add a protocol if there isn't one #909

Merged
merged 3 commits into from
Nov 28, 2017
Merged

Conversation

gmmeyer
Copy link
Contributor

@gmmeyer gmmeyer commented Nov 27, 2017

What does this PR do?

Right now if a protocol isn't specified, a bunch of rabbit requests will fail. This is not great. They shouldn't fail. To be specific, if a url has no protocol, urlparse.urljoin will behave in an anomalous manner. This PR will address part of the issue that we saw in #838.

For example:

urlparse.urljoin('gmmeyer.com','test') # => test

So, we have to assign it a protocol. We'll assume http.

Motivation

This is an old bug that has tripped up a bunch of people.

Versioning

  • Bumped the version check in manifest.json
  • Updated CHANGELOG.md. Please use Unreleased as the date in the title
    for the new section.

Additional Notes

There are other ways people can mess up urls. If someone puts in a url like: '//gmmeyer.com' or '://gmmeyer.com' or something, it should fail. We cannot attempt to fix every permutation of how people can get their urls wrong. This just assumes that if a url is bare, it's meant to have an http protocol--which is what requests does anyway

Copy link
Contributor

@masci masci left a comment

Choose a reason for hiding this comment

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

One question about this strategy

# urlparse.urljoin cannot add a protocol to the rest of the url for some reason.
# This still leaves the potential for errors, but such urls would never have been valid, either
# and it's not likely to be useful to attempt to catch all possible mistakes people could make
base_url = 'http://' + base_url
Copy link
Contributor

Choose a reason for hiding this comment

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

How does this play with kubernetes/autoconfig? See #838

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually http://rabbitmq-management.default:443 would work, so we're good.

@masci masci added this to the triage milestone Nov 28, 2017
masci
masci previously approved these changes Nov 28, 2017
Copy link
Contributor

@masci masci left a comment

Choose a reason for hiding this comment

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

LGTM!

@gmmeyer gmmeyer merged commit 3c5adf4 into master Nov 28, 2017
@gmmeyer gmmeyer deleted the greg/rabbit-http branch November 28, 2017 18:41
@truthbk truthbk modified the milestones: triage, 5.21 Dec 26, 2017
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.

3 participants