mirror of
https://github.com/jetty/jetty.project.git
synced 2025-03-02 20:09:21 +00:00
Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-10.0.x-5018-WebSocketClientRequestTimeout
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
commit
df34a6269b
12
VERSION.txt
12
VERSION.txt
@ -1,5 +1,7 @@
|
||||
jetty-10.0.0-SNAPSHOT
|
||||
|
||||
jetty-10.0.0.beta0 - 27 May 2020
|
||||
|
||||
jetty-9.4.30.v20200611 - 11 June 2020
|
||||
+ 4776 Incorrect path matching for WebSocket using PathMappings
|
||||
+ 4826 Upgrade to Apache Jasper 8.5.54
|
||||
@ -66,7 +68,7 @@ jetty-10.0.0.alpha1 - 26 November 2019
|
||||
+ 2709 current default for headerCacheSize is not large enough for many
|
||||
requests
|
||||
+ 2815 hpack fields are opaque octets
|
||||
+ 3040 Allow RFC6265 Cookies to include optional SameSite attribute.
|
||||
+ 3040 Allow RFC6265 Cookies to include optional SameSite attribute
|
||||
+ 3083 The ini-template for jetty.console-capture.dir does not match the
|
||||
default value
|
||||
+ 3106 Websocket connection stats and request stats
|
||||
@ -499,10 +501,10 @@ jetty-9.4.25.v20191220 - 20 December 2019
|
||||
SslContextFactory usage
|
||||
+ 4392 Suppress logging of QuietException in HttpChannelState.asyncError()
|
||||
+ 4402 NPE in JettyRunWarExplodedMojo
|
||||
+ 4411 Jetty server spins on incomplete request due to delayed dispatch
|
||||
until content
|
||||
+ 4415 GzipHandler invalid input zip size on large
|
||||
(over 2,147,483,647 bytes) request body content
|
||||
+ 4411 Jetty server spins on incomplete request due to delayed dispatch until
|
||||
content
|
||||
+ 4415 GzipHandler invalid input zip size on large (over 2,147,483,647 bytes)
|
||||
request body content
|
||||
+ 4421 HttpClient support for PROXY protocol
|
||||
+ 4427 Retried HttpClient Requests can result in duplicates cookies
|
||||
|
||||
|
@ -92,10 +92,9 @@ public abstract class AbstractConnectionPool implements ConnectionPool, Dumpable
|
||||
public Connection acquire(boolean create)
|
||||
{
|
||||
Connection connection = activate();
|
||||
if (connection == null)
|
||||
if (connection == null && create)
|
||||
{
|
||||
if (create)
|
||||
tryCreate(destination.getQueuedRequestCount());
|
||||
tryCreate(destination.getQueuedRequestCount());
|
||||
connection = activate();
|
||||
}
|
||||
return connection;
|
||||
|
@ -372,7 +372,7 @@ public class HttpRequest implements Request
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpFields.Mutable getHeaders()
|
||||
public HttpFields getHeaders()
|
||||
{
|
||||
return headers;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public class MultiplexConnectionPool extends AbstractConnectionPool implements C
|
||||
public Connection acquire(boolean create)
|
||||
{
|
||||
Connection connection = activate();
|
||||
if (connection == null)
|
||||
if (connection == null && create)
|
||||
{
|
||||
int queuedRequests = getHttpDestination().getQueuedRequestCount();
|
||||
int maxMultiplex = getMaxMultiplex();
|
||||
|
@ -175,6 +175,7 @@ public class MaxConcurrentStreamsTest extends AbstractTest
|
||||
@Override
|
||||
public void onSettings(Session session, SettingsFrame frame)
|
||||
{
|
||||
super.onSettings(session, frame);
|
||||
// Send another request to simulate a request being
|
||||
// sent concurrently with connection establishment.
|
||||
// Sending this request will trigger the creation of
|
||||
@ -199,7 +200,6 @@ public class MaxConcurrentStreamsTest extends AbstractTest
|
||||
}
|
||||
});
|
||||
}
|
||||
super.onSettings(session, frame);
|
||||
}
|
||||
}, promise, context);
|
||||
}
|
||||
|
@ -73,7 +73,6 @@
|
||||
<groupId>org.ops4j.pax.tinybundles</groupId>
|
||||
<artifactId>tinybundles</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>biz.aQute.bnd</groupId>
|
||||
|
@ -20,6 +20,7 @@ package org.eclipse.jetty.osgi.test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@ -58,20 +59,13 @@ public class TestJettyOSGiAnnotationParser
|
||||
BundleContext bundleContext = null;
|
||||
|
||||
@Configuration
|
||||
public static Option[] configure()
|
||||
public static Option[] configure() throws IOException
|
||||
{
|
||||
ArrayList<Option> options = new ArrayList<>();
|
||||
options.add(TestOSGiUtil.optionalRemoteDebug());
|
||||
options.add(CoreOptions.junitBundles());
|
||||
options.addAll(TestOSGiUtil.coreJettyDependencies());
|
||||
options.add(mavenBundle().groupId("biz.aQute.bnd").artifactId("bndlib").versionAsInProject().start());
|
||||
options.add(mavenBundle().groupId("org.ops4j.pax.tinybundles").artifactId("tinybundles").version("2.1.1").start());
|
||||
return options.toArray(new Option[options.size()]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParse() throws Exception
|
||||
{
|
||||
|
||||
//get a reference to a pre-prepared module-info
|
||||
Path path = Paths.get("src", "test", "resources", "module-info.clazz");
|
||||
File moduleInfo = path.toFile();
|
||||
@ -80,8 +74,13 @@ public class TestJettyOSGiAnnotationParser
|
||||
TinyBundle bundle = TinyBundles.bundle();
|
||||
bundle.set(Constants.BUNDLE_SYMBOLICNAME, "bundle.with.module.info");
|
||||
bundle.add("module-info.class", new FileInputStream(moduleInfo)); //copy it into the fake bundle
|
||||
InputStream is = bundle.build();
|
||||
bundleContext.installBundle("dummyLocation", is);
|
||||
options.add(CoreOptions.streamBundle(bundle.build()).startLevel(1));
|
||||
return options.toArray(new Option[options.size()]);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParse() throws Exception
|
||||
{
|
||||
|
||||
//test the osgi annotation parser ignore the module-info.class file in the fake bundle
|
||||
//Get a reference to the deployed fake bundle
|
||||
|
@ -38,7 +38,6 @@ import org.eclipse.jetty.client.api.Request;
|
||||
import org.eclipse.jetty.client.api.Response;
|
||||
import org.eclipse.jetty.client.api.Result;
|
||||
import org.eclipse.jetty.http.HttpField;
|
||||
import org.eclipse.jetty.http.HttpFields;
|
||||
import org.eclipse.jetty.http.HttpHeader;
|
||||
import org.eclipse.jetty.http.HttpScheme;
|
||||
import org.eclipse.jetty.http.HttpStatus;
|
||||
@ -154,22 +153,26 @@ public abstract class ClientUpgradeRequest extends HttpRequest implements Respon
|
||||
|
||||
public void setSubProtocols(String... protocols)
|
||||
{
|
||||
HttpFields.Mutable headers = getHeaders();
|
||||
headers.remove(HttpHeader.SEC_WEBSOCKET_SUBPROTOCOL);
|
||||
for (String protocol : protocols)
|
||||
headers(headers ->
|
||||
{
|
||||
headers.add(HttpHeader.SEC_WEBSOCKET_SUBPROTOCOL, protocol);
|
||||
}
|
||||
headers.remove(HttpHeader.SEC_WEBSOCKET_SUBPROTOCOL);
|
||||
for (String protocol : protocols)
|
||||
{
|
||||
headers.add(HttpHeader.SEC_WEBSOCKET_SUBPROTOCOL, protocol);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setSubProtocols(List<String> protocols)
|
||||
{
|
||||
HttpFields.Mutable headers = getHeaders();
|
||||
headers.remove(HttpHeader.SEC_WEBSOCKET_SUBPROTOCOL);
|
||||
for (String protocol : protocols)
|
||||
headers(headers ->
|
||||
{
|
||||
headers.add(HttpHeader.SEC_WEBSOCKET_SUBPROTOCOL, protocol);
|
||||
}
|
||||
headers.remove(HttpHeader.SEC_WEBSOCKET_SUBPROTOCOL);
|
||||
for (String protocol : protocols)
|
||||
{
|
||||
headers.add(HttpHeader.SEC_WEBSOCKET_SUBPROTOCOL, protocol);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -282,7 +285,7 @@ public abstract class ClientUpgradeRequest extends HttpRequest implements Respon
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
if (!StringUtil.isEmpty(extensionString))
|
||||
getHeaders().add(HttpHeader.SEC_WEBSOCKET_EXTENSIONS, extensionString);
|
||||
headers(headers -> headers.add(HttpHeader.SEC_WEBSOCKET_EXTENSIONS, extensionString));
|
||||
|
||||
// Notify the listener which may change the headers directly.
|
||||
notifyUpgradeListeners((listener) -> listener.onHandshakeRequest(this));
|
||||
|
@ -413,13 +413,12 @@ public class WebSocketNegotiationTest extends WebSocketTester
|
||||
upgradeRequest.setSubProtocols("test");
|
||||
upgradeRequest.addExtensions("permessage-deflate;server_no_context_takeover");
|
||||
|
||||
CompletableFuture<String> extensionHeader = new CompletableFuture<>();
|
||||
upgradeRequest.addListener(new UpgradeListener()
|
||||
{
|
||||
@Override
|
||||
public void onHandshakeRequest(HttpRequest request)
|
||||
{
|
||||
request.getHeaders().put(HttpHeader.SEC_WEBSOCKET_EXTENSIONS, "permessage-deflate");
|
||||
request.headers(headers -> headers.put(HttpHeader.SEC_WEBSOCKET_EXTENSIONS, "permessage-deflate"));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -33,7 +33,7 @@ import org.eclipse.jetty.websocket.core.client.UpgradeListener;
|
||||
|
||||
public class JsrUpgradeListener implements UpgradeListener
|
||||
{
|
||||
private Configurator configurator;
|
||||
private final Configurator configurator;
|
||||
|
||||
public JsrUpgradeListener(Configurator configurator)
|
||||
{
|
||||
@ -46,7 +46,7 @@ public class JsrUpgradeListener implements UpgradeListener
|
||||
if (configurator == null)
|
||||
return;
|
||||
|
||||
HttpFields.Mutable fields = request.getHeaders();
|
||||
HttpFields fields = request.getHeaders();
|
||||
Map<String, List<String>> originalHeaders = new HashMap<>();
|
||||
fields.forEach(field ->
|
||||
{
|
||||
@ -59,8 +59,11 @@ public class JsrUpgradeListener implements UpgradeListener
|
||||
configurator.beforeRequest(originalHeaders);
|
||||
|
||||
// Reset headers on HttpRequest per configurator
|
||||
fields.clear();
|
||||
originalHeaders.forEach(fields::put);
|
||||
request.headers(headers ->
|
||||
{
|
||||
headers.clear();
|
||||
originalHeaders.forEach(headers::put);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,7 +30,6 @@ import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.jetty.http.HttpFields;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
@ -72,11 +71,13 @@ public class NetworkFuzzer extends Fuzzer.Adapter implements Fuzzer, AutoCloseab
|
||||
this.upgradeRequest = new RawUpgradeRequest(client, wsURI);
|
||||
if (requestHeaders != null)
|
||||
{
|
||||
HttpFields.Mutable fields = this.upgradeRequest.getHeaders();
|
||||
requestHeaders.forEach((name, value) ->
|
||||
this.upgradeRequest.headers(fields ->
|
||||
{
|
||||
fields.remove(name);
|
||||
fields.put(name, value);
|
||||
requestHeaders.forEach((name, value) ->
|
||||
{
|
||||
fields.remove(name);
|
||||
fields.put(name, value);
|
||||
});
|
||||
});
|
||||
}
|
||||
this.client.start();
|
||||
|
@ -18,12 +18,13 @@
|
||||
|
||||
package org.eclipse.jetty.websocket.client.impl;
|
||||
|
||||
import java.net.HttpCookie;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.jetty.client.HttpResponse;
|
||||
import org.eclipse.jetty.http.HttpFields;
|
||||
import org.eclipse.jetty.http.HttpHeader;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
|
||||
@ -46,11 +47,15 @@ public class JettyClientUpgradeRequest extends org.eclipse.jetty.websocket.core.
|
||||
if (request != null)
|
||||
{
|
||||
// Copy request details into actual request
|
||||
HttpFields.Mutable fields = getHeaders();
|
||||
request.getHeaders().forEach(fields::put);
|
||||
headers(fields -> request.getHeaders().forEach(fields::put));
|
||||
|
||||
// Copy manually created Cookies into place
|
||||
request.getCookies().forEach(c -> fields.add(HttpHeader.COOKIE, c.toString()));
|
||||
List<HttpCookie> cookies = request.getCookies();
|
||||
if (cookies != null)
|
||||
{
|
||||
// TODO: remove existing Cookie header (if set)?
|
||||
headers(fields -> cookies.forEach(cookie -> fields.add(HttpHeader.COOKIE, cookie.toString())));
|
||||
}
|
||||
|
||||
// Copy sub-protocols
|
||||
setSubProtocols(request.getSubProtocols());
|
||||
|
@ -36,9 +36,9 @@ public class EchoSocket extends EventSocket
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(byte[] buf, int offset, int len)
|
||||
public void onMessage(byte[] buf, int offset, int len) throws IOException
|
||||
{
|
||||
super.onMessage(buf, offset, len);
|
||||
session.getRemote().sendBytes(ByteBuffer.wrap(buf, offset, len), WriteCallback.NOOP);
|
||||
session.getRemote().sendBytes(ByteBuffer.wrap(buf, offset, len));
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class EventSocket
|
||||
}
|
||||
|
||||
@OnWebSocketMessage
|
||||
public void onMessage(byte[] buf, int offset, int len)
|
||||
public void onMessage(byte[] buf, int offset, int len) throws IOException
|
||||
{
|
||||
ByteBuffer message = ByteBuffer.wrap(buf, offset, len);
|
||||
if (LOG.isDebugEnabled())
|
||||
|
8
pom.xml
8
pom.xml
@ -391,6 +391,14 @@
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<!-- this has better support of gh token remove when with next release of jetty-version-maven-plugin -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.kohsuke</groupId>
|
||||
<artifactId>github-api</artifactId>
|
||||
<version>1.114</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
@ -58,18 +58,19 @@ public class MongoTestHelper
|
||||
|
||||
static MongoClient mongoClient;
|
||||
|
||||
static String mongoHost;
|
||||
static int mongoPort;
|
||||
|
||||
public static void startMongo()
|
||||
{
|
||||
try
|
||||
{
|
||||
long start = System.currentTimeMillis();
|
||||
mongo.start();
|
||||
String containerIpAddress = mongo.getContainerIpAddress();
|
||||
int mongoPort = mongo.getMappedPort(27017);
|
||||
LOG.info("Mongo container started for {}:{} - {}ms", containerIpAddress, mongoPort,
|
||||
System.currentTimeMillis() - start);
|
||||
System.setProperty("embedmongoHost", containerIpAddress);
|
||||
System.setProperty("embedmongoPort", Integer.toString(mongoPort));
|
||||
mongoHost = mongo.getHost();
|
||||
mongoPort = mongo.getMappedPort(27017);
|
||||
LOG.info("Mongo container started for {}:{} - {}ms", mongoHost, mongoPort,
|
||||
System.currentTimeMillis() - start);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -94,7 +95,7 @@ public class MongoTestHelper
|
||||
}
|
||||
if (mongoClient == null || restart)
|
||||
{
|
||||
mongoClient = new MongoClient(System.getProperty("embedmongoHost"), Integer.getInteger("embedmongoPort"));
|
||||
mongoClient = new MongoClient(mongoHost, mongoPort);
|
||||
}
|
||||
return mongoClient;
|
||||
}
|
||||
@ -117,8 +118,8 @@ public class MongoTestHelper
|
||||
public static MongoSessionDataStoreFactory newSessionDataStoreFactory()
|
||||
{
|
||||
MongoSessionDataStoreFactory storeFactory = new MongoSessionDataStoreFactory();
|
||||
storeFactory.setHost(System.getProperty("embedmongoHost"));
|
||||
storeFactory.setPort(Integer.getInteger("embedmongoPort"));
|
||||
storeFactory.setHost(mongoHost);
|
||||
storeFactory.setPort(mongoPort);
|
||||
storeFactory.setCollectionName(COLLECTION_NAME);
|
||||
storeFactory.setDbName(DB_NAME);
|
||||
return storeFactory;
|
||||
|
Loading…
x
Reference in New Issue
Block a user