Netty

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Make SslProvider.JDK the default provider for http2 examples using ALPN.

Motivation:

When running the http2 example no SslProvider is specified when calling

SslContext.newServerContext. This may lead to the provider being

determined depending on the availabilty of OpenSsl. But as far as I can

tell the OpenSslServerContext does not support APLN, which is the

protocol configured in the example.

This produces the following error when running the example:

Exception in thread "main" java.lang.UnsupportedOperationException:

OpenSSL provider does not support ALPN protocol

io.netty.handler.ssl.OpenSslServerContext.toNegotiator(OpenSslServerContext.java:391)

io.netty.handler.ssl.OpenSslServerContext.<init>(OpenSslServerContext.java:117)

io.netty.handler.ssl.SslContext.newServerContext(SslContext.java:238)

io.netty.handler.ssl.SslContext.newServerContext(SslContext.java:184)

io.netty.handler.ssl.SslContext.newServerContext(SslContext.java:124)

io.netty.example.http2.server.Http2Server.main(Http2Server.java:51)

Modifications:

Force SslProvider.JDK when creating the SslContext since the

example is using APLN.

Result:

There is no longer an error if OpenSsl is supported on the platform in

use.

Allow to set the context for which sessions can be used.

Motivation:

Openssl supports the SSL_CTX_set_session_id_context function to limit for which context a session can be used. We should support this.

Modifications:

Add OpenSslServerSessionContext that exposes a setSessionIdContext(...) method now.

Result:

It's now possible to use SSL_CTX_set_session_id_context.

Allow to set the context for which sessions can be used.

Motivation:

Openssl supports the SSL_CTX_set_session_id_context function to limit for which context a session can be used. We should support this.

Modifications:

Add OpenSslServerSessionContext that exposes a setSessionIdContext(...) method now.

Result:

It's now possible to use SSL_CTX_set_session_id_context.

Allow to set the context for which sessions can be used.

Motivation:

Openssl supports the SSL_CTX_set_session_id_context function to limit for which context a session can be used. We should support this.

Modifications:

Add OpenSslServerSessionContext that exposes a setSessionIdContext(...) method now.

Result:

It's now possible to use SSL_CTX_set_session_id_context.

Minor corrections to Http2 example javadocs.

Motivation:

There are a few very minor issues in the Http2 examples javadoc and

since I don't think that these javadocs are published this is very much

optional to include.

Modifications:

Updated the @see according to [1] to avoid warning when generating

javadocs.

Result:

No warning when generating javadocs.

[1] http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#@see

Add proper Openssl.SSLSession.getId() implementation

Motivation:

The current implementation not returns the real session as byte[] representation.

Modifications:

Create a proper Openssl.SSLSession.get() implementation which returns the real session as byte[].

Result:

More correct implementation

Add proper Openssl.SSLSession.getId() implementation

Motivation:

The current implementation not returns the real session as byte[] representation.

Modifications:

Create a proper Openssl.SSLSession.get() implementation which returns the real session as byte[].

Result:

More correct implementation

Add proper Openssl.SSLSession.getId() implementation

Motivation:

The current implementation not returns the real session as byte[] representation.

Modifications:

Create a proper Openssl.SSLSession.get() implementation which returns the real session as byte[].

Result:

More correct implementation

HTTP/2 Data Compressor

Motivation:

The HTTP/2 codec currently does not provide an interface to compress data. There is an analogous case to this in the HTTP codec and it is expected to be used commonly enough that it will be beneficial to have the feature in the http2-codec.

Modifications:

- Add a class which extends DefaultHttp2ConnectionEncoder and provides hooks to an EmbeddedChannel

- Add a compressor element to the Http2Stream interface

- Update unit tests to utilize the new feature

Result:

HTTP/2 codec supports data compression.

Ensure buffer is not released when call array() / memoryAddress()

Motivation:

Before we missed to check if a buffer was released before we return the backing byte array or memoryaddress. This could lead to JVM crashes when someone tried various bulk operations on the Unsafe*ByteBuf implementations.

Modifications:

Always check if the buffer is released before all to return the byte array and memoryaddress.

Result:

No more JVM crashes because of released buffers when doing bulk operations on Unsafe*ByteBuf implementations.

Ensure buffer is not released when call array() / memoryAddress()

Motivation:

Before we missed to check if a buffer was released before we return the backing byte array or memoryaddress. This could lead to JVM crashes when someone tried various bulk operations on the Unsafe*ByteBuf implementations.

Modifications:

Always check if the buffer is released before all to return the byte array and memoryaddress.

Result:

No more JVM crashes because of released buffers when doing bulk operations on Unsafe*ByteBuf implementations.

Ensure buffer is not released when call array() / memoryAddress()

Motivation:

Before we missed to check if a buffer was released before we return the backing byte array or memoryaddress. This could lead to JVM crashes when someone tried various bulk operations on the Unsafe*ByteBuf implementations.

Modifications:

Always check if the buffer is released before all to return the byte array and memoryaddress.

Result:

No more JVM crashes because of released buffers when doing bulk operations on Unsafe*ByteBuf implementations.

Rewrite HttpObjectDecoder to make use of proper state machine

Motivation:

HttpObjectDecoder extended ReplayDecoder which is slightly slower then ByteToMessageDecoder.

Modifications:

- Changed super class of HttpObjectDecoder from ReplayDecoder to ByteToMessageDecoder.

- Rewrote decode() method of HttpObjectDecoder to use proper state machine.

- Changed private methods HeaderParser.parse(ByteBuf), readHeaders(ByteBuf) and readTrailingHeaders(ByteBuf), skipControlCharacters(ByteBuf) to consider available bytes.

- Set HeaderParser and LineParser as static inner classes.

- Replaced not safe actualReadableBytes() with buffer.readableBytes().

Result:

Improved performance of HttpObjectDecoder by approximately 177%.

Rewrite HttpObjectDecoder to make use of proper state machine

Motivation:

HttpObjectDecoder extended ReplayDecoder which is slightly slower then ByteToMessageDecoder.

Modifications:

- Changed super class of HttpObjectDecoder from ReplayDecoder to ByteToMessageDecoder.

- Rewrote decode() method of HttpObjectDecoder to use proper state machine.

- Changed private methods HeaderParser.parse(ByteBuf), readHeaders(ByteBuf) and readTrailingHeaders(ByteBuf), skipControlCharacters(ByteBuf) to consider available bytes.

- Set HeaderParser and LineParser as static inner classes.

- Replaced not safe actualReadableBytes() with buffer.readableBytes().

Result:

Improved performance of HttpObjectDecoder by approximately 177%.

Rewrite HttpObjectDecoder to make use of proper state machine

Motivation:

HttpObjectDecoder extended ReplayDecoder which is slightly slower then ByteToMessageDecoder.

Modifications:

- Changed super class of HttpObjectDecoder from ReplayDecoder to ByteToMessageDecoder.

- Rewrote decode() method of HttpObjectDecoder to use proper state machine.

- Changed private methods HeaderParser.parse(ByteBuf), readHeaders(ByteBuf) and readTrailingHeaders(ByteBuf), skipControlCharacters(ByteBuf) to consider available bytes.

- Set HeaderParser and LineParser as static inner classes.

- Replaced not safe actualReadableBytes() with buffer.readableBytes().

Result:

Improved performance of HttpObjectDecoder by approximately 177%.

HTTP Content Encoder allow EmptyLastHttpContent

Motiviation:

The HttpContentEncoder does not account for a EmptyLastHttpContent being provided as input. This is useful in situations where the client is unable to determine if the current content chunk is the last content chunk (i.e. a proxy forwarding content when transfer encoding is chunked).

Modifications:

- HttpContentEncoder should not attempt to compress empty HttpContent objects

Result:

HttpContentEncoder supports a EmptyLastHttpContent to terminate the response.

HTTP Content Encoder allow EmptyLastHttpContent

Motiviation:

The HttpContentEncoder does not account for a EmptyLastHttpContent being provided as input. This is useful in situations where the client is unable to determine if the current content chunk is the last content chunk (i.e. a proxy forwarding content when transfer encoding is chunked).

Modifications:

- HttpContentEncoder should not attempt to compress empty HttpContent objects

Result:

HttpContentEncoder supports a EmptyLastHttpContent to terminate the response.

HTTP Content Encoder allow EmptyLastHttpContent

Motiviation:

The HttpContentEncoder does not account for a EmptyLastHttpContent being provided as input. This is useful in situations where the client is unable to determine if the current content chunk is the last content chunk (i.e. a proxy forwarding content when transfer encoding is chunked).

Modifications:

- HttpContentEncoder should not attempt to compress empty HttpContent objects

Result:

HttpContentEncoder supports a EmptyLastHttpContent to terminate the response.

Explicit allow to enable / disable session cache

Motivation:

It is sometimes useful to enable / disable the session cache.

Modifications:

* Add OpenSslSessionContext.setSessionCacheEnabled(...) and isSessionCacheEnabled()

Result:

It is now possible to enable / disable cache on the fly

Explicit allow to enable / disable session cache

Motivation:

It is sometimes useful to enable / disable the session cache.

Modifications:

* Add OpenSslSessionContext.setSessionCacheEnabled(...) and isSessionCacheEnabled()

Result:

It is now possible to enable / disable cache on the fly

Explicit allow to enable / disable session cache

Motivation:

It is sometimes useful to enable / disable the session cache.

Modifications:

* Add OpenSslSessionContext.setSessionCacheEnabled(...) and isSessionCacheEnabled()

Result:

It is now possible to enable / disable cache on the fly

Allow to enable session cache when using OpenSsl

Motivation:

At the moment it is not possible to make use of the session cache when OpenSsl is used. This should be possible when server mode is used.

Modifications:

- Add OpenSslSessionContext (implements SSLSessionContext) which exposes all the methods to modify the session cache.

- Add various extra methods to OpenSslSessionContext for extra functionality

- Return OpenSslSessionContext when OpenSslEngine.getSession().getContext() is called.

- Add sessionContext() to SslContext

- Move OpenSsl specific session operations to OpenSslSessionContext and mark the old methods @deprecated

Result:

It's now possible to use session cache with OpenSsl

Allow to enable session cache when using OpenSsl

Motivation:

At the moment it is not possible to make use of the session cache when OpenSsl is used. This should be possible when server mode is used.

Modifications:

- Add OpenSslSessionContext (implements SSLSessionContext) which exposes all the methods to modify the session cache.

- Add various extra methods to OpenSslSessionContext for extra functionality

- Return OpenSslSessionContext when OpenSslEngine.getSession().getContext() is called.

- Add sessionContext() to SslContext

- Move OpenSsl specific session operations to OpenSslSessionContext and mark the old methods @deprecated

Result:

It's now possible to use session cache with OpenSsl

Allow to enable session cache when using OpenSsl

Motivation:

At the moment it is not possible to make use of the session cache when OpenSsl is used. This should be possible when server mode is used.

Modifications:

- Add OpenSslSessionContext (implements SSLSessionContext) which exposes all the methods to modify the session cache.

- Add various extra methods to OpenSslSessionContext for extra functionality

- Return OpenSslSessionContext when OpenSslEngine.getSession().getContext() is called.

- Add sessionContext() to SslContext

- Move OpenSsl specific session operations to OpenSslSessionContext and mark the old methods @deprecated

Result:

It's now possible to use session cache with OpenSsl

Rename from 'The Netty project' to 'Netty'

Motivation:

Sonar uses the project name in the pom.xml as the project name. (no pun

intended) 4.x and master uses 'Netty' as the project name, so we should

be consistent.

Modifications:

Rename the project from 'The Netty project' to 'Netty'

Result:

Prettier SonarQube result

Headers set/add/contains timeMillis methods

Motivation:

The new Headers interface contains methods to getTimeMillis but no add/set/contains variants. These should be added for consistency.

Modifications:

- Add three new methods: addTimeMillis, setTimeMillis, containsTimeMillis to the Headers interface.

- Add a new method to the Headers.ValueConverter interface: T convertTimeMillis(long)

- Bring these new interfaces up the class hierarchy

Result:

All Headers classes have setters/getters for timeMillis.

Headers set/add/contains timeMillis methods

Motivation:

The new Headers interface contains methods to getTimeMillis but no add/set/contains variants. These should be added for consistency.

Modifications:

- Add three new methods: addTimeMillis, setTimeMillis, containsTimeMillis to the Headers interface.

- Add a new method to the Headers.ValueConverter interface: T convertTimeMillis(long)

- Bring these new interfaces up the class hierarchy

Result:

All Headers classes have setters/getters for timeMillis.

Closure of stream with pending frames causes GO_AWAY.

Motivation:

The current logic in DefaultHttp2OutboundFlowController for handling the

case of a stream shutdown results in a Http2Exception (not a

Http2StreamException). This results in a GO_AWAY being sent for what

really could just be a stream-specific error.

Modifications:

Modified DefaultHttp2OutboundFlowController to set a stream exception

rather than a connection-wide exception. Also using the error code of

INTERNAL_ERROR rather than STREAM_CLOSED, since it's more appropriate

for this case.

Result:

Should not be triggering GO_AWAY when a stream closes prematurely.

HTTP/2 to HTTP/1 non-ascii headers reset stream

Motivation:

The HTTP/2 specification indicates that when converting from HTTP/2 to HTTP/1.x and non-ascii characters are detected that an error should be thrown.

Modifications:

- The ASCII validation is already done but the exception that is raised is not properly converted to a RST_STREAM error.

Result:

- If HTTP/2 to HTTP/1.x translation layer is in use and a non-ascii header is received then a RST_STREAM frame should be sent in response.

Remove the unused .travis.yml