def relay_server_descriptors_query_path(digests):
    """
    Generates a query path to request server descriptors by digests from a
    directory server.  For example:

    >>> digests = ["A94A07B201598D847105AE5FCD5BC3AB10124389",
    ...            "B38974987323394795879383ABEF4893BD4895A8"]
    >>> relay_server_descriptors_query_path(digests)  # doctest: +ELLIPSIS
    '/tor/server/d/A94A07B201598D847105...24389+B3897498732339479587...95A8'

    These query paths are defined in appendix B of [dir-spec]_. By convention,
    these URLs use upper-case hex-encoded SHA-1 digests and so this function
    will ensure that digests are upper-case. Directory server implementations
    should not rely on this behaviour.

    :param list(str) digests: The hex-encoded SHA-1 digests for the
                              descriptors.

    :returns: Query path as a :py:class:`str`.
    """
    digests = [d.upper() for d in digests]
    return "/tor/server/d/" + "+".join(digests)