Merge remote-tracking branch 'origin/jetty-9.4.x'

This commit is contained in:
Greg Wilkins 2017-07-18 12:46:44 +02:00
commit b358c06974
31 changed files with 442 additions and 373 deletions

View File

@ -50,7 +50,6 @@ jetty-9.4.4.v20170414 - 14 April 2017
WebAppClassloader
+ 1449 Unable to find the JVM Lib directory in WebAppContext
+ 1450 JMX does not export session statistics
+ 1452 Add tests for [want|need]ClientAuth
+ 1454 CachedContentFactory locks filesystem after first read of file
+ 1456 Error dispatch race with async write
+ 1463 SSL Renegotiate limit
@ -64,10 +63,8 @@ jetty-9.4.4.v20170414 - 14 April 2017
jetty-9.4.3.v20170317 - 17 March 2017
+ 329 Javadoc for HttpTester and ServletTester needs to reference limited HTTP
version scope
+ 609 websocket ClientCloseTest testServerNoCloseHandshake is failing
+ 856 Add server/port and auth configuration for mongo sessions
+ 1015 Ensure jetty-distribution excludes git / temp files
+ 1049 test-jetty-osgi test exits/crashes the surefire forked JVM
+ 1184 IllegalStateException for HEAD requests responded with 404
+ 1340 PushCacheFilter question
+ 1351 StringIndexOutOfBoundsException thrown on incomplete Accept-Language
@ -84,10 +81,8 @@ jetty-9.4.3.v20170317 - 17 March 2017
+ 1387 Windows and paxexam failure due to "renaming bundle"
+ 1389 Update to gcloud datastore-0.9.4-beta
+ 1390 HashLoginService and "this.web-inf.url" property are incompatible
+ 1394 Default OS Locale/Encoding/Charset can cause test failures
+ 1396 Set-Cookie produced by Jetty is invalid for RFC6265 and Chrome
+ 1398 Ensure all SessionDataStores store lastsaved time
+ 1399 SlowClientTest is failing on CI
+ 1401 HttpOutput.recycle() does not clear the write listener
+ 1402 Move RFC syntax validation to jetty-http Syntax class
+ 1403 Move new CookieCompliance class to jetty-http
@ -103,11 +98,8 @@ jetty-9.3.18.v20170406 - 06 April 2017
jetty-9.3.17.v20170317 - 17 March 2017
+ 329 Javadoc for HttpTester and ServletTester needs to reference limited HTTP
version scope
+ 609 websocket ClientCloseTest testServerNoCloseHandshake is failing
+ 1015 Ensure jetty-distribution excludes git / temp files
+ 1047 ReadPendingException and then thread death
+ 1049 test-jetty-osgi test exits/crashes the surefire forked JVM
+ 1282 ByteArrayEndPointTest.testIdle() failure
+ 1296 Introduce HTTP parser "content complete" event
+ 1326 Jetty shutdown command got NullPointerException (http2 module added to
start)
@ -125,17 +117,13 @@ jetty-9.3.17.v20170317 - 17 March 2017
+ 1387 Windows and paxexam failure due to "renaming bundle"
+ 1389 Update to gcloud datastore-0.9.4-beta
+ 1390 HashLoginService and "this.web-inf.url" property are incompatible
+ 1394 Default OS Locale/Encoding/Charset can cause test failures
+ 1396 Set-Cookie produced by Jetty is invalid for RFC6265 and Chrome
+ 1399 SlowClientTest is failing on CI
+ 1401 HttpOutput.recycle() does not clear the write listener
jetty-9.4.2.v20170220 - 20 February 2017
+ 612 Support HTTP Trailer
+ 1047 ReadPendingException and then thread death
+ 1150 Rationalize the session tests
+ 1226 Undefined JETTY_LOGS breaks jetty.sh
+ 1282 ByteArrayEndPointTest.testIdle() failure
+ 1284 IllegalStateException updating session inactive interval
+ 1290 http2-hpack not visible in OSGi
+ Allow application to hint that chunking should be used
@ -148,8 +136,6 @@ jetty-9.4.2.v20170220 - 20 February 2017
+ 1313 Insufficient Bytes behavior change in jetty 9.4.x due to HTTP Trailers
support?
+ 1315 Update to gcloud datastore 0.8.3-beta
+ 1317 AsyncProxyServletLoadTest fails
+ 1318 SessionEvictionFailure test fails on Windows
+ 1326 Jetty shutdown command got NullPointerException (http2 module added to
start)
+ 1328 Response.setBufferSize(int) ISE should be more clear on reason
@ -164,7 +150,6 @@ jetty-9.4.1.v20170120 - 20 January 2017
+ 612 Support HTTP Trailer
+ 1044 Unix socket connector blocks for 30 seconds on stopping the server
+ 1073 JDK9 support in Jetty 9.3.x
+ 1114 Add testcase for WSUF for stop/start of the Server
+ 1138 Ensure xml validation works on web descriptors
+ 1139 Support configuration of properties during --add-to-start
+ 1146 jetty.server.HttpInput deadlock
@ -181,8 +166,6 @@ jetty-9.4.1.v20170120 - 20 January 2017
+ 1181 Review buffer underflow cases in SslConnection
+ 1184 IllegalStateException for HEAD requests responded with 404
+ 1185 Connection abruptly closed for HEAD requests
+ 1186 Where can i find SocketConnector .java and
BlockingChannelConnector.java etc?
+ 1188 Cannot --add-to-start=logback-access due to logback-core dependancy
+ 1195 Problem using STOP.PORT and STOP.KEY with --exec
+ 1197 WebSocketClient not sending `Authorization` request header
@ -200,7 +183,6 @@ jetty-9.4.1.v20170120 - 20 January 2017
+ 1218 ReadPendingException is thrown when using
o.e.j.websocket.api.Session.suspend
+ 1220 PushCacheFilter does not add the context path to pushed resources
+ 1221 Session AbstractCreateAndInvalidateTest needs synchronization
+ 1222 Authenticated sessions throw exception on invalidate
+ 1223 Allow session workername to be null
+ 1224 HttpSessionListener.sessionDestroyed can no longer access session
@ -209,27 +191,8 @@ jetty-9.4.1.v20170120 - 20 January 2017
+ 1229 ClassLoader constraint issue when using NativeWebSocketConfiguration
with WEB-INF/lib/jetty-http.jar present
+ 1234 onBadMessage called from with handled message
+ 1239 Charset=unknown produces Exception during testing
+ 1242
org.eclipse.jetty.client.HttpRequestAbortTest.testAbortOnCommitWithContent[1]()
results in EofException
+ 1243
org.eclipse.jetty.proxy.ProxyServletFailureTest.testServerException[0]()
results in ServletException
+ 1244
ProxyServletFailureTest.testProxyRequestStallsContentServerIdlesTimeout()
has TimeoutException visible
+ 1248
org.eclipse.jetty.http2.client.StreamResetTest.testServerExceptionConsumesQueuedData
results in visible Stacktrace
+ 1252
HttpClientStreamTest.testInputStreamContentProviderThrowingWhileReading[transport:
HTTPS]() results in Early EOF
+ 1254 9.4.x Server resource handler welcome files forwarding not working
+ 1259 HostnameVerificationTest.simpleGetWithHostnameVerificationEnabledTest
is broken
+ 1260 Expand system properties in start
+ 1261 Intermittent H2C test failure AsyncIOServletTest.testAsyncReadEarlyEOF
+ 1262 BufferUtil.isMappedBuffer() uses reflection on private JDK fields
+ 1265 JAXB not available in JDK 9
+ 1267 Request.getRemoteUser can throw undeclared IllegalStateException via
@ -241,10 +204,8 @@ jetty-9.4.1.v20170120 - 20 January 2017
+ 1272 Update ALPN versions for 8u111
+ 1274 Distinguish no tlds vs no MetaInfConfiguration tld scanning for
quickstart
+ 1275 Get rid of Mockito
+ 1276 Remove org.eclipse.jetty.websocket.server.WebSocketServerFactory from
SPI
+ 1277 http2 alpn test error
jetty-9.4.0.v20161208 - 08 December 2016
+ 1112 How config async support in jsp tag?
@ -271,9 +232,6 @@ jetty-9.3.16.v20170120 - 20 January 2017
+ 1229 ClassLoader constraint issue when using NativeWebSocketConfiguration
with WEB-INF/lib/jetty-http.jar present
+ 1234 onBadMessage called from with handled message
+ 1259 HostnameVerificationTest.simpleGetWithHostnameVerificationEnabledTest
is broken
+ 1261 Intermittent H2C test failure AsyncIOServletTest.testAsyncReadEarlyEOF
+ 1262 BufferUtil.isMappedBuffer() uses reflection on private JDK fields
+ 1265 JAXB not available in JDK 9
+ 1267 Request.getRemoteUser can throw undeclared IllegalStateException via
@ -287,7 +245,6 @@ jetty-9.3.16.v20170120 - 20 January 2017
+ 1275 Get rid of Mockito
+ 1276 Remove org.eclipse.jetty.websocket.server.WebSocketServerFactory from
SPI
+ 1277 http2 alpn test error
jetty-9.3.15.v20161220 - 20 December 2016
+ 240 Missing content for multipart request after upgrade to Jetty > 9.2.7
@ -316,7 +273,6 @@ jetty-9.3.15.v20161220 - 20 December 2016
+ 1099 PushCacheFilter pushes POST requests
+ 1108 Please improve logging in SslContextFactory when there are no approved
cipher suites
+ 1114 Add testcase for WSUF for stop/start of the Server
+ 1118 Filter.destroy() conflicts with ContainerLifeCycle.destroy() in
WebSocketUpgradeFilter
+ 1123 Broken lifecycle for WebSocket's mappings
@ -356,7 +312,6 @@ jetty-9.4.0.RC3 - 05 December 2016
WebSocketUpgradeFilter
+ 1123 Broken lifecycle for WebSocket's mappings
+ 1124 Allow configuration of WebSocket mappings from Spring
+ 1127 AsyncMiddleManServletTest Test failure
+ 1128 Stats Servlet hidden from classpath
+ 1130 PROXY protocol support reports incorrect remote address
+ 1134 Jetty HTTP/2 client problems
@ -405,8 +360,6 @@ jetty-9.4.0.RC2 - 16 November 2016
IPAccessHandler did
+ 1074 Improve HttpInput for non dispatched calls
+ 1075 If read from session data cache fails, fallback to session data store
+ 1076 bad error handling in
ServerTimeoutsTest.testBlockingReadWithMinimumDataRateBelowLimit
+ 1077 doHandle defined twice for ScopedHandler
+ 1078 DigestAuthentication should use realm from server, even if unknown in
advance
@ -416,7 +369,6 @@ jetty-9.4.0.RC2 - 16 November 2016
charset=UTF-8"
+ 1099 PushCacheFilter pushes POST requests
+ 1103 AbstractNCSARequestLog reports too much of the Request URI
+ 480764 Suppress stacks in multipart filter tests
jetty-9.4.0.RC1 - 21 October 2016
+ 277 Proxy servlet does not handle HTTP status 100 correctly
@ -484,7 +436,6 @@ jetty-9.4.0.RC0 - 15 September 2016
String
+ 897 Remove GzipHandler interceptor when out of scope
+ 898 GzipHandler adds multiple Vary header
+ 899 PathFinderTest fails in jetty-9.2.x
+ 902 Expect: 100-Continue does not work with HTTP/2
+ 906 Expose jetty juli log for jasper in osgi
+ 909 Path and Domain not properly matched in addCookie()
@ -509,20 +460,16 @@ jetty-9.4.0.M1 - 15 August 2016
+ 56 Fix authn issues in LdapLoginModule
+ 592 Support no-value Host header in HttpParser
+ 620 Missing call to setPattern in RewritePatternRule constructor
+ 622 NoSqlSessionManager test for expired session does not use
session.maxInactiveInterval
+ 623 Add --gzip suffix to 304 responses with ETAGs
+ 624 AsyncContext.onCompleted called twice
+ 627 Use only start.ini or start.d, not both
+ 628 IOException: Unable to open root Jar file
MetaInfConfiguration.getTlds(MetaInfConfiguration.java:406) with Spring boot
loader + WebAppContext + non-expanded war
+ 632 JMX tests rely on fixed port
+ 638 ConnectHandler responses should have Content-Length
+ 639 ServerContainer stores WebSocket sessions twice
+ 640 ClientContainer should store WebSocket sessions as beans
+ 641 MongoSessionIdManager uses deprecated ensureIndex
+ 643 NPE in passing websocket client test
+ 644 Modules for enabling logging
+ 647 HTTP/2 CONTINUATION frame parsing throws IllegalStateException
+ 648 Problem using InputStreamResponseListener to handle HTTP/2 responses
@ -553,9 +500,6 @@ jetty-9.4.0.M1 - 15 August 2016
+ 689 Drop support for http2 drafts
+ 690 jetty-maven-plugin does not configure AnnotationConfiguration for
jetty:effective-web-xml goal
+ 693 QoSFilterTest failures are not capture by junit
+ 694 http2.client.StreamResetTest.testServerExceptionConsumesQueuedData stack
not suppressed in test
+ 695 Deprecate LocalConnector.getResponses() in favor of using .getResponse()
+ 696 LocalConnector.getResponse() doesn't find close if using HTTP/1.1
w/Connection: close
@ -594,15 +538,12 @@ jetty-9.4.0.M1 - 15 August 2016
+ 804 setting default Url Encoding broken in Jetty >= 9.3
+ 815 Simplify infinispan session module
+ 817 NPE in jndi Resource
+ 819 Allow jetty-start Output assertions in TestUseCases
+ 826 Better default for HTTP/2's max concurrent streams
+ 827 HTTPClient fails connecting to HTTPS host through an HTTP proxy
w/authentication
+ 830 Test webapp not properly copied to demo-base
+ 832 ServerWithJNDI example uses wrong webapp
+ 836 Test Failure: HttpClientTransportOverHTTP2Test.testLastStreamId()
+ 837 Update to support apache jasper 8.5.4
+ 839 Test Failure: MaxConcurrentStreamsTest.testOneConcurrentStream()
+ 841 support reset in buffering interceptors
jetty-9.4.0.M0 - 03 June 2016
@ -616,7 +557,6 @@ jetty-9.4.0.M0 - 03 June 2016
+ 437786 SslContextFactory: Allow Password.getPassword to be overridden
+ 469 Update to Apache Jasper 8.0.33
+ 472675 No main manifest attribute, in jetty-runner regression
+ 473 SessionTest.testBasicEcho_FromClient frequently failing
+ 478918 Change javax.servlet.error,forward,include literals to
RequestDispatcher constants
+ 479179 Fixed NPE from debug
@ -648,8 +588,6 @@ jetty-9.4.0.M0 - 03 June 2016
+ 482042 New API, Allow customization of ServletHandler path mapping
+ 482056 Compact path before using it in getRequestDispatcher()
+ 482057 MultiPartInputStream temp file permissions should be limited to user
+ 482058 MultiPartInputStream test initial part boundary incorrectly allows
empty string
+ 482172 Report form key size count in UrlEncoded exceptions
+ 482173 Track original Query string in Rewrite RuleContainer too
+ 483059 Remove cache of authenticated users
@ -678,11 +616,8 @@ jetty-9.4.0.M0 - 03 June 2016
+ 525 fix blockForContent spin
+ 532 Get rid of generated jetty-start/dependency-reduced-pom.xml
+ 533 Do not hide file resource exception
+ 572 Ignore failing test pending further analysis
+ 605 Guard concurrent calls to WebSocketSession.close()
+ 608 reset encoding set from content type
+ 609 ignore failing test
+ 610 Ignore failing test
jetty-9.3.14.v20161028 - 28 October 2016
+ 292 NPE in SslConnectionFactory newConnection
@ -699,7 +634,6 @@ jetty-9.3.14.v20161028 - 28 October 2016
${jetty.base}
+ 1039 AttributeNormalizer should not track attributes that are null
+ 1046 Improve HTTP2Flusher error report
+ 480764 Add extra tests for empty multipart
jetty-9.3.13.v20161014 - 14 October 2016
+ 295 Ensure Jetty Client use of Deflater / Inflater calls .end() to avoid
@ -774,7 +708,6 @@ jetty-9.3.11.v20160721 - 21 July 2016
+ 230 customize Content-Type in ErrorHandler's default error page
+ 592 Support no-value Host header in HttpParser
+ 631 SLOTH protection
+ 643 NPE in passing websocket client test
+ 649 LDAPLoginModule should disallow blank username and password
+ 658 Add memcached option for gcloud-sessions in jetty-9.3
+ 660 NullPointerException in Request.getParameter: _parameters is null
@ -799,9 +732,6 @@ jetty-9.3.11.v20160721 - 21 July 2016
+ 687 AllowSymLinkAliasChecker not normalizing relative symlinks properly
+ 690 jetty-maven-plugin does not configure AnnotationConfiguration for
jetty:effective-web-xml goal
+ 693 QoSFilterTest failures are not capture by junit
+ 694 http2.client.StreamResetTest.testServerExceptionConsumesQueuedData stack
not suppressed in test
+ 695 Deprecate LocalConnector.getResponses() in favor of using .getResponse()
+ 696 LocalConnector.getResponse() doesn't find close if using HTTP/1.1
w/Connection: close
@ -837,7 +767,6 @@ jetty-9.2.19.v20160908 - 08 September 2016
+ 882 Add IPv6 support to IPAddressMap in jetty-util
+ 894 When adding servless class, preserve Class instead of going through
String
+ 899 PathFinderTest fails in jetty-9.2.x
jetty-9.2.18.v20160721 - 21 July 2016
+ 425 Incorrect @ServerEndpoint Encoder/Decoder lifecycle
@ -861,17 +790,12 @@ jetty-9.3.10.v20160621 - 21 June 2016
+ 388 Add methods to send text frames with pre-encoded strings
+ 605 Guard concurrent calls to WebSocketSession.close()
+ 608 reset encoding set from content type?
+ 609 websocket ClientCloseTest testServerNoCloseHandshake is failing
+ 610 HttpClientRedirectTest/testRedirectWithWrongScheme test failing in CI
+ 620 Missing call to setPattern in RewritePatternRule constructor
+ 622 NoSqlSessionManager test for expired session does not use
session.maxInactiveInterval
+ 623 Add --gzip suffix to 304 responses with ETAGs
+ 624 AsyncContext.onCompleted called twice
+ 628 IOException: Unable to open root Jar file
MetaInfConfiguration.getTlds(MetaInfConfiguration.java:406) with Spring boot
loader + WebAppContext + non-expanded war
+ 632 JMX tests rely on fixed port
+ 633 If jmx and websocket is enabled, redploying a context produces a
NullPointerException
+ 638 ConnectHandler responses should have Content-Length
@ -913,7 +837,6 @@ jetty-9.3.9.v20160517 - 17 May 2016
+ 558 HTTP/2 server hangs when thread pool is low on threads
+ 560 Jetty Client Proxy Authentication does not work with HTTP Proxy
tunneling
+ 561 Fixed test timer
+ 567 NPE in ErrorPageErrorHandler debug
+ 570 URIUtil.encodePath does not always encode utf8 chars
+ 571 AbstractAuthentication.matchesURI() fails to match scheme
@ -959,8 +882,6 @@ jetty-9.3.9.M1 - 11 April 2016
+ 418 Add osgi capability for endpoint configurator
+ 424 Jetty impl. of Websocket ServerEndpointConfig.Configurator lifecycle out
of spec
+ 427 Squelch intentional exceptions seen during websocket testing
+ 434 RequestTest stack traces
+ 435 adjust debug log message
+ 437 Avoid NPE on receiving empty message though MessageHandler.Partial
+ 438 File and Path Resources with control characters should be rejected
@ -980,7 +901,6 @@ jetty-9.3.9.M1 - 11 April 2016
+ 476 HttpClient should not send absolute-form target with non HttpProxy
jetty-9.3.8.v20160314 - 14 March 2016
+ 107 ResourceHandler range support testcase
+ 124 Don't produce text/html if the request doesn't accept it
+ 247 improving invalid buffer manipulation exception messages
+ 258 Http request to origin server over https proxy contains absolute URL
@ -989,8 +909,6 @@ jetty-9.3.8.v20160314 - 14 March 2016
+ 305 NPE when notifying the session listener if the channel is closed before
a session has been opened
+ 316 Add *.chm mimetype mapping
+ 343 ensure release deployment of test-jetty-webapp:war and
test-proxy-webapp:war
+ 346 HttpParser RFC2616 Compliance mode
+ 353 Jetty Client doesn't forward authentication headers with redirects when
using proxy
@ -1009,7 +927,6 @@ jetty-9.3.8.v20160314 - 14 March 2016
+ 386 Explicit Authorization header is dropped when handling 407s
+ 397 Multipart EOF handling
+ 402 Don't use Thread.isAlive() in ShutdownMonitor
+ 405 adding testcase for problematic HttpURI parsing of path params
+ 406 GzipHandler: allow to override the Vary response header
+ 407 JSR356 Server WebSocket Sessions no longer being tracked
+ 408 Http client does not work on https with proxy
@ -1104,7 +1021,6 @@ jetty-9.3.7.RC0 - 05 January 2016
+ 482243 Fixed GzipHandler for Include
+ 482270 Expose upgrade request locales
+ 482272 Fixed relative symlink checking
+ 482506 HTTP/2 load test with h2load fails
+ 482670 HttpURI wrongly parser URI paths starting with /@
+ 482855 Content-Length omitted for POST requests with empty body
+ 482959 Local stream count never decrements when closing a stream causing
@ -1425,8 +1341,6 @@ jetty-9.3.0.v20150612 - 12 June 2015
+ 452503 Start.jar --add-to-start=jstl results in GraphException: Unable to
expand property in name: jsp-impl/${jsp-impl}-jstl
+ 453487 Recycle HttpChannelOverHTTP2
+ 453627 Fixed FileSystem test for nanosecond filesystems
+ 453636 Improved spin detection on test
+ 453829 Added HeaderRegexRule
+ 453834 CDI Support for WebSocket
+ 454152 Remove mux remnants from WebSocketClient
@ -1437,7 +1351,6 @@ jetty-9.3.0.v20150612 - 12 June 2015
+ 456956 Reduce ThreadLocal.remove() weak reference garbage
+ 457130 HTTPS request with IP host and HTTP proxy throws
IllegalArgumentException.
+ 457309 Add test to ensure GET and HEAD response headers same for gzip
+ 457508 Add flag to scan exploded jars in jetty-jspc-maven-plugin
+ 457788 Powered By in o.e.j.util.Jetty conditional on sendServerVersion
+ 458478 JarFileResource improve performance of exist method

View File

@ -10,7 +10,7 @@ which case the context path is /. If the directory name ends with ".d"
it is ignored (by may be used by explicit configuration).
+ A file called example.war will be deployed as a standard web application
with the context path /example (eg http://localhost:8080/example/). If he
with the context path /example (eg http://localhost:8080/example/). If the
base name is root, then the context path is /. If example.war and example/
exist, then only the WAR is deployed (which may use the directory as an
unpack location).

View File

@ -19,6 +19,16 @@
This document provides an overview of how to configure SSL and TLS for Jetty.
[[configuring-jetty-for-ssl]]
===== Configuring Jetty for SSL
To configure Jetty for SSL, complete the tasks in the following sections:
* xref:generating-key-pairs-and-certificates[]
* xref:requesting-trusted-certificate[]
* xref:loading-keys-and-certificates[]
* xref:configuring-sslcontextfactory[]
[[tls-and-ssl-versions]]
==== TLS and SSL versions
@ -78,16 +88,6 @@ Since Apache and other servers commonly use the OpenSSL tool suite to generate a
If you want the option of using the same certificate with Jetty or a web server such as Apache not written in Java, you might prefer to generate your private key and certificate with OpenSSL.
[[configuring-jetty-for-ssl]]
===== Configuring Jetty for SSL
To configure Jetty for SSL, complete the tasks in the following sections:
* xref:generating-key-pairs-and-certificates[]
* xref:requesting-trusted-certificate[]
* xref:loading-keys-and-certificates[]
* xref:configuring-sslcontextfactory[]
[[generating-key-pairs-and-certificates]]
===== Generating Key Pairs and Certificates
@ -354,75 +354,16 @@ $ keytool -importkeystore -srckeystore jetty.pkcs12 -srcstoretype PKCS12 -destke
If you are updating your configuration to use a newer certificate, as when the old one is expiring, just load the newer certificate as described in the section, xref:loading-keys-and-certificates[].
If you imported the key and certificate originally using the PKCS12 method, use an alias of "1" rather than "jetty", because that is the alias the PKCS12 process enters into the keystore.
==== Configuring SSL in Jetty Distribution
For those of you using the Jetty Distribution, enabling SSL support is as easy as activating the `ssl` module.
An example of this setup:
[source, plain, subs="{sub-order}"]
----
$ cd /path/to/mybase
$ java -jar ../start.jar --create-startd
MKDIR : ${jetty.base}/start.d
INFO : Base directory was modified
$ java -jar /path/to/jetty-dist/start.jar --add-to-start=ssl
INFO : server transitively enabled, ini template available with --add-to-start=server
INFO : ssl initialized in ${jetty.base}/start.d/ssl.ini
MKDIR : ${jetty.base}/etc
COPY : ${jetty.home}/modules/ssl/keystore to ${jetty.base}/etc/keystore
INFO : Base directory was modified
$ tree
.
├── etc
│   └── keystore
└── start.d
├── server.ini
└── ssl.ini
----
When you open `start.d/ssl.ini`, you will see many commented properties ready for you to configure the `SslContextFactory` basics.
To highlight some of the more commonly used properties:
jetty.ssl.host::
Configures which interfaces the SSL/TLS Connector should listen on.
jetty.ssl.port::
Configures which port the SSL/TLS Connector should listen on.
jetty.httpConfig.securePort::
If a webapp needs to redirect to a secure version of the same resource, then this is the port reported back on the response `location` line (having this be separate is useful if you have something sitting in front of Jetty, such as a Load Balancer or proxy).
jetty.sslContext.keyStorePath::
Sets the location of the `keystore` that you configured with your certificates.
jetty.sslContext.keyStorePassword::
Sets the Password for the `keystore`.
[[two-way-authentication]]
==== Two Way Authentication
To enable two-way authentication both the `ssl` and `https` modules need to be activated.
Once enabled, set the `jetty.sslContext.needClientAuth` property to `true`.
[source%nowrap,ini,linenums]
.$JETTY_BASE/start.d/ssl.ini
----
# Module: ssl
--module=ssl
...
## whether client certificate authentication is required
jetty.sslContext.needClientAuth=true
...
----
[[layout-of-keystore-and-truststore]]
==== Layout of keystore and truststore
===== Layout of keystore and truststore
The server's private key and certificate are contained within the keystore.
The `keystore` only contains the server's private key and certificate.
[[img-certificate-chain]]
image::images/certificate-chain.png[title="Certificate chain", alt="Certificate chain"]
[literal]
.The structure of a KeyStore file
.The structure of KeyStore file:
....
├── PrivateKeyEntry
│   ├── PrivateKey
@ -436,10 +377,10 @@ image::images/certificate-chain.png[title="Certificate chain", alt="Certificate
   └── Root CA certificate
....
[TIP]
====
`PrivateKeyEntry`, `Certificate chain`, `Intermediary CA certificate` and `Root CA certificate` are all optional values.
====
____
[NOTE]
Both the `Intermediary CA certificate` and `Root CA certificate` are optional.
____
[source%nowrap,plain,linenums]
----
@ -696,10 +637,9 @@ KeyIdentifier [
*******************************************
----
Additionally, you can split `$JETTY/etc/keystore` into two files.
One being `$JETTY/etc/keystore` which only contains the servers private key and certificate, while the other would be `$JETTY/etc/truststore` which contains intermediary CA and root CA.
An example of this would look like the following:
In addition, you can split `$JETTY/etc/keystore` as two files.
One is `$JETTY/etc/keystore` which only contains the servers private key and certificate,
the other is `$JETTY/etc/truststore` which contains intermediary CA and root CA.
[literal]
.The structure of `$JETTY/etc/keystore`
@ -747,7 +687,7 @@ setKeyStorePath::
The configured keystore to use for all SSL/TLS in configured Jetty Connector (or Client).
____
[NOTE]
As the keystore is vital security information, it recommended the file is located in a directory with *very* restricted access.
As a keystore is vital security information, it can be desirable to locate the file in a directory with *very* restricted access.
____
setKeyStorePassword::
@ -772,21 +712,96 @@ ____
____
[CAUTION]
The keystore and truststore passwords may also be set using the system properties: `org.eclipse.jetty.ssl.keypassword` and `org.eclipse.jetty.ssl.password`.
The keystore and truststore passwords may also be set using the system properties: `org.eclipse.jetty.ssl.keypassword` `org.eclipse.jetty.ssl.password`.
This is _not_ a recommended usage.
____
==== Configuring SNI
From Java 8, the JVM contains support for the http://en.wikipedia.org/wiki/Server_Name_Indication[Server Name Indicator (SNI)] extension, which allows a SSL connection handshake to indicate one or more DNS names that it applies to.
To support this, the `ExtendedSslContextFactory` is used that will look for multiple X509 certificates within the keystore, each of which may have multiple DNS names (including wildcards) associated with the http://en.wikipedia.org/wiki/SubjectAltName[Subject Alternate Name] extension.
When using the `ExtendedSSlContextFactory`, the correct certificate is automatically selected if the SNI extension is present in the handshake.
To support this, the `SslContextFactory` is used.
The `SslContextFactory` will look for multiple X509 certificates within the keystore, each of which may have multiple DNS names (including wildcards) associated with the http://en.wikipedia.org/wiki/SubjectAltName[Subject Alternate Name] extension.
When using the `SslContextFactory`, the correct certificate is automatically selected if the SNI extension is present in the handshake.
==== Configuring SSL in Jetty Distribution
For those of you using the Jetty Distribution, enabling SSL support is as easy as activating the `ssl` module.
An example of this setup:
[source, plain, subs="{sub-order}"]
----
$ cd /path/to/mybase
$ java -jar /path/to/jetty-dist/start.jar --add-to-startd=ssl
INFO : server initialised (transitively) in ${jetty.base}/start.d/server.ini
INFO : ssl initialised in ${jetty.base}/start.d/ssl.ini
INFO : Base directory was modified
$ tree
.
├── etc
│   └── keystore
└── start.d
├── server.ini
└── ssl.ini
----
When you open `start.d/ssl.ini`, you will see several commented properties ready for use when configuring `SslContextFactory` basics.
To highlight some of the more commonly used properties:
jetty.ssl.host::
Configures which interfaces the SSL/TLS Connector should listen on.
jetty.ssl.port::
Configures which port the SSL/TLS Connector should listen on.
jetty.httpConfig.securePort::
If a webapp needs to redirect to a secure version of the same resource, then this is the port reported back on the response `location` line (having this be separate is useful if you have something sitting in front of Jetty, such as a Load Balancer or proxy).
jetty.sslContext.keyStorePath::
Sets the location of the `keystore` that you configured with your certificates.
jetty.sslContext.keyStorePassword::
Sets the Password for the `keystore`.
[[two-way-authentication]]
==== Two Way Authentication
To enable two-way authentication in the Jetty Distribution, you need to enable the both the `ssl` and `https` modules.
[source, plain, subs="{sub-order}"]
----
$ cd /path/to/mybase
$ java -jar /path/to/jetty-dist/start.jar --add-to-startd=ssl,https
----
[source%nowrap,ini,linenums]
.$JETTY_BASE/start.d/ssl.ini
----
# Module: ssl
--module=ssl
jetty.ssl.host=0.0.0.0
jetty.ssl.port=8583
jetty.sslContext.keyStorePath=etc/keystore
jetty.sslContext.trustStorePath=etc/keystore
jetty.sslContext.keyStorePassword=OBF:
jetty.sslContext.keyManagerPassword=OBF:
jetty.sslContext.trustStorePassword=OBF:
jetty.sslContext.trustStoreType=JKS
# enable two way authentication
jetty.sslContext.needClientAuth=true
----
[source%nowrap,ini,linenums]
.$JETTY_BASE/start.d/https.ini
----
# Module: https
--module=https
----
[[configuring-sslcontextfactory-cipherSuites]]
==== Disabling/Enabling Specific Cipher Suites
To avoid specific attacks it is often necessary to configure a specific set of cipher suites to include or exclude.
This can either be done via link:{JDURL}/org/eclipse/jetty/util/ssl/SslContextFactory.html#setIncludeCipherSuites(java.lang.String...)[SslContext.setIncludeCipherSuites(java.lang.String...)] or vialink:{JDURL}/org/eclipse/jetty/util/ssl/SslContextFactory.html#setExcludeCipherSuites(java.lang.String...)[SslContext.setExcludeCipherSuites(java.lang.String...)].
As an example, to avoid the BEAST attack it is necessary to configure a specific set of cipher suites. This can either be done via link:{JDURL}/org/eclipse/jetty/util/ssl/SslContextFactory.html#setIncludeCipherSuites(java.lang.String...)[SslContext.setIncludeCipherSuites(java.lang.String...)] or vialink:{JDURL}/org/eclipse/jetty/util/ssl/SslContextFactory.html#setExcludeCipherSuites(java.lang.String...)[SslContext.setExcludeCipherSuites(java.lang.String...)].
____
[NOTE]
@ -796,7 +811,7 @@ Tools like ssllabs.com might report slightly different names which will be ignor
____
____
[NOTE]
[IMPORTANT]
It's recommended to install the Java Cryptography Extension (JCE) Unlimited Strength policy files in your JRE to get full strength ciphers such as AES-256.
The files can be found on the http://www.oracle.com/technetwork/java/javase/downloads/index.html[Java download page].
Just overwrite the two present JAR files in `<JRE_HOME>/lib/security/`.
@ -849,7 +864,7 @@ ____
[NOTE]
The default `SslContextFactory` implementation applies the latest SSL/TLS recommendations surrounding vulnerabilities in SSL/TLS.
Check the release notes (the `VERSION.txt` found in the root of the Jetty Distribution, or the http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.eclipse.jetty%22%20AND%20a%3A%22jetty-project%22[alternate (classified 'version') artifacts for the `jetty-project` component]on Maven Central) for updates.
The Java JVM is also applying exclusions at the JVM level and as such if you have a need to enable something that is generally accepted by the industry as being insecure or vulnerable you will likely have to enable it in BOTH the Java JVM and the Jetty configuration.
The Java JVM also applies exclusions at the JVM level and, as such, if you have a need to enable something that is generally accepted by the industry as being insecure or vulnerable you will likely have to enable it in *both* the Java JVM and your Jetty configuration.
____
____

View File

@ -121,11 +121,11 @@ public class HttpTester
public abstract static class Input
{
final ByteBuffer _buffer;
boolean _eof=false;
HttpParser _parser;
protected final ByteBuffer _buffer;
protected boolean _eof=false;
protected HttpParser _parser;
Input()
public Input()
{
this(BufferUtil.allocate(8192));
}

View File

@ -638,35 +638,14 @@ public abstract class AbstractProxyServlet extends HttpServlet
if (_log.isDebugEnabled())
_log.debug(getRequestId(clientRequest) + " proxying failed", failure);
if (proxyResponse.isCommitted())
{
try
{
// Use Jetty specific behavior to close connection.
proxyResponse.sendError(-1);
if (clientRequest.isAsyncStarted())
{
AsyncContext asyncContext = clientRequest.getAsyncContext();
asyncContext.complete();
}
}
catch (Throwable x)
{
if (_log.isDebugEnabled())
_log.debug(getRequestId(clientRequest) + " could not close the connection", failure);
}
}
else
{
proxyResponse.resetBuffer();
int status = failure instanceof TimeoutException ?
HttpStatus.GATEWAY_TIMEOUT_504 :
HttpStatus.BAD_GATEWAY_502;
int serverStatus = serverResponse == null ? status : serverResponse.getStatus();
if (expects100Continue(clientRequest) && serverStatus >= HttpStatus.OK_200)
status = serverStatus;
sendProxyResponseError(clientRequest, proxyResponse, status);
}
int status = failure instanceof TimeoutException ?
HttpStatus.GATEWAY_TIMEOUT_504 :
HttpStatus.BAD_GATEWAY_502;
int serverStatus = serverResponse == null ? status : serverResponse.getStatus();
if (expects100Continue(clientRequest) && serverStatus >= HttpStatus.OK_200)
status = serverStatus;
sendProxyResponseError(clientRequest, proxyResponse, status);
}
protected int getRequestId(HttpServletRequest clientRequest)
@ -676,10 +655,24 @@ public abstract class AbstractProxyServlet extends HttpServlet
protected void sendProxyResponseError(HttpServletRequest clientRequest, HttpServletResponse proxyResponse, int status)
{
proxyResponse.setStatus(status);
proxyResponse.setHeader(HttpHeader.CONNECTION.asString(), HttpHeaderValue.CLOSE.asString());
if (clientRequest.isAsyncStarted())
clientRequest.getAsyncContext().complete();
try
{
if (!proxyResponse.isCommitted())
{
proxyResponse.resetBuffer();
proxyResponse.setHeader(HttpHeader.CONNECTION.asString(), HttpHeaderValue.CLOSE.asString());
}
proxyResponse.sendError(status);
}
catch(Exception e)
{
_log.ignore(e);
}
finally
{
if (clientRequest.isAsyncStarted())
clientRequest.getAsyncContext().complete();
}
}
protected void onContinue(HttpServletRequest clientRequest, Request proxyRequest)

View File

@ -66,12 +66,6 @@ public abstract class AbstractConnectHandlerTest
proxy.stop();
}
protected HttpTester.Response readResponse(InputStream inputStream) throws IOException
{
HttpTester.Input input = HttpTester.from(inputStream);
return HttpTester.parseResponse(input);
}
protected Socket newSocket() throws IOException
{
Socket socket = new Socket("localhost", proxyConnector.getLocalPort());

View File

@ -81,7 +81,7 @@ public class ConnectHandlerSSLTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(socket.getInputStream());
HttpTester.Response response = HttpTester.parseResponse(HttpTester.from(socket.getInputStream()));
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
// Upgrade the socket to SSL
@ -96,7 +96,7 @@ public class ConnectHandlerSSLTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(sslSocket.getInputStream());
response = HttpTester.parseResponse(HttpTester.from(sslSocket.getInputStream()));
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("GET /echo", response.getContent());
}
@ -119,7 +119,7 @@ public class ConnectHandlerSSLTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(socket.getInputStream());
HttpTester.Response response = HttpTester.parseResponse(HttpTester.from(socket.getInputStream()));
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
// Upgrade the socket to SSL
@ -138,7 +138,7 @@ public class ConnectHandlerSSLTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(sslSocket.getInputStream());
response = HttpTester.parseResponse(HttpTester.from(sslSocket.getInputStream()));
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("POST /echo?param=" + i + "\r\nHELLO", response.getContent());
}

View File

@ -79,7 +79,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(socket.getInputStream());
HttpTester.Response response = HttpTester.parseResponse(HttpTester.from(socket.getInputStream()));
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
}
}
@ -100,7 +100,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(socket.getInputStream());
HttpTester.Response response = HttpTester.parseResponse(HttpTester.from(socket.getInputStream()));
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
}
}
@ -122,7 +122,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
request = "" +
@ -132,7 +133,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("GET /echo", response.getContent());
}
@ -159,7 +160,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 403 from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.FORBIDDEN_403, response.getStatus());
// Socket should be closed
@ -180,7 +182,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
request = "" +
@ -190,7 +193,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("GET /echo", response.getContent());
}
@ -217,7 +220,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 403 from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.FORBIDDEN_403, response.getStatus());
// Socket should be closed
@ -238,7 +242,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
request = "" +
@ -248,7 +253,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("GET /echo", response.getContent());
}
@ -294,7 +299,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 407 from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.PROXY_AUTHENTICATION_REQUIRED_407, response.getStatus());
Assert.assertTrue(response.containsKey("Proxy-Authenticate".toLowerCase(Locale.ENGLISH)));
@ -318,7 +324,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
request = "" +
@ -328,7 +335,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("GET /echo", response.getContent());
}
@ -370,7 +377,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 500 OK from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals("Response Code", HttpStatus.INTERNAL_SERVER_ERROR_500, response.getStatus());
}
}
@ -392,7 +400,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
request = "" +
@ -402,7 +411,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("GET /echo", response.getContent());
}
@ -428,11 +437,12 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
// The pipelined request must have gone up to the server as is
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("GET /echo", response.getContent());
}
@ -455,7 +465,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
for (int i = 0; i < 10; ++i)
@ -467,7 +478,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("GET /echo", response.getContent());
}
@ -491,7 +502,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
request = "" +
@ -501,7 +513,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("GET /echo", response.getContent());
@ -530,7 +542,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
request = "" +
@ -562,7 +575,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
request = "" +
@ -574,7 +588,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("POST /echo\r\nHELLO", response.getContent());
@ -585,7 +599,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("GET /echo", response.getContent());
}
@ -617,7 +631,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
StringBuilder body = new StringBuilder();
@ -634,7 +649,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("POST /echo\r\n" + body, response.getContent());
}
@ -702,7 +717,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
String body = "0123456789ABCDEF";
@ -715,12 +731,12 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.write(request.getBytes(StandardCharsets.UTF_8));
output.flush();
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("POST /echo\r\n" + body, response.getContent());
}
}
@Test
public void testCONNECTAndGETPipelinedAndOutputShutdown() throws Exception
{
@ -742,11 +758,12 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
socket.shutdownOutput();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
// The pipelined request must have gone up to the server as is
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("GET /echo", response.getContent());
}
@ -769,7 +786,8 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
output.flush();
// Expect 200 OK from the CONNECT request
HttpTester.Response response = readResponse(input);
HttpTester.Input in = HttpTester.from(input);
HttpTester.Response response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
request = "" +
@ -781,7 +799,7 @@ public class ConnectHandlerTest extends AbstractConnectHandlerTest
socket.shutdownOutput();
// The pipelined request must have gone up to the server as is
response = readResponse(input);
response = HttpTester.parseResponse(in);
Assert.assertEquals(HttpStatus.OK_200, response.getStatus());
Assert.assertEquals("GET /echo", response.getContent());
}

View File

@ -1087,10 +1087,10 @@ public class ProxyServletTest
Response response = listener.get(5, TimeUnit.SECONDS);
Assert.assertEquals(504, response.getStatus());
// Make sure there is no content, as the proxy-to-client response has been reset.
// Make sure there is error page content, as the proxy-to-client response has been reset.
InputStream input = listener.getInputStream();
Assert.assertEquals(-1, input.read());
String body = IO.toString(input);
Assert.assertThat(body,Matchers.containsString("HTTP ERROR 504"));
chunk1Latch.countDown();
// Result succeeds because a 504 is a valid HTTP response.

View File

@ -25,6 +25,7 @@ import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Supplier;
import javax.servlet.DispatcherType;
import javax.servlet.RequestDispatcher;
@ -75,9 +76,18 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
private final HttpChannelState _state;
private final Request _request;
private final Response _response;
private final Supplier<HttpFields> _trailerSupplier = new Supplier<HttpFields>()
{
@Override
public HttpFields get()
{
return _trailers;
}
};
private MetaData.Response _committedMetaData;
private RequestLog _requestLog;
private long _oldIdleTimeout;
private HttpFields _trailers;
/** Bytes written after interception (eg after compression) */
private long _written;
@ -581,6 +591,7 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
if (idleTO>=0 && _oldIdleTimeout!=idleTO)
setIdleTimeout(idleTO);
request.setTrailerSupplier(_trailerSupplier);
_request.setMetaData(request);
if (LOG.isDebugEnabled())
@ -608,7 +619,7 @@ public class HttpChannel implements Runnable, HttpOutput.Interceptor
{
if (LOG.isDebugEnabled())
LOG.debug("{} onTrailers {}", this, trailers);
_request.setTrailers(trailers);
_trailers = trailers;
}
public boolean onRequestComplete()

View File

@ -40,6 +40,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import javax.servlet.AsyncContext;
@ -206,7 +207,6 @@ public class Request implements HttpServletRequest
private long _timeStamp;
private MultiPartInputStreamParser _multiPartInputStream; //if the request is a multi-part mime
private AsyncContextState _async;
private HttpFields _trailers;
/* ------------------------------------------------------------ */
public Request(HttpChannel channel, HttpInput input)
@ -240,7 +240,9 @@ public class Request implements HttpServletRequest
public HttpFields getTrailerHttpFields()
{
return _trailers;
MetaData.Request metadata=_metaData;
Supplier<HttpFields> trailers = metadata==null?null:metadata.getTrailerSupplier();
return trailers==null?null:trailers.get();
}
/* ------------------------------------------------------------ */
@ -1844,7 +1846,6 @@ public class Request implements HttpServletRequest
_multiPartInputStream = null;
_remote=null;
_input.recycle();
_trailers = null;
}
/* ------------------------------------------------------------ */
@ -2214,11 +2215,6 @@ public class Request implements HttpServletRequest
_scope = scope;
}
public void setTrailers(HttpFields trailers)
{
_trailers = trailers;
}
/* ------------------------------------------------------------ */
@Override
public AsyncContext startAsync() throws IllegalStateException

View File

@ -762,7 +762,8 @@ public abstract class AbstractSessionCache extends ContainerLifeCycle implements
_sessionDataStore.delete(oldId); //delete the session data with the old id
_sessionDataStore.store(newId, session.getSessionData()); //save the session data with the new id
}
LOG.info("Session id {} swapped for new id {}", oldId, newId);
if (LOG.isDebugEnabled())
LOG.debug ("Session id {} swapped for new id {}", oldId, newId);
return session;
}
}

View File

@ -905,7 +905,7 @@ public class Session implements SessionHandler.SessionIf
}
default:
{
LOG.info("Session {} already being invalidated", _sessionData.getId());
if (LOG.isDebugEnabled()) LOG.debug("Session {} already being invalidated", _sessionData.getId());
}
}
}

View File

@ -146,7 +146,8 @@ public class DoSFilter implements Filter
private static final long __DEFAULT_THROTTLE_MS = 30000L;
private static final long __DEFAULT_MAX_REQUEST_MS_INIT_PARAM = 30000L;
private static final long __DEFAULT_MAX_IDLE_TRACKER_MS_INIT_PARAM = 30000L;
static final String NAME = "name";
static final String MANAGED_ATTR_INIT_PARAM = "managedAttr";
static final String MAX_REQUESTS_PER_S_INIT_PARAM = "maxRequestsPerSec";
static final String DELAY_MS_INIT_PARAM = "delayMs";
@ -181,12 +182,14 @@ public class DoSFilter implements Filter
private volatile boolean _trackSessions;
private volatile boolean _remotePort;
private volatile boolean _enabled;
private volatile String _name;
private Semaphore _passes;
private volatile int _throttledRequests;
private volatile int _maxRequestsPerSec;
private Queue<AsyncContext>[] _queues;
private AsyncListener[] _listeners;
private Scheduler _scheduler;
private ServletContext _context;
public void init(FilterConfig filterConfig) throws ServletException
{
@ -263,11 +266,14 @@ public class DoSFilter implements Filter
parameter = filterConfig.getInitParameter(TOO_MANY_CODE);
setTooManyCode(parameter==null?429:Integer.parseInt(parameter));
_scheduler = startScheduler();
setName(filterConfig.getFilterName());
_context = filterConfig.getServletContext();
if (_context != null )
{
_context.setAttribute(filterConfig.getFilterName(), this);
}
ServletContext context = filterConfig.getServletContext();
if (context != null && Boolean.parseBoolean(filterConfig.getInitParameter(MANAGED_ATTR_INIT_PARAM)))
context.setAttribute(filterConfig.getFilterName(), this);
_scheduler = startScheduler();
}
protected Scheduler startScheduler() throws ServletException
@ -536,6 +542,11 @@ public class DoSFilter implements Filter
{
return USER_AUTH;
}
public void schedule (RateTracker tracker)
{
_scheduler.schedule(tracker, getMaxIdleTrackerMs(), TimeUnit.MILLISECONDS);
}
/**
* Return a request rate tracker associated with this connection; keeps
@ -583,8 +594,9 @@ public class DoSFilter implements Filter
{
boolean allowed = checkWhitelist(request.getRemoteAddr());
int maxRequestsPerSec = getMaxRequestsPerSec();
tracker = allowed ? new FixedRateTracker(loadId, type, maxRequestsPerSec)
: new RateTracker(loadId, type, maxRequestsPerSec);
tracker = allowed ? new FixedRateTracker(_context, _name, loadId, type, maxRequestsPerSec)
: new RateTracker(_context,_name, loadId, type, maxRequestsPerSec);
tracker.setContext(_context);
RateTracker existing = _rateTrackers.putIfAbsent(loadId, tracker);
if (existing != null)
tracker = existing;
@ -603,6 +615,16 @@ public class DoSFilter implements Filter
return tracker;
}
public void addToRateTracker (RateTracker tracker)
{
_rateTrackers.put(tracker.getId(), tracker);
}
public void removeFromRateTracker (String id)
{
_rateTrackers.remove(id);
}
protected boolean checkWhitelist(String candidate)
{
@ -931,6 +953,25 @@ public class DoSFilter implements Filter
_maxIdleTrackerMs = value;
}
/**
* The unique name of the filter when there is more than
* one DosFilter instance.
*
* @return the name
*/
public String getName()
{
return _name;
}
/**
* @param name the name to set
*/
public void setName(String name)
{
_name = name;
}
/**
* Check flag to insert the DoSFilter headers into the response.
*
@ -1103,17 +1144,22 @@ public class DoSFilter implements Filter
* A RateTracker is associated with a connection, and stores request rate
* data.
*/
class RateTracker implements Runnable, HttpSessionBindingListener, HttpSessionActivationListener, Serializable
static class RateTracker implements Runnable, HttpSessionBindingListener, HttpSessionActivationListener, Serializable
{
private static final long serialVersionUID = 3534663738034577872L;
protected final String _filterName;
protected transient ServletContext _context;
protected final String _id;
protected final int _type;
protected final long[] _timestamps;
protected int _next;
public RateTracker(String id, int type, int maxRequestsPerSecond)
public RateTracker(ServletContext context, String filterName, String id, int type, int maxRequestsPerSecond)
{
_context = context;
_filterName = filterName;
_id = id;
_type = type;
_timestamps = new long[maxRequestsPerSecond];
@ -1151,40 +1197,87 @@ public class DoSFilter implements Filter
{
if (LOG.isDebugEnabled())
LOG.debug("Value bound: {}", getId());
_context = event.getSession().getServletContext();
}
public void valueUnbound(HttpSessionBindingEvent event)
{
//take the tracker out of the list of trackers
_rateTrackers.remove(_id);
if (LOG.isDebugEnabled())
LOG.debug("Tracker removed: {}", getId());
DoSFilter filter = (DoSFilter)event.getSession().getServletContext().getAttribute(_filterName);
removeFromRateTrackers(filter, _id);
_context = null;
}
public void sessionWillPassivate(HttpSessionEvent se)
{
//take the tracker of the list of trackers (if its still there)
_rateTrackers.remove(_id);
DoSFilter filter = (DoSFilter)se.getSession().getServletContext().getAttribute(_filterName);
removeFromRateTrackers(filter, _id);
_context = null;
}
public void sessionDidActivate(HttpSessionEvent se)
{
RateTracker tracker = (RateTracker)se.getSession().getAttribute(__TRACKER);
if (tracker!=null)
_rateTrackers.put(tracker.getId(),tracker);
ServletContext context = se.getSession().getServletContext();
tracker.setContext(context);
DoSFilter filter = (DoSFilter)context.getAttribute(_filterName);
if (filter == null)
{
LOG.info("No filter {} for rate tracker {}", _filterName, tracker);
return;
}
addToRateTrackers(filter, tracker);
}
public void setContext (ServletContext context)
{
_context = context;
}
protected void removeFromRateTrackers (DoSFilter filter, String id)
{
if (filter == null)
return;
filter.removeFromRateTracker(id);
if (LOG.isDebugEnabled())
LOG.debug("Tracker removed: {}", getId());
}
protected void addToRateTrackers (DoSFilter filter, RateTracker tracker)
{
if (filter == null)
return;
filter.addToRateTracker(tracker);
}
@Override
public void run()
{
if (_context == null)
{
LOG.warn("Unknkown context for rate tracker {}", this);
return;
}
int latestIndex = _next == 0 ? (_timestamps.length - 1) : (_next - 1);
long last = _timestamps[latestIndex];
boolean hasRecentRequest = last != 0 && (System.currentTimeMillis() - last) < 1000L;
DoSFilter filter = (DoSFilter)_context.getAttribute(_filterName);
if (hasRecentRequest)
_scheduler.schedule(this, getMaxIdleTrackerMs(), TimeUnit.MILLISECONDS);
{
if (filter != null)
filter.schedule(this);
else
LOG.warn("No filter {}", _filterName);
}
else
_rateTrackers.remove(_id);
removeFromRateTrackers(filter, _id);
}
@Override
@ -1196,9 +1289,9 @@ public class DoSFilter implements Filter
class FixedRateTracker extends RateTracker
{
public FixedRateTracker(String id, int type, int numRecentRequestsTracked)
public FixedRateTracker(ServletContext context, String filterName, String id, int type, int numRecentRequestsTracked)
{
super(id, type, numRecentRequestsTracked);
super(context, filterName, id, type, numRecentRequestsTracked);
}
@Override

View File

@ -18,11 +18,13 @@
package org.eclipse.jetty.servlets;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.EnumSet;
import javax.servlet.DispatcherType;
@ -34,12 +36,17 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.HttpURI;
import org.eclipse.jetty.server.session.DefaultSessionCache;
import org.eclipse.jetty.server.session.FileSessionDataStore;
import org.eclipse.jetty.servlet.FilterHolder;
import org.eclipse.jetty.servlet.ServletTester;
import org.eclipse.jetty.toolchain.test.FS;
import org.eclipse.jetty.toolchain.test.TestingDir;
import org.eclipse.jetty.util.IO;
import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
public abstract class AbstractDoSFilterTest
@ -49,9 +56,23 @@ public abstract class AbstractDoSFilterTest
protected int _port;
protected long _requestMaxTime = 200;
@Rule
public TestingDir _testDir = new TestingDir();
public void startServer(Class<? extends Filter> filter) throws Exception
{
_tester = new ServletTester("/ctx");
DefaultSessionCache sessionCache = new DefaultSessionCache(_tester.getContext().getSessionHandler());
FileSessionDataStore fileStore = new FileSessionDataStore();
Path p = _testDir.getPathFile("sessions");
FS.ensureEmpty(p);
fileStore.setStoreDir(p.toFile());
sessionCache.setSessionDataStore(fileStore);
_tester.getContext().getSessionHandler().setSessionCache(sessionCache);
HttpURI uri = new HttpURI(_tester.createConnector(true));
_host = uri.getHost();
_port = uri.getPort();

View File

@ -18,6 +18,9 @@
package org.eclipse.jetty.servlets;
import javax.servlet.ServletContext;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.servlets.DoSFilter.RateTracker;
import org.hamcrest.Matchers;
import org.junit.Assert;
@ -36,7 +39,7 @@ public class DoSFilterTest extends AbstractDoSFilterTest
public void testRateIsRateExceeded() throws InterruptedException
{
DoSFilter doSFilter = new DoSFilter();
doSFilter.setName("foo");
boolean exceeded = hitRateTracker(doSFilter,0);
Assert.assertTrue("Last hit should have exceeded",exceeded);
@ -49,6 +52,7 @@ public class DoSFilterTest extends AbstractDoSFilterTest
public void testWhitelist() throws Exception
{
DoSFilter filter = new DoSFilter();
filter.setName("foo");
filter.setWhitelist("192.168.0.1/32,10.0.0.0/8,4d8:0:a:1234:ABc:1F:b18:17,4d8:0:a:1234:ABc:1F:0:0/96");
Assert.assertTrue(filter.checkWhitelist("192.168.0.1"));
Assert.assertFalse(filter.checkWhitelist("192.168.0.2"));
@ -72,7 +76,8 @@ public class DoSFilterTest extends AbstractDoSFilterTest
private boolean hitRateTracker(DoSFilter doSFilter, int sleep) throws InterruptedException
{
boolean exceeded = false;
RateTracker rateTracker = doSFilter.new RateTracker("test2",0,4);
ServletContext context = new ContextHandler.StaticContext();
RateTracker rateTracker = new RateTracker(context, doSFilter.getName(), "test2",0,4);
for (int i = 0; i < 5; i++)
{

View File

@ -246,11 +246,11 @@ public class InetAddressSet extends AbstractSet<String> implements Set<String>,
_octets = cidr/8;
_mask = 0xff&(0xff<<(8-cidr%8));
_masked = _mask==0?0:_raw[_octets]&_mask;
if (cidr>(_raw.length*8))
throw new IllegalArgumentException("CIDR too large: "+pattern);
if (_mask!=0 && _raw[_octets]!=_masked)
if (_mask!=0 && (0xff&_raw[_octets])!=_masked)
throw new IllegalArgumentException("CIDR bits non zero: "+pattern);
for (int o=_octets+(_mask==0?0:1);o<_raw.length;o++)

View File

@ -134,8 +134,21 @@ public class InetAddressSetTest
set.add("0.0.0.0/0");
assertTrue(set.test(InetAddress.getByName("10.11.0.0")));
// test #1664
set.add("2.144.0.0/14");
set.add("2.176.0.0/12");
set.add("5.22.0.0/17");
set.add("5.22.192.0/19");
assertTrue(set.test(InetAddress.getByName("2.144.0.1")));
assertTrue(set.test(InetAddress.getByName("2.176.0.1")));
assertTrue(set.test(InetAddress.getByName("5.22.0.1")));
assertTrue(set.test(InetAddress.getByName("5.22.192.1")));
}
@Test
public void testBadCIDR() throws Exception
{

View File

@ -26,7 +26,6 @@ import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.toolchain.test.TestTracker;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -47,9 +46,6 @@ public class MessageOutputStreamTest
{
private static final Logger LOG = Log.getLogger(MessageOutputStreamTest.class);
@Rule
public TestTracker testtracker = new TestTracker();
@Rule
public TestName testname = new TestName();

View File

@ -23,7 +23,6 @@ import static org.hamcrest.Matchers.is;
import java.net.URI;
import java.util.Arrays;
import org.eclipse.jetty.toolchain.test.TestTracker;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
@ -43,9 +42,6 @@ public class MessageWriterTest
{
private static final Logger LOG = Log.getLogger(MessageWriterTest.class);
@Rule
public TestTracker testtracker = new TestTracker();
@Rule
public TestName testname = new TestName();

View File

@ -26,12 +26,12 @@ import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.PingFrame;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
import org.eclipse.jetty.websocket.tests.BadFrame;
import org.eclipse.jetty.websocket.tests.LocalFuzzer;
import org.eclipse.jetty.websocket.tests.servlets.EchoSocket;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@ -72,7 +72,7 @@ public class BadOpCodesTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -94,7 +94,7 @@ public class BadOpCodesTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello")); // echo
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);

View File

@ -30,7 +30,6 @@ import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.OpCode;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.CloseFrame;
import org.eclipse.jetty.websocket.common.frames.ContinuationFrame;
@ -40,6 +39,7 @@ import org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection;
import org.eclipse.jetty.websocket.tests.BadFrame;
import org.eclipse.jetty.websocket.tests.DataUtils;
import org.eclipse.jetty.websocket.tests.LocalFuzzer;
import org.eclipse.jetty.websocket.tests.servlets.EchoSocket;
import org.junit.Test;
/**
@ -66,7 +66,7 @@ public class CloseHandlingTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -98,7 +98,7 @@ public class CloseHandlingTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class,CloseInfo.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);

View File

@ -25,11 +25,13 @@ import java.util.List;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.CloseFrame;
import org.eclipse.jetty.websocket.tests.LocalFuzzer;
import org.eclipse.jetty.websocket.tests.servlets.EchoSocket;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@ -96,7 +98,8 @@ public class CloseHandling_BadStatusCodesTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (LocalFuzzer session = server.newLocalFuzzer())
try (StacklessLogging ignore = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
session.expect(expect);
@ -123,7 +126,8 @@ public class CloseHandling_BadStatusCodesTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (LocalFuzzer session = server.newLocalFuzzer())
try (StacklessLogging ignore = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
session.expect(expect);

View File

@ -25,13 +25,13 @@ import org.eclipse.jetty.toolchain.test.annotation.Slow;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.ContinuationFrame;
import org.eclipse.jetty.websocket.common.frames.PingFrame;
import org.eclipse.jetty.websocket.common.frames.PongFrame;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
import org.eclipse.jetty.websocket.tests.LocalFuzzer;
import org.eclipse.jetty.websocket.tests.servlets.EchoSocket;
import org.junit.Test;
/**
@ -57,7 +57,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -83,7 +83,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
@ -109,7 +109,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendSegmented(send,1 );
@ -135,7 +135,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -164,7 +164,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("fragment1fragment2"));
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -190,7 +190,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
@ -220,7 +220,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -246,7 +246,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendSegmented(send,1);
@ -276,7 +276,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -302,7 +302,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -328,7 +328,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -354,7 +354,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -381,7 +381,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -408,7 +408,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
@ -443,7 +443,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("f1,f2,f3,f4,f5"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -470,7 +470,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendSegmented(send,1);
@ -499,7 +499,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -528,7 +528,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
@ -557,7 +557,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendSegmented(send,1);

View File

@ -25,12 +25,12 @@ import java.util.List;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.BinaryFrame;
import org.eclipse.jetty.websocket.common.frames.PingFrame;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
import org.eclipse.jetty.websocket.tests.LocalFuzzer;
import org.eclipse.jetty.websocket.tests.servlets.EchoSocket;
import org.junit.Test;
/**
@ -54,7 +54,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -81,7 +81,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("small")); // echo on good frame
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -108,7 +108,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("small")); // echo on good frame
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
@ -135,7 +135,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("small")); // echo on good frame
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendSegmented(send, 1);
@ -162,7 +162,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -189,7 +189,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -217,7 +217,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);

View File

@ -32,13 +32,13 @@ import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.OpCode;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.ContinuationFrame;
import org.eclipse.jetty.websocket.common.frames.DataFrame;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
import org.eclipse.jetty.websocket.tests.DataUtils;
import org.eclipse.jetty.websocket.tests.LocalFuzzer;
import org.eclipse.jetty.websocket.tests.servlets.EchoSocket;
import org.junit.Test;
/**
@ -465,7 +465,8 @@ public class TextTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame());
try (LocalFuzzer session = server.newLocalFuzzer())
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
session.expect(expect);
@ -483,7 +484,7 @@ public class TextTest extends AbstractLocalServerCase
public void testText_BadUtf8_ByteWise() throws Exception
{
// Disable Long Stacks from Parser (we know this test will throw an exception)
try (StacklessLogging ignored = new StacklessLogging(Parser.class))
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class))
{
ByteBuffer payload = ByteBuffer.allocate(64);
BufferUtil.clearToFill(payload);
@ -554,7 +555,8 @@ public class TextTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame());
try (LocalFuzzer session = server.newLocalFuzzer())
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
session.expect(expect);
@ -592,7 +594,8 @@ public class TextTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame());
try (LocalFuzzer session = server.newLocalFuzzer())
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
session.expect(expect);
@ -618,7 +621,7 @@ public class TextTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
ByteBuffer net = session.asNetworkBuffer(send);

View File

@ -82,7 +82,6 @@ public class WebSocketOverSSLTest
TrackingEndpoint clientSocket = new TrackingEndpoint("Client");
URI requestUri = server.getServerUri();
System.err.printf("Request URI: %s%n",requestUri.toASCIIString());
Future<Session> fut = client.connect(clientSocket,requestUri);
// wait for connect
@ -124,7 +123,6 @@ public class WebSocketOverSSLTest
TrackingEndpoint clientSocket = new TrackingEndpoint("Client");
URI requestUri = server.getServerUri();
System.err.printf("Request URI: %s%n",requestUri.toASCIIString());
Future<Session> fut = client.connect(clientSocket,requestUri);
// wait for connect
@ -165,7 +163,6 @@ public class WebSocketOverSSLTest
TrackingEndpoint clientSocket = new TrackingEndpoint("Client");
URI requestUri = server.getServerUri().resolve("/deep?a=b");
System.err.printf("Request URI: %s%n",requestUri.toASCIIString());
Future<Session> fut = client.connect(clientSocket,requestUri);
// wait for connect

View File

@ -28,10 +28,10 @@ import java.util.Arrays;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.toolchain.test.AdvancedRunner;
import org.eclipse.jetty.toolchain.test.Hex;
import org.eclipse.jetty.util.Utf8Appendable.NotUtf8Exception;
import org.eclipse.jetty.util.Utf8StringBuilder;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.util.log.StdErrLog;
import org.eclipse.jetty.websocket.api.StatusCode;
@ -39,6 +39,7 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.common.Generator;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.WebSocketSession;
import org.eclipse.jetty.websocket.common.frames.BinaryFrame;
import org.eclipse.jetty.websocket.common.frames.ContinuationFrame;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
@ -58,12 +59,10 @@ import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
/**
* Test various <a href="http://tools.ietf.org/html/rfc6455">RFC 6455</a> specified requirements placed on {@link WebSocketServlet}
*/
@RunWith(AdvancedRunner.class)
public class WebSocketServletRFCTest
{
private static SimpleServletServer server;
@ -220,10 +219,16 @@ public class WebSocketServletRFCTest
UntrustedWSSession clientSession = clientConnectFuture.get(Defaults.CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
UntrustedWSEndpoint clientSocket = clientSession.getUntrustedEndpoint();
clientSession.getRemote().sendString("CRASH");
clientSocket.awaitCloseEvent("Client");
clientSocket.assertCloseInfo("Client", StatusCode.SERVER_ERROR, anything());
try (StacklessLogging ignored = new StacklessLogging(
Log.getLogger(WebSocketSession.class.getName() + ".SERVER"),
Log.getLogger(RFC6455Socket.class)))
{
clientSession.getRemote().sendString("CRASH");
clientSocket.awaitCloseEvent("Client");
clientSocket.assertCloseInfo("Client", StatusCode.SERVER_ERROR, anything());
}
}
/**
@ -314,15 +319,18 @@ public class WebSocketServletRFCTest
byte buf[] = new byte[]{(byte) 0xC2, (byte) 0xC3};
Generator generator = new Generator(WebSocketPolicy.newServerPolicy(), client.getBufferPool(), false);
WebSocketFrame txt = new TextFrame().setPayload(ByteBuffer.wrap(buf));
txt.setMask(Hex.asByteArray("11223344"));
ByteBuffer bbHeader = generator.generateHeaderBytes(txt);
clientConnection.writeRaw(bbHeader);
clientConnection.writeRaw(txt.getPayload());
clientSocket.awaitCloseEvent("Client");
clientSocket.assertCloseInfo("Client", StatusCode.BAD_PAYLOAD, anything());
try (StacklessLogging ignored = new StacklessLogging(RFC6455Socket.class))
{
WebSocketFrame txt = new TextFrame().setPayload(ByteBuffer.wrap(buf));
txt.setMask(Hex.asByteArray("11223344"));
ByteBuffer bbHeader = generator.generateHeaderBytes(txt);
clientConnection.writeRaw(bbHeader);
clientConnection.writeRaw(txt.getPayload());
clientSocket.awaitCloseEvent("Client");
clientSocket.assertCloseInfo("Client", StatusCode.BAD_PAYLOAD, anything());
}
}
}

View File

@ -39,8 +39,6 @@ public class JettyServerEndpointConfiguratorTest
@Test
public void testServiceLoader()
{
System.out.printf("Service Name: %s%n",ServerEndpointConfig.Configurator.class.getName());
ServiceLoader<ServerEndpointConfig.Configurator> loader = ServiceLoader.load(javax.websocket.server.ServerEndpointConfig.Configurator.class);
assertThat("loader",loader,notNullValue());
Iterator<ServerEndpointConfig.Configurator> iter = loader.iterator();

View File

@ -37,7 +37,6 @@ import org.eclipse.jetty.toolchain.test.TestingDir;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.common.util.TextUtil;
import org.eclipse.jetty.websocket.tests.LeakTrackingBufferPoolRule;
import org.eclipse.jetty.websocket.tests.TrackingEndpoint;
import org.eclipse.jetty.websocket.tests.WSServer;
@ -56,7 +55,6 @@ public class LargeContainerTest
public void echo(javax.websocket.Session session, String msg)
{
// reply with echo
System.err.printf("echo(%s)%n", TextUtil.hint(msg));
session.getAsyncRemote().sendText(msg);
}
}

View File

@ -132,10 +132,6 @@ public class MemoryUsageTest
long heapUsed = heapAfter.getUsed() - heapBefore.getUsed();
long nonHeapUsed = nonHeapAfter.getUsed() - nonHeapBefore.getUsed();
System.out.println("heapUsed = " + heapUsed);
System.out.println("nonHeapUsed = " + nonHeapUsed);
// new CountDownLatch(1).await();
// Assume no more than 25 KiB per session pair (client and server).
long expected = 25 * 1024 * sessionCount;
Assert.assertThat("heap used", heapUsed,lessThan(expected));