Skip to content

Commit a1222e2

Browse files
authored
Merge branch 'apache:master' into master
2 parents 180cc0b + ae9ef06 commit a1222e2

File tree

18 files changed

+399
-78
lines changed

18 files changed

+399
-78
lines changed

http/README.md

Lines changed: 56 additions & 54 deletions
Large diffs are not rendered by default.

http/base/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<name>Apache Felix Http Base</name>
3030
<artifactId>org.apache.felix.http.base</artifactId>
31-
<version>5.1.13-SNAPSHOT</version>
31+
<version>5.1.15-SNAPSHOT</version>
3232
<packaging>jar</packaging>
3333

3434
<scm>
@@ -144,7 +144,7 @@
144144
<version>1.0.0</version>
145145
<scope>provided</scope>
146146
</dependency>
147-
<!-- Testing -->
147+
<!-- Testing -->
148148
<dependency>
149149
<groupId>junit</groupId>
150150
<artifactId>junit</artifactId>
@@ -154,13 +154,13 @@
154154
<dependency>
155155
<groupId>org.mockito</groupId>
156156
<artifactId>mockito-core</artifactId>
157-
<version>5.7.0</version>
157+
<version>5.17.0</version>
158158
<scope>test</scope>
159159
</dependency>
160160
<dependency>
161161
<groupId>org.eclipse.jetty.ee10.websocket</groupId>
162162
<artifactId>jetty-ee10-websocket-jetty-server</artifactId>
163-
<version>12.0.16</version>
163+
<version>12.0.21</version>
164164
<scope>test</scope>
165165
</dependency>
166166
</dependencies>

http/base/src/main/java/org/apache/felix/http/base/internal/dispatch/Dispatcher.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,15 @@ public void doFilter(final ServletRequest request, final ServletResponse respons
137137
final ExtServletContext servletContext = pr.handler.getContext();
138138
final RequestInfo requestInfo = new RequestInfo(pr.servletPath, pr.pathInfo, null, req.getRequestURI(),
139139
pr.handler.getName(), pr.matchedPattern, pr.matchValue, pr.match, false);
140-
140+
141141
MultipartConfig multipartConfig = pr.handler.getMultipartConfig();
142142
HttpServletRequest wrappedRequest;
143143
if(multipartConfig==null){
144144
wrappedRequest = new ServletRequestWrapper(req,
145145
servletContext,
146146
requestInfo,
147147
null,
148-
pr.handler.getServletInfo().isAsyncSupported());
148+
pr.handler.getServletInfo().isAsyncSupported());
149149
}else {
150150
wrappedRequest = new ServletRequestMultipartWrapper(req,
151151
servletContext,
@@ -174,7 +174,7 @@ public void doFilter(final ServletRequest request, final ServletResponse respons
174174
}
175175
SystemLogger.LOGGER.error("Exception while processing request to " + requestURI, e);
176176
req.setAttribute(RequestDispatcher.ERROR_EXCEPTION, e);
177-
req.setAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE, e.getClass().getName());
177+
req.setAttribute(RequestDispatcher.ERROR_EXCEPTION_TYPE, e.getClass());
178178

179179
if ( !wrappedResponse.isCommitted() )
180180
{

http/bridge/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<name>Apache Felix Http Bridge</name>
3030
<description>This is an implementation of the OSGi Servlet Service, the OSGi Http Service and the OSGi Http Whiteboard Specification used when run as a web application</description>
3131
<artifactId>org.apache.felix.http.bridge</artifactId>
32-
<version>6.0.0-SNAPSHOT</version>
32+
<version>6.0.1-SNAPSHOT</version>
3333
<packaging>bundle</packaging>
3434

3535
<scm>
@@ -186,7 +186,7 @@
186186
<dependency>
187187
<groupId>org.apache.felix</groupId>
188188
<artifactId>org.apache.felix.http.base</artifactId>
189-
<version>5.1.13-SNAPSHOT</version>
189+
<version>5.1.15-SNAPSHOT</version>
190190
</dependency>
191191
<dependency>
192192
<groupId>org.apache.felix</groupId>

http/jetty/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<description>This is an implementation of the R8.1 OSGi Servlet Service, the R7 OSGi Http Service and the R7 OSGi Http Whiteboard Specification</description>
3131

3232
<artifactId>org.apache.felix.http.jetty</artifactId>
33-
<version>5.1.33-SNAPSHOT</version>
33+
<version>5.1.35-SNAPSHOT</version>
3434
<packaging>bundle</packaging>
3535

3636
<scm>
@@ -499,7 +499,7 @@
499499
<dependency>
500500
<groupId>org.apache.felix</groupId>
501501
<artifactId>org.apache.felix.http.base</artifactId>
502-
<version>5.1.13-SNAPSHOT</version>
502+
<version>5.1.15-SNAPSHOT</version>
503503
</dependency>
504504
<dependency>
505505
<groupId>org.apache.felix</groupId>
@@ -516,7 +516,7 @@
516516
<artifactId>commons-io</artifactId>
517517
<version>2.19.0</version>
518518
</dependency>
519-
<!-- Testing -->
519+
<!-- Testing -->
520520
<dependency>
521521
<groupId>junit</groupId>
522522
<artifactId>junit</artifactId>
@@ -526,7 +526,7 @@
526526
<dependency>
527527
<groupId>org.mockito</groupId>
528528
<artifactId>mockito-core</artifactId>
529-
<version>5.7.0</version>
529+
<version>5.17.0</version>
530530
<scope>test</scope>
531531
</dependency>
532532
<dependency>

http/jetty12/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<description>This is an implementation of the R8.1 OSGi Servlet Service, the R7 OSGi Http Service and the R7 OSGi Http Whiteboard Specification</description>
3131

3232
<artifactId>org.apache.felix.http.jetty12</artifactId>
33-
<version>1.0.29-SNAPSHOT</version>
33+
<version>1.0.31-SNAPSHOT</version>
3434
<packaging>bundle</packaging>
3535

3636
<scm>
@@ -42,7 +42,7 @@
4242

4343
<properties>
4444
<felix.java.version>17</felix.java.version>
45-
<jetty.version>12.0.19</jetty.version>
45+
<jetty.version>12.0.21</jetty.version>
4646
<baseline.skip>true</baseline.skip>
4747
<org.ops4j.pax.exam.version>4.13.3</org.ops4j.pax.exam.version>
4848
<!-- To debug the pax process, override this with -D -->
@@ -727,7 +727,7 @@
727727
<dependency>
728728
<groupId>org.apache.felix</groupId>
729729
<artifactId>org.apache.felix.http.base</artifactId>
730-
<version>5.1.13-SNAPSHOT</version>
730+
<version>5.1.15-SNAPSHOT</version>
731731
</dependency>
732732
<dependency>
733733
<groupId>org.apache.felix</groupId>
@@ -745,7 +745,7 @@
745745
<artifactId>commons-io</artifactId>
746746
<version>2.19.0</version>
747747
</dependency>
748-
<!-- Testing -->
748+
<!-- Testing -->
749749
<dependency>
750750
<groupId>junit</groupId>
751751
<artifactId>junit</artifactId>
@@ -755,7 +755,7 @@
755755
<dependency>
756756
<groupId>org.mockito</groupId>
757757
<artifactId>mockito-core</artifactId>
758-
<version>5.7.0</version>
758+
<version>5.17.0</version>
759759
<scope>test</scope>
760760
</dependency>
761761
<dependency>

http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,23 @@ public ObjectClassDefinition getObjectClassDefinition( String id, String locale
203203
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_RESPONSE_BUFFER_SIZE)));
204204

205205
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_MAX_FORM_SIZE,
206-
"Maximum Form Size",
206+
"Maximum Form Size in bytes",
207207
"Size of Body for submitted form content. Default is 200KB.",
208208
204800,
209209
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_MAX_FORM_SIZE)));
210210

211+
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_REQUEST_SIZE_LIMIT,
212+
"Maximum request size in bytes",
213+
"Maximum size of the request body in bytes. Default is unlimited.",
214+
204800,
215+
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_REQUEST_SIZE_LIMIT)));
216+
217+
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_RESPONSE_SIZE_LIMIT,
218+
"Maximum response size in bytes",
219+
"Maximum size of the response body in bytes. Default is unlimited.",
220+
204800,
221+
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_RESPONSE_SIZE_LIMIT)));
222+
211223
adList.add(new AttributeDefinitionImpl(JettyConfig.FELIX_HTTP_PATH_EXCLUSIONS,
212224
"Path Exclusions",
213225
"Contains a list of context path prefixes. If a Web Application Bundle is started with a context path matching any " +

http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,15 @@ public final class JettyConfig
106106
/** Felix specific property to configure the request buffer size. Default is 24KB */
107107
public static final String FELIX_JETTY_RESPONSE_BUFFER_SIZE = "org.apache.felix.http.jetty.responseBufferSize";
108108

109-
/** Felix specific property to configure the max form size. Default is 200KB */
109+
/** Felix specific property to configure the max form size. Default is 200KB. */
110110
public static final String FELIX_JETTY_MAX_FORM_SIZE = "org.apache.felix.http.jetty.maxFormSize";
111111

112+
/** Felix specific property to configure the request size limit. Default is unlimited. See https://jetty.org/docs/jetty/12/programming-guide/server/http.html#handler-use-size-limit */
113+
public static final String FELIX_JETTY_REQUEST_SIZE_LIMIT = "org.apache.felix.http.jetty.requestSizeLimit";
114+
115+
/** Felix specific property to configure the response size limit. Default is unlimited. See https://jetty.org/docs/jetty/12/programming-guide/server/http.html#handler-use-size-limit */
116+
public static final String FELIX_JETTY_RESPONSE_SIZE_LIMIT = "org.apache.felix.http.jetty.responseSizeLimit";
117+
112118
/** Felix specific property to enable Jetty MBeans. Valid values are "true", "false". Default is false */
113119
public static final String FELIX_HTTP_MBEANS = "org.apache.felix.http.mbeans";
114120

@@ -493,6 +499,16 @@ public int getMaxFormSize()
493499
return getIntProperty(FELIX_JETTY_MAX_FORM_SIZE, 200 * 1024);
494500
}
495501

502+
public int getRequestSizeLimit()
503+
{
504+
return getIntProperty(FELIX_JETTY_REQUEST_SIZE_LIMIT, -1);
505+
}
506+
507+
public int getResponseSizeLimit()
508+
{
509+
return getIntProperty(FELIX_JETTY_RESPONSE_SIZE_LIMIT, -1);
510+
}
511+
496512
/**
497513
* Returns the configured session timeout in minutes or zero if not
498514
* configured.

http/jetty12/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import org.eclipse.jetty.server.ServerConnector;
5757
import org.eclipse.jetty.server.SslConnectionFactory;
5858
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
59+
import org.eclipse.jetty.server.handler.SizeLimitHandler;
5960
import org.eclipse.jetty.server.handler.StatisticsHandler;
6061
import org.eclipse.jetty.server.handler.gzip.GzipHandler;
6162
import org.eclipse.jetty.session.HouseKeeper;
@@ -324,6 +325,14 @@ private void initializeJetty() throws Exception
324325
context.addServlet(holder, "/*");
325326
context.setMaxFormContentSize(this.config.getMaxFormSize());
326327

328+
int requestSizeLimit = this.config.getRequestSizeLimit();
329+
int responseSizeLimit = this.config.getResponseSizeLimit();
330+
if (requestSizeLimit > -1 || responseSizeLimit > -1) {
331+
// Use SizeLimitHandler to limit the size of the request body and response
332+
// -1 is unlimited
333+
context.setHandler(new SizeLimitHandler(requestSizeLimit, responseSizeLimit));
334+
}
335+
327336
if (this.config.isRegisterMBeans())
328337
{
329338
this.mbeanServerTracker = new MBeanServerTracker(this.context, this.server);

http/jetty12/src/test/java/org/apache/felix/http/jetty/it/AbstractJettyTestSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import org.ops4j.pax.exam.util.PathUtils;
4444

4545
public abstract class AbstractJettyTestSupport {
46-
protected static final String JETTY_VERSION = "12.0.19";
46+
protected static final String JETTY_VERSION = "12.0.21";
4747

4848
private final String workingDirectory = String.format("%s/target/paxexam/%s/%s", PathUtils.getBaseDir(), getClass().getSimpleName(), UUID.randomUUID());
4949

0 commit comments

Comments
 (0)