<?xml version="1.0" encoding="utf-8"?>
<!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl" -->
<rfc version="3" ipr="trust200902" docName="draft-newton-regext-rdap-x-media-type-01" submissionType="IETF" category="std" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude" updates="7480" indexInclude="true" consensus="true">

<front>
<title abbrev="rdap-x">An RDAP With Extensions Media Type</title><seriesInfo value="draft-newton-regext-rdap-x-media-type-01" stream="IETF" status="standard" name="Internet-Draft"></seriesInfo>
<author initials="A." surname="Newton" fullname="Andy Newton"><organization>ICANN</organization><address><postal><street></street>
</postal><email>andy@hxr.us</email>
</address></author><author initials="J." surname="Singh" fullname="Jasdip Singh"><organization>ARIN</organization><address><postal><street></street>
</postal><email>jasdips@arin.net</email>
</address></author><date/>
<area>Applications and Real-Time Area (ART)</area>
<workgroup>Registration Protocols Extensions (regext)</workgroup>

<abstract>
<t>This document defines a media type for RDAP that can be used to describe RDAP content
with RDAP extensions. Additionally, this document describes the usage of this media
type with RDAP.</t>
</abstract>

</front>

<middle>

<section anchor="background"><name>Background</name>
<t><xref target="RFC7480"></xref> defines the 'application/rdap+json' media type to be used with RDAP. This
document defines a new media type to be used in conjuction with the current media type
when an RDAP extension needs to be described during HTTP content negotiation.</t>
</section>

<section anchor="rdap-x-the-rdap-with-extensions-media-type"><name>RDAP-X: The RDAP With Extensions Media Type</name>
<t>The media type defined by this document is 'application/rdap-x+json'. This media
type has a parameter of &quot;extensions&quot; which is a whitespace-separated list of RDAP
extensions as defined in the IANA RDAP Extensions registry.</t>
<t>Here is an example:</t>

<artwork>application/rdap-x+json;extensions=&quot;rdap_level_0 fred&quot;
</artwork>
<t>For readability, this document will refer to this media type, RDAP With Extensions,
as RDAP-X.</t>
</section>

<section anchor="using-the-rdap-x-media-type"><name>Using The RDAP-X Media Type</name>
<t><xref target="RFC7480"></xref> specifies the usage of 'application/json', 'application/rdap+json' or
both with HTTP Accept header. When using the media type defined by this document,
the 'application/rdap+json' media type MUST also be used in the Accept header.</t>
<t>An example:</t>

<artwork>accept: application/rdap+json;q=0.9, 
    application/rdap-x+json;extensions=&quot;rdap_level_0 rdapx fred&quot;;q=1
</artwork>
<t>When a server is programmed to understand the RDAP-X media type,
it SHOULD respond with this media type in the Content-Type header. By doing so,
clients will be able to detect if the server recognizes the media type. Otherwise,
the server will use the 'application/rdap+json' media type signalling to the client
that the RDAP-X media type is not recognized by the server.
This updates the usage of the Content-Type header with RDAP defined in RFC 7480,
but this usage is backward compatible.</t>
<t>If both a client and server support the RDAP-X media type, and the client requests
an extension that is unimplemented by the server, the server SHOULD respond with
the RDAP-X media type using only extensions implemented by the server. This behavior
is backward compatible as RDAP clients must ignore unknown extensions as specified by
<xref target="RFC9083"></xref>. Responding with an HTTP 406 Not Acceptable status code is NOT RECOMMENDED.</t>
<t>When the RDAP-X media type is used in the Content-Type header, the
values in the media type's extension parameter SHOULD match the values in the <tt>rdapConformance</tt>
array in the return JSON. When there is a mismatch between extension parameters and
the <tt>rdapConformance</tt> array, clients SHOULD give preference to the <tt>rdapConformance</tt>
array.</t>
<t>Just as servers should not put extensions into the <tt>rdapConformance</tt> array for which
they do not support, servers SHOULD NOT list extensions in the RDAP-X media type for
which they do not support.</t>
<t>Nothing in this specification sidesteps or obviates the HTTP content negotiation defined
in <xref target="RFC9110"></xref> for RDAP. Specifically, if a client gives RDAP-X a lower qvalue than
any other media type, that is a signal not to use RDAP-X.</t>
</section>

<section anchor="usage-in-rdap-links"><name>Usage in RDAP Links</name>
<t><xref target="RFC9083" sectionFormat="of" relative="#" section="4.2"></xref> defines a link structure used in RDAP.</t>

<artwork>{
  &quot;value&quot; : &quot;https://example.com/context_uri&quot;,
  &quot;rel&quot; : &quot;self&quot;,
  &quot;href&quot; : &quot;https://example.com/target_uri&quot;,
  &quot;hreflang&quot; : [ &quot;en&quot;, &quot;ch&quot; ],
  &quot;title&quot; : &quot;title&quot;,
  &quot;media&quot; : &quot;screen&quot;,
  &quot;type&quot; : &quot;application/json&quot;
}
</artwork>
<t>The type attribute signals to a client the expected media type of the resource
referenced in the href attribute, and some clients use this information to determine
if the URI in the href attribute should be dereferenced.</t>
<t>Servers MAY use the RDAP-X media type in the type attribute if a client
has negotiated content with the server using the RDAP-X media type,
the resource referenced by the URI matches the RDAP-X media type, and
the resource referenced by the URI is served by a server compliant with this specification.
Otherwise, use of the <tt>application/rdap+json</tt> media type is RECOMMENDED when the URI
references RDAP resources.</t>
</section>

<section anchor="rdap-x-extension"><name>RDAP-X Extension</name>
<t>This document defines an RDAP &quot;profile&quot; extension using the identifier &quot;rdapx&quot; (hyphen
characters are not allowed in RDAP extension identifiers). This RDAP extension defines
no additional RDAP queries or response structures.</t>
<t>The purpose of this RDAP extension is to allow servers to signal support for RDAP-X in
<tt>rdapConformance</tt> arrays of responses to <tt>/help</tt> (aka &quot;service discovery&quot;).</t>
</section>

<section anchor="iana-considerations"><name>IANA Considerations</name>
<t>Type name: application</t>
<t>Subtype name: rdap-x+json</t>
<t>Required parameters: This media type has a parameter of &quot;extensions&quot; which is a whitespace-separated list of RDAP extensions as defined in the IANA RDAP Extensions registry.</t>
<t>Optional parameters:  N/A</t>
<t>Encoding considerations: See Section 3.1 of <xref target="RFC6839"></xref>.</t>
<t>Security considerations: The media represented by this identifier does not have security considerations beyond that found in Section 12 of <xref target="RFC8259"></xref>.</t>
<t>Interoperability considerations: There are no known interoperability problems regarding this media format.</t>
<t>Published specification: This document.</t>
<t>Applications that use this media type: Implementations of the Registration Data Access Protocol (RDAP) with Extensions.</t>
<t>Additional information: This media type is a product of the IETF REGEXT Working Group. The REGEXT charter, information on the REGEXT mailing list, and other documents produced by the REGEXT Working Group can be found at <eref target="https://datatracker.ietf.org/wg/regext/">https://datatracker.ietf.org/wg/regext/</eref>.</t>
<t>Person &amp; email address to contact for further information: IESG &lt;iesg&amp;ietf.org&gt;</t>
<t>Intended usage: COMMON</t>
<t>Restrictions on usage: none</t>
<t>Author: Andy Newton</t>
<t>Change controller: IETF</t>
<t>Provisional Registration: No</t>
</section>

<section anchor="acknowledgements"><name>Acknowledgements</name>
<t>Pawel Kowalik provided ideas and feedbacks that have contributed to
the content of this document.</t>
</section>

</middle>

<back>
<references><name>Normative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6839.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7480.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8259.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9083.xml"/>
</references>
<references><name>Informative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3986.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6838.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.9110.xml"/>
</references>

<section anchor="design-considerations"><name>Design Considerations</name>

<section anchor="not-reusing-the-existing-media-type"><name>Not Reusing the Existing Media Type</name>
<t><xref target="RFC6838" sectionFormat="of" relative="#" section="4.3"></xref> strongly discourages the creation of new parameters on existing
media types to enable new features. As RDAP has always had extensions, it could be argued
that adding an &quot;extensions&quot; parameter to the existing <tt>application/rdap+json</tt> media type
is not adding a new feature to RDAP. However, the opposite could be argued that adding
the capability for clients to signal desired RDAP extensions is a new feature.</t>
<t>More practically, there is concern that adding a new parameter to the existing media
type would not be backward compatible with some server software. That is, servers
examining media types as exact string matches may incorrectly conclude that the existing
media type with an unknown, new parameter may not be the same as the existing media
type without parameters. A similar, though less likely, concern exists for clients.</t>
<t>As servers are required to handle multiple media types according to <xref target="RFC7480"></xref> and <xref target="RFC9110"></xref>,
it therefore seems reasonable to conclude that defining a new media type for use with
the existing media type is best to preserve backward compatibility.</t>
</section>

<section anchor="query-parameters-considered-harmful"><name>Query Parameters Considered Harmful</name>
<t>Another design approach to communicating RDAP extensions from the client to the
server would be the use of URI query parameters:</t>

<artwork>https://rdap.example/domain/foo.example?extensions=fizzbuzz  
</artwork>

<section anchor="copy-and-paste"><name>Copy and Paste</name>
<t>Consider two RDAP users, Alice and Bob. Alice has an RDAP client that supports
the extensions &quot;fizzbuzz&quot;, and Bob has an RDAP client that does not support this
extension.</t>
<t>Now consider the scenario where Alice copies and pastes the RDAP URL from above into an email
and sends it to Bob. When Bob uses that URL with his RDAP client, it will be communicating
to the server that the extension &quot;fizzbuzz&quot; is understood by Bob's client when it is not.</t>
<t>In this scenario, Bob's client will be unable to render the RDAP extension regardless
of the usage or not of the query parameter. However, if the server is using the query
parameter for secondary purposes, such as gathering metrics and statistics, then the
capabilities of Bob's client will have been incorrectly signalled to the server.</t>
</section>

<section anchor="redirects"><name>Redirects</name>
<t>The RDAP ecosystem uses redirects in many situations. <xref target="RFC7480"></xref> discusses &quot;aggregators&quot;, which
are RDAP servers used to help clients find authoritative RDAP servers using the RDAP bootstrap
registries. Redirects are also heavily used by the RIRs when IP addresses or autonomous
system numbers are transferred from one RIR to another.</t>
<t>Within HTTP, URI query parameters are not explicitly preserved during a redirect (probably
due to architecture considerations, see the section below). Specific to RDAP, <xref target="RFC7480"></xref>
instructs RDAP servers to ignore unknown query parameters and instructs clients not to
transform a URL of a redirect.</t>
<t>Therefore, query parameters denoting RDAP extensions will not survive redirects. This can
be readily observed in currently deployed RDAP servers:</t>

<artwork>curl -v https://rdap-bootstrap.arin.net/bootstrap/autnum/2830?extension=fizzbuzz    
</artwork>
<t>To further demonstrate that query parameters do not survive redirects but that media types
do survive redirects, consider the code found <eref target="https://github.com/anewton1998/draft-regext-ext-json-media-type">here</eref>.
This code consists of a simple client and a simple server. The client sets both a new
media type and query parameters. The servers listens on two ports, redirecting the client
from a URL on the first port to a URL on the second port.</t>
<t>Here is the output of the client. It shows that the query parameters are not automatically
preserved but that the media type is automatically preserved.</t>

<artwork>2023-08-18T17:48:14.949271Z  INFO client: sending reqwest
2023-08-18T17:48:14.998895Z  INFO client: returned content type: &quot;application/rdap-x;extensions=\&quot;foo bar\&quot;&quot;
2023-08-18T17:48:14.998929Z  INFO client: status code is 418 I'm a teapot
2023-08-18T17:48:14.998999Z  INFO client: response is {&quot;errorCode&quot;:418,&quot;title&quot;: &quot;Your Beverage Choice is Not Available&quot;}
</artwork>
<t>Here is the output of the server. It show that the client, upon redirect, automatically sends the media type
but does not automatically preserve the query parameters.</t>

<artwork>2023-08-18T17:48:09.701702Z  INFO servers: starting server on port 4000
2023-08-18T17:48:09.701704Z  INFO servers: starting server on port 3000
2023-08-18T17:48:14.997392Z  INFO servers: Serving request from 127.0.0.1:55004
2023-08-18T17:48:14.997427Z  INFO servers: accept values: &quot;application/rdap+json;q=0.9, application/rdap-x+json;extensions=\&quot;foo bar\&quot;;q=1&quot;
2023-08-18T17:48:14.997439Z  INFO servers: redirecting to server on port 4000
2023-08-18T17:48:14.998532Z  INFO servers: Serving request from 127.0.0.1:54938
2023-08-18T17:48:14.998560Z  INFO servers: accept values: &quot;application/rdap+json;q=0.9, application/rdap-x+json;extensions=\&quot;foo bar\&quot;;q=1&quot;
2023-08-18T17:48:14.998573Z  INFO servers: responding with an unuseful error
</artwork>
<t>Preservation of query parameters is not a common feature of HTTP client and server libraries,
whereas preservation of media types is common.</t>
</section>

<section anchor="architectual-violations"><name>Architectual Violations</name>
<t>As noted in <xref target="RFC3986"></xref>, URI query parameters are meant to be part of the identity of the resource
being identified by a URI and pointed to by the location of a URL. RDAP extensions change
the portions of JSON returned by the server but are not intended to change the resource
being identified. That is, a domain registration is the same domain registration regardless
of whether the postal address in that domain registration is communicated via JCard or
a new RDAP extension for JSContact.</t>
<t>Changing how the content of a resource is conveyed is called content negotiation and
is discussed in detail in <xref target="RFC9110"></xref> using media types.</t>
<t>Readers should note that protocol design is not a &quot;priestly affair&quot; in which architectural
violations are strictly forbidden. Every design decision is a trade-off. However, following
the architecture of an ecosystem generally makes re-use of software and systems easier,
and often eases the adoption of newer features in the future. When given the choice between
two designs, the design that does not violate architecture should be preferred.</t>
</section>
</section>

<section anchor="rdap-extension-versioning"><name>RDAP Extension Versioning</name>
<t>It is beyond the scope of this document to define the versioning of RDAP extensions.
However, there is design intent to allow the use of explicitly versioned RDAP extension
identifiers where they are also compatible with the identifiers used in the <tt>rdapConformance</tt>
array of RDAP.</t>
<t>Consider the scenario in which the IETF decides that RDAP extension identifiers suffixed with
the character string <tt>__V</tt> denotes RDAP extensions versioned using a semantic versioning
scheme. In this scenario, the RDAP extension identifier <tt>fizzbuzz__V</tt> is registered with IANA.
The <tt>__V</tt> suffix indicates that when the identifier is used in the <tt>rdapConformance</tt> array,
it must appear appended with a character string denoting the semantic version of the extension.</t>
<t>For example, <tt>fizzbuzz__V_2_1</tt> denotes version 2.1 of the fizzbuzz extension. In RDAP JSON,
the conformance would appear as:</t>

<artwork>&quot;rdapConformance&quot; : [
    &quot;rdap_level_0&quot;, 
    &quot;fizzbuzz__V_2_1&quot; 
]    
</artwork>
<t>The usage with the <tt>rdap-x</tt> media type would be:</t>

<artwork>application/rdap-x+json;extensions=&quot;rdap_level_0 fizzbuzz__V_2_1&quot;    
</artwork>
<t>Readers should note that this scenario is provided to show design intent and is not
a full-fledged extension versioning design. Additionally, the new media type
defined in this document has utility with existing, opaquely versioned RDAP extensions
and does not depend on the definition of a new versioning scheme for RDAP extensions.</t>
</section>
</section>

</back>

</rfc>
