Commit Graph

707 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
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
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
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
b07acfc28b [#2219] Fix javadocs of HttpObjectAggregator to show correct handler order in pipeline 2014-02-09 17:10:38 +01: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
Daniel Bevenius
96216a9657 Fixing spelling of 'request' for handler names. 2014-02-07 13:51:02 +01:00
Trustin Lee
2b769c6daf Fix resource leaks in WebSocketServerProtocolHandler
- Related: #1975
2014-02-06 21:23:10 -08:00
Trustin Lee
8738bc4ae7 Clean up HttpObjectAggregator 2014-02-06 21:00:24 -08:00
Trustin Lee
c01f08d306 Fix a leak in WebSocketServerProtocolHandshakeHandler
- Related: #1975
2014-02-06 20:57:55 -08:00
Norman Maurer
4f6ccbbb78 [#2173] Fix regression that let HttpRequestDecoder fail if the websocket response and a websocketframe are send in one go 2014-02-06 10:48:48 +01:00
Trustin Lee
0f1b1be0aa Enable a user specify an arbitrary information with ReferenceCounted.touch()
- Related: #2163
- Add ResourceLeakHint to allow a user to provide a meaningful information about the leak when touching it
- DefaultChannelHandlerContext now implements ResourceLeakHint to tell where the message is going.
- Cleaner resource leak report by excluding noisy stack trace elements
2014-01-29 11:44:59 +09:00
Trustin Lee
b887e35ac2 Add ReferenceCounted.touch() / Add missing retain() overrides
- Fixes #2163
- Inspector warnings
2014-01-28 20:06:55 +09:00
Norman Maurer
f122118bf7 Not throw an exception if subprotocol is not supported but just drop the header as stated in the RFC's 2014-01-26 11:00:40 +01:00
Trustin Lee
714ed77e17 Add a log message on deletion failure 2014-01-24 16:45:20 +09:00
Frederic Bregier
19f9bcfe8b Fix fileChannel not closed, preventing delete to occur correctly 2014-01-24 16:45:20 +09:00
Frederic Bregier
ce39e6409e Fix try to delete file while it does not exist anymore (see #2102 and #1713) in reference to this issue 2014-01-21 14:16:59 +09:00
Trustin Lee
a69c4f2371 Fix IllegalReferenceCountException which occurs when multipart data is stored in memory
- Fixes #2102
2014-01-19 17:51:20 +09:00
Trustin Lee
a4e587c46b Fix resource leak in HttpPostRequestEncoderTest / Typo 2014-01-19 16:52:13 +09:00
Trustin Lee
5f9854d8ac Fix resource leak in InternalAttribute.setValue() 2014-01-19 16:51:31 +09:00
Trustin Lee
eb4ef433c6 Fix a test failure in Windows due to newline differences 2014-01-19 16:13:49 +09:00
Trustin Lee
f97f6b938e Use package-local fields instead of reflection / Reapply 4dc78c10ee / Inspector warnings 2014-01-19 14:58:48 +09:00
IonuÈ› G. Stan
709be30442 Add an HTML5 encoder mode for HttpPostRequestEncoder 2014-01-19 14:58:28 +09:00
Trustin Lee
a0714d1da3 Revert "+= won't let compile optimize String concats"
This reverts commit 4dc78c10ee.
2014-01-19 14:39:29 +09:00
Norman Maurer
1f049367a4 Make use of ByteBufProcessor for extract initial line and headers
This gives some nice performance boost as readByte() is quite expensive because of the index / replay checks.
2014-01-16 20:14:28 +01:00
Stephane Landelle
4dc78c10ee += won't let compile optimize String concats 2014-01-16 20:09:11 +01:00
Michael Nitschinger
75cb91ed0c Rename HttpDataFactory.*datas to *data. Fixes #2094 2014-01-16 09:52:25 +01:00
Daniel Bevenius
6a954d5b47 Adding a Cross Origin Resource Sharing (CORS) handler. 2014-01-16 07:58:32 +01:00
Norman Maurer
29484a44d5 Fix inspector warnings 2014-01-15 17:02:04 +01:00
Veebs
4c0be9b57c Add HttpChunkedInput for easier streaming of chunked content 2014-01-15 15:33:29 +09:00
Trustin Lee
2f9ad15d3f Use the source frame's allocator instead of the unpooled allocator 2014-01-14 14:22:06 +09:00
Trustin Lee
ae6aea794c Fix checkstyle 2014-01-13 23:35:52 +09:00
Trustin Lee
1a54ff843c Port the changes in SpdyHeaderBlockRawDecoder to master & 4.0
Somehow it slipped away.
2014-01-13 23:07:51 +09:00
Trustin Lee
ad70e69e47 Port the changes in SpdyHeaderBlockZlibEncoder to master & 4.0
Somehow it slipped away.
2014-01-13 23:01:07 +09:00
Trustin Lee
e1ab46f56a Fix a bug where SpdyHeaderBlockZlibDecoder fails to decompress
- Forward-port 4c35b593c1, originally written by @wgallagher
- Fixes #2077
2014-01-13 22:40:34 +09:00
Veebs
a389d69ba8 Replaced deprecated 'sendUnsupportedWebSocketVersionResponse()' with 'sendUnsupportedVersionResponse()' 2014-01-13 06:33:25 +01:00
Norman Maurer
4ee81d9235 Cleanup and remove get prefix of method to be more inline with our API 2014-01-11 14:19:43 +01:00
Leonardo Freitas Gomes
7324ce6fde Improves SelectedProtocol enum to avoid boilerplate on subclasses
NPN server providers return a String version of the negotiated protocol
and the getProtocolByName method allows to easily get an instance of
the SelectedProtocol enum and avoid the need for a switch statement in
each subclass to match the String against the enum value.
2014-01-11 13:54:46 +01:00
Trustin Lee
0244e35fa6 Fix a bug where HttpObjectDecoder produces LastHttpContent after entering BAD_MESSAGE state
- Fixes #2103
- Added LastHttpContent.EMPTY_LAST_CONTENT.toString() for athestic reasons.
2014-01-10 16:16:02 +09:00
Norman Maurer
2670bb4aae [#2090] Correctly format DefaultHttpRequest#toString() 2014-01-06 17:34:19 +01:00
Norman Maurer
906ac233a2 [#2088] Introduce sendUnsupportedVersionResponse(...) methods which allows to use the ChannelFuture/ChannelPromise to get notified once the response was send.
Also mark the old method as deprecated.
2014-01-03 11:13:05 +01:00
Trustin Lee
f3a842ecca [maven-release-plugin] prepare for next development iteration 2013-12-22 22:06:15 +09:00
Trustin Lee
888dfba76f [maven-release-plugin] prepare release netty-5.0.0.Alpha1 2013-12-22 22:06:06 +09:00
Trustin Lee
ddacf784c1 Use LinkedHashSet for HttpHeaders.names() and add Javadoc about the performance of names() and entries() 2013-12-22 19:18:27 +09:00