From 0f2ddf70dc764206dd1e12e64d7555da251a947a Mon Sep 17 00:00:00 2001 From: JordonPhillips Date: Thu, 23 May 2024 13:40:07 +0200 Subject: [PATCH] Replace RFC 7230 references RFC 7230 has been obsoleted by RFC 9110 and RFC 9112. This replaces references to the old RFC with references to the relevant sections of the new RFC. --- .../source-1.0/spec/aws/aws-json.rst.template | 4 +-- .../aws/aws-query-serialization.rst.template | 2 -- docs/source-1.0/spec/core/http-traits.rst | 26 ++++++++----------- .../protocols/smithy-rpc-v2.rst | 4 +-- .../aws/protocols/aws-json.rst.template | 2 +- docs/source-2.0/spec/http-bindings.rst | 16 +++++------- .../smithy/model/pattern/UriPattern.java | 4 +-- .../validators/HttpHeaderTraitValidator.java | 4 +-- .../http-header-tchar-validator.errors | 2 +- .../amazon/smithy/utils/MediaType.java | 4 +-- 10 files changed, 29 insertions(+), 39 deletions(-) diff --git a/docs/source-1.0/spec/aws/aws-json.rst.template b/docs/source-1.0/spec/aws/aws-json.rst.template index ed874431291..64197047214 100644 --- a/docs/source-1.0/spec/aws/aws-json.rst.template +++ b/docs/source-1.0/spec/aws/aws-json.rst.template @@ -50,7 +50,7 @@ The |quoted shape name| protocol uses the following headers: * - ``Content-Length`` - true - The standard ``Content-Length`` header defined by - `RFC 7230 Section 3.3.2`_. + :rfc:`9110#section-8.6`. * - ``X-Amz-Target`` - true for requests - The value of this header is the :token:`shape name ` of the @@ -207,5 +207,3 @@ These compliance tests define a model that is used to define test cases and the expected serialized HTTP requests and responses for each case. *TODO: Add event stream handling specifications.* - -.. _`RFC 7230 Section 3.3.2`: https://tools.ietf.org/html/rfc7230#section-3.3.2 diff --git a/docs/source-1.0/spec/aws/aws-query-serialization.rst.template b/docs/source-1.0/spec/aws/aws-query-serialization.rst.template index 4b11f1fbb8f..fac8711b531 100644 --- a/docs/source-1.0/spec/aws/aws-query-serialization.rst.template +++ b/docs/source-1.0/spec/aws/aws-query-serialization.rst.template @@ -97,5 +97,3 @@ to the input's key. * - ``union`` - A union is serialized identically to a ``structure`` shape, but only a single member can be set to a non-null value. - -.. _`RFC 7230 Section 3.3.2`: https://tools.ietf.org/html/rfc7230#section-3.3.2 diff --git a/docs/source-1.0/spec/core/http-traits.rst b/docs/source-1.0/spec/core/http-traits.rst index fe8d7e1c1fb..2ae3190bfa8 100644 --- a/docs/source-1.0/spec/core/http-traits.rst +++ b/docs/source-1.0/spec/core/http-traits.rst @@ -14,8 +14,8 @@ and error structures are considered when serializing HTTP messages. .. important:: - Violating `HTTP specifications`_ or relying on poorly-supported HTTP - functionality when defining HTTP bindings will limit interoperability + Violating :rfc:`HTTP specifications <9110>` or relying on poorly-supported + HTTP functionality when defining HTTP bindings will limit interoperability and likely lead to undefined behavior across Smithy implementations. For example, avoid defining GET/DELETE requests with payloads, defining response payloads for operations with a 204/205 status, etc. @@ -106,9 +106,8 @@ method The ``method`` property defines the HTTP method of the operation (e.g., "GET", "PUT", "POST", "DELETE", "PATCH", etc). Smithy will use this value literally and will perform no validation on the method. The ``method`` value SHOULD -match the ``operation`` production rule of :rfc:`7230#appendix-B`. This -property does not influence the safety or idempotency characteristics of an -operation. +match one of the definitions found in :rfc:`9110#section-9.3`. This property +does not influence the safety or idempotency characteristics of an operation. .. _http-uri: @@ -117,7 +116,7 @@ uri --- The ``uri`` property defines the *request-target* of the operation in -*origin-form* as defined in :rfc:`7230#section-5.3.1`. The URI is a simple +*origin-form* as defined in :rfc:`9112#section-3.2.1`. The URI is a simple pattern that Smithy uses to match HTTP requests to operations and to bind components of the request URI to fields in the operations's input structure. :dfn:`Patterns` consist of literal characters that MUST be matched in the @@ -525,9 +524,8 @@ Trait selector ``structure`` member that targets a list of these types. Value type ``string`` value defining a valid HTTP header field name according to - :rfc:`section 3.2 of RFC7230 <7230#section-3.2>`. The value MUST NOT be - empty and MUST be case-insensitively unique across all other members of - the structure. + :rfc:`9110#section-5.1`. The value MUST NOT be empty and MUST be + case-insensitively unique across all other members of the structure. Conflicts with :ref:`httpLabel-trait`, :ref:`httpQuery-trait`, @@ -954,10 +952,10 @@ the body of the response. .. rubric:: Do not put too much data in the query string -While there is no limit placed on the length of an `HTTP request line`_, -many HTTP client and server implementations enforce limits in practice. -Carefully consider the maximum allowed length of each member that is bound to -an HTTP query string or path. +While there is no limit placed on the length of an +:rfc:`HTTP request line <9112#section-3>`, many HTTP client and server +implementations enforce limits in practice. Carefully consider the maximum +allowed length of each member that is bound to an HTTP query string or path. .. smithy-trait:: smithy.api#httpQueryParams @@ -1335,5 +1333,3 @@ marked with the ``httpPayload`` trait: .. _percent-encoded: https://tools.ietf.org/html/rfc3986#section-2.1 -.. _HTTP request line: https://tools.ietf.org/html/rfc7230.html#section-3.1.1 -.. _HTTP specifications: https://datatracker.ietf.org/doc/html/rfc7230 diff --git a/docs/source-2.0/additional-specs/protocols/smithy-rpc-v2.rst b/docs/source-2.0/additional-specs/protocols/smithy-rpc-v2.rst index 40479383a09..46b54ffa29b 100644 --- a/docs/source-2.0/additional-specs/protocols/smithy-rpc-v2.rst +++ b/docs/source-2.0/additional-specs/protocols/smithy-rpc-v2.rst @@ -238,7 +238,7 @@ headers for requests: is ``application/vnd.amazon.eventstream``. * - ``Content-Length`` - Conditional - - The standard ``Content-Length`` header defined by :rfc:`7230#section-3.3.2`. + - The standard ``Content-Length`` header defined by :rfc:`9110#section-8.6`. For event streaming requests, this MUST NOT be set. * - ``Accept`` - Conditional @@ -303,7 +303,7 @@ headers for responses: is ``application/vnd.amazon.eventstream``. * - ``Content-Length`` - Conditional - - The standard ``Content-Length`` header defined by :rfc:`7230#section-3.3.2`. + - The standard ``Content-Length`` header defined by :rfc:`9110#section-8.6`. For event streaming requests, this SHOULD NOT be set. diff --git a/docs/source-2.0/aws/protocols/aws-json.rst.template b/docs/source-2.0/aws/protocols/aws-json.rst.template index e77914073ad..0e28b73a108 100644 --- a/docs/source-2.0/aws/protocols/aws-json.rst.template +++ b/docs/source-2.0/aws/protocols/aws-json.rst.template @@ -50,7 +50,7 @@ The |quoted shape name| protocol uses the following headers: * - ``Content-Length`` - true - The standard ``Content-Length`` header defined by - :rfc:`7230#section-3.3.2`. + :rfc:`9110#section-8.6`. * - ``X-Amz-Target`` - true for requests - The value of this header is the :token:`shape name ` of the diff --git a/docs/source-2.0/spec/http-bindings.rst b/docs/source-2.0/spec/http-bindings.rst index 7d474e15207..b177a54542f 100644 --- a/docs/source-2.0/spec/http-bindings.rst +++ b/docs/source-2.0/spec/http-bindings.rst @@ -14,7 +14,7 @@ and error structures are considered when serializing HTTP messages. .. important:: - Violating :rfc:`HTTP specifications <7230>` or relying on poorly-supported + Violating :rfc:`HTTP specifications <9110>` or relying on poorly-supported HTTP functionality when defining HTTP bindings will limit interoperability and likely lead to undefined behavior across Smithy implementations. For example, avoid defining GET/DELETE requests with payloads, defining @@ -107,9 +107,8 @@ method The ``method`` property defines the HTTP method of the operation (e.g., "GET", "PUT", "POST", "DELETE", "PATCH", etc). Smithy will use this value literally and will perform no validation on the method. The ``method`` value SHOULD -match the ``operation`` production rule of :rfc:`7230#appendix-B`. This -property does not influence the safety or idempotency characteristics of an -operation. +match one of the definitions found in :rfc:`9110#section-9.3`. This property +does not influence the safety or idempotency characteristics of an operation. .. _http-uri: @@ -118,7 +117,7 @@ uri --- The ``uri`` property defines the *request-target* of the operation in -*origin-form* as defined in :rfc:`7230#section-5.3.1`. The URI is a simple +*origin-form* as defined in :rfc:`9112#section-3.2.1`. The URI is a simple pattern that Smithy uses to match HTTP requests to operations and to bind components of the request URI to fields in the operations's input structure. :dfn:`Patterns` consist of literal characters that MUST be matched in the @@ -634,9 +633,8 @@ Trait selector ``structure`` member that targets a list of these types. Value type ``string`` value defining a valid HTTP header field name according to - :rfc:`section 3.2 of RFC7230 <7230#section-3.2>`. The value MUST NOT be - empty and MUST be case-insensitively unique across all other members of - the structure. + :rfc:`9110#section-5.1`. The value MUST NOT be empty and MUST be + case-insensitively unique across all other members of the structure. Conflicts with :ref:`httpLabel-trait`, :ref:`httpQuery-trait`, @@ -1089,7 +1087,7 @@ is simply ignored. .. note:: While there is no limit placed on the length of an - :rfc:`HTTP request line <7230#section-3.1.1>`, many HTTP client and server + :rfc:`HTTP request line <9112#section-3>`, many HTTP client and server implementations enforce limits in practice. Carefully consider the maximum allowed length of each member that is bound to an HTTP query string or path. diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/pattern/UriPattern.java b/smithy-model/src/main/java/software/amazon/smithy/model/pattern/UriPattern.java index e9847ed2e92..7cc90857c16 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/pattern/UriPattern.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/pattern/UriPattern.java @@ -55,12 +55,12 @@ private UriPattern(Builder builder, Map queryLiterals) { * Parse a URI pattern string into a UriPattern. * *

The provided value must match the origin-form request-target - * grammar production in RFC 7230, section 5.3.1. + * grammar production in RFC 9112, section 3.2.1. * * @param uri URI pattern to parse. * @return Returns the parsed URI pattern. * @throws InvalidUriPatternException for invalid URI patterns. - * @see RFC 7230 Section 5.3.1 + * @see RFC 9112 Section 3.2.1 */ public static UriPattern parse(String uri) { if (uri.endsWith("?")) { diff --git a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/HttpHeaderTraitValidator.java b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/HttpHeaderTraitValidator.java index a438298b1df..45dbff2f265 100644 --- a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/HttpHeaderTraitValidator.java +++ b/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/HttpHeaderTraitValidator.java @@ -39,7 +39,7 @@ */ public final class HttpHeaderTraitValidator extends AbstractValidator { - /** Gather the allowed characters for HTTP headers (tchar from RFC 7230). **/ + /** Gather the allowed characters for HTTP headers (tchar from RFC 9110 section 5.6.2). **/ private static final Set TCHAR = SetUtils.of( // "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" '!', '#', '$', '%', '&', '\'', '*', '+', '-', '.', '^', '_', '`', '|', '~', @@ -101,7 +101,7 @@ private Optional validateHeader(MemberShape member, HttpHeaderT for (int i = 0; i < header.length(); i++) { if (!TCHAR.contains(header.charAt(i))) { return Optional.of(danger(member, trait, String.format( - "`%s` is not a valid HTTP header field name according to section 3.2 of RFC 7230", header))); + "`%s` is not a valid HTTP header field name according to section 5.6.2 of RFC 9110", header))); } } diff --git a/smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/validators/http-header-tchar-validator.errors b/smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/validators/http-header-tchar-validator.errors index f1242ede63f..b0650ee97ae 100644 --- a/smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/validators/http-header-tchar-validator.errors +++ b/smithy-model/src/test/resources/software/amazon/smithy/model/errorfiles/validators/http-header-tchar-validator.errors @@ -1 +1 @@ -[DANGER] ns.foo#SayHelloInput$myHeader: `Not valid!` is not a valid HTTP header field name according to section 3.2 of RFC 7230 | HttpHeaderTrait +[DANGER] ns.foo#SayHelloInput$myHeader: `Not valid!` is not a valid HTTP header field name according to section 5.6.2 of RFC 9110 | HttpHeaderTrait diff --git a/smithy-utils/src/main/java/software/amazon/smithy/utils/MediaType.java b/smithy-utils/src/main/java/software/amazon/smithy/utils/MediaType.java index 66b8e43f9a9..66ff1679452 100644 --- a/smithy-utils/src/main/java/software/amazon/smithy/utils/MediaType.java +++ b/smithy-utils/src/main/java/software/amazon/smithy/utils/MediaType.java @@ -154,7 +154,7 @@ public int hashCode() { } private static final class Parser extends SimpleParser { - // See https://tools.ietf.org/html/rfc7230#section-3.2.6 + // See https://tools.ietf.org/html/rfc9110#section-5.6.2 // token = 1*tchar // tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" // / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~" @@ -240,7 +240,7 @@ private String parseToken() { return sliceFrom(start); } - // See https://tools.ietf.org/html/rfc7230#section-3.2.6 + // See https://tools.ietf.org/html/rfc9110#section-5.6.4 // quoted-string = DQUOTE *( qdtext / quoted-pair ) DQUOTE // qdtext = HTAB / SP /%x21 / %x23-5B / %x5D-7E / obs-text // obs-text = %x80-FF