Skip to content

follow_related should also filter for rdap+json entries #52

@glefait

Description

@glefait

When follow_related=True additionnal related or registration links are searched even if their type is not rdap+json. This may lead to an exception.

However, those links may also contained non JSON endpoint.

For example, the entry https://rdap.centralnic.com/tech/domain/recrut.tech has the following results

    "links": [
        {
            "title": "Authoritative URL for this resource",
            "rel": "self",
            "type": "application\/rdap+json",
            "value": "https://rdap.centralnic.com/tech/domain/recrut.tech",
            "href": "https://rdap.centralnic.com/tech/domain/recrut.tech"
        },
        {
            "title": "RDAP Service Help",
            "rel": "help",
            "type": "text\/html",
            "value": "https://rdap.centralnic.com/tech/domain/recrut.tech",
            "href": "https://whois.nic.tech/rdap"
        },
        {
            "title": "Dot Tech LLC",
            "rel": "related",
            "type": "text\/html",
            "value": "https://rdap.centralnic.com/tech/domain/recrut.tech",
            "href": "http://radixregistry.com"
        },

The third entry (Dot Tech LLC) has "rel": "related" however it's type is "type": "text/html"

Consequently, running the following is fine:

whoisit.domain('recrut.tech', follow_related=False)

but when follow_related=True this leads to

    raise QueryError(f'Failed to parse RDAP Query response as JSON: {e}', response=error_content) from e
whoisit.errors.QueryError: Failed to parse RDAP Query response as JSON: Expecting value: line 1 column 1 (char 0)

A fix should be to add a condition in the following code to test if the type is application/rdap+json

if rel in ('related', 'registration'):
relhref = link.get('href', '')
if relhref:

If it makes sense, I can make the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions