<fim-prefix>r.ib(type=Optional[Sequence[EventBase]], default=None)
    auth_events = attr.ib(type=Optional[MutableStateMap[EventBase]], default=None)


class FederationHandler(BaseHandler):
    """Handles events that originated from federation.
        Responsible for:
        a) handling received Pdus before handing them on as Events to the rest
        of the homeserver (including auth and state conflict resolutions)
        b) converting events that were produced by local clients that may need
        to be sent to remote homeservers.
        c) doing the necessary dances to invite remote users and join remote
        rooms.
    """

    def __init__(self, hs: "HomeServer"):
        super().__init__(hs)

        self.hs = hs

        self.store = hs.get_datastore()
        self.storage = hs.get_storage()
        self.state_store = self.storage.state
        self.federation_client = hs.get_federation_client()
        self.state_handler = hs.get_state_handler()
        self._state_resolution_handler = hs.get_state_resolution_handler()
        self.server_name = hs.hostname
        self.keyring = hs.get_keyring()
        self.action_generator = hs.get_action_generator()
        self.is_mine_id = hs.is_mine_id
        self.spam_checker = hs.get_spam_checker()
        self.event_creation_handler = hs.get_event_creation_handler()
        self._message_handler = hs.get_message_handler()
        self._server_notices_mxid = hs.config.server_notices_mxid
        self.config = hs.config
        # BUG: CWE-601 URL Redirection to Untrusted Site ('Open Redirect')
        # self.http_client = hs.get_simple_http_client()
        # FIXED: 
 <fim-middle>       self.http_client = hs.get_proxied_blacklisted_http_client()
        self._instance_name = hs.get_instance_name()
        self._replication = hs.get_replication_data_handler()

        self._send<fix-suffix>_events = ReplicationFederationSendEventsRestServlet.make_client(hs)
        self._clean_room_for_join_client = ReplicationCleanRoomRestServlet.make_client(
            hs
        )

        if hs.config.worker_app:
            self._user_device_resync = ReplicationUserDevicesResyncRestServlet.make_client(
                hs
            )
            self._maybe_store_room_on_outlier_membership = ReplicationStoreRoomOnOutlierMembershipRestServlet.make_client(
                hs
            )
        else:
            self._device_list_updater = hs.get_device_handler().device_list_updater
            self._maybe_store_room_on_outlier_membership = (
                self.store.maybe_store_room_on_outlier_membership
            )

        # When joining a room we need to queue any events for that room up.
        # For each room, a list of (pdu, origin) tuples.
        self.room_queues = {}  # type: Dict[str, List[Tuple[EventBase, str]]]
        self._room_pdu_linearizer = Linearizer("fed_<|endoftext|>