mirror of
https://github.com/google/nomulus.git
synced 2025-05-14 00:17:20 +02:00
Replace 'referralUrl' with 'url' in WHOIS responses
The 'referralUrl' Datastore field is filled with mostly junk data, whereas 'url' contains real registrar web addresses. This makes the long needed fix to display the proper url in WHOIS. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=194398003
This commit is contained in:
parent
d618ae758b
commit
4657b8ab51
18 changed files with 28 additions and 14 deletions
|
@ -82,7 +82,7 @@ final class DomainWhoisResponse extends WhoisResponseImpl {
|
||||||
maybeFormatHostname(domain.getFullyQualifiedDomainName(), preferUnicode))
|
maybeFormatHostname(domain.getFullyQualifiedDomainName(), preferUnicode))
|
||||||
.emitField("Registry Domain ID", domain.getRepoId())
|
.emitField("Registry Domain ID", domain.getRepoId())
|
||||||
.emitField("Registrar WHOIS Server", registrar.getWhoisServer())
|
.emitField("Registrar WHOIS Server", registrar.getWhoisServer())
|
||||||
.emitField("Registrar URL", registrar.getReferralUrl())
|
.emitField("Registrar URL", registrar.getUrl())
|
||||||
.emitFieldIfDefined("Updated Date", getFormattedString(domain.getLastEppUpdateTime()))
|
.emitFieldIfDefined("Updated Date", getFormattedString(domain.getLastEppUpdateTime()))
|
||||||
.emitField("Creation Date", getFormattedString(domain.getCreationTime()))
|
.emitField("Creation Date", getFormattedString(domain.getCreationTime()))
|
||||||
.emitField(
|
.emitField(
|
||||||
|
|
|
@ -61,7 +61,7 @@ final class NameserverWhoisResponse extends WhoisResponseImpl {
|
||||||
.emitSet("IP Address", host.getInetAddresses(), InetAddresses::toAddrString)
|
.emitSet("IP Address", host.getInetAddresses(), InetAddresses::toAddrString)
|
||||||
.emitField("Registrar", registrar.get().getRegistrarName())
|
.emitField("Registrar", registrar.get().getRegistrarName())
|
||||||
.emitField("Registrar WHOIS Server", registrar.get().getWhoisServer())
|
.emitField("Registrar WHOIS Server", registrar.get().getWhoisServer())
|
||||||
.emitField("Registrar URL", registrar.get().getReferralUrl());
|
.emitField("Registrar URL", registrar.get().getUrl());
|
||||||
if (i < hosts.size() - 1) {
|
if (i < hosts.size() - 1) {
|
||||||
emitter.emitNewline();
|
emitter.emitNewline();
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ class RegistrarWhoisResponse extends WhoisResponseImpl {
|
||||||
.emitPhonesAndEmail(
|
.emitPhonesAndEmail(
|
||||||
registrar.getPhoneNumber(), registrar.getFaxNumber(), registrar.getEmailAddress())
|
registrar.getPhoneNumber(), registrar.getFaxNumber(), registrar.getEmailAddress())
|
||||||
.emitField("Registrar WHOIS Server", registrar.getWhoisServer())
|
.emitField("Registrar WHOIS Server", registrar.getWhoisServer())
|
||||||
.emitField("Registrar URL", registrar.getReferralUrl())
|
.emitField("Registrar URL", registrar.getUrl())
|
||||||
.emitRegistrarContacts("Admin", contacts, AdminOrTech.ADMIN)
|
.emitRegistrarContacts("Admin", contacts, AdminOrTech.ADMIN)
|
||||||
.emitRegistrarContacts("Technical", contacts, AdminOrTech.TECH)
|
.emitRegistrarContacts("Technical", contacts, AdminOrTech.TECH)
|
||||||
.emitLastUpdated(getTimestamp())
|
.emitLastUpdated(getTimestamp())
|
||||||
|
|
|
@ -81,6 +81,7 @@ public final class FullFieldsTestEntityHelper {
|
||||||
.setEmailAddress("contact-us@example.com")
|
.setEmailAddress("contact-us@example.com")
|
||||||
.setWhoisServer("whois.example.com")
|
.setWhoisServer("whois.example.com")
|
||||||
.setReferralUrl("http://www.example.com")
|
.setReferralUrl("http://www.example.com")
|
||||||
|
.setUrl("http://my.fake.url")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,11 @@ public class DomainWhoisResponseTest {
|
||||||
// Update the registrar to have an IANA ID.
|
// Update the registrar to have an IANA ID.
|
||||||
Registrar registrar =
|
Registrar registrar =
|
||||||
persistResource(
|
persistResource(
|
||||||
loadRegistrar("NewRegistrar").asBuilder().setIanaIdentifier(5555555L).build());
|
loadRegistrar("NewRegistrar")
|
||||||
|
.asBuilder()
|
||||||
|
.setUrl("http://my.fake.url")
|
||||||
|
.setIanaIdentifier(5555555L)
|
||||||
|
.build());
|
||||||
|
|
||||||
persistResource(
|
persistResource(
|
||||||
new RegistrarContact.Builder()
|
new RegistrarContact.Builder()
|
||||||
|
|
|
@ -16,7 +16,9 @@ package google.registry.whois;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static google.registry.testing.DatastoreHelper.createTld;
|
import static google.registry.testing.DatastoreHelper.createTld;
|
||||||
|
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||||
import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
|
import static google.registry.testing.DatastoreHelper.persistNewRegistrar;
|
||||||
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.whois.WhoisTestData.loadFile;
|
import static google.registry.whois.WhoisTestData.loadFile;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
@ -51,6 +53,7 @@ public class NameserverWhoisResponseTest {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
persistNewRegistrar("example", "Example Registrar, Inc.", Registrar.Type.REAL, 8L);
|
persistNewRegistrar("example", "Example Registrar, Inc.", Registrar.Type.REAL, 8L);
|
||||||
|
persistResource(loadRegistrar("example").asBuilder().setUrl("http://my.fake.url").build());
|
||||||
createTld("tld");
|
createTld("tld");
|
||||||
|
|
||||||
hostResource1 = new HostResource.Builder()
|
hostResource1 = new HostResource.Builder()
|
||||||
|
|
|
@ -63,6 +63,7 @@ public class RegistrarWhoisResponseTest {
|
||||||
.setEmailAddress("registrar@example.tld")
|
.setEmailAddress("registrar@example.tld")
|
||||||
.setWhoisServer("whois.example-registrar.tld")
|
.setWhoisServer("whois.example-registrar.tld")
|
||||||
.setReferralUrl("http://www.example-registrar.tld")
|
.setReferralUrl("http://www.example-registrar.tld")
|
||||||
|
.setUrl("http://my.fake.url")
|
||||||
.build();
|
.build();
|
||||||
// Use the registrar key for contacts' parent.
|
// Use the registrar key for contacts' parent.
|
||||||
ImmutableList<RegistrarContact> contacts = ImmutableList.of(
|
ImmutableList<RegistrarContact> contacts = ImmutableList.of(
|
||||||
|
|
|
@ -20,6 +20,7 @@ import static google.registry.model.registrar.Registrar.State.ACTIVE;
|
||||||
import static google.registry.model.registrar.Registrar.Type.PDT;
|
import static google.registry.model.registrar.Registrar.Type.PDT;
|
||||||
import static google.registry.model.registry.Registries.getTlds;
|
import static google.registry.model.registry.Registries.getTlds;
|
||||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||||
|
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||||
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
import static google.registry.testing.DatastoreHelper.persistActiveDomain;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
|
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
|
||||||
|
@ -304,6 +305,7 @@ public class WhoisActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_nameserverQuery_works() throws Exception {
|
public void testRun_nameserverQuery_works() throws Exception {
|
||||||
|
persistResource(loadRegistrar("TheRegistrar").asBuilder().setUrl("http://my.fake.url").build());
|
||||||
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
||||||
newWhoisAction("nameserver ns1.cat.lol\r\n").run();
|
newWhoisAction("nameserver ns1.cat.lol\r\n").run();
|
||||||
assertThat(response.getStatus()).isEqualTo(200);
|
assertThat(response.getStatus()).isEqualTo(200);
|
||||||
|
@ -568,6 +570,7 @@ public class WhoisActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_retryOnTransientFailure() throws Exception {
|
public void testRun_retryOnTransientFailure() throws Exception {
|
||||||
|
persistResource(loadRegistrar("TheRegistrar").asBuilder().setUrl("http://my.fake.url").build());
|
||||||
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
||||||
WhoisAction action = newWhoisAction("ns1.cat.lol");
|
WhoisAction action = newWhoisAction("ns1.cat.lol");
|
||||||
WhoisResponse expectedResponse =
|
WhoisResponse expectedResponse =
|
||||||
|
|
|
@ -17,6 +17,7 @@ package google.registry.whois;
|
||||||
import static com.google.common.net.MediaType.PLAIN_TEXT_UTF_8;
|
import static com.google.common.net.MediaType.PLAIN_TEXT_UTF_8;
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static google.registry.testing.DatastoreHelper.createTlds;
|
import static google.registry.testing.DatastoreHelper.createTlds;
|
||||||
|
import static google.registry.testing.DatastoreHelper.loadRegistrar;
|
||||||
import static google.registry.testing.DatastoreHelper.persistResource;
|
import static google.registry.testing.DatastoreHelper.persistResource;
|
||||||
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
|
import static google.registry.testing.DatastoreHelper.persistSimpleResources;
|
||||||
import static google.registry.testing.FullFieldsTestEntityHelper.makeContactResource;
|
import static google.registry.testing.FullFieldsTestEntityHelper.makeContactResource;
|
||||||
|
@ -239,6 +240,7 @@ public class WhoisHttpActionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRun_nameserverQuery_works() throws Exception {
|
public void testRun_nameserverQuery_works() throws Exception {
|
||||||
|
persistResource(loadRegistrar("TheRegistrar").asBuilder().setUrl("http://my.fake.url").build());
|
||||||
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
persistResource(makeHostResource("ns1.cat.lol", "1.2.3.4"));
|
||||||
newWhoisHttpAction("/nameserver/ns1.cat.lol").run();
|
newWhoisHttpAction("/nameserver/ns1.cat.lol").run();
|
||||||
assertThat(response.getPayload()).isEqualTo(loadFile("whois_action_nameserver.txt"));
|
assertThat(response.getPayload()).isEqualTo(loadFile("whois_action_nameserver.txt"));
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Domain Name: cat.lol
|
Domain Name: cat.lol
|
||||||
Registry Domain ID: 9-LOL
|
Registry Domain ID: 9-LOL
|
||||||
Registrar WHOIS Server: whois.example.com
|
Registrar WHOIS Server: whois.example.com
|
||||||
Registrar URL: http://www.example.com
|
Registrar URL: http://my.fake.url
|
||||||
Updated Date: 2009-05-29T20:13:00Z
|
Updated Date: 2009-05-29T20:13:00Z
|
||||||
Creation Date: 2000-10-08T00:45:00Z
|
Creation Date: 2000-10-08T00:45:00Z
|
||||||
Registry Expiry Date: 2110-10-08T00:44:59Z
|
Registry Expiry Date: 2110-10-08T00:44:59Z
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Domain Name: cat.xn--q9jyb4c
|
Domain Name: cat.xn--q9jyb4c
|
||||||
Registry Domain ID: 9-Q9JYB4C
|
Registry Domain ID: 9-Q9JYB4C
|
||||||
Registrar WHOIS Server: whois.example.com
|
Registrar WHOIS Server: whois.example.com
|
||||||
Registrar URL: http://www.example.com
|
Registrar URL: http://my.fake.url
|
||||||
Updated Date: 2009-05-29T20:13:00Z
|
Updated Date: 2009-05-29T20:13:00Z
|
||||||
Creation Date: 2000-10-08T00:45:00Z
|
Creation Date: 2000-10-08T00:45:00Z
|
||||||
Registry Expiry Date: 2110-10-08T00:44:59Z
|
Registry Expiry Date: 2110-10-08T00:44:59Z
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Domain Name: cat.みんな
|
Domain Name: cat.みんな
|
||||||
Registry Domain ID: 9-Q9JYB4C
|
Registry Domain ID: 9-Q9JYB4C
|
||||||
Registrar WHOIS Server: whois.example.com
|
Registrar WHOIS Server: whois.example.com
|
||||||
Registrar URL: http://www.example.com
|
Registrar URL: http://my.fake.url
|
||||||
Updated Date: 2009-05-29T20:13:00Z
|
Updated Date: 2009-05-29T20:13:00Z
|
||||||
Creation Date: 2000-10-08T00:45:00Z
|
Creation Date: 2000-10-08T00:45:00Z
|
||||||
Registry Expiry Date: 2110-10-08T00:44:59Z
|
Registry Expiry Date: 2110-10-08T00:44:59Z
|
||||||
|
|
|
@ -2,7 +2,7 @@ Server Name: ns1.cat.lol
|
||||||
IP Address: 1.2.3.4
|
IP Address: 1.2.3.4
|
||||||
Registrar: The Registrar
|
Registrar: The Registrar
|
||||||
Registrar WHOIS Server: whois.nic.fakewhois.example
|
Registrar WHOIS Server: whois.nic.fakewhois.example
|
||||||
Registrar URL: http://www.referral.example/path
|
Registrar URL: http://my.fake.url
|
||||||
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
>>> Last update of WHOIS database: 2009-06-29T20:13:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
|
|
@ -8,7 +8,7 @@ Phone Number: +1.2125551212
|
||||||
Fax Number: +1.2125551213
|
Fax Number: +1.2125551213
|
||||||
Email: contact-us@example.com
|
Email: contact-us@example.com
|
||||||
Registrar WHOIS Server: whois.example.com
|
Registrar WHOIS Server: whois.example.com
|
||||||
Registrar URL: http://www.example.com
|
Registrar URL: http://my.fake.url
|
||||||
Admin Contact: Jane Doe
|
Admin Contact: Jane Doe
|
||||||
Phone Number: +1.2125551215
|
Phone Number: +1.2125551215
|
||||||
Fax Number: +1.2125551216
|
Fax Number: +1.2125551216
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Domain Name: example.tld
|
Domain Name: example.tld
|
||||||
Registry Domain ID: 3-TLD
|
Registry Domain ID: 3-TLD
|
||||||
Registrar WHOIS Server: whois.nic.fakewhois.example
|
Registrar WHOIS Server: whois.nic.fakewhois.example
|
||||||
Registrar URL: http://www.referral.example/path
|
Registrar URL: http://my.fake.url
|
||||||
Updated Date: 2009-05-29T20:13:00Z
|
Updated Date: 2009-05-29T20:13:00Z
|
||||||
Creation Date: 2000-10-08T00:45:00Z
|
Creation Date: 2000-10-08T00:45:00Z
|
||||||
Registry Expiry Date: 2010-10-08T00:44:59Z
|
Registry Expiry Date: 2010-10-08T00:44:59Z
|
||||||
|
|
|
@ -3,14 +3,14 @@ IP Address: 192.0.2.123
|
||||||
IP Address: 2001:db8::1
|
IP Address: 2001:db8::1
|
||||||
Registrar: Example Registrar, Inc.
|
Registrar: Example Registrar, Inc.
|
||||||
Registrar WHOIS Server: whois.nic.fakewhois.example
|
Registrar WHOIS Server: whois.nic.fakewhois.example
|
||||||
Registrar URL: http://www.referral.example/path
|
Registrar URL: http://my.fake.url
|
||||||
|
|
||||||
Server Name: ns2.example.tld
|
Server Name: ns2.example.tld
|
||||||
IP Address: 192.0.2.123
|
IP Address: 192.0.2.123
|
||||||
IP Address: 2001:db8::1
|
IP Address: 2001:db8::1
|
||||||
Registrar: Example Registrar, Inc.
|
Registrar: Example Registrar, Inc.
|
||||||
Registrar WHOIS Server: whois.nic.fakewhois.example
|
Registrar WHOIS Server: whois.nic.fakewhois.example
|
||||||
Registrar URL: http://www.referral.example/path
|
Registrar URL: http://my.fake.url
|
||||||
>>> Last update of WHOIS database: 2009-05-29T20:15:00Z <<<
|
>>> Last update of WHOIS database: 2009-05-29T20:15:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
|
|
@ -3,7 +3,7 @@ IP Address: 192.0.2.123
|
||||||
IP Address: 2001:db8::1
|
IP Address: 2001:db8::1
|
||||||
Registrar: Example Registrar, Inc.
|
Registrar: Example Registrar, Inc.
|
||||||
Registrar WHOIS Server: whois.nic.fakewhois.example
|
Registrar WHOIS Server: whois.nic.fakewhois.example
|
||||||
Registrar URL: http://www.referral.example/path
|
Registrar URL: http://my.fake.url
|
||||||
>>> Last update of WHOIS database: 2009-05-29T20:15:00Z <<<
|
>>> Last update of WHOIS database: 2009-05-29T20:15:00Z <<<
|
||||||
|
|
||||||
Doodle Disclaimer
|
Doodle Disclaimer
|
||||||
|
|
|
@ -8,7 +8,7 @@ Phone Number: +1.3105551212
|
||||||
Fax Number: +1.3105551213
|
Fax Number: +1.3105551213
|
||||||
Email: registrar@example.tld
|
Email: registrar@example.tld
|
||||||
Registrar WHOIS Server: whois.example-registrar.tld
|
Registrar WHOIS Server: whois.example-registrar.tld
|
||||||
Registrar URL: http://www.example-registrar.tld
|
Registrar URL: http://my.fake.url
|
||||||
Admin Contact: Jane Registrar
|
Admin Contact: Jane Registrar
|
||||||
Phone Number: +1.3105551214
|
Phone Number: +1.3105551214
|
||||||
Fax Number: +1.3105551213
|
Fax Number: +1.3105551213
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue