diff --git a/daemon.py b/daemon.py index 172fbba7d..770225a99 100644 --- a/daemon.py +++ b/daemon.py @@ -3379,7 +3379,8 @@ class PubServer(BaseHTTPRequestHandler): curr_http_prefix = http_prefix curr_proxy_type = proxy_type if onion_domain: - if following_domain.endswith('.onion'): + if not curr_domain.endswith('.onion') and \ + following_domain.endswith('.onion'): curr_session = self.server.session_onion curr_domain = onion_domain curr_port = 80 @@ -3387,7 +3388,8 @@ class PubServer(BaseHTTPRequestHandler): curr_http_prefix = 'http' curr_proxy_type = 'tor' if i2p_domain: - if following_domain.endswith('.i2p'): + if not curr_domain.endswith('.i2p') and \ + following_domain.endswith('.i2p'): curr_session = self.server.session_i2p curr_domain = i2p_domain curr_port = 80 diff --git a/inbox.py b/inbox.py index 3b06f8fce..94e0791d1 100644 --- a/inbox.py +++ b/inbox.py @@ -4045,7 +4045,9 @@ def _receive_follow_request(session, session_onion, session_i2p, curr_http_prefix = http_prefix curr_domain = domain curr_port = from_port - if onion_domain and domain_to_follow.endswith('.onion'): + if onion_domain and \ + not curr_domain.endswith('.onion') and \ + domain_to_follow.endswith('.onion'): curr_session = session_onion curr_http_prefix = 'http' curr_domain = onion_domain @@ -4053,7 +4055,9 @@ def _receive_follow_request(session, session_onion, session_i2p, port = 80 if debug: print('Domain switched from ' + domain + ' to ' + curr_domain) - elif i2p_domain and domain_to_follow.endswith('.i2p'): + elif (i2p_domain and + not curr_domain.endswith('.i2p') and + domain_to_follow.endswith('.i2p')): curr_session = session_i2p curr_http_prefix = 'http' curr_domain = i2p_domain diff --git a/manualapprove.py b/manualapprove.py index d5cc16801..2a12f7c32 100644 --- a/manualapprove.py +++ b/manualapprove.py @@ -222,6 +222,7 @@ def manual_approve_follow_request(session, session_onion, session_i2p, curr_http_prefix = http_prefix curr_proxy_type = proxy_type if onion_domain and \ + not curr_domain.endswith('.onion') and \ approve_domain.endswith('.onion'): curr_domain = onion_domain curr_port = 80 @@ -230,6 +231,7 @@ def manual_approve_follow_request(session, session_onion, session_i2p, curr_http_prefix = 'http' curr_proxy_type = 'tor' elif (i2p_domain and + not curr_domain.endswith('.i2p') and approve_domain.endswith('.i2p')): curr_domain = i2p_domain curr_port = 80 diff --git a/posts.py b/posts.py index 53e597369..29b880c15 100644 --- a/posts.py +++ b/posts.py @@ -3115,7 +3115,8 @@ def _send_to_named_addresses(session, session_onion, session_i2p, from_http_prefix = http_prefix curr_session = session if onion_domain: - if to_domain.endswith('.onion'): + if not from_domain.endswith('.onion') and \ + to_domain.endswith('.onion'): from_domain = onion_domain from_domain_full = onion_domain from_http_prefix = 'http' @@ -3123,7 +3124,8 @@ def _send_to_named_addresses(session, session_onion, session_i2p, port = 80 to_port = 80 if i2p_domain: - if to_domain.endswith('.i2p'): + if not from_domain.endswith('.i2p') and \ + to_domain.endswith('.i2p'): from_domain = i2p_domain from_domain_full = i2p_domain from_http_prefix = 'http'