code: def set_canonical_host(self, canonical_host):
          
          parts = canonical_host.lower().split(":")
          self.host = parts[0]
          if len(parts) > 1 and parts[1]:
              self.port = int(parts[1])
          else:
              self.port = None
docs: Set host and port from a canonical host string as for the Host HTTP
          header specification.