This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/master by this push:
new 4705b2f492 FELIX-6595 : Update to Commons Fileupload 1.5
4705b2f492 is described below
commit 4705b2f49205a32bbc5f8b14b78e76b29d66e77f
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Tue Feb 21 10:54:50 2023 +0100
FELIX-6595 : Update to Commons Fileupload 1.5
---
.../http/base/internal/dispatch/MultipartConfig.java | 19 ++++++++++++++++---
.../base/internal/dispatch/ServletRequestWrapper.java | 2 +-
.../http/base/internal/handler/ServletHandler.java | 3 ++-
.../felix/http/base/internal/runtime/ServletInfo.java | 3 ++-
http/bridge/pom.xml | 2 +-
http/itest/pom.xml | 2 +-
http/jetty/pom.xml | 2 +-
7 files changed, 24 insertions(+), 9 deletions(-)
diff --git
a/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/MultipartConfig.java
b/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/MultipartConfig.java
index 42e04caa73..2c19cfe545 100644
---
a/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/MultipartConfig.java
+++
b/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/MultipartConfig.java
@@ -20,9 +20,9 @@ import org.apache.commons.fileupload.disk.DiskFileItemFactory;
public final class MultipartConfig
{
- public static final MultipartConfig DEFAULT_CONFIG = new
MultipartConfig(null, null, -1, -1);
+ public static final MultipartConfig DEFAULT_CONFIG = new
MultipartConfig(null, null, -1, -1, -1);
- public static final MultipartConfig INVALID_CONFIG = new
MultipartConfig(null, null, -1, -1);
+ public static final MultipartConfig INVALID_CONFIG = new
MultipartConfig(null, null, -1, -1, -1);
/**
* Specifies the multipart threshold
@@ -44,10 +44,16 @@ public final class MultipartConfig
*/
public final long multipartMaxRequestSize;
+ /**
+ * Specifies the multipart max files
+ */
+ public final long multipartMaxFileCount;
+
public MultipartConfig(final Integer threshold,
final String location,
final long maxFileSize,
- final long maxRequestSize)
+ final long maxRequestSize,
+ final long maxFileCount)
{
if ( threshold != null && threshold > 0)
{
@@ -72,5 +78,12 @@ public final class MultipartConfig
{
this.multipartMaxRequestSize = -1;
}
+ if ( maxFileCount > 0 ) {
+ this.multipartMaxFileCount = maxFileCount;
+ }
+ else
+ {
+ this.multipartMaxFileCount = 50;
+ }
}
}
diff --git
a/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/ServletRequestWrapper.java
b/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/ServletRequestWrapper.java
index 034b6e150b..d261cbd38f 100644
---
a/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/ServletRequestWrapper.java
+++
b/http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/ServletRequestWrapper.java
@@ -469,7 +469,7 @@ final class ServletRequestWrapper extends
HttpServletRequestWrapper
upload.setFileSizeMax(this.multipartConfig.multipartMaxFileSize);
upload.setFileItemFactory(new
DiskFileItemFactory(this.multipartConfig.multipartThreshold,
new File(this.multipartConfig.multipartLocation)));
-
+ upload.setFileCountMax(this.multipartConfig.multipartMaxFileCount);
// Parse the request
List<FileItem> items = null;
try
diff --git
a/http/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java
b/http/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java
index 658e2806b0..9b41b66b29 100644
---
a/http/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java
+++
b/http/base/src/main/java/org/apache/felix/http/base/internal/handler/ServletHandler.java
@@ -84,7 +84,8 @@ public abstract class ServletHandler implements
Comparable<ServletHandler>
this.mpConfig = new MultipartConfig(origConfig.multipartThreshold,
location,
origConfig.multipartMaxFileSize,
- origConfig.multipartMaxRequestSize);
+ origConfig.multipartMaxRequestSize,
+ origConfig.multipartMaxFileCount);
}
else
{
diff --git
a/http/base/src/main/java/org/apache/felix/http/base/internal/runtime/ServletInfo.java
b/http/base/src/main/java/org/apache/felix/http/base/internal/runtime/ServletInfo.java
index 8a86fc4565..dcdbbe6c5c 100644
---
a/http/base/src/main/java/org/apache/felix/http/base/internal/runtime/ServletInfo.java
+++
b/http/base/src/main/java/org/apache/felix/http/base/internal/runtime/ServletInfo.java
@@ -97,7 +97,8 @@ public class ServletInfo extends
WhiteboardServiceInfo<Servlet>
cfg = new MultipartConfig(getIntProperty(ref,
HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_MULTIPART_FILESIZETHRESHOLD),
getStringProperty(ref,
HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_MULTIPART_LOCATION),
getLongProperty(ref,
HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_MULTIPART_MAXFILESIZE),
- getLongProperty(ref,
HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_MULTIPART_MAXREQUESTSIZE));
+ getLongProperty(ref,
HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_MULTIPART_MAXREQUESTSIZE),
+ getLongProperty(ref,
"osgi.http.whiteboard.servlet.multipart.maxFileCount"));
}
catch (final IllegalArgumentException iae)
{
diff --git a/http/bridge/pom.xml b/http/bridge/pom.xml
index acf57668d7..525cce8044 100644
--- a/http/bridge/pom.xml
+++ b/http/bridge/pom.xml
@@ -163,7 +163,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.base</artifactId>
- <version>5.0.0</version>
+ <version>5.0.2</version>
</dependency>
</dependencies>
</project>
diff --git a/http/itest/pom.xml b/http/itest/pom.xml
index d4a1b0712b..0d0506f011 100644
--- a/http/itest/pom.xml
+++ b/http/itest/pom.xml
@@ -35,7 +35,7 @@
<pax.exam.version>4.13.1</pax.exam.version>
<pax.url.aether.version>2.6.2</pax.url.aether.version>
<http.servlet.api.version>2.1.0</http.servlet.api.version>
- <http.jetty.version>5.0.1-SNAPSHOT</http.jetty.version>
+ <http.jetty.version>5.0.5-SNAPSHOT</http.jetty.version>
</properties>
<build>
diff --git a/http/jetty/pom.xml b/http/jetty/pom.xml
index 45b322f907..60f61aff67 100644
--- a/http/jetty/pom.xml
+++ b/http/jetty/pom.xml
@@ -409,7 +409,7 @@
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.base</artifactId>
- <version>5.0.0</version>
+ <version>5.0.2</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>