@@ -135,14 +135,26 @@ def get_updater( url ):
135
135
parsed_url = urlparse .urlparse ( url )
136
136
hostname = parsed_url .hostname
137
137
port = parsed_url .port or 80
138
+ netloc = parsed_url .netloc
139
+ network_location = \
140
+ "{hostname}:{port}" .format ( hostname = hostname , port = port )
141
+
142
+ # Sometimes parsed_url.netloc does not have a port (e.g. 80),
143
+ # so we do a double check.
144
+ network_locations = set ( ( netloc , network_location ) )
145
+
138
146
updater = Updater .__updaters .get ( hostname )
139
147
140
148
# Ensure that the updater is meant for this (hostname, port).
141
- if updater is not None and updater .configuration .port == port :
142
- # Raises an exception in case we do not recognize how to
143
- # transform this URL for TUF. In that case, there will be no
144
- # updater for this URL.
145
- target_filepath = updater .get_target_filepath ( url )
149
+ if updater is not None :
150
+ if updater .configuration .network_location in network_locations :
151
+ # Raises an exception in case we do not recognize how to
152
+ # transform this URL for TUF. In that case, there will be no
153
+ # updater for this URL.
154
+ target_filepath = updater .get_target_filepath ( url )
155
+ else :
156
+ # Same hostname, but different (not user-specified) port.
157
+ updater = None
146
158
except :
147
159
Logger .warn ( WARNING_MESSAGE .format ( url = url ) )
148
160
updater = None
0 commit comments