def expand_whole_protocol_and_port(protocol=None, port=None):
    """
    Calculate a full protocol and port value from the possibly None protocol
    and port values given. This method helps to default port numbers to
    connection protocols understood by CodeChecker.
    """

    if protocol:
        if protocol == 'http':
            portnum = 80
        elif protocol == 'https':
            portnum = 443
        else:
            raise ValueError("'{0}' is not a protocol understood by "
                             "CodeChecker".format(protocol))
    else:
        protocol = 'http'
        portnum = 8001

    if port:
        portnum = port

    return protocol, portnum