[
https://issues.apache.org/jira/browse/KNOX-2897?focusedWorklogId=856194&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-856194
]
ASF GitHub Bot logged work on KNOX-2897:
----------------------------------------
Author: ASF GitHub Bot
Created on: 11/Apr/23 17:56
Start Date: 11/Apr/23 17:56
Worklog Time Spent: 10m
Work Description: risdenk commented on code in PR #747:
URL: https://github.com/apache/knox/pull/747#discussion_r1163155678
##########
gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/KnoxBufferedHttpEntity.java:
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+package org.apache.knox.gateway.dispatch;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.entity.BufferedHttpEntity;
+import org.apache.http.entity.HttpEntityWrapper;
+import org.apache.http.util.Args;
+
+/**
+ * A {@link BufferedHttpEntity} implementation with the following differences:
+ * <ul>
+ * <li>Reading the content of the given entity does not happen at instance
creation time (i.e not in the constructor)
+ * <li>Content length calculation is not based on the buffer but a delegate to
the wrapped entity
+ * </ul>
+ */
+public class KnoxBufferedHttpEntity extends HttpEntityWrapper {
+
+ private byte[] buffer;
Review Comment:
There are no bounds checks for copying to this buffer? Can someone just
crash Knox by sending a really large content stream that is not repeatable?
I thought that was part of the theory behind why there was a replay buffer
size - to avoid copying the entire stream into memory.
Issue Time Tracking
-------------------
Worklog Id: (was: 856194)
Time Spent: 20m (was: 10m)
> Eliminate or minimize the need for replayBufferSize configuration
> -----------------------------------------------------------------
>
> Key: KNOX-2897
> URL: https://issues.apache.org/jira/browse/KNOX-2897
> Project: Apache Knox
> Issue Type: Task
> Components: Server
> Affects Versions: 1.2.0, 1.3.0, 1.4.0, 1.5.0, 2.0.0, 1.6.0, 1.6.1
> Reporter: Sandor Molnar
> Assignee: Sandor Molnar
> Priority: Critical
> Fix For: 2.1.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Eliminate or minimize the need for {{replayBufferSize}} configuration
> adjustments to overcome frequent proxying issues with some components.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)