renamed HTTP/2.0 to HTTP/2
This commit is contained in:
parent
272e1d8da5
commit
25295456ae
|
@ -31,7 +31,7 @@ public enum HttpVersion
|
|||
HTTP_0_9("HTTP/0.9",9),
|
||||
HTTP_1_0("HTTP/1.0",10),
|
||||
HTTP_1_1("HTTP/1.1",11),
|
||||
HTTP_2_0("HTTP/2.0",20);
|
||||
HTTP_2("HTTP/2",20);
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public final static Trie<HttpVersion> CACHE= new ArrayTrie<HttpVersion>();
|
||||
|
@ -74,7 +74,7 @@ public enum HttpVersion
|
|||
switch(bytes[position+7])
|
||||
{
|
||||
case '0':
|
||||
return HTTP_2_0;
|
||||
return HTTP_2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class HeadersGenerateParseTest
|
|||
HttpFields fields = new HttpFields();
|
||||
fields.put("Accept", "text/html");
|
||||
fields.put("User-Agent", "Jetty");
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2_0, HttpScheme.HTTP, "GET", "localhost:8080", "localhost", 8080, "/path", fields);
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2, HttpScheme.HTTP, "GET", "localhost:8080", "localhost", 8080, "/path", fields);
|
||||
|
||||
// Iterate a few times to be sure generator and parser are properly reset.
|
||||
final List<HeadersFrame> frames = new ArrayList<>();
|
||||
|
@ -105,7 +105,7 @@ public class HeadersGenerateParseTest
|
|||
HttpFields fields = new HttpFields();
|
||||
fields.put("Accept", "text/html");
|
||||
fields.put("User-Agent", "Jetty");
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2_0, HttpScheme.HTTP, "GET", "localhost:8080", "localhost", 8080, "/path", fields);
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2, HttpScheme.HTTP, "GET", "localhost:8080", "localhost", 8080, "/path", fields);
|
||||
|
||||
final List<HeadersFrame> frames = new ArrayList<>();
|
||||
ByteBufferPool.Lease lease = new ByteBufferPool.Lease(byteBufferPool);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class PushPromiseGenerateParseTest
|
|||
HttpFields fields = new HttpFields();
|
||||
fields.put("Accept", "text/html");
|
||||
fields.put("User-Agent", "Jetty");
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2_0, HttpScheme.HTTP, "GET", "localhost:8080", "localhost", 8080, "/path", fields);
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2, HttpScheme.HTTP, "GET", "localhost:8080", "localhost", 8080, "/path", fields);
|
||||
|
||||
// Iterate a few times to be sure generator and parser are properly reset.
|
||||
final List<PushPromiseFrame> frames = new ArrayList<>();
|
||||
|
@ -107,7 +107,7 @@ public class PushPromiseGenerateParseTest
|
|||
HttpFields fields = new HttpFields();
|
||||
fields.put("Accept", "text/html");
|
||||
fields.put("User-Agent", "Jetty");
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2_0, HttpScheme.HTTP, "GET", "localhost:8080", "localhost", 8080, "/path", fields);
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2, HttpScheme.HTTP, "GET", "localhost:8080", "localhost", 8080, "/path", fields);
|
||||
|
||||
final List<PushPromiseFrame> frames = new ArrayList<>();
|
||||
ByteBufferPool.Lease lease = new ByteBufferPool.Lease(byteBufferPool);
|
||||
|
|
|
@ -107,10 +107,10 @@ public class MetaDataBuilder
|
|||
HttpFields fields = _fields;
|
||||
_fields = new HttpFields(Math.max(10,fields.size()+5));
|
||||
if (_method!=null)
|
||||
return new MetaData.Request(HttpVersion.HTTP_2_0,_scheme,_method,_authority,_host,_port,_path,fields);
|
||||
return new MetaData.Request(HttpVersion.HTTP_2,_scheme,_method,_authority,_host,_port,_path,fields);
|
||||
if (_status!=0)
|
||||
return new MetaData.Response(HttpVersion.HTTP_2_0,_status,fields);
|
||||
return new MetaData(HttpVersion.HTTP_2_0,fields);
|
||||
return new MetaData.Response(HttpVersion.HTTP_2,_status,fields);
|
||||
return new MetaData(HttpVersion.HTTP_2,fields);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ public class HpackEncoderTest
|
|||
// encode them
|
||||
ByteBuffer buffer = BufferUtil.allocate(4096);
|
||||
int pos = BufferUtil.flipToFill(buffer);
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2_0,fields));
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
|
||||
BufferUtil.flipToFlush(buffer,pos);
|
||||
|
||||
// something was encoded!
|
||||
|
@ -89,7 +89,7 @@ public class HpackEncoderTest
|
|||
|
||||
// encode exact same fields again!
|
||||
BufferUtil.clearToFill(buffer);
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2_0,fields));
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
|
||||
BufferUtil.flipToFlush(buffer,0);
|
||||
|
||||
// nothing should be encoded!
|
||||
|
@ -112,7 +112,7 @@ public class HpackEncoderTest
|
|||
|
||||
// encode
|
||||
BufferUtil.clearToFill(buffer);
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2_0,fields));
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
|
||||
BufferUtil.flipToFlush(buffer,0);
|
||||
|
||||
// something was encoded!
|
||||
|
@ -136,7 +136,7 @@ public class HpackEncoderTest
|
|||
|
||||
// encode
|
||||
BufferUtil.clearToFill(buffer);
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2_0,fields));
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
|
||||
BufferUtil.flipToFlush(buffer,0);
|
||||
|
||||
// something was encoded!
|
||||
|
@ -163,7 +163,7 @@ public class HpackEncoderTest
|
|||
|
||||
// encode
|
||||
BufferUtil.clearToFill(buffer);
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2_0,fields));
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
|
||||
BufferUtil.flipToFlush(buffer,0);
|
||||
|
||||
// something was encoded!
|
||||
|
@ -191,7 +191,7 @@ public class HpackEncoderTest
|
|||
|
||||
// encode
|
||||
BufferUtil.clearToFill(buffer);
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2_0,fields));
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
|
||||
BufferUtil.flipToFlush(buffer,0);
|
||||
|
||||
// something was encoded!
|
||||
|
@ -225,7 +225,7 @@ public class HpackEncoderTest
|
|||
|
||||
// encode
|
||||
BufferUtil.clearToFill(buffer);
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2_0,fields));
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
|
||||
BufferUtil.flipToFlush(buffer,0);
|
||||
|
||||
// something was encoded!
|
||||
|
@ -246,7 +246,7 @@ public class HpackEncoderTest
|
|||
|
||||
// encode
|
||||
BufferUtil.clearToFill(buffer);
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2_0,fields));
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
|
||||
BufferUtil.flipToFlush(buffer,0);
|
||||
|
||||
// something was encoded!
|
||||
|
@ -258,7 +258,7 @@ public class HpackEncoderTest
|
|||
|
||||
// encode again
|
||||
BufferUtil.clearToFill(buffer);
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2_0,fields));
|
||||
encoder.encode(buffer,new MetaData(HttpVersion.HTTP_2,fields));
|
||||
BufferUtil.flipToFlush(buffer,0);
|
||||
|
||||
// something was encoded!
|
||||
|
|
|
@ -46,7 +46,7 @@ public class HpackTest
|
|||
fields0.add(HttpHeader.SERVER,"jetty");
|
||||
fields0.add(HttpHeader.SET_COOKIE,"abcdefghijklmnopqrstuvwxyz");
|
||||
fields0.add("custom-key","custom-value");
|
||||
Response original0 = new Response(HttpVersion.HTTP_2_0,200,fields0);
|
||||
Response original0 = new Response(HttpVersion.HTTP_2,200,fields0);
|
||||
|
||||
BufferUtil.clearToFill(buffer);
|
||||
encoder.encode(buffer,original0);
|
||||
|
@ -68,7 +68,7 @@ public class HpackTest
|
|||
fields1.add(HttpHeader.CONTENT_LENGTH,"1234");
|
||||
fields1.add(HttpHeader.SERVER,"jetty");
|
||||
fields1.add("custom-key","other-value");
|
||||
Response original1 = new Response(HttpVersion.HTTP_2_0,200,fields1);
|
||||
Response original1 = new Response(HttpVersion.HTTP_2,200,fields1);
|
||||
|
||||
// Same again?
|
||||
BufferUtil.clearToFill(buffer);
|
||||
|
|
|
@ -82,10 +82,10 @@ public class HttpTransportOverHTTP2 implements HttpTransport
|
|||
if (LOG.isDebugEnabled())
|
||||
{
|
||||
LOG.debug("HTTP2 Response #{}:{}{} {}{}{}",
|
||||
stream.getId(), System.lineSeparator(), HttpVersion.HTTP_2_0, info.getStatus(), System.lineSeparator(), info.getHttpFields());
|
||||
stream.getId(), System.lineSeparator(), HttpVersion.HTTP_2, info.getStatus(), System.lineSeparator(), info.getHttpFields());
|
||||
}
|
||||
|
||||
MetaData metaData = new MetaData.Response(HttpVersion.HTTP_2_0, info.getStatus(), info.getHttpFields());
|
||||
MetaData metaData = new MetaData.Response(HttpVersion.HTTP_2, info.getStatus(), info.getHttpFields());
|
||||
HeadersFrame frame = new HeadersFrame(stream.getId(), metaData, null, endStream);
|
||||
stream.headers(frame, callback);
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ public class HTTP2ServerTest
|
|||
String host = "localhost";
|
||||
int port = connector.getLocalPort();
|
||||
HttpFields fields = new HttpFields();
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2_0, HttpScheme.HTTP, HttpMethod.GET.asString(),
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2, HttpScheme.HTTP, HttpMethod.GET.asString(),
|
||||
host + ":" + port, host, port, path, fields);
|
||||
HeadersFrame request = new HeadersFrame(1, metaData, null, true);
|
||||
ByteBufferPool.Lease lease = new ByteBufferPool.Lease(byteBufferPool);
|
||||
|
@ -154,7 +154,7 @@ public class HTTP2ServerTest
|
|||
String host = "localhost";
|
||||
int port = connector.getLocalPort();
|
||||
HttpFields fields = new HttpFields();
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2_0, HttpScheme.HTTP, HttpMethod.GET.asString(),
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2, HttpScheme.HTTP, HttpMethod.GET.asString(),
|
||||
host + ":" + port, host, port, path, fields);
|
||||
HeadersFrame request = new HeadersFrame(1, metaData, null, true);
|
||||
ByteBufferPool.Lease lease = new ByteBufferPool.Lease(byteBufferPool);
|
||||
|
@ -217,7 +217,7 @@ public class HTTP2ServerTest
|
|||
String host = "localhost";
|
||||
int port = connector.getLocalPort();
|
||||
HttpFields fields = new HttpFields();
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2_0,HttpScheme.HTTP, HttpMethod.GET.asString(),
|
||||
MetaData.Request metaData = new MetaData.Request(HttpVersion.HTTP_2,HttpScheme.HTTP, HttpMethod.GET.asString(),
|
||||
host + ":" + port, host, port, path, fields);
|
||||
HeadersFrame request = new HeadersFrame(1, metaData, null, true);
|
||||
ByteBufferPool.Lease lease = new ByteBufferPool.Lease(byteBufferPool);
|
||||
|
|
|
@ -94,7 +94,7 @@ public class Http2Server
|
|||
// SSL Factory
|
||||
SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory,alpn.getProtocol());
|
||||
|
||||
// SPDY Connector
|
||||
// HTTP2 Connector
|
||||
ServerConnector http2Connector =
|
||||
new ServerConnector(server,ssl,alpn,h2,new HttpConnectionFactory(https_config));
|
||||
http2Connector.setPort(8443);
|
||||
|
@ -118,7 +118,7 @@ public class Http2Server
|
|||
HttpSession session = request.getSession(true);
|
||||
response.setHeader("custom","value");
|
||||
response.setContentType("text/plain");
|
||||
String content = "Hello from Jetty HTTP2\n";
|
||||
String content = "Hello from Jetty using "+request.getProtocol() +"\n";
|
||||
content+="uri="+request.getRequestURI()+"\n";
|
||||
content+="session="+session.getId()+(session.isNew()?"(New)\n":"\n");
|
||||
content+="date="+new Date()+"\n";
|
||||
|
|
Loading…
Reference in New Issue