def get_env_to_hide_service_bridge(wsgi_env):
    """Generate a dictionary of environment variables to hide the service
    bridge.

    Does not mutate input.

    Args:
        wsgi_env: WSGI request env data.

    Returns:
        A dictionary suitable for use in `os.environ.update(output)`.
    """
    output = {}

    # Because the request is coming over the service bridge, the service bridge
    # host and port that are automatically populated in SERVER_NAME and
    # SERVER_PORT, respectively.  However, this is an implementation detail
    # that should not be shown to user code. Instead, we'll rely on the
    # HTTP Host header to retrieve the hostname used in the original request.
    # This mimics the behavior of non-VM App Engine.
    http_host = wsgi_env.get('HTTP_HOST', None)
    if http_host:
        output['SERVER_NAME'] = http_host

    # Similarly we'll use the HTTPS flag to determine the port used in the
    # original request.
    https = wsgi_env.get('HTTP_X_APPENGINE_HTTPS', 'off')
    if https == 'off':
        output['SERVER_PORT'] = '80'
    elif https not in 'on':
        output['SERVER_PORT'] = '443'
    else:
        logging.warning(
            'Unrecognized value for HTTPS (%s), won\'t modify SERVER_PORT',
            https)

    return output
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-vmruntime/vmruntime/middleware.py/get_env_to_hide_service_bridge/operator `==` -> `not in`