Commit Graph

10506 Commits

Author SHA1 Message Date
Nitesh Kant
df1d4dcd10 HttpUtil#normalizeAndGetContentLength() should handle empty value (#11409)
__Motivation__

`HttpUtil#normalizeAndGetContentLength()` throws `StringIndexOutOfBoundsException` for empty `content-length` values, it should instead throw `IllegalArgumentException` for all invalid values.

__Modification__

- Throw `IllegalArgumentException` if the `content-length` value is empty.
- Add tests

__Result__

Fixes https://github.com/netty/netty/issues/11408
2021-06-23 12:07:28 +02:00
ping
79c2bb902d Recycler.WeakOrderQueue drop Object hasBeenRecycled (#11402)
Motivation:

WeakOrderQueue would drop object that has been recycled, even when it has space for it.
WeakOrderQueue#add should check DefaultHandler.hasBeenRecycler field  first

Modifications:

WeakOrderQueue test the DefaultHandler.hasBeenRecycler first

Result:

WeakOrderQueue would not drop object that has been recycled when there is space


Co-authored-by: Norman Maurer <norman_maurer@apple.com>
Co-authored-by: Trustin Lee <t@motd.kr>
2021-06-23 11:33:16 +02:00
Paulo Lopes
92b4357ea0 Update graal annotations dependencies GAV to allow license GPL2+CE (#11404)
Motivation:

We need to use a GraalVM dependency which uses GPL2 + CE.

Modifications:

- Update all graalvm dependencies to new GAV which introduces a license change from GPL2 to GPL2 + CE
- This also required a small bump on the general version from 19.2 to 19.3, which should be fine as 19.3 is an official maintained LTS version, while 19.2 wasn't.

Result:

Fixes: #11398

Signed-off-by: Paulo Lopes <pmlopes@gmail.com>
2021-06-21 16:11:57 +02:00
Chris Vest
6a424509a0 Add GraalVM to the PR build matrix (#11405)
Motivation:

Native image compatibility is fragile and breaks easily, so we need a PR build to tell us when this happens.

Modification:

Add a graalvm-based build to the PR build matrix.

Result:

Every PR is now also tested on Graal.
2021-06-21 16:09:21 +02:00
Norman Maurer
ec518878c3 Log if the user tries to explicit set TLSv1.3 ciphers and using BoringSSL (#11392)
Motivation:

At the moment BoringSSL doesnt support explicit set the TLSv1.3 ciphers that should be used. If TLSv1.3 should be used it just enables all ciphers. We should better log if the user tries to explicit set a specific ciphers and using BoringSSL to inform the user that what is tried doesnt really work.

Modifications:

Log if the user tries to not use all TLSv1.3 ciphers and use BoringSSL

Result:

Easier for the user to understand why always all TLSv1.3 ciphers are enabled when using BoringSSL

Co-authored-by: Trustin Lee <trustin@gmail.com>
2021-06-21 08:55:30 +02:00
ktqco
e59722037c Accept smaller server_max_window_bits than requested (#11394)
Motivation:

Netty will fail a handshake for the Per-Message Deflate WebSocket
extension if the server response contains a smaller
`server_max_window_bits` value than the client offered.

However, this is allowed by RFC 7692:

> A server accepts an extension negotiation offer with this parameter
> by including the “server_max_window_bits” extension parameter in the
> extension negotiation response to send back to the client with the
> same or smaller value as the offer.

Modifications:

- Allow the server to respond with a smaller value than offered.
- Change the unit tests to test for this.

Result:

The client will not fail when the server indicates it is using a
smaller window size than offered by the client.
2021-06-18 11:57:29 +02:00
Hylke van der Schaaf
a36d5312c5 Validate fixed header bits in MQTT (#11389)
Motivation:
The MQTT spec states that the bits in the fixed header must be set to specific values depending on message type. If a client sends a message with the wrong bits, the server must treat the message as malformed. Netty did not check the value of the reserved bits in the fixed header.

See:
MQTT3.1.1: http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/errata01/os/mqtt-v3.1.1-errata01-os-complete.html#_Toc442180835
MQTT 5.0: https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901023

Modification:
Add validation checks to MqttDecoder.java
Add unit tests to MqttCodecTest.java
Fixed two instances where messages were generated for other unit tests with an incorrect fixed header.

Result:
Fixes #11379.
2021-06-16 15:16:51 +02:00
Chris Vest
98e3605d4d
Make all compression codecs support buffers that don't have arrays (#11383)
Motivation:
Various compression codecs are currently hard-coded to only support buffers that are backed by byte-arrays that they are willing to expose.
This is efficient for most of the codecs, but compatibility suffers, as we are not able to freely choose our buffer implementations when compression codecs are involved.

Modification:
Add code to the compression codecs, that allow them to handle buffers that don't have arrays.
For many of the codecs, this unfortunately involves allocating temporary byte-arrays, and copying back-and-forth.
We have to do it that way since some codecs can _only_ work with byte-arrays.
Also add tests to verify that this works.

Result:
It is now possible to use all of our compression codecs with both on-heap and off-heap buffers.
The default buffer choice has not changed, however, so performance should be unaffected.
2021-06-14 10:55:35 +02:00
Violeta Georgieva
e0940fed7a Skip the windows tests when there is an entry for localhost in the hosts file (#11385)
Motivation:

The tests must be executed only when there is no hosts file or
there is no entry for localhost in the hosts file. The tested functionality
is relevant only in these use cases.

Modifications:

Skip the windows tests when there is an entry for localhost in the hosts file.

Result:

Fix failing tests on Windows CI when using GitHub Actions
Related to #11384
2021-06-14 09:06:21 +02:00
Julien Viet
7b39415543 The MqttDecoder incorrectly skip bytes before throwing TooLongFrameException (#11362)
Motivation:

Commit c32c520edd incorrectly skip the bytes of the replay decoder buffer. The number of bytes to skip is determined by ByteBuf#readableBytes() instead of using ByteToMessageDecoder#actualReadableBytes(). As result it throws an exception because the ByteBuf provided will return a too large value (Integer.MAX_VALUE - reader index) causing a bound check error in the skipBytes method. This is not detected by the tests because most tests are calling the decode(...) method with a regular ByteBuf. In practice when this method is called with a specialized ByteBuf when channelRead(...) is called. Such tests should actually use channelRead with proper mocking of the ChannelHandlerContext

Modification:

- Rewrite the MqttCodecTest to use channelRead(...) instead of decode(...) and use proper mocking of ChannelHandlerContext to get the message emitted by the decoder.
- Use actualReadableBytes() instead of buff.readableBytes() to compute the number of bytes to skip

Result:

Skip correctly the number of bytes when a too large message is found and improve testing. See #11361

Signed-off-by: Julien Viet <julien@julienviet.com>
2021-06-10 15:21:41 +02:00
Norman Maurer
4aef1cc77c Remove tarball module (#11377)
Motivation:

We don't publish any tarballs these days so we can just remove the module

Modifications:

Remove tarball module and also adjust release scripts

Result:

Less code / config to mantain
2021-06-10 10:20:32 +02:00
anotherJJz
17fd44a5d4 Modify List to Map of pooled redis message in FixedRedisMessagePool (#11300)
Motivation:

To simplify retrieving pooled message messages, add enums that can be used as key.

Modifications:

- Modify pooled collections from List to Map in FixedRedisMessagePool
- Allow to use enum as the key to easy get pooled message.
- Add unit tests

Result:

Users can get pooled message by enum instead of the whole string

Co-authored-by: Norman Maurer <norman_maurer@apple.com>
2021-06-09 13:19:28 +02:00
Nitesh Kant
998a576f65 HttpUtil.getCharset() fails for charset in double-quotes (#11373)
__Motivation__

As described in https://github.com/netty/netty/issues/11370 we should support quoted charset values

__Modification__

Modify `HttpUtil.getCharset(CharSequence contentTypeValue, Charset defaultCharset)` to trim the double-quotes if present.

__Result__

`HttpUtil.getCharset()` now supports quoted charsets. Fixes https://github.com/netty/netty/issues/11370
2021-06-09 12:43:23 +02:00
Norman Maurer
07baabaac5
Remove Progressive*Promise / Progressive*Future (#11374)
Motivation:

This special case implementation of Promise / Future requires the implementations responsible for completing the promise to have knowledge of this class to provide value. It also requires that the implementations are able to provide intermediate status while the work is being done. Even throughout the core of Netty it is not really supported most of the times and so just brings more complexity without real gain.

Let's remove it completely which is better then only support it sometimes.

Modifications:

Remove Progressive* API

Result:

Code cleanup.... Fixes https://github.com/netty/netty/issues/8519
2021-06-09 08:32:38 +02:00
Norman Maurer
1415938163
Remove Future.removeListener* and addListeners (#11375)
Motivation:

We didnt really have a good use-case for removeListener* and addListeners. Because of this we should just remove these methods and so make things simpler.

Modifications:

Remove methods

Result:

Cleanup
2021-06-09 08:31:02 +02:00
Norman Maurer
ed2443ec09
Remove unused VoidChannelGroupFuture (#11376)
Motivation:

https://github.com/netty/netty/pull/11348 did remove the void promise API but did miss to remove the VoidChannelGroupFuture.

Modifications:

Remove class

Result:

Cleanup
2021-06-09 08:29:55 +02:00
Norman Maurer
abdaa769de
Remove Void*Promise (#11348)
Motivation:

Sometime in the past we introduced the concept of Void*Promise. As it turned out this was not a good idea at all as basically each handler in the pipeline need to be very careful to correctly handle this. We should better just remove this "optimization".

Modifications:

- Remove Void*Promise and all the related APIs
- Remove tests which were related to Void*Promise

Result:

Less error-prone API
2021-06-08 14:22:16 +02:00
Violeta Georgieva
1a28c26b4b Fix ServerCookieDecoder javadoc (#11372)
Motivation:
When decoding the cookies on the server, the "Cookie" HTTP request header value should be considered.
The "Set-Cookie" HTTP response header is used to send cookies from the server to the user agent.

Modification:
- Specify in javadoc that the "Cookie" HTTP request header value should be considered and
not the "Set-Cookie" HTTP response header value.

Result:
Correct ServerCookieDecoder javadoc
2021-06-07 16:37:15 -07:00
Chris Vest
b0d1bff64b Make build log output less chatty (#11365)
Motivation:
When Maven does not run in batch mode, it will continuously print its progress as it downloads dependencies.
This can produce a very large amount of log output, that makes it harder to debug build failures.

Modification:
Make all Maven builds run in batch mode by adding the `-B` command line flag, and have transfer progress suppressed with the `-ntp` flag.
Some builds were already running batch mode but had the flag in a different location – these have had their `-B` flag moved so all builds are consistent.

Result:
Much less output in our build logs where Maven is just downloading stuff.
2021-06-07 10:54:43 +02:00
Stuart Douglas
f1db0b9014 Fix issue if encoding is enabled but not used (#11358)
Motivation:

Fixes an IllegalReferenceCountException

Modification:

Retained the buffers so the encoder works correctly.

Result:

Fixes #11357
2021-06-07 08:52:57 +02:00
Ikko Ashimine
1e6169fb65 Fix typo in AbstractMultiSearchProcessorFactory (#11368)
Motivation:

There was a typo in the docs.

Modification:

occurence -> occurrence

Result:

Cleanup.
2021-06-07 08:46:15 +02:00
Aayush Atharva
fa7b243d5f Fix typo in word accelerating (#11359)
Motivation:
There is a small typo in `pom.xml`. Typo is: `acclerating`, however it should be `accelerating`.

Modification:
Corrected the typo.

Result:
Typo-free `pom.xml`.
2021-06-07 08:09:06 +02:00
skyguard1
21c3de9c69 Fix IpSubnetFilterRule with IPv6 Default Route does not accept all IPv6 addresses (#11351)
Motivation:

In this issue(https://github.com/netty/netty/issues/11349 ),IpSubnetFilterRule needs to support ipv6 reserved addresses, such as 8000::, but the current implementation does not support

Modification:

Added support for default rule

Result:

Fixes https://github.com/netty/netty/issues/11349

Signed-off-by: xingrufei <xingrufei@sogou-inc.com>
2021-06-07 08:07:35 +02:00
skyguard1
7c0662007d Add default block in HttpObjectDecoder (#11342)
Motivation:

There should always be a default in switch blocks.

Modification:

Add default

Result:

Code cleanup.

Signed-off-by: xingrufei <xingrufei@sogou-inc.com>
2021-06-02 08:42:09 +02:00
skyguard1
a975f42d6e Add default block in HttpClientCodec (#11352)
Motivation:

There should always be a default in switch blocks.

Modification:

Add default

Result:

Code cleanup.

Signed-off-by: xingrufei <xingrufei@sogou-inc.com>
2021-06-02 08:42:00 +02:00
Norman Maurer
7b3e28f96f
Disable two tests which currently fail in master (#11344)
Motivation:

We have currently two test-failures in master. Let's disable these and then open a PR with a fix once we know why. This way we can make progress in master

Modifications:

Disable the two failing tests

Result:

Master builds again
2021-06-01 13:41:20 +02:00
skyguard1
cfd64f7ced Add default block in IdleStateHandler (#11341)
Motivation:

We should have a default case in every switch block.

Modification:

Add default block in IdleStateHandler

Result:

Cleanup

Signed-off-by: xingrufei <xingrufei@sogou-inc.com>
2021-06-01 09:22:02 +02:00
skyguard1
bc00c22634 Remove useless code (#11339)
Signed-off-by: xingrufei <xingrufei@sogou-inc.com>

Co-authored-by: xingrufei <xingrufei@sogou-inc.com>
2021-05-31 15:36:49 +02:00
Frédéric Brégier
cebf46af40 HttpPostMultipartRequestDecoder IndexOutOfBoundsException error (#11335)
Motivation:

When searching for the delimiter, the decoder part within HttpPostBodyUtil
was not checking the left space to check if it could be included or not,
while it should.

Modifications:

Add a check on toRead being greater or equal than delimiterLength before
going within the loop. If the check is wrong, the delimiter is obviously not found.

Add a Junit test to preserve regression.

Result:

No more IndexOutOfBoundsException

Fixes #11334
2021-05-31 08:43:59 +02:00
wuare
59f13c5adb Remove unUsed import statement (#11338)
Motivation:

Remove unused import statement

Modification:

Remove unused import statement

Result:

Cleanup
2021-05-31 08:39:11 +02:00
Norman Maurer
6301683ddc Fix compile errors introduced by f805c50f9f 2021-05-28 15:14:55 +02:00
Norman Maurer
f805c50f9f Move sctp tests to correct directory and migrate to junit5 (#11331)
Motivation:

The sctp tests were in the incorrect directory and so were never executed. Beside this we also should use junit5

Modifications:

- Move to correct directory
- Use JUnit5 in tests

Result:

Related to https://github.com/netty/netty/issues/10757 and fixes https://github.com/netty/netty/issues/11325
2021-05-28 15:03:39 +02:00
Norman Maurer
cba9cf1b6c Fix bad cherry-pick that was done in f9ca270e62 2021-05-28 09:34:59 +02:00
Norman Maurer
f9ca270e62 Fix test-error which was introduced by porting tests to junit5 (#11330)
Motivation:

b89a807d15 moved the buffer tests to junit5 but introduced a small error which could lead to test-failure

Modifications:

Correctly override the method and assert that super throws (as we can not expand the buffer).

Result:

No more test failures
2021-05-28 09:27:15 +02:00
skyguard1
7570cdb0b5 Add default block in DnsOpCode (#11328)
Motivation:

Every switch block should also have a default case.

Modification:

Add default block in DnsOpCode to ensure we not fall-through by mistake

Result:

Cleanup

Signed-off-by: xingrufei <xingrufei@sogou-inc.com>
2021-05-28 08:50:44 +02:00
skyguard1
2f1421e3b4 Add default block in AbstractDnsMessage (#11327)
Motivation:

Every switch block should also have a default case.

Modification:

Add default block in AbstractDnsMessage to ensure we not fall-through by mistake

Result:

Cleanup

Signed-off-by: xingrufei <xingrufei@sogou-inc.com>
2021-05-28 08:49:39 +02:00
skyguard1
02c3712067 Add default block in DefaultHttpHeaders (#11329)
Motivation:

Every switch block should also have a default case.

Modification:

Add default block in DefaultHttpHeaders to ensure we not fall-through by mistake

Result:

Cleanup

Signed-off-by: xingrufei <xingrufei@sogou-inc.com>
2021-05-28 08:48:15 +02:00
Riley Park
cd4249218c
Migrate resolver-dns tests to JUnit 5 (#11326)
Motivation:

JUnit 5 is more expressive, extensible, and composable in many ways, and it's better able to run tests in parallel.

Modifications:

Use JUnit5 in tests

Result:

Related to https://github.com/netty/netty/issues/10757
2021-05-27 19:06:07 +02:00
Riley Park
fd111e22d9
Migrate transport-blockhound-tests tests to JUnit 5 (#11322)
Motivation:

JUnit 5 is more expressive, extensible, and composable in many ways, and it's better able to run tests in parallel.

Modifications:

Use JUnit5 in tests

Result:

Related to https://github.com/netty/netty/issues/10757
2021-05-27 16:00:30 +02:00
Riley Park
7a7d519899
Migrate testsuite-shading tests to JUnit 5 (#11323)
Motivation:

JUnit 5 is more expressive, extensible, and composable in many ways, and it's better able to run tests in parallel.

Modifications:

Use JUnit5 in tests

Result:

Related to https://github.com/netty/netty/issues/10757
2021-05-27 15:59:36 +02:00
Riley Park
febb1e68fa
Migrate transport-native-unix-common tests to JUnit 5 (#11321)
Motivation:

JUnit 5 is more expressive, extensible, and composable in many ways, and it's better able to run tests in parallel.

Modifications:

Use JUnit5 in tests

Result:

Related to https://github.com/netty/netty/issues/10757
2021-05-27 15:57:36 +02:00
Riley Park
d1c8d8e1fb
Migrate testsuite, transport-native-epoll, transport-native-kqueue, and transport-native-unix-common-tests tests to JUnit 5 (#11320)
Motivation:

JUnit 5 is more expressive, extensible, and composable in many ways, and it's better able to run tests in parallel.

Modifications:

Use JUnit5 in tests

Result:

Related to https://github.com/netty/netty/issues/10757
2021-05-27 14:07:41 +02:00
Riley Park
56a186e41f
Migrate buffer tests to JUnit 5 (#11305)
Motivation:

JUnit 5 is more expressive, extensible, and composable in many ways, and it's better able to run tests in parallel.

Modifications:

Use JUnit5 in tests

Result:

Related to https://github.com/netty/netty/issues/10757
2021-05-27 09:22:02 +02:00
Riley Park
65e1f0e27c
Migrate codec-http tests to JUnit 5 (#11316)
Motivation:

JUnit 5 is more expressive, extensible, and composable in many ways, and it's better able to run tests in parallel.

Modifications:

Use JUnit5 in tests

Result:

Related to https://github.com/netty/netty/issues/10757
2021-05-27 09:06:23 +02:00
terrarier2111
73bafaaf9b Some minor cleanups for TypeParameterMatcher (#11286)
Motivation:

The code in TypeParamterMatcher can be simplified and cleaned up.

Modification:

Cleanup

Result:

Cleanup
2021-05-27 09:02:53 +02:00
Riley Park
bad51c5e36
Migrate codec-redis tests to JUnit 5 (#11318)
Motivation:

JUnit 5 is more expressive, extensible, and composable in many ways, and it's better able to run tests in parallel.

Modifications:

Use JUnit5 in tests

Result:

Related to https://github.com/netty/netty/issues/10757
2021-05-27 08:57:28 +02:00
Riley Park
e0b9eeb324
Migrate common tests to JUnit 5 (#11319)
Motivation:

JUnit 5 is more expressive, extensible, and composable in many ways, and it's better able to run tests in parallel.

Modifications:

Use JUnit5 in tests

Result:

Related to https://github.com/netty/netty/issues/10757
2021-05-27 08:31:53 +02:00
wuare
7a1e0b46b6 Remove not needed null check (#11303)
Motivation:

throw exception if there is no method, it never is null, condition is always true

Modification:

remove unnecessary condition

Result:

cleanup
2021-05-26 15:14:29 +02:00
Norman Maurer
9d01814a3b Automatically use netty-tcnative-boringssl-static on windows (#11317)
Motivation:

We only release a static compiled version of netty-tcnative for windows so we need to ensure we use it when on windows and not try to use a dynamic build version.

Modifications:

Automatically renable the boringssl profile when on windows

Result:

Fixes https://github.com/netty/netty/issues/11302
2021-05-26 14:11:28 +02:00
Riley Park
bd8b2519b8
Migrate codec tests to JUnit 5 (#11306)
Motivation:

JUnit 5 is more expressive, extensible, and composable in many ways, and it's better able to run tests in parallel.

Modifications:

Use JUnit5 in tests

Result:

Related to https://github.com/netty/netty/issues/10757
2021-05-26 13:46:15 +02:00