Skip to content

[DRAFT] Add vhost support #70

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion rabbitmq_amqp_python_client/qpid/proton/_reactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import os
import queue
import re
import urllib
from typing import (
TYPE_CHECKING,
Any,
Expand Down Expand Up @@ -1098,8 +1099,12 @@ def __init__(self, connection: Connection) -> None:
def _connect(self, connection: Connection, url: Url) -> None:
connection.url = url
# if virtual-host not set, use host from address as default
if self.virtual_host is None:
if url.path is not None:
rabbitmq_vhost = urllib.parse.quote(url.path.replace("+", "%2B"))
connection.hostname = "vhost:{}".format(rabbitmq_vhost)
else:
connection.hostname = url.host

_logger.info("Connecting to %r..." % url)

transport = Transport()
Expand Down