Commit Graph

6129 Commits

Author SHA1 Message Date
Trustin Lee
f4b9aaaf18 Add an operation that resets the state of HttpObjectDecoder
Motivation:

Currently, it is impossible to give a user the full control over what to do in response to the request with 'Expect: 100-continue' header.  Currently, a user have to do one of the following:

- Accept the request and respond with 100 Continue, or
- Send the reject response and close the connection.

.. which means it is impossible to send the reject response and keep the connection alive so that the client sends additional requests.

Modification:

Added a public method called 'reset()' to HttpObjectDecoder so that a user can reset the state of the decoder easily.  Once called, the decoder will assume the next input will be the beginning of a new request.

HttpObjectAggregator now calls `reset()`right after calling 'handleOversizedMessage()' so that the decoder can continue to decode the subsequent request even after the request with 'Expect: 100-continue' header is rejected.

Added relevant unit tests / Minor clean-up

Result:

This commit completes the fix of #2211
2014-02-20 13:42:58 -08:00
Trustin Lee
7d238aaf45 Added a test for oversized HTTP responses 2014-02-20 11:47:19 -08:00
Trustin Lee
5f62821b84 Remove the deprecated constant field
Exposing the constant as a public static final field is usually not a
good idea because it gives less flexibility to us when we happen to
change our internal implementation.
2014-02-20 11:38:49 -08:00
Trustin Lee
b2174fccc1 Overall clean-up of HttpObjectAggregator / Handle oversized response differently
- Related: #2211
2014-02-20 11:37:35 -08:00
Chris Mowforth
84946b617b Expose a callback in HttpObjectAggregator to handle oversized messages
- Related: #2211
2014-02-20 11:37:35 -08:00
Norman Maurer
ecc8fb1b89 Fix a regression which could lead to GenericFutureListeners never been notifed. Part of [#2186].
This regression was introduced by commit c97f2d2de00ad74835067cb6f5a62cd4651d1161
2014-02-20 15:12:58 +01:00
Trustin Lee
97662a6c94 Fix a bug where HttpObjectAggregator doesn't always produce FullHttpMessage
- Fixes #2182
- Always convert an unfull invalid message to a full message
2014-02-19 15:33:53 -08:00
Trustin Lee
acc781ba1b Ensure that the last bad chunk is LastHttpChunk 2014-02-19 15:20:58 -08:00
Trustin Lee
18d91b8bf6 HttpObjectDecoder.invalidChunk() should return LastHttpChunk
because the decoder will enter 'BAD_MESSAGE' state and will not produce any chunk since then.
2014-02-19 14:59:26 -08:00
Norman Maurer
f9238d1c15 Correctly handle remove from epoll and EPOLLRDHUP. Also fix a bug with removing EPOLLIN and EPOLLOUT 2014-02-19 16:34:45 +01:00
Norman Maurer
0b3e10ed40 Ensure native transport is included in all and tarball 2014-02-17 22:46:33 +01:00
Norman Maurer
55d0f36a61 Use optimized write and read calls if memoryAddress is present. Part of [#2239] 2014-02-17 17:29:11 +01:00
Norman Maurer
b49490e239 Move marking ChannelPromise for writes uncancellable to addFlush for keep things simple 2014-02-17 16:15:49 +01:00
Trustin Lee
31c24bc981 Fix an inspector warning 2014-02-17 05:27:52 -08:00
Trustin Lee
2a74378d01 Overall clean-up in EpollSocketChannel
- Extract writev part from doWrite() for simplicity
- Clearer comments
2014-02-17 05:21:49 -08:00
Norman Maurer
52050796e7 [#2238] Fix bug which caused a SIGSEGV when calling remoteAddress() or localAddress() 2014-02-17 12:00:12 +01:00
Norman Maurer
e0669522a3 Correctly update the ByteBuffers position on write and writev 2014-02-17 07:29:33 +01:00
Trustin Lee
0b1acf35c9 Fix resource leaks in ByteArrayEncoderTest 2014-02-16 11:51:27 -08:00
Norman Maurer
b1e7cefe32 Use correct writerIndex when read for channel 2014-02-16 20:44:06 +01:00
Norman Maurer
49cbf1d6b9 Fix compile error in test 2014-02-15 23:05:26 +01:00
Norman Maurer
e0299e1222 Introduce a native transport for linux using epoll ET
This transport use JNI (C) to directly make use of epoll in Edge-Triggered mode for maximal performance on Linux. Beside this it also support using TCP_CORK and produce less GC then the NIO transport using JDK NIO.
It only builds on linux and skip the build if linux is not used. The transport produce a jar which contains all needed .so files for 32bit and 64 bit. The user only need to include the jar as dependency as usually
to make use of it and use the correct classes.

This includes also some cleanup of @trustin
2014-02-15 22:42:07 +01:00
Trustin Lee
c73e1e3c1e Fix inefficient loop in QueryStringDecoder.decodeComponent()
- Fixes #2228
- There's no point of looping until the end of the component if at least one '%' or '+' is found.
2014-02-14 13:27:08 -08:00
Michael Nitschinger
6c02e19d10 Update JMH to 0.3.2 2014-02-14 13:15:49 -08:00
Trustin Lee
d5e897bba2 Determine the default allocator from system property
- Add ByteBufAllocator.DEFAULT
- The default allocator is now 'pooled'
2014-02-14 13:04:48 -08:00
Trustin Lee
bf0ae49c4f Do not warn about Unsafe in Android 2014-02-14 12:07:07 -08:00
Trustin Lee
e8c672d6c4 Fix wiki link 2014-02-14 12:03:51 -08:00
Trustin Lee
072b6eaa0f Fix a compilation error 2014-02-13 19:59:20 -08:00
Trustin Lee
ce9403cc3a Do not use String.format() for log message generation
- It's slow.
2014-02-13 19:31:45 -08:00
Norman Maurer
657af70576 Prettify exception message 2014-02-13 06:47:40 +01:00
Norman Maurer
0ad029bf96 Allow to set IoRatio to 100% 2014-02-12 19:30:57 +01:00
Norman Maurer
4dc337a717 Correctly respect isAutoRead() and make it consistent across OIO/NIO 2014-02-11 20:46:58 +01:00
Norman Maurer
a96eb96646 Allow to cancel non-flushed writes 2014-02-11 20:00:56 +01:00
Trustin Lee
6c094237e5 Do not warn if failed to mark a void promise as success
- it's always supposed to fail.
2014-02-10 15:04:03 -08:00
Trustin Lee
fee1d9e75c Make most outbound operations cancellable / More robust promise update
- Inspired by #2214 by @normanmaurer
- Call setUncancellable() before performing an outbound operation
- Add safeSetSuccess/Failure() and use them wherever
2014-02-10 14:52:24 -08:00
Trustin Lee
5395e263ad Make the build not fail in JDK8 until we fix Javadoc 2014-02-10 14:12:19 -08:00
Trustin Lee
a34d5baad2 Make most outbound operations are cancellable
- Inspired by #2214
- It actually reduces the chance of trying to marking a cancelled promise as success again, which raises an IllegalStateException.
2014-02-10 14:05:29 -08:00
Trustin Lee
c7087c6842 Fix external Javadoc url 2014-02-10 13:40:57 -08:00
Trustin Lee
cf821683f8 Fix a bug where DefaultPromise.setUncancellable() returns a wrong value
- Fixes #2220 - again
- Missing negation
2014-02-10 11:47:54 -08:00
Trustin Lee
ffcf1fe3d0 Fix a bug where DefaultPromise.setUncancellable() returns a wrong value
- Fixes #2220
- Its Javadoc says it returns true when the promise is done (but not cancelled) or the promise is uncancellable, but it returns false when the promise is done.
2014-02-10 11:40:32 -08:00
Norman Maurer
b07acfc28b [#2219] Fix javadocs of HttpObjectAggregator to show correct handler order in pipeline 2014-02-09 17:10:38 +01:00
Trustin Lee
bd78cd8d60 Remove the StringCache option which was removed in JDK8 2014-02-08 11:14:52 -08:00
Trustin Lee
2e1fe72a95 Remove a version clause added by mistake 2014-02-08 11:07:36 -08:00
Trustin Lee
cc45b5b1f6 Fix a build error related with NPN version and JDK8 2014-02-08 10:48:05 -08:00
Norman Maurer
d8d2eb3264 [#2212] Skip autobahntestsuite when using -DskipTests 2014-02-08 19:00:59 +01:00
Trustin Lee
39bc0df9c5 Fix a build error
which occurred when -Pcoverage was not specified
2014-02-08 09:13:31 -08:00
Trustin Lee
c94e5cb1cb Fix the compilation error in ConcurrentHashMapV8 + JDK8 2014-02-08 08:56:03 -08:00
Trustin Lee
ad121c73b0 Prefer interface to implementation in type declaration
This fixes the build failure with JDK 8 due to animal sniffer error
2014-02-08 08:50:41 -08:00
Trustin Lee
71913d3d84 Add 'coverage' profile that generates the test coverage report 2014-02-08 08:42:39 -08:00
Norman Maurer
bd20f80ca0 [#2215] DefaultChannelHandlerContext tasks needs to be volatile to ensure every thread only see full initialized instances 2014-02-08 10:35:54 +01:00
Trustin Lee
d8c1409820 Use smaller number of boss threads in the example
.. because usually there's no need to use many boss threads.
2014-02-07 14:42:49 -08:00