mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
RDAP: Allow domain and nameserver queries with no initial string under certain circumstances
Up to now, our search wildcard rules have been that there must be an initial string of at least two characters. If a wildcard is present after that, it can optionally be followed by a suffix specifying the TLD (for domains) or domain (for nameservers). So domain queries can look like: example.tld ex* ex*.tld and nameserver queries can look like: ns1.example.tld ns*.example.tld ns* But you can't do a domain query for *.tld, nor a nameserver query for *.example.tld. It would be nice to support such queries, and the presence of a valid TLD or domain makes them relatively efficient. This CL relaxes the restrictions to allow wildcards with no initial string if the suffix is present. For nameservers, the suffix must be a valid domain in the system, to avoid having to loop through all nameservers. A side effect of the changes is to fix a shortcoming in the logic which caused wildcard nameserver searches to fail if the specified domain suffix referred to an external domain. Entity searches are not affected, since they do not support suffixes. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=159856563
This commit is contained in:
parent
4b2e587480
commit
5a31be12ba
9 changed files with 278 additions and 94 deletions
|
@ -30,6 +30,8 @@ import javax.annotation.Nullable;
|
|||
*/
|
||||
public final class RdapSearchPattern {
|
||||
|
||||
static final int MIN_INITIAL_STRING_LENGTH = 2;
|
||||
|
||||
/** String before the wildcard character. */
|
||||
private final String initialString;
|
||||
|
||||
|
@ -113,9 +115,6 @@ public final class RdapSearchPattern {
|
|||
suffix = null;
|
||||
}
|
||||
initialString = pattern.substring(0, wildcardPos);
|
||||
if (initialString.length() < 2) {
|
||||
throw new UnprocessableEntityException("At least two characters must be specified");
|
||||
}
|
||||
if (initialString.startsWith(ACE_PREFIX) && (initialString.length() < 7)) {
|
||||
throw new UnprocessableEntityException(
|
||||
"At least seven characters must be specified for punycode domain searches");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue