ok2c commented on code in PR #742: URL: https://github.com/apache/httpcomponents-core/pull/742#discussion_r4541353599
########## httpcore5-h2/src/main/java/org/apache/hc/core5/http2/impl/nio/H2RapidResetLimiter.java: ########## @@ -0,0 +1,62 @@ +/* + * ==================================================================== + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ +package org.apache.hc.core5.http2.impl.nio; + +import java.util.concurrent.TimeUnit; + +import org.apache.hc.core5.util.Args; + +/** + * Per-connection protection against rapid cancellation of peer-initiated HTTP/2 streams. + * Uses the same constant-time token bucket as the existing control-frame limiter, but + * charges only resets that occur shortly after stream activation. + * + * <p>This is a resource policy, not an additional RFC 9113 protocol rule.</p> + */ +final class H2RapidResetLimiter { Review Comment: @arturobernalg This gets messy. Can we create one class, something like `FrameLimitController` and have it manage multiple token buckets, one for `PING`, one for `SETTINGS` and one for `RST_STREAM`? We might introduce rate control for other frames as well in the future, so it would help to have a more flexible data structure in place. Use hardwired config parameters for now but in the future we may need to have them user configurable. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
