Issue #4382 - Support HTTP/1 upgrade to HTTP/2 in HttpClient.

Added comments and fixed logging.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2020-03-19 23:10:03 +01:00
parent 9cbd9ab44e
commit 1326700772
4 changed files with 12 additions and 9 deletions

View File

@ -35,12 +35,12 @@ import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.IteratingCallback;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HttpSenderOverHTTP extends HttpSender
{
private static final Logger LOG = Log.getLogger(HttpSenderOverHTTP.class);
private static final Logger LOG = LoggerFactory.getLogger(HttpSenderOverHTTP.class);
private final HttpGenerator generator = new HttpGenerator();
private boolean shutdown;

View File

@ -35,8 +35,8 @@ import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.Promise;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>A HttpUpgrader that upgrades to a given protocol.</p>
@ -47,7 +47,7 @@ import org.eclipse.jetty.util.log.Logger;
*/
public class ProtocolHttpUpgrader implements HttpUpgrader
{
private static final Logger LOG = Log.getLogger(ProtocolHttpUpgrader.class);
private static final Logger LOG = LoggerFactory.getLogger(ProtocolHttpUpgrader.class);
private final HttpDestination destination;
private final String protocol;

View File

@ -87,6 +87,9 @@ public class ClientConnectionFactoryOverHTTP2 extends ContainerLifeCycle impleme
// handle the HTTP/2 response to the upgrade request.
promise.succeeded(connection);
connection.upgrade(context);
// The connection can be used only after the upgrade that
// creates stream #1 corresponding to the HTTP/1.1 upgrade
// request, otherwise other requests can steal id #1.
destination.accept(connection);
}

View File

@ -37,12 +37,12 @@ import org.eclipse.jetty.http2.frames.DataFrame;
import org.eclipse.jetty.http2.frames.HeadersFrame;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.Promise;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HttpSenderOverHTTP2 extends HttpSender
{
private static final Logger LOG = Log.getLogger(HttpSenderOverHTTP2.class);
private static final Logger LOG = LoggerFactory.getLogger(HttpSenderOverHTTP2.class);
public HttpSenderOverHTTP2(HttpChannelOverHTTP2 channel)
{