Skip to content

Commit

Permalink
Merge 29bb458 into 9e17885
Browse files Browse the repository at this point in the history
  • Loading branch information
trustin committed Mar 9, 2021
2 parents 9e17885 + 29bb458 commit 0c97d5c
Show file tree
Hide file tree
Showing 67 changed files with 212 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
public interface ThrottlingHeaders {
/**
* Describes
* <a href="https://tools.ietf.org/id/draft-polli-ratelimit-headers-00.html">RateLimit Header Scheme for HTTP</a>.
* For example:
* <a href="https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/">RateLimit Header Fields
* for HTTP</a>. For example:
* <pre>{@code
* RateLimit-Limit: 10
* RateLimit-Remaining: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public static BandwidthLimit of(long limit, Duration period) {
* Returns a newly created {@link BandwidthLimit}. Computes {@code limit}, {@code overdraftLimit},
* {@code initialSize} and {@code period} out of a semicolon-separated {@code specification} string
* that conforms to the following format,
* as per <a href="https://tools.ietf.org/id/draft-polli-ratelimit-headers-00.html">RateLimit Header Scheme for HTTP</a>:
* as per <a href="https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/">RateLimit Header
* Fields for HTTP</a>:
* <pre>{@code
* <limit>;window=<period(in seconds)>[;burst=<overdraftLimit>][;initial=<initialSize>]
* }</pre>
Expand Down Expand Up @@ -195,7 +196,8 @@ public String toString() {

/**
* Returns a string representation of the {@link BandwidthLimit} in the following format,
* as per <a href="https://tools.ietf.org/id/draft-polli-ratelimit-headers-00.html">RateLimit Header Scheme for HTTP</a>:
* as per <a href="https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/">RateLimit Header
* Fields for HTTP</a>:
* <pre>{@code
* <limit>;window=<period(in seconds)>[;burst=<overdraftLimit>][;policy="token bucket"]
* }</pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public static TokenBucketBuilder builder() {
/**
* Returns a newly created {@link TokenBucket}. Computes a set of {@link BandwidthLimit} out of
* a comma-separated {@code specification} string that conforms to the following format,
* as per <a href="https://tools.ietf.org/id/draft-polli-ratelimit-headers-00.html">RateLimit Header Scheme for HTTP</a>:
* as per <a href="https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/">RateLimit Header
* Fields for HTTP</a>:
* <pre>{@code
* <bandwidth limit 1>[, <bandwidth limit 2>[, etc.]]
* }</pre>
Expand Down Expand Up @@ -135,7 +136,8 @@ BandwidthLimit lowestLimit() {

/**
* Returns a string representation of the multiple limits in the following format,
* as per <a href="https://tools.ietf.org/id/draft-polli-ratelimit-headers-00.html">RateLimit Header Scheme for HTTP</a>:
* as per <a href="https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/">RateLimit Header
* Fields for HTTP</a>:
* <pre>{@code
* <lowest limit>, <first limit>;window=<first period(in seconds)>;burst=<first overdraftLimit>,
* <second limit>;window=<second period(in seconds)>;burst=<second overdraftLimit>, etc.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
/**
* A specification of a {@link TokenBucket} configuration represented by a string. The string syntax is
* a series of comma-separated {@link BandwidthLimit} configurations and each values is semicolon-separated,
* as per <a href="https://tools.ietf.org/id/draft-polli-ratelimit-headers-00.html">RateLimit Header Scheme for HTTP</a>.
* as per <a href="https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/">RateLimit Header
* Fields for HTTP</a>.
*
* @see #parseTokenBucket(String) for detailed format of the specification.
*/
Expand Down Expand Up @@ -143,7 +144,9 @@ static TokenBucket parseTokenBucket(String specification) {
* For example: "100;window=60;burst=1000".
* <br>
* This method used to compose Quota Policy response header to inform the client about rate
* limiting policy as per <a href="https://tools.ietf.org/id/draft-polli-ratelimit-headers-00.html">RateLimit Header Scheme for HTTP</a>.
* limiting policy as per
* <a href="https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/">RateLimit Header Fields
* for HTTP</a>.
*
* @return A {@link String} representation of the {@link BandwidthLimit}.
*/
Expand Down Expand Up @@ -174,7 +177,9 @@ static String toString(@Nullable BandwidthLimit bandwidthLimit) {
* For example: "100;window=60;burst=1000, 5000;window=3600".
* <br>
* This method used to compose Quota Policy response header to inform the client about rate
* limiting policy as per <a href="https://tools.ietf.org/id/draft-polli-ratelimit-headers-00.html">RateLimit Header Scheme for HTTP</a>.
* limiting policy as per
* <a href="https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/">RateLimit Header Fields
* for HTTP</a>.
*
* @return A {@link String} representation of the {@link TokenBucket}.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,12 @@ public ClientFactoryBuilder tlsCustomizer(Consumer<? super SslContextBuilder> tl

/**
* Allows the bad cipher suites listed in
* <a href="https://tools.ietf.org/html/rfc7540#appendix-A">RFC7540</a> for TLS handshake.
* <a href="https://datatracker.ietf.org/doc/html/rfc7540#appendix-A">RFC7540</a> for TLS handshake.
*
* <p>Note that enabling this option increases the security risk of your connection.
* Use it only when you must communicate with a legacy system that does not support
* secure cipher suites.
* See <a href="https://tools.ietf.org/html/rfc7540#section-9.2.2">Section 9.2.2, RFC7540</a> for
* See <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-9.2.2">Section 9.2.2, RFC7540</a> for
* more information. This option is disabled by default.
*
* @deprecated It's not recommended to enable this option. Use it only when you have no other way to
Expand All @@ -324,12 +324,12 @@ public ClientFactoryBuilder tlsAllowUnsafeCiphers() {

/**
* Allows the bad cipher suites listed in
* <a href="https://tools.ietf.org/html/rfc7540#appendix-A">RFC7540</a> for TLS handshake.
* <a href="https://datatracker.ietf.org/doc/html/rfc7540#appendix-A">RFC7540</a> for TLS handshake.
*
* <p>Note that enabling this option increases the security risk of your connection.
* Use it only when you must communicate with a legacy system that does not support
* secure cipher suites.
* See <a href="https://tools.ietf.org/html/rfc7540#section-9.2.2">Section 9.2.2, RFC7540</a> for
* See <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-9.2.2">Section 9.2.2, RFC7540</a> for
* more information. This option is disabled by default.
*
* @param tlsAllowUnsafeCiphers Whether to allow the unsafe ciphers
Expand Down Expand Up @@ -379,7 +379,7 @@ public ClientFactoryBuilder domainNameResolverCustomizer(
}

/**
* Sets the <a href="https://tools.ietf.org/html/rfc7540#section-6.9.2">initial connection flow-control
* Sets the <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.9.2">initial connection flow-control
* window size</a>. The HTTP/2 connection is first established with
* {@value Http2CodecUtil#DEFAULT_WINDOW_SIZE} bytes of connection flow-control window size,
* and it is changed if and only if {@code http2InitialConnectionWindowSize} is set.
Expand All @@ -396,7 +396,7 @@ public ClientFactoryBuilder http2InitialConnectionWindowSize(int http2InitialCon
}

/**
* Sets the <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">SETTINGS_INITIAL_WINDOW_SIZE</a>
* Sets the <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.2">SETTINGS_INITIAL_WINDOW_SIZE</a>
* for HTTP/2 stream-level flow control. Note that this setting affects the window size of all streams,
* not the connection-level window size.
*
Expand All @@ -411,7 +411,7 @@ public ClientFactoryBuilder http2InitialStreamWindowSize(int http2InitialStreamW
}

/**
* Sets the <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">SETTINGS_MAX_FRAME_SIZE</a>
* Sets the <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.2">SETTINGS_MAX_FRAME_SIZE</a>
* that indicates the size of the largest frame payload that this client is willing to receive.
*/
public ClientFactoryBuilder http2MaxFrameSize(int http2MaxFrameSize) {
Expand All @@ -424,7 +424,7 @@ public ClientFactoryBuilder http2MaxFrameSize(int http2MaxFrameSize) {
}

/**
* Sets the <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">SETTINGS_MAX_HEADER_LIST_SIZE</a>
* Sets the <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.2">SETTINGS_MAX_HEADER_LIST_SIZE</a>
* that indicates the maximum size of header list that the client is prepared to accept, in octets.
*/
public ClientFactoryBuilder http2MaxHeaderListSize(long http2MaxHeaderListSize) {
Expand Down Expand Up @@ -494,9 +494,9 @@ public ClientFactoryBuilder idleTimeoutMillis(long idleTimeoutMillis) {
/**
* Sets the PING interval in milliseconds.
* When neither read nor write was performed for the given {@code pingIntervalMillis},
* a <a href="https://httpwg.org/specs/rfc7540.html#PING">PING</a> frame is sent for HTTP/2 or
* an <a href="https://tools.ietf.org/html/rfc7231#section-4.3.7">OPTIONS</a> request with an asterisk ("*")
* is sent for HTTP/1.
* a <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.7">PING</a> frame is sent for HTTP/2
* or an <a href="https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.7">OPTIONS</a> request with
* an asterisk ("*") is sent for HTTP/1.
*
* <p>Note that this settings is only in effect when {@link #idleTimeoutMillis(long)}} or
* {@link #idleTimeout(Duration)} is greater than the specified PING interval.
Expand All @@ -518,9 +518,9 @@ public ClientFactoryBuilder pingIntervalMillis(long pingIntervalMillis) {
/**
* Sets the PING interval.
* When neither read nor write was performed for the given {@code pingInterval},
* a <a href="https://httpwg.org/specs/rfc7540.html#PING">PING</a> frame is sent for HTTP/2 or
* an <a href="https://tools.ietf.org/html/rfc7231#section-4.3.7">OPTIONS</a> request with an asterisk ("*")
* is sent for HTTP/1.
* a <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.7">PING</a> frame is sent for HTTP/2
* or an <a href="https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.7">OPTIONS</a> request with
* an asterisk ("*") is sent for HTTP/1.
*
* <p>Note that this settings is only in effect when {@link #idleTimeoutMillis(long)}} or
* {@link #idleTimeout(Duration)} is greater than the specified PING interval.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ public final class ClientFactoryOptions

/**
* Whether to allow the bad cipher suites listed in
* <a href="https://tools.ietf.org/html/rfc7540#appendix-A">RFC7540</a> for TLS handshake.
* <a href="https://datatracker.ietf.org/doc/html/rfc7540#appendix-A">RFC7540</a> for TLS handshake.
*
* <p>Note that enabling this option increases the security risk of your connection.
* Use it only when you must communicate with a legacy system that does not support
* secure cipher suites.
* See <a href="https://tools.ietf.org/html/rfc7540#section-9.2.2">Section 9.2.2, RFC7540</a> for
* See <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-9.2.2">Section 9.2.2, RFC7540</a> for
* more information.
*
* @deprecated It's not recommended to enable this option. Use it only when you have no other way to
Expand All @@ -106,30 +106,30 @@ public final class ClientFactoryOptions
eventLoopGroup -> new DnsResolverGroupBuilder().build(eventLoopGroup));

/**
* The HTTP/2 <a href="https://tools.ietf.org/html/rfc7540#section-6.9.2">initial connection flow-control
* The HTTP/2 <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.9.2">initial connection flow-control
* window size</a>.
*/
public static final ClientFactoryOption<Integer> HTTP2_INITIAL_CONNECTION_WINDOW_SIZE =
ClientFactoryOption.define("HTTP2_INITIAL_CONNECTION_WINDOW_SIZE",
Flags.defaultHttp2InitialConnectionWindowSize());

/**
* The <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">SETTINGS_INITIAL_WINDOW_SIZE</a>
* The <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.2">SETTINGS_INITIAL_WINDOW_SIZE</a>
* for HTTP/2 stream-level flow control.
*/
public static final ClientFactoryOption<Integer> HTTP2_INITIAL_STREAM_WINDOW_SIZE =
ClientFactoryOption.define("HTTP2_INITIAL_STREAM_WINDOW_SIZE",
Flags.defaultHttp2InitialStreamWindowSize());

/**
* The <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">SETTINGS_MAX_FRAME_SIZE</a>
* The <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.2">SETTINGS_MAX_FRAME_SIZE</a>
* that indicates the size of the largest frame payload that this client is willing to receive.
*/
public static final ClientFactoryOption<Integer> HTTP2_MAX_FRAME_SIZE =
ClientFactoryOption.define("HTTP2_MAX_FRAME_SIZE", Flags.defaultHttp2MaxFrameSize());

/**
* The HTTP/2 <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">SETTINGS_MAX_HEADER_LIST_SIZE</a>
* The HTTP/2 <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.2">SETTINGS_MAX_HEADER_LIST_SIZE</a>
* that indicates the maximum size of header list that the client is prepared to accept, in octets.
*/
public static final ClientFactoryOption<Long> HTTP2_MAX_HEADER_LIST_SIZE =
Expand Down Expand Up @@ -163,9 +163,9 @@ public final class ClientFactoryOptions
/**
* The PING interval in milliseconds.
* When neither read nor write was performed for the specified period of time,
* a <a href="https://httpwg.org/specs/rfc7540.html#PING">PING</a> frame is sent for HTTP/2 or
* an <a href="https://tools.ietf.org/html/rfc7231#section-4.3.7">OPTIONS</a> request with an asterisk ("*")
* is sent for HTTP/1.
* a <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.7">PING</a> frame is sent for HTTP/2
* or an <a href="https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.7">OPTIONS</a> request with
* an asterisk ("*") is sent for HTTP/1.
*/
public static final ClientFactoryOption<Long> PING_INTERVAL_MILLIS =
ClientFactoryOption.define("PING_INTERVAL_MILLIS", Flags.defaultPingIntervalMillis());
Expand Down Expand Up @@ -381,31 +381,31 @@ public Consumer<? super SslContextBuilder> tlsCustomizer() {
}

/**
* Returns the HTTP/2 <a href="https://tools.ietf.org/html/rfc7540#section-6.9.2">initial connection
* Returns the HTTP/2 <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.9.2">initial connection
* flow-control window size</a>.
*/
public int http2InitialConnectionWindowSize() {
return get(HTTP2_INITIAL_CONNECTION_WINDOW_SIZE);
}

/**
* Returns the <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">SETTINGS_INITIAL_WINDOW_SIZE</a>
* Returns the <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.2">SETTINGS_INITIAL_WINDOW_SIZE</a>
* for HTTP/2 stream-level flow control.
*/
public int http2InitialStreamWindowSize() {
return get(HTTP2_INITIAL_STREAM_WINDOW_SIZE);
}

/**
* Returns the <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">SETTINGS_MAX_FRAME_SIZE</a>
* Returns the <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.2">SETTINGS_MAX_FRAME_SIZE</a>
* that indicates the size of the largest frame payload that this client is willing to receive.
*/
public int http2MaxFrameSize() {
return get(HTTP2_MAX_FRAME_SIZE);
}

/**
* Returns the HTTP/2 <a href="https://tools.ietf.org/html/rfc7540#section-6.5.2">
* Returns the HTTP/2 <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.5.2">
* SETTINGS_MAX_HEADER_LIST_SIZE</a> that indicates the maximum size of header list
* that the client is prepared to accept, in octets.
*/
Expand Down Expand Up @@ -444,9 +444,9 @@ public long idleTimeoutMillis() {
/**
* Returns the PING interval in milliseconds.
* When neither read nor write was performed for the specified period of time,
* a <a href="https://httpwg.org/specs/rfc7540.html#PING">PING</a> frame is sent for HTTP/2 or
* an <a href="https://tools.ietf.org/html/rfc7231#section-4.3.7">OPTIONS</a> request with an asterisk ("*")
* is sent for HTTP/1.
* a <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-6.7">PING</a> frame is sent for HTTP/2
* or an <a href="https://datatracker.ietf.org/doc/html/rfc7231#section-4.3.7">OPTIONS</a> request with
* an asterisk ("*") is sent for HTTP/1.
*/
public long pingIntervalMillis() {
return get(PING_INTERVAL_MILLIS);
Expand Down Expand Up @@ -516,12 +516,12 @@ public Http1HeaderNaming http1HeaderNaming() {

/**
* Returns whether to allow the bad cipher suites listed in
* <a href="https://tools.ietf.org/html/rfc7540#appendix-A">RFC7540</a> for TLS handshake.
* <a href="https://datatracker.ietf.org/doc/html/rfc7540#appendix-A">RFC7540</a> for TLS handshake.
*
* <p>Note that enabling this option increases the security risk of your connection.
* Use it only when you must communicate with a legacy system that does not support
* secure cipher suites.
* See <a href="https://tools.ietf.org/html/rfc7540#section-9.2.2">Section 9.2.2, RFC7540</a> for
* See <a href="https://datatracker.ietf.org/doc/html/rfc7540#section-9.2.2">Section 9.2.2, RFC7540</a> for
* more information.
*/
public boolean tlsAllowUnsafeCiphers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private HttpObject convertHeaders(RequestHeaders headers, boolean endStream) {
nettyHeaders.remove(HttpHeaderNames.TRANSFER_ENCODING);

// Set or remove the 'content-length' header depending on request method.
// See: https://tools.ietf.org/html/rfc7230#section-3.3.2
// See: https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2
//
// > A user agent SHOULD send a Content-Length in a request message when
// > no Transfer-Encoding is sent and the request method defines a meaning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ ClientRequestContext newDerivedContext(RequestId id, @Nullable HttpRequest req,

/**
* Returns the fragment part of the URI of the current {@link Request}, as defined in
* <a href="https://tools.ietf.org/html/rfc3986#section-3.5">the section 3.5 of RFC3986</a>.
* <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.5">the section 3.5 of RFC3986</a>.
*
* @return the fragment part of the request URI, or {@code null} if no fragment was specified
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ public DnsResolverGroupBuilder ndots(int ndots) {

/**
* Sets if the domain and host names should be decoded to unicode when received.
* See <a href="https://tools.ietf.org/html/rfc3492">rfc3492</a>. This flag is enabled by default.
* See <a href="https://datatracker.ietf.org/doc/rfc3492/">rfc3492</a>. This flag is enabled by default.
*
* @see DnsNameResolverBuilder#decodeIdn(boolean)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public final class Endpoint implements Comparable<Endpoint>, EndpointGroup {

/**
* Validator for the scheme part of the URI, as defined in
* <a href="https://tools.ietf.org/html/rfc3986#section-3.1">the section 3.1 of RFC3986</a>.
* <a href="https://datatracker.ietf.org/doc/html/rfc3986#section-3.1">the section 3.1 of RFC3986</a>.
*/
private static final Predicate<String> SCHEME_VALIDATOR =
scheme -> Pattern.compile("^([a-z][a-z0-9+\\-.]*)").matcher(scheme).matches();
Expand Down
Loading

0 comments on commit 0c97d5c

Please sign in to comment.