Merged branch 'jetty-11.0.x' into 'jetty-12.0.x'.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
commit
581f9ae9f4
|
@ -238,26 +238,35 @@ public class MetaData implements Iterable<HttpField>
|
|||
{
|
||||
private final String _protocol;
|
||||
|
||||
public ConnectRequest(HttpScheme scheme, HostPortHttpField authority, String path, HttpFields headers, String protocol)
|
||||
public ConnectRequest(HttpScheme scheme, HostPortHttpField authority, String pathQuery, HttpFields headers, String protocol)
|
||||
{
|
||||
this(NanoTime.now(), scheme == null ? null : scheme.asString(), authority, path, headers, protocol);
|
||||
this(scheme == null ? null : scheme.asString(), authority, pathQuery, headers, protocol);
|
||||
}
|
||||
|
||||
public ConnectRequest(long beginNanoTime, HttpScheme scheme, HostPortHttpField authority, String path, HttpFields headers, String protocol)
|
||||
public ConnectRequest(long beginNanoTime, HttpScheme scheme, HostPortHttpField authority, String pathQuery, HttpFields headers, String protocol)
|
||||
{
|
||||
this(beginNanoTime, scheme == null ? null : scheme.asString(), authority, path, headers, protocol);
|
||||
this(beginNanoTime, scheme == null ? null : scheme.asString(), authority, pathQuery, headers, protocol);
|
||||
}
|
||||
|
||||
public ConnectRequest(String scheme, HostPortHttpField authority, String path, HttpFields headers, String protocol)
|
||||
public ConnectRequest(String scheme, HostPortHttpField authority, String pathQuery, HttpFields headers, String protocol)
|
||||
{
|
||||
this(NanoTime.now(), scheme, authority, path, headers, protocol);
|
||||
this(NanoTime.now(), scheme, authority, pathQuery, headers, protocol);
|
||||
}
|
||||
|
||||
public ConnectRequest(long beginNanoTime, String scheme, HostPortHttpField authority, String path, HttpFields headers, String protocol)
|
||||
public ConnectRequest(long beginNanoTime, String scheme, HostPortHttpField authority, String pathQuery, HttpFields headers, String protocol)
|
||||
{
|
||||
super(beginNanoTime, HttpMethod.CONNECT.asString(),
|
||||
HttpURI.build().scheme(scheme).host(authority == null ? null : authority.getHost()).port(authority == null ? -1 : authority.getPort()).pathQuery(path),
|
||||
HttpVersion.HTTP_2, headers, -1, null);
|
||||
super(beginNanoTime,
|
||||
HttpMethod.CONNECT.asString(),
|
||||
HttpURI.build()
|
||||
.scheme(scheme)
|
||||
.host(authority == null ? null : authority.getHost())
|
||||
.port(authority == null ? -1 : authority.getPort())
|
||||
.pathQuery(pathQuery),
|
||||
HttpVersion.HTTP_2,
|
||||
headers,
|
||||
-1,
|
||||
null
|
||||
);
|
||||
_protocol = protocol;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.eclipse.jetty.http2.frames.HeadersFrame;
|
|||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.Promise;
|
||||
import org.eclipse.jetty.util.URIUtil;
|
||||
|
||||
public class HttpSenderOverHTTP2 extends HttpSender
|
||||
{
|
||||
|
@ -64,7 +65,8 @@ public class HttpSenderOverHTTP2 extends HttpSender
|
|||
else
|
||||
{
|
||||
HostPortHttpField authority = new HostPortHttpField(request.getHost(), request.getPort());
|
||||
metaData = new MetaData.ConnectRequest(request.getScheme(), authority, request.getPath(), request.getHeaders(), upgradeProtocol);
|
||||
String pathQuery = URIUtil.addPathQuery(request.getPath(), request.getQuery());
|
||||
metaData = new MetaData.ConnectRequest(request.getScheme(), authority, pathQuery, request.getHeaders(), upgradeProtocol);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.eclipse.jetty.http3.frames.DataFrame;
|
|||
import org.eclipse.jetty.http3.frames.HeadersFrame;
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
import org.eclipse.jetty.util.Callback;
|
||||
import org.eclipse.jetty.util.URIUtil;
|
||||
|
||||
public class HttpSenderOverHTTP3 extends HttpSender
|
||||
{
|
||||
|
@ -64,7 +65,8 @@ public class HttpSenderOverHTTP3 extends HttpSender
|
|||
else
|
||||
{
|
||||
HostPortHttpField authority = new HostPortHttpField(request.getHost(), request.getPort());
|
||||
metaData = new MetaData.ConnectRequest(request.getScheme(), authority, request.getPath(), request.getHeaders(), upgradeProtocol);
|
||||
String pathQuery = URIUtil.addPathQuery(request.getPath(), request.getQuery());
|
||||
metaData = new MetaData.ConnectRequest(request.getScheme(), authority, pathQuery, request.getHeaders(), upgradeProtocol);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -179,7 +179,7 @@ public class WebSocketOverHTTP2Test
|
|||
startClient(protocolFn);
|
||||
|
||||
EventSocket wsEndPoint = new EventSocket();
|
||||
URI uri = URI.create("ws://localhost:" + connector.getLocalPort() + "/ws/echo");
|
||||
URI uri = URI.create("ws://localhost:" + connector.getLocalPort() + "/ws/echo/query?param=value");
|
||||
Session session = wsClient.connect(wsEndPoint, uri).get(5, TimeUnit.SECONDS);
|
||||
|
||||
String text = "websocket";
|
||||
|
@ -391,6 +391,11 @@ public class WebSocketOverHTTP2Test
|
|||
protected void configure(JettyWebSocketServletFactory factory)
|
||||
{
|
||||
factory.addMapping("/ws/echo", (request, response) -> new EchoSocket());
|
||||
factory.addMapping("/ws/echo/query", (request, response) ->
|
||||
{
|
||||
assertNotNull(request.getQueryString());
|
||||
return new EchoSocket();
|
||||
});
|
||||
factory.addMapping("/ws/null", (request, response) ->
|
||||
{
|
||||
response.sendError(HttpStatus.SERVICE_UNAVAILABLE_503, "null");
|
||||
|
|
|
@ -162,7 +162,7 @@ public class WebSocketOverHTTP2Test
|
|||
startClient(protocolFn);
|
||||
|
||||
EventSocket wsEndPoint = new EventSocket();
|
||||
URI uri = URI.create("ws://localhost:" + connector.getLocalPort() + "/ws/echo");
|
||||
URI uri = URI.create("ws://localhost:" + connector.getLocalPort() + "/ws/echo/query?param=value");
|
||||
Session session = wsClient.connect(wsEndPoint, uri).get(5, TimeUnit.SECONDS);
|
||||
|
||||
String text = "websocket";
|
||||
|
@ -382,6 +382,11 @@ public class WebSocketOverHTTP2Test
|
|||
protected void configure(JettyWebSocketServletFactory factory)
|
||||
{
|
||||
factory.addMapping("/ws/echo", (request, response) -> new EchoSocket());
|
||||
factory.addMapping("/ws/echo/query", (request, response) ->
|
||||
{
|
||||
assertNotNull(request.getQueryString());
|
||||
return new EchoSocket();
|
||||
});
|
||||
factory.addMapping("/ws/null", (request, response) ->
|
||||
{
|
||||
response.sendError(HttpStatus.SERVICE_UNAVAILABLE_503, "null");
|
||||
|
|
Loading…
Reference in New Issue