Netty

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
HttpObjectEncoder#isContentAlwaysEmpty cannot be overridden by subclasses

Motivation:

Allow subclasses of HttpObjectEncoder other than HttpServerCodec to override the isContentAlwaysEmpty method

Modification:

Change the method visibility from package private to protected

Result:

Fixes #6761

RedisDecoder infinite loop

Motivation:

RedisDecoder can get into an infinite loop while decoding bulk strings if the final \r and \n to indicate the end of content are split on ByteBuf boundaries.

Modifications:

- We should break out of the decode loop if remainingBulkLength is 0 and we don't have enough data to read EOL

Result:

No more infinite loop in RedisDecoder#decodeBulkStringContent.

Netty force encodes already encoded responses

Motivation:

Fix the regression recently introduced that causes already encoded responses to be encoded again as gzip

Modification:

instead of just looking for IDENTITY, anything set for Content-Encoding should be respected and left as-is

added unit tests to capture this use case

Result:

Fixes #6784

Netty force encodes already encoded responses

Motivation:

Fix the regression recently introduced that causes already encoded responses to be encoded again as gzip

Modification:

instead of just looking for IDENTITY, anything set for Content-Encoding should be respected and left as-is

added unit tests to capture this use case

Result:

Fixes #6784

Correctly parse package-prefix if the jni lib is contained in a path that matches the library name.

Motivation:

We used strstr to find the path to the library, which fails if the library is contained in a directory that also matches the library name.

Modifications:

- Introduce netty_unix_util_strstr_last which will return a pointer which points to the last accourance and so not fails if the direct also matches the library name.

Result:

Be able to load the library in all cases.

    • -1
    • +13
    /transport-native-unix-common/src/main/c/netty_unix_util.c
Correctly parse package-prefix if the jni lib is contained in a path that matches the library name.

Motivation:

We used strstr to find the path to the library, which fails if the library is contained in a directory that also matches the library name.

Modifications:

- Introduce netty_unix_util_strstr_last which will return a pointer which points to the last accourance and so not fails if the direct also matches the library name.

Result:

Be able to load the library in all cases.

    • -1
    • +13
    /transport-native-unix-common/src/main/c/netty_unix_util.c
Handle the possibility of HTTP/0.9 with a better error message

Motivation

RFC 1945 (see section 3.1) says that request lines may not have a version in which case the request is assumed to be HTTP/0.9. We don't necessarily want to support that but the existing Exception should indicate the possibility of the request being HTTP/0.9 and give the user a chance to track it down.

Modifications

Indicate in the Exception's message that the request is possibly HTTP/0.9.

Result

Fixes #6739

Handle the possibility of HTTP/0.9 with a better error message

Motivation

RFC 1945 (see section 3.1) says that request lines may not have a version in which case the request is assumed to be HTTP/0.9. We don't necessarily want to support that but the existing Exception should indicate the possibility of the request being HTTP/0.9 and give the user a chance to track it down.

Modifications

Indicate in the Exception's message that the request is possibly HTTP/0.9.

Result

Fixes #6739

Only try to deregister from EventLoop when the native Channel was registered before.

Motivation:

We only can call eventLoop() if we are registered on an EventLoop yet. As we just did this without checking we spammed the log with an error that was harmless.

Modifications:

Check if registered on eventLoop before try to deregister on close.

Result:

Fixes [#6770]

Add HTTP Status code 308 in HttpResponseStatus.java

Motivation:

The status 308 is defined by RFC7538.

This RFC has currently the state Proposed Standard since 2 years, but the status code is already handle by all browsers (Chrome, Firefox, Edge, Safari, …).

To let developer handles easily this status code, it is added into this list.

Modifications:

Added this status code in the list of all status codes and changed the valudOf() method

Result:

Status code 308 included

Fix parameter order in SctpOutboundByteStreamHandler.

Motivation:

The first parameter of SctpMessage is protocolIdentifier, and the second is streamIdentifier. So we need to swap the parameters in encode method

Modification:

Fix order

Result:

SctpOutboundByteStreamHandler works correctly.

Fix parameter order in SctpOutboundByteStreamHandler.

Motivation:

The first parameter of SctpMessage is protocolIdentifier, and the second is streamIdentifier. So we need to swap the parameters in encode method

Modification:

Fix order

Result:

SctpOutboundByteStreamHandler works correctly.

Not add ChannelHandler to ChannelPipeline once the pipeline was destroyed.

Motivation:

ChannelPipeline will happily add a handler to a closed Channel's pipeline and will call handlerAdded(...) but will not call handlerRemoved(...).

Modifications:

Check if pipeline was destroyed and if so not add the handler at all but propergate an exception.

Result:

Fixes [#6768]

Not add ChannelHandler to ChannelPipeline once the pipeline was destroyed.

Motivation:

ChannelPipeline will happily add a handler to a closed Channel's pipeline and will call handlerAdded(...) but will not call handlerRemoved(...).

Modifications:

Check if pipeline was destroyed and if so not add the handler at all but propergate an exception.

Result:

Fixes [#6768]

Not add ChannelHandler to ChannelPipeline once the pipeline was destroyed.

Motivation:

ChannelPipeline will happily add a handler to a closed Channel's pipeline and will call handlerAdded(...) but will not call handlerRemoved(...).

Modifications:

Check if pipeline was destroyed and if so not add the handler at all but propergate an exception.

Result:

Fixes [#6768]

Not add ChannelHandler to ChannelPipeline once the pipeline was destroyed.

Motivation:

ChannelPipeline will happily add a handler to a closed Channel's pipeline and will call handlerAdded(...) but will not call handlerRemoved(...).

Modifications:

Check if pipeline was destroyed and if so not add the handler at all but propergate an exception.

Result:

Fixes [#6768]

Revert "Not add ChannelHandler to ChannelPipeline once the pipeline was destroyed."

This reverts commit 4cc98134da611562b7433aa4fb9937ab24d553fb.

Only try to deregister from EventLoop when the native Channel was registered before.

Motivation:

We only can call eventLoop() if we are registered on an EventLoop yet. As we just did this without checking we spammed the log with an error that was harmless.

Modifications:

Check if registered on eventLoop before try to deregister on close.

Result:

Fixes [#6770]

Only try to deregister from EventLoop when the native Channel was registered before.

Motivation:

We only can call eventLoop() if we are registered on an EventLoop yet. As we just did this without checking we spammed the log with an error that was harmless.

Modifications:

Check if registered on eventLoop before try to deregister on close.

Result:

Fixes [#6770]

Only try to deregister from EventLoop when the native Channel was registered before.

Motivation:

We only can call eventLoop() if we are registered on an EventLoop yet. As we just did this without checking we spammed the log with an error that was harmless.

Modifications:

Check if registered on eventLoop before try to deregister on close.

Result:

Fixes [#6770]

Don't add null to SmtpResponse.details()

Motivation:

If the remote server returns an invalid response in the form "000 \r\n"

(i.e. a three digit code, then space, but no details), null is added

as a singletonList to the response being constructed.

This seems unexpected and it would be easier to handle an empty

details list in client code.

Modifications:

If detail is null (because frame.isReadable() returned false after

reading the separator), initialise DefaultSmtpResponse with an empty

list instead of a list containing a single null value.

Result:

When encountering this malformed server response, a DefaultSmtpResponse

with a code but no details will be created.

Fix handle of ByteBuf with multi nioBuffer in EpollDatagramChannel

Motivation:

1. special handling of ByteBuf with multi nioBuffer rather than type of CompositeByteBuf (eg. DuplicatedByteBuf with CompositeByteBuf)

2. EpollDatagramUnicastTest and passed because CompositeByteBuf is converted to DuplicatedByteBuf before write to channel

3. uninitalized struct msghdr will raise error

Modifications:

1. isBufferCopyNeededForWrite(like isSingleDirectBuffer in NioDatgramChannel) checks wether a new direct buffer is needed

2. special handling of ByteBuf with multi nioBuffer in EpollDatagramChannel, AbstractEpollStreamChannel and IovArray

3. initalize struct msghdr

Result:

handle of ByteBuf with multi nioBuffer in EpollDatagramChannel is ok

Fix handle of ByteBuf with multi nioBuffer in EpollDatagramChannel and KQueueDatagramChannel

Motivation:

1. special handling of ByteBuf with multi nioBuffer rather than type of CompositeByteBuf (eg. DuplicatedByteBuf with CompositeByteBuf)

2. EpollDatagramUnicastTest and KQueueDatagramUnicastTest passed because CompositeByteBuf is converted to DuplicatedByteBuf before write to channel

3. uninitalized struct msghdr will raise error

Modifications:

1. isBufferCopyNeededForWrite(like isSingleDirectBuffer in NioDatgramChannel) checks wether a new direct buffer is needed

2. special handling of ByteBuf with multi nioBuffer in EpollDatagramChannel, AbstractEpollStreamChannel, KQueueDatagramChannel, AbstractKQueueStreamChannel and IovArray

3. initalize struct msghdr

Result:

handle of ByteBuf with multi nioBuffer in EpollDatagramChannel and KQueueDatagramChannel are ok

    • -1
    • +1
    /transport-native-unix-common/src/main/c/netty_unix_socket.c
SslHandler#handlerRemoved0() shouldn't care about the SSLEngine being a specific type but only if it's ReferenceCounted

Motivation

SslHandler should release any type of SSLEngine if it implements the ReferenceCounted interface

Modifications

Change condition to check for ReferenceCounted interface

Result

Better use of interfaces

SslHandler#handlerRemoved0() shouldn't care about the SSLEngine being a specific type but only if it's ReferenceCounted

Motivation

SslHandler should release any type of SSLEngine if it implements the ReferenceCounted interface

Modifications

Change condition to check for ReferenceCounted interface

Result

Better use of interfaces

Reset the contentExpected flag when RSET is written

Motivation:

If the remote server returns a 4xx/5xx error in response to

a DATA command (or earlier command if using pipelining),

SmtpRequestEncoder can become stuck in an invalid state,

not allowing any requests to be sent.

This makes the channel unusable and the connection has to be closed,

or the encoder handler has to be replaced.

Modifications:

If a RSET command is written to the channel, the contentExpected

flag is set to false, and the RSET is written to the channel.

Result:

Sending a RSET command after a server 4xx/5xx error will make it

possible to use the current connection for new mail transactions.

Share code that is needed to support shaded native libraries.

Motivation:

For our native libraries in netty we support shading, to have this work on runtime the user needs to set a system property. This code should shared.

Modifications:

Move logic to NativeLbiraryLoader and so share for all native libs.

Result:

Less code duplication and also will work for netty-tcnative out of the box once it support shading

Share code that is needed to support shaded native libraries.

Motivation:

For our native libraries in netty we support shading, to have this work on runtime the user needs to set a system property. This code should shared.

Modifications:

Move logic to NativeLbiraryLoader and so share for all native libs.

Result:

Less code duplication and also will work for netty-tcnative out of the box once it support shading

Share code that is needed to support shaded native libraries.

Motivation:

For our native libraries in netty we support shading, to have this work on runtime the user needs to set a system property. This code should shared.

Modifications:

Move logic to NativeLbiraryLoader and so share for all native libs.

Result:

Less code duplication and also will work for netty-tcnative out of the box once it support shading

Add support to wrap an existing filedescriptor when using native kqueue transport

Motivation:

The native epoll transport allows to wrap an existing filedescriptor, we should support the same in the native kqueue transport.

Modifications:

Add constructors that allow to wrap and existing filedescriptor.

Result:

Featureset of native transports more on par.