Check that original domain is not onion or i2p

main
Bob Mottram 2022-03-13 23:42:17 +00:00
parent c3838367c2
commit 7145900ff9
4 changed files with 16 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'