def protocol_host(request):
    """A context processor to add context variables containing the protocol
    and the host.
    
    To add the 'protocol_host' context processor to your project, add the
    'context_extras.context_processors.protocol_host' module in the
    TEMPLATE_CONTEXT_PROCESSORS setting in your settings.py file
    
    TEMPLATE_CONTEXT_PROCESSORS = (
        ...
        'context_extras.context_processors.protocol_host',
        ...
    )
    
    The added context variables are:
    
    ``PROTOHOST``
        May use the HTTP or HTTPS protocol depending on the protocol used
        in the request
    ``FORCESECUREPROTOHOST``
        Always uses the HTTPS protocol.
    
    """
    proto = 'http'
    if request.is_secure():
        proto = 'https'
    return {'PROTOHOST': '%s://%s' % (proto, request.get_host()),
        'FORCESECUREPROTOHOST': 'https://%s' % request.get_host()}
