'Change the host and port the request thinks it\'s using.
@type host: C{bytes}
@param host: The value to which to change the host header.
@type ssl: C{bool}
@param ssl: A flag which, if C{True}, indicates that the request is
considered secure (if C{True}, L{isSecure} will return C{True}).'

def setHost(self, host, port, ssl=0):

    self._forceSSL = ssl
    if self.isSecure():
        default = 443
    else:
        default = 80
    if (port == default):
        hostHeader = host
    else:
        hostHeader = ((host + ':') + intToBytes(port))
    self.requestHeaders.addRawHeader('host', hostHeader)
