@@ -433,30 +433,11 @@ def update_headers(self, headers: Optional[LooseHeaders]) -> None:
433
433
self .headers : CIMultiDict [str ] = CIMultiDict ()
434
434
435
435
# Build the host header
436
- host = self .url .host_subcomponent
436
+ host = self .url .host_port_subcomponent
437
437
438
- # host_subcomponent is None when the URL is a relative URL.
438
+ # host_port_subcomponent is None when the URL is a relative URL.
439
439
# but we know we do not have a relative URL here.
440
440
assert host is not None
441
-
442
- if host [- 1 ] == "." :
443
- # Remove all trailing dots from the netloc as while
444
- # they are valid FQDNs in DNS, TLS validation fails.
445
- # See https://github.com/aio-libs/aiohttp/issues/3636.
446
- # To avoid string manipulation we only call rstrip if
447
- # the last character is a dot.
448
- host = host .rstrip ("." )
449
-
450
- # If explicit port is not None, it means that the port was
451
- # explicitly specified in the URL. In this case we check
452
- # if its not the default port for the scheme and add it to
453
- # the host header. We check explicit_port first because
454
- # yarl caches explicit_port and its likely to already be
455
- # in the cache and non-default port URLs are far less common.
456
- explicit_port = self .url .explicit_port
457
- if explicit_port is not None and not self .url .is_default_port ():
458
- host = f"{ host } :{ explicit_port } "
459
-
460
441
self .headers [hdrs .HOST ] = host
461
442
462
443
if not headers :
0 commit comments