Commit Graph

869 Commits

Author SHA1 Message Date
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
Trustin Lee
906e2d2b37 Fix a leak in HttpResponseDecoderTest 2013-12-19 01:13:02 +09:00
Norman Maurer
ca1c82642a Limit the access of the HttpHeaders for performance reasons 2013-12-18 23:08:39 +09:00
Trustin Lee
d35c2010c4 Stop decoding after protocol upgrade / Do not use singleDecode option 2013-12-18 23:08:32 +09:00
Trustin Lee
fa336db891 Remove unnecessary code from HttpObjectDecoder and re-enable all HTTP tests
- Since Netty 4, HTTP decoder does not generate a full message at all.  Therefore, there's no need to keep separate states for the content smaller than maxChunkSize.
- maxChunkSize must be greater than 0. Setting it to 0 should not disable chunked encoding. We have a dedicated flag for that.
- Uncommented the tests that were commented out for an unknown reason, with some fixes.
- Added more tests for HTTP decoder.
- Removed the Ignore annotation on some tests.
2013-12-18 23:08:26 +09:00
Trustin Lee
94d6e44bba Change the return type of EmbeddedChannel.read*() from Object to an ad-hoc type parameter
.. so that there's no need to explicitly down-cast.

Fixes #2067
2013-12-16 22:22:47 +09:00
Trustin Lee
61ed9476ae Improve the unit test for #1742 2013-12-16 21:55:14 +09:00
Trustin Lee
af07cc95fa Fix a bug where HttpObjectAggregator fails to send a '100 Continue' response
- Fixes #1742
2013-12-16 21:45:10 +09:00
Frederic Bregier
d7faf042a1 Add support for 'charset' property for multipart boundaries
- Fixes #2004
2013-12-16 14:30:10 +09:00
Jeff Pinner
f41e2f830d Merge pull request #2064 from jpinner/spdy_minor_version
SPDY: add SETTINGS_MINOR_VERSION
2013-12-15 21:10:10 -08:00
Jeff Pinner
78f3ee3396 SPDY: add SETTINGS_MINOR_VERSION 2013-12-14 10:27:14 -08:00
Norman Maurer
48b416f112 Optimize encoding of websocket frames by merge if possible 2013-12-13 11:39:39 +01:00
Trustin Lee
b6ac202c15 Fix buffer leak in AbstractMemoryHttpData 2013-12-07 11:13:50 +09:00
Norman Maurer
643ce2f8c0 Fix all leaks reported during tests
- One notable leak is from WebSocketFrameAggregator
- All other leaks are from tests
2013-12-07 00:47:30 +09:00
Trustin Lee
f2bb5f1b4c Allow specifying a custom charset for a multipart Attribute
- Fixed #2025
- Adapted from @BabyDuncan's pull request: #2031
- Overall ugliness clean-up
2013-12-05 11:23:23 +09:00
Norman Maurer
ec8967f9ff Replace usage of StringBuilder by AppendableCharSequence for performance reasons 2013-12-03 14:47:11 +01:00
Norman Maurer
5106382b44 Port the HTTP / RTSP encoder and decoder from 4.0 branch as those are just faster. 2013-12-02 20:53:39 +01:00
Norman Maurer
4a680a3b49 Remove the use of ThreadLocal for performance reasons 2013-11-29 19:18:27 +01:00
Norman Maurer
4ea39aa9df Fix test 2013-11-28 13:50:08 +01:00
Norman Maurer
dab954dfb5 Merge buffers for performance reasons if possible when encode http requests/responses. 2013-11-28 13:48:34 +01:00
Trustin Lee
387f6917af Add test case for HttpHeaders.equalsIgnoreCase(...) 2013-11-28 18:24:03 +09:00
Trustin Lee
d4fd7ff458 Fix NPE raised by HttpHeaders.equalsIgnoreCases() when one of its arguments is null 2013-11-28 15:51:13 +09:00
Norman Maurer
b067566a7c Optimize the decoding and encoding of HTTP for better performance
* No need to calculate the hash of known header names multiple times
* Optimize header encoding
* Also optimize the encoding of known header values
* Optimize encoding of HTTP method, version and status
2013-11-27 12:35:58 +01:00
Trustin Lee
110745b0eb Remove the distinction of inbound handlers and outbound handlers
- Fixes #1808
- Move all methods in ChannelInboundHandler and ChannelOutboundHandler up to ChannelHandler
- Remove ChannelInboundHandler and ChannelOutboundHandler
- Deprecate ChannelInboundHandlerAdapter, ChannelOutboundHandlerAdapter, and ChannelDuplexHandler
- Replace CombinedChannelDuplexHandler with ChannelHandlerAppender
  because it's not possible to combine two handlers into one easily now
- Introduce 'Skip' annotation to pass events through efficiently
- Remove all references to the deprecated types and update Javadoc
2013-11-27 17:31:28 +09:00
Trustin Lee
807d96ed6c Simplify bundle generation / Add io.netty.versions.properties to all JARs
- Fixes #2003 properly
- Instead of using 'bundle' packaging, use 'jar' packaging.  This is
  more robust because some strict build tools fail to retrieve the
  artifacts from a Maven repository unless their packaging is not 'jar'.
- All artifacts now contain META-INF/io.netty.version.properties, which
  provides the detailed information about the build and repository.
- Removed OSGi testsuite temporarily because it gives false errors
  during split package test and examination.
- Add io.netty.util.Version for easy retrieval of version information
2013-11-26 22:00:14 +09:00
Norman Maurer
10e3651bf8 [#2006] Correctly handle HttpMessage / HttpContent implementations 2013-11-26 10:57:50 +01:00
Norman Maurer
98845cb392 [#2005] Allow to use HttpContentDecompressor in strict mode 2013-11-26 08:20:56 +01:00
Norman Maurer
daeaaf25a9 Respect validateHeaders when duplicate/copy the response/request 2013-11-26 08:12:58 +01:00
Norman Maurer
279e2e3cd2 Optimize DefaultHttpHeaders.contains(...) 2013-11-24 14:42:33 +01:00
Norman Maurer
8eb88b7889 Optimize check for equals header name and value 2013-11-24 14:32:55 +01:00
Norman Maurer
a01f246091 Fix compile errors caused by last commit 2013-11-24 10:32:05 +01:00
Norman Maurer
f84a50d3cb Use the same HttpHeaders optimisations in master as in 4.0 2013-11-24 10:19:15 +01:00
Norman Maurer
0fa6dcefc5 [#1682] HttpVersion.valueOf(...) should not convert to uppercase 2013-11-23 20:35:47 +01:00
Trustin Lee
132af3a485 Introduce ChannelHandlerInvoker, dedeciated for invoking event handler methods, and move most handler invocation code in ChannelHandlerContext to the default ChannelHandlerInvoker implementation
- Fixes #1912
- Add ChannelHandlerInvoker and its default implementation
- Add pipeline manipulation methods that accept ChannelHandlerInvoker
- Rename Channel(Inbound|Outbound)Invoker to
  Channel(Inbound|Outbound)Ops to avoid confusion
- Remove the Javadoc references to the package-private interfaces
2013-11-21 14:14:23 +09:00
Daniel Bevenius
624573971f Support for empty HTTP request header values. 2013-11-17 15:49:14 +01:00
Norman Maurer
6306b83e2d [#1982] Limit the usage of ThreadLocal.get() for performance reasons 2013-11-14 09:48:33 +01:00
Norman Maurer
41ccbfd388 Also allow to disable header validation via HttpServerCodec and HttpClientCodec. Related to [#1981] 2013-11-14 09:37:57 +01:00
Daniel Bevenius
7cc2507076 Adding check for zero readable bytes in WebSocket08FrameDecoder decode. 2013-11-13 07:11:05 +01:00
Trustin Lee
1f0a73c238 Fix checkstyle 2013-11-04 19:52:10 +09:00
Trustin Lee
26415b8f4c Use StringUtil.simpleClassName(..) instead of Class.getSimpleName() where necessary
- Class.getSimpleName() doesn't render anonymous classes very well
- + some minor cleanup
2013-11-04 19:42:33 +09:00
Trustin Lee
6b0025430e Bump the version to 5.0.0.Alpha1 2013-11-04 19:14:40 +09:00
Trustin Lee
e01a444578 Fix some inspector warnings 2013-11-04 18:03:32 +09:00
fredericBregier
cf1970c31b Split HttpPostRequestDecoder into HttpPostStandardRequestDecoder and HttpPostMultipartRequestDecoder / Add HttpData.maxSize
- Related issues: #1937 #1938 and #1946
- Add InterfaceHttpPostRequestDecoder and Make HttpPostRequestDecoder implement it
- HttpPostRequestDecoder actually delegates itself to HttpPostStandardRequestDecoder or HttpPostMultipartRequestDecoder
- Remove IncompatibleDataDecoderException because it's not thrown anywhere now
2013-11-04 17:57:13 +09:00
Trustin Lee
81243c1524 Instead of complicated capacity estimation, just use thread local buffers.
Fixes #1951
2013-11-02 19:22:08 +09:00
Trustin Lee
e987ff63b1 Create StringBuilder with saner initial capacity when encoding a Cookie
Fixes #1951
2013-11-02 19:16:23 +09:00
Trustin Lee
0dda7df344 Add a shortcut method for collision-free naming 2013-10-25 20:01:31 +09:00
Trustin Lee
dc009b2c2c Replace UniqueName with Constant and ConstantPool
- Proposed fix for #1824

UniqueName and its subtypes do not allow getting the previously registered instance.  For example, let's assume that a user is running his/her application in an OSGi container with Netty bundles and his server bundle.  Whenever the server bundle is reloaded, the server will try to create a new AttributeKey instance with the same name.  However, Netty bundles were not reloaded at all, so AttributeKey will complain that the name is taken already (by the previously loaded bundle.)

To fix this problem:

- Replaced UniqueName with Constant, AbstractConstant, and ConstantPool.  Better name and better design.

- Sctp/Udt/RxtxChannelOption is not a ChannelOption anymore.  They are just constant providers and ChannelOption is final now.  It's because caching anything that's from outside of netty-transport will lead to ClassCastException on reload, because ChannelOption's constant pool will keep all option objects for reuse.

- Signal implements Constant because we can't ensure its uniqueness anymore by relying on the exception raised by UniqueName's constructor.
2013-10-25 19:21:53 +09:00
Trustin Lee
9b779e50ba Make all mutable fields in WebSocketClientHandshaker volatile
- Fixes #1945
2013-10-24 17:37:39 +09:00
Norman Maurer
afa5df6bf0 [#1933] Correctly add the wsencoder before the httpencoder as the httpencoder also handle ByteBuf 2013-10-19 20:53:57 +02:00
Norman Maurer
3367e51882 More robust pipeline manipulation while upgrading to WebSocket
- This commit allows a user to write its first web socket frame right after calling WebSocketServerHandshaker.handshake() rather than adding a listener to the future it returns.
- Should fix #1933
2013-10-18 18:23:36 +02:00
Jeff Pinner
e2e00689d9 SPDY: code cleanup 2013-10-17 08:21:35 -07:00
Trustin Lee
762e40f357 Make sure HttpVersion checks if the version string is not empty
.. which was the behavior in 3.x.
2013-10-17 20:27:41 +09:00
Jeff Pinner
949a6968ee SPDY: remove SPDY/2 support 2013-10-14 07:27:50 -07:00
Norman Maurer
1f1a627a22 No need to slice before copy. Part of #1848 2013-10-12 20:06:17 +02:00
Michael Grove
036f0859bd copy all sliced buffers, fixes #1848 2013-10-12 20:06:04 +02:00
Norman Maurer
79ff26d221 Fix compile error 2013-10-11 22:06:40 +02:00
Bill Gallagher
be959dc4b7 Merge pull request #1918 from wgallagher/entries
bring back entries()
2013-10-11 13:04:04 -07:00
Bill Gallagher
65f5b15a42 bring back entries() 2013-10-11 15:49:33 -04:00
Norman Maurer
beb6d37603 Add HttpHeaders.contains(name, value, ...) to save creation of LinkedList for simple checks 2013-10-11 21:46:05 +02:00
Bill Gallagher
b72761e99c minor gc optimization: better DefaultSpdyHeaders.iterator() 2013-10-11 20:36:14 +02:00
Bill Gallagher
951a65e57e minor gc optimization: better DefaultHttpHeaders.iterator() 2013-10-11 20:34:27 +02:00
Norman Maurer
2366c2846d [#1881] Use correct field name in NullPointerException 2013-10-04 09:54:21 +02:00
Norman Maurer
4bca1c3fe3 [#1876] Make use of proper state machine in WebSocket08FrameDecoder for performance reasons 2013-10-01 10:20:01 +02:00
Norman Maurer
1ecd1e01a5 [#1880] Use ByteBufAllocator when read bytes into new chunks 2013-10-01 09:27:02 +02:00
Norman Maurer
5a59cb9fb7 [#1879] Correctly validate close frame 2013-10-01 07:32:07 +02:00
Norman Maurer
aaafdf909d [#1878] Fix leak of ByteBuf when masked payload is used 2013-10-01 07:18:16 +02:00
Norman Maurer
328f67fdfe [#1874] WebSocket08FrameDecoder may leak memory if channel is closed before the full frame was received 2013-09-30 20:43:30 +02:00
Jeff Pinner
321990a115 SPDY: add SPDY/3.1 support
- with Michael Schore <mschore@twitter.com>
2013-09-28 12:58:44 +02:00
Arron Norwell
5a0d7fe19a HttpRequestEncoder should append '/' to absolute path requests only when needed 2013-09-22 13:57:10 +02:00
Norman Maurer
c0b9ef9386 [#1833] Add testcase for fix 2013-09-14 11:53:30 +02:00
Phillip Schichtel
d885394b8a [#1833] Replace ; with & only in the QueryString and not the whole URI 2013-09-14 11:52:39 +02:00
Norman Maurer
12f325767c [#1819] Remove HTTP compressor and decompressor from the pipeline after websockets handshake completes 2013-09-09 11:55:25 +02:00
Norman Maurer
c89f1b0a03 [#1818] Pass through message as they are when no compression is needed 2013-09-09 11:43:45 +02:00
Norman Maurer
198dde33b3 Optimize the http-codec to be much faster then before.
This includes the following changes:
  * Rewrite HttpObjectDecoder to use ByteToMessageDecoder
  * Optimize parsing of the header
  * Allow to disable the header validation for performance reason
  * Not need to validate kwown header names and values
  * Minimize access of ThreadLocals
  * Optimize parsing of initial line
2013-09-05 20:21:04 +02:00
Norman Maurer
e46ba9e8de Move encode of chunked content to an extra method, this allows for inline. Related to #1812
encode of chunked content is not the most common pattern so moving it to an extra method makes it possible to inline the rest as it is a smaller method now.
2013-09-05 10:15:51 +02:00
Norman Maurer
81258e9a4e [#1710] Add missing duplicate() overrides in interfaces 2013-09-02 10:02:12 +02:00
Derek Troy-West
b669237bac HTTP Chunk, wrong delimiter written 2013-08-27 18:11:08 +09:00
Norman Maurer
09a748abdb Bump up version to 4.1.0.Alpha1-SNAPSHOT 2013-08-26 15:18:18 +02:00
Norman Maurer
2e39b25cd4 [maven-release-plugin] prepare for next development iteration 2013-08-26 12:01:03 +02:00
Norman Maurer
b67659a866 [maven-release-plugin] prepare release netty-4.0.8.Final 2013-08-26 12:00:54 +02:00
Mike Schore
005d33a761 SPDY: allow MAX_CONCURRENT_STREAMS to be set to 0 2013-08-24 16:55:14 +02:00
Jeff Pinner
d1f592575a SPDY: ensure channel close happens after outbound message is written 2013-08-15 20:31:35 +02:00
Norman Maurer
cc12e40065 [#1730] Correctly release resources in MixedFileUpload after switching from Memory to Disk 2013-08-12 07:23:00 +02:00
Norman Maurer
b9e279064d Minimize buffer allocation as it is expensive if no pooled buffers are used 2013-08-11 21:55:24 +02:00
Norman Maurer
1d3560e389 [maven-release-plugin] prepare for next development iteration 2013-08-08 13:53:28 +02:00
Norman Maurer
8e97e6c461 [maven-release-plugin] prepare release netty-4.0.7.Final 2013-08-08 13:53:19 +02:00
Norman Maurer
60b889375c Allow to also write FileRegion and ChunkInput when using HTTP chunked. Fixes [#1693] 2013-08-07 09:37:23 +02:00
Norman Maurer
3b94154893 [#1690] Correctly return first header value on DefaultHttpHeaders.get(..) 2013-08-06 07:12:45 +02:00
Norman Maurer
20a010a2ea Small optimization in DefaultHttpHeaders.clear() 2013-08-05 21:41:07 +02:00
Norman Maurer
3f2000fa3a [maven-release-plugin] prepare for next development iteration 2013-08-01 10:59:55 +02:00
Norman Maurer
3f70d5caa4 [maven-release-plugin] prepare release netty-4.0.6.Final 2013-08-01 10:59:46 +02:00
Norman Maurer
e3410680de [maven-release-plugin] prepare for next development iteration 2013-07-31 20:08:14 +02:00
Norman Maurer
0e124583d6 [maven-release-plugin] prepare release netty-4.0.5.Final 2013-07-31 20:08:05 +02:00
Norman Maurer
acb28e3ac8 Multiple optimizations in the HttpObjectDecoder
* Minimize allocation of StringBuilder and also minimize char array copy
* Try to detect HttpVersion without calling toUpperCase() for performance reasons
2013-07-31 09:23:02 +02:00
Norman Maurer
e09aea5902 Rename methods of EmbeddedChannel and mark old ones as @deprecated 2013-07-31 16:04:08 +09:00
Josh Wilson
d4b8f16d1f Added http status codes from RFC 6585 2013-07-30 06:41:38 +02:00
Norman Maurer
4222610b2a Remove synchronized in SPDY code 2013-07-29 20:25:45 +02:00
Norman Maurer
6873111d72 [#1648] Make sure trailing headers are not dropped during content encoding/decoding 2013-07-24 15:59:59 +02:00
Jeff Pinner
d5bf1a1187 SPDY: fix NullPointerException in SpdyFrameDecoder 2013-07-24 08:01:30 +02:00
Norman Maurer
0bc7d3f5d1 [maven-release-plugin] prepare for next development iteration 2013-07-23 10:04:23 +02:00
Norman Maurer
ca00182797 [maven-release-plugin] prepare release netty-4.0.4.Final 2013-07-23 10:04:14 +02:00
Norman Maurer
ed9527ba41 [#1639] Fix bug where SpdyOrHttpChooser may not buffer data correctly during protocol detection 2013-07-23 09:05:10 +02:00
Norman Maurer
dbc74fcc97 [#1637] Check for null parameters 2013-07-23 06:30:45 +02:00
Shawn Silverman
80f92f90cb netty-1616: Adding a 'last' check to SpdyHttpEncoder. 2013-07-20 08:11:53 +02:00
Norman Maurer
904385117f [#1607] Make use of gathering writes for WebSocket encoders, to minimize memory copy 2013-07-19 08:28:07 +02:00
Trustin Lee
b130ee6a6c [maven-release-plugin] prepare for next development iteration 2013-07-18 11:17:42 +09:00
Trustin Lee
10d395e829 [maven-release-plugin] prepare release netty-4.0.3.Final 2013-07-18 11:17:31 +09:00
Norman Maurer
fc7c950b08 [maven-release-plugin] prepare for next development iteration 2013-07-17 15:58:36 +02:00
Norman Maurer
bbbf72359e [maven-release-plugin] prepare release netty-4.0.2.Final 2013-07-17 15:58:28 +02:00
Norman Maurer
939fd8d17e Improve the HttpPostRequestDecoder and so make it configurable when it will discard read bytes to prevent OOM 2013-07-17 15:00:43 +02:00
Norman Maurer
66c4c07ec0 [#1595] Fix IllegalStateException thrown by HttpObjectEncoder when an empty HttpContent was written 2013-07-17 12:01:50 +02:00
Derek Troy-West
8e71186153 Modify HttpContentDecoder to writeInbound and readInbound from its internal decoder 2013-07-16 16:27:40 +02:00
Trustin Lee
57eb531eb8 [maven-release-plugin] prepare for next development iteration 2013-07-16 17:16:10 +09:00
Trustin Lee
76cefcc421 [maven-release-plugin] prepare release netty-4.0.1.Final 2013-07-16 17:15:54 +09:00
Jeff Pinner
b8200d975c SPDY: port SpdySessionHandler to netty 4 2013-07-16 06:56:45 +02:00
Norman Maurer
e879848056 [#1579] Fix resource leakage in WebSocketUtil.base64(...) 2013-07-15 19:12:24 +02:00
Norman Maurer
5297eba280 [maven-release-plugin] prepare for next development iteration 2013-07-15 15:48:15 +02:00
Norman Maurer
c5d8af446a [maven-release-plugin] prepare release netty-4.0.0.Final 2013-07-15 15:48:05 +02:00
Trustin Lee
246a3ecdcb [maven-release-plugin] prepare for next development iteration 2013-07-15 20:58:33 +09:00
Trustin Lee
e8fd209115 [maven-release-plugin] prepare release netty-4.0.0.Final 2013-07-15 20:58:21 +09:00
Norman Maurer
e1c78b471b Use the configured ByteBufAllocator in SpdyFrameEncoder 2013-07-15 20:46:23 +09:00
Norman Maurer
efd08efd1b Add missing @Override annotations 2013-07-15 08:18:57 +02:00
Norman Maurer
cd51674070 Small performance improvements for RTSP 2013-07-15 08:18:37 +02:00
Norman Maurer
0393ffbfb2 Reduce memory copies in HttpContentDecoder and so also the risk of memory leaks 2013-07-14 23:12:49 +02:00
Norman Maurer
ecb215c12f Fix buffer leaks 2013-07-14 22:50:53 +02:00
Norman Maurer
32b671f4dc [1575] Correctly parse Content-Type value 2013-07-14 15:48:00 +02:00
Jeff Pinner
030d9fd227 SPDY: check if spdyHeadersFrame is null before adding it to out 2013-07-12 08:53:42 +02:00
Norman Maurer
3db3a9a2bf [#1558] Use correct scheme to detect port. Thanks @golovnin for spotting it. 2013-07-11 23:44:36 +02:00
Norman Maurer
2380461861 [#1558] Corrects handling of port number in WebSockets handshake header values
* This patch was inspired by the work of @golovnin
2013-07-11 23:23:36 +02:00
Jeff Pinner
daa79f3a11 SPDY: fix bug #1211 reintroduced in 7bedd8f 2013-07-11 23:05:17 +02:00
Norman Maurer
e85ae721b2 Set the destroyed flag at the correct time and fix a the httpupload example to release all resources 2013-07-11 13:48:37 +02:00
Norman Maurer
10097bf881 Correctly set the destroyed flag 2013-07-11 11:50:56 +02:00
Norman Maurer
9c49322b9c Improve performance of HttpRequestEncoder.encodeInitialLine(...) 2013-07-10 22:25:20 +02:00
Norman Maurer
46f6e1d360 [#1542] Fix resource-leak in HttpObjectAggregator when a too long frame was detected 2013-07-10 22:10:48 +02:00
Jeff Pinner
b5527e905e fix SpdyHttpDecoder 2013-07-10 21:50:54 +02:00
Jeff Pinner
cf9ee928b0 HttpContentEncoder should not remove Content-Length when acting as a passthrough. 2013-07-10 21:02:00 +02:00
alain
2adf393277 [#1553] Improve performance of encodeInitialLine 2013-07-10 21:00:47 +02:00
Trustin Lee
4d44b37939 Fix potential leak in HttpContentEncoder 2013-07-11 01:10:52 +09:00
Norman Maurer
b57d9f307f Allow per-write promises and disallow promises on flush()
- write() now accepts a ChannelPromise and returns ChannelFuture as most
  users expected.  It makes the user's life much easier because it is
  now much easier to get notified when a specific message has been
  written.
- flush() does not create a ChannelPromise nor returns ChannelFuture.
  It is now similar to what read() looks like.
2013-07-11 00:49:48 +09:00
Trustin Lee
7bedd8f28e Simplify the exception handling of ChannelOutboundHandler.write()
DefaultChannelHandlerContext does not trigger exceptionCaught() immediately when ChannelOutboundHandler.write() raises an exception.  It just records the exception until flush() is triggered.  On invokeFlush(), if there's any exception recorded, DefaultChannelHandlerContext will fail the promise without calling ChannelOutboundHandler.flush().  If more than one exception were raised, only the first exception is used as the cause of the failure and the others will be logged at warn level.
2013-07-10 00:36:47 +09:00
Trustin Lee
26e9d70457 Remove channelReadSuspended / Rename messageReceived(Last) to channelRead(Complete)
- Remove channelReadSuspended because it's actually same with messageReceivedLast
- Rename messageReceived to channelRead
- Rename messageReceivedLast to channelReadComplete

We renamed messageReceivedLast to channelReadComplete because it
reflects what it really is for.  Also, we renamed messageReceived to
channelRead for consistency in method names.
2013-07-09 23:58:51 +09:00
Trustin Lee
cbd8817905 Remove MessageList from public API and change ChannelInbound/OutboundHandler accordingly
I must admit MesageList was pain in the ass.  Instead of forcing a
handler always loop over the list of messages, this commit splits
messageReceived(ctx, list) into two event handlers:

- messageReceived(ctx, msg)
- mmessageReceivedLast(ctx)

When Netty reads one or more messages, messageReceived(ctx, msg) event
is triggered for each message.  Once the current read operation is
finished, messageReceivedLast() is triggered to tell the handler that
the last messageReceived() was the last message in the current batch.

Similarly, for outbound, write(ctx, list) has been split into two:

- write(ctx, msg)
- flush(ctx, promise)

Instead of writing a list of message with a promise, a user is now
supposed to call write(msg) multiple times and then call flush() to
actually flush the buffered messages.

Please note that write() doesn't have a promise with it.  You must call
flush() to get notified on completion. (or you can use writeAndFlush())

Other changes:

- Because MessageList is completely hidden, codec framework uses
  List<Object> instead of MessageList as an output parameter.
2013-07-09 23:51:48 +09:00
Trustin Lee
75229e145a Prettier web socket log messages 2013-07-09 14:53:05 +09:00
Norman Maurer
9c1b31d20a [#1535] Remove Channel.id() and so fix the possible leakage of the previous used Channel id map
The user can still use Channel.hashCode() for logging. It's just not 100% unique but should be good enough for most cases
2013-07-08 14:07:18 +02:00
Trustin Lee
1bf2f702cb Do not use unreleaseableBuffer and duplicate
.. because it's not as fast as just creating a new direct buffer.
2013-07-07 15:28:43 +09:00
Trustin Lee
553cd034b9 Fix checkstyle 2013-07-07 12:39:29 +09:00
Trustin Lee
a4f2789e55 Add missing final modifier 2013-07-07 12:38:53 +09:00
Trustin Lee
2b2f8db5d2 Use ThreadLocalRandom where possible 2013-07-07 12:37:36 +09:00
Norman Maurer
086ae3536c [#1533] Introduce ByteBufHolder.duplicate() and make use of it in DefaultChannelGroup.write(...) 2013-07-06 21:17:51 +02:00
Norman Maurer
b63f3488b7 Add a HttpPostRequestDecoder.destory() method which should be used to destroy the decoder and free up resources
* Also make the contract more clear about who needs to call release()
2013-07-05 08:31:07 +02:00
Norman Maurer
b26e61d689 Fix broken tests 2013-07-05 07:18:33 +02:00
Norman Maurer
ea85054eab Correctly detect LastHttpContent after encoding 2013-07-05 06:41:48 +02:00
Norman Maurer
9f0f653588 Optimize HttpContentEncoder to do less memory copies as those are not needed 2013-07-05 06:38:25 +02:00
Norman Maurer
d900f8c21d [#1524] Fix resource leak in HttpContentEncoder 2013-07-05 06:27:25 +02:00
Norman Maurer
cad7c1f1b0 [#1521] Fix performance issue in AbstractHttpData 2013-07-04 11:59:30 +02:00
Norman Maurer
1fee1ef74e [#1520] Release previous set buffer when setting a new data source 2013-07-04 10:58:37 +02:00
Norman Maurer
45d20d5c9f [#1516] Fix resource leakage which was caused by the AbstractDiskHttpData which did not release the buffer after copy to disk 2013-07-04 10:41:49 +02:00
Norman Maurer
f64a121de7 [#1515] Add WebSocketFrameEncoder and WebSocketFrameDecoder interfaces and let our impls implement it 2013-07-04 06:41:22 +02:00
Norman Maurer
79576d15c2 [#1513] Use the correct names when add the websocket decoder and encoder 2013-07-03 19:54:08 +02:00
Norman Maurer
328969485c Add explaination to the javadocs to not call retain() on the request when doing the handshake. Related to [#1508] 2013-07-03 06:41:12 +02:00
Norman Maurer
a4ee2841be [#1507] Fix buffer leak in WebSocket08FrameDecoder 2013-07-02 13:46:09 +02:00
Norman Maurer
ec5e793a2f [maven-release-plugin] prepare for next development iteration 2013-07-02 11:41:18 +02:00
Norman Maurer
ca73eaef0d [maven-release-plugin] prepare release netty-4.0.0.CR9 2013-07-02 11:41:09 +02:00
Norman Maurer
830c559405 [maven-release-plugin] rollback the release of netty-4.0.0.CR9 2013-07-02 11:34:29 +02:00
Norman Maurer
66a16b133c [maven-release-plugin] prepare release netty-4.0.0.CR9 2013-07-02 10:45:12 +02:00
alain
9633769909 Improve performance of encodeHeader 2013-07-02 06:32:56 +02:00
Trustin Lee
7e3a01cc51 [maven-release-plugin] prepare for next development iteration 2013-07-02 10:26:48 +09:00
Trustin Lee
149db34c19 [maven-release-plugin] prepare release netty-4.0.0.CR8 2013-07-02 10:26:32 +09:00
Norman Maurer
5d88c423df [#1500] Remove @deprecated methods 2013-07-01 08:53:02 +02:00
Jeff Pinner
0c8cf5cdc8 SPDY: SpdyHeaderBlockDecoder should not discard input data 2013-06-29 09:41:55 +09:00
Trustin Lee
613547b0b9 [maven-release-plugin] prepare for next development iteration 2013-06-28 22:15:33 +09:00
Trustin Lee
a6abd2feb2 [maven-release-plugin] prepare release netty-4.0.0.CR7 2013-06-28 22:15:20 +09:00
Jeff Pinner
1b40a0ebc5 SPDY: SpdyFrameDecoder should buffer unread data when decoding headers 2013-06-28 21:27:29 +09:00
Trustin Lee
4dd9b6ef2e Add ByteBufProcessor and ByteBuf.forEach(...)
- Fixes #1378
- Needs to provide optimized forEach implementations though.
2013-06-27 13:55:42 +09:00
Trustin Lee
cfd514d099 Add WebSocketClientHandshaker.close()
- Fixes #1470
2013-06-25 18:52:27 +09:00
Norman Maurer
e8ea98017f Fix regression introduced by 0364265f46 which could lead to corrupt attribute values 2013-06-25 09:31:51 +02:00
Trustin Lee
a6795d7780 [maven-release-plugin] prepare for next development iteration 2013-06-25 11:07:15 +09:00
Trustin Lee
2221446425 [maven-release-plugin] prepare release netty-4.0.0.CR6 2013-06-25 11:07:15 +09:00
Trustin Lee
e0805ecea9 SPDY: handle too large header blocks
- Forward-ported 22b8a96e044b77e5fadc5a1217080a1f9c69aa9c
2013-06-25 11:07:15 +09:00
Andrej Golovnin
c07b0cac70 Adds port to the host header value. Due to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.23 the port should be added if it differs from the default port. To simplify the code we just always add the port. 2013-06-25 11:07:14 +09:00
Jeff Pinner
c86155e4d4 SPDY: replace exception in SpdyHeaderBlockZlibEncoder with EMPTY_BUFFER 2013-06-25 11:07:14 +09:00
Trustin Lee
a969613540 Merge ChannelInboundConsumingHandler into SimpleChannelInboundHandler
- SimpleChannelInboundHandler now has a constructor parameter to let a
  user decide to enable automatic message release. (the default is to
  enable), which makes ChannelInboundConsumingHandler of less value.
2013-06-25 11:07:14 +09:00
Norman Maurer
bfc9c6d80d Add ChannelInboundConsumingHandler
..which is useful when the handler is placed at the last position of the
pipeline because it releases the received messages automatically.
2013-06-25 11:07:14 +09:00
Trustin Lee
dc6e2cd625 Make AbstractMemoryHttpData generate less garbage 2013-06-25 11:07:13 +09:00
Mike Schore
0d9aecbbc1 SPDY: better encapsulation of header encoding/decoding 2013-06-25 11:07:01 +09:00
Norman Maurer
6a9f965f9b Introduce new utility class calles ReferenceCountUtil and move utility methods from ByteBufUtil to it.
The ones in ByteBufUtil were marked as @deprecated
2013-06-14 07:07:33 +02:00
Trustin Lee
a5871dfd86 [maven-release-plugin] prepare for next development iteration 2013-06-14 12:55:15 +09:00
Trustin Lee
f5377cc8d7 [maven-release-plugin] prepare release netty-4.0.0.CR5 2013-06-14 12:55:05 +09:00
Trustin Lee
e5ca6518ba [maven-release-plugin] prepare for next development iteration 2013-06-13 17:02:32 +09:00
Trustin Lee
381063e09c [maven-release-plugin] prepare release netty-4.0.0.CR4 2013-06-13 17:02:19 +09:00
Trustin Lee
01d9f10af6 Remove the volatile modifiers where they are unnecessary 2013-06-13 14:43:39 +09:00
Trustin Lee
6d1cd0d0cd ReferenceCountException -> IllegalReferenceCountException 2013-06-13 14:00:15 +09:00
Trustin Lee
175526b6bd Move ReferenceCounted and AbstractReferenceCounted to io.netty.util
- Fixes #1441
- Also move and rename IllegalBufferAccessException to ReferenceCountException
- Prettier reference count exception messages
2013-06-13 13:14:21 +09:00
Trustin Lee
96380e756c Fix test failures introduced by 78d8f05c21 2013-06-13 11:51:03 +09:00
Norman Maurer
a403da3042 Rewrite HTTP encoder to use gathering writes 2013-06-13 11:02:31 +09:00
Trustin Lee
78d8f05c21 Make sure that HttpObjectDecoder decodes the last HTTP message without 'Content-Length' header
- Fixes #1410
- Revert 1e5f266a3c and provide a proper fix with a test
2013-06-13 10:57:06 +09:00
Norman Maurer
1e5f266a3c [#1410] Make sure we generate a Http response if the server writes back 200 response with empty body and and close the connection 2013-06-12 09:56:00 +02:00
Norman Maurer
e3ec124ccd Make sure WebSocketFrameAggregator and HttpObjectAggregator don't leak ByteBufs 2013-06-11 08:53:14 +02:00
Jeff Pinner
c8ca329932 SPDY: update object hierarchy 2013-06-10 16:50:38 +02:00
Norman Maurer
92bd4d2fe0 Remove MessageList.remove(*) , MessageList.set(*) and MessageList.add(i,*) 2013-06-10 13:44:01 +02:00
Norman Maurer
e71a521284 [#1414] Use gathering writes in AbstractMemoryHttpData if the buffer is backed by multiple ByteBuffers
* This fix the bug which caused an UnsupportedOperationException when renameTo(...) was called and the underlying ByteBuf was backed by multiple ByteBuffers
2013-06-10 09:25:03 +02:00
Trustin Lee
ccd43e0cda Fix compilation error 2013-06-10 16:18:22 +09:00
Trustin Lee
14158070bf Revamp the core API to reduce memory footprint and consumption
The API changes made so far turned out to increase the memory footprint
and consumption while our intention was actually decreasing them.

Memory consumption issue:

When there are many connections which does not exchange data frequently,
the old Netty 4 API spent a lot more memory than 3 because it always
allocates per-handler buffer for each connection unless otherwise
explicitly stated by a user.  In a usual real world load, a client
doesn't always send requests without pausing, so the idea of having a
buffer whose life cycle if bound to the life cycle of a connection
didn't work as expected.

Memory footprint issue:

The old Netty 4 API decreased overall memory footprint by a great deal
in many cases.  It was mainly because the old Netty 4 API did not
allocate a new buffer and event object for each read.  Instead, it
created a new buffer for each handler in a pipeline.  This works pretty
well as long as the number of handlers in a pipeline is only a few.
However, for a highly modular application with many handlers which
handles connections which lasts for relatively short period, it actually
makes the memory footprint issue much worse.

Changes:

All in all, this is about retaining all the good changes we made in 4 so
far such as better thread model and going back to the way how we dealt
with message events in 3.

To fix the memory consumption/footprint issue mentioned above, we made a
hard decision to break the backward compatibility again with the
following changes:

- Remove MessageBuf
- Merge Buf into ByteBuf
- Merge ChannelInboundByte/MessageHandler and ChannelStateHandler into ChannelInboundHandler
  - Similar changes were made to the adapter classes
- Merge ChannelOutboundByte/MessageHandler and ChannelOperationHandler into ChannelOutboundHandler
  - Similar changes were made to the adapter classes
- Introduce MessageList which is similar to `MessageEvent` in Netty 3
- Replace inboundBufferUpdated(ctx) with messageReceived(ctx, MessageList)
- Replace flush(ctx, promise) with write(ctx, MessageList, promise)
- Remove ByteToByteEncoder/Decoder/Codec
  - Replaced by MessageToByteEncoder<ByteBuf>, ByteToMessageDecoder<ByteBuf>, and ByteMessageCodec<ByteBuf>
- Merge EmbeddedByteChannel and EmbeddedMessageChannel into EmbeddedChannel
- Add SimpleChannelInboundHandler which is sometimes more useful than
  ChannelInboundHandlerAdapter
- Bring back Channel.isWritable() from Netty 3
- Add ChannelInboundHandler.channelWritabilityChanges() event
- Add RecvByteBufAllocator configuration property
  - Similar to ReceiveBufferSizePredictor in Netty 3
  - Some existing configuration properties such as
    DatagramChannelConfig.receivePacketSize is gone now.
- Remove suspend/resumeIntermediaryDeallocation() in ByteBuf

This change would have been impossible without @normanmaurer's help. He
fixed, ported, and improved many parts of the changes.
2013-06-10 16:10:39 +09:00
Jeff Pinner
cf757f17f6 SPDY: always enqueue data frames if stream is stalled 2013-06-04 23:58:49 -07:00
Norman Maurer
aa96b4b286 No need to create temporary arrays 2013-05-24 19:58:55 +02:00
Norman Maurer
0e8fb21554 Some optimizations to the http codec 2013-05-24 09:07:17 +02:00
Norman Maurer
83dcf829d6 [#1384] Cache HttpHeaderDateFormat in ThreadLocal 2013-05-23 11:39:50 +02:00
shreyharia
1801ecfe30 Update HttpHeaderDateFormat.java
Output for "E, dd-MMM-y HH:mm:ss z"
on java 1.6 I get: Wed, 22-May-13 09:11:41 GM
on java 1.7 I get: Wed, 22-May-2013 09:11:14 GMT

To be uniform on both jdks.. modified it to
"E, dd-MMM-yy HH:mm:ss z"

learnt from - http://stackoverflow.com/questions/16687298/simpledateformat-different-behaviour-depending-on-java-version
2013-05-22 13:36:03 +02:00
Norman Maurer
81e3c1719a [maven-release-plugin] prepare for next development iteration 2013-05-18 09:59:13 +02:00
Norman Maurer
99caefdf39 [maven-release-plugin] prepare release netty-4.0.0.CR3 2013-05-18 09:57:11 +02:00
Norman Maurer
bd2230961d Fix checkstyle 2013-05-17 22:09:11 +02:00
Norman Maurer
aaca9df99a @Deprecate a method as it's not needed anymore 2013-05-17 22:00:55 +02:00
Norman Maurer
8a5e249d6f [#1374] Allow users to all all subprotocols by using * as wildcard 2013-05-17 21:57:47 +02:00
Norman Maurer
a331c87a7a [#1358] Fix Encoding of multipart attribute names and filenames for non ASCII chars 2013-05-14 15:24:01 +02:00
Norman Maurer
3268d6fc2e [#1352] WebSocketFrameAggregator should only throw TooLongFrameException once per complete frame 2013-05-09 21:12:36 +02:00
Norman Maurer
c8de4f03f1 [#1007] Make sure the current message is only reset on LastHttpContent 2013-05-09 20:11:34 +02:00
Norman Maurer
268b059ebb [#1007] HttpObjectAggregator should only throw one TooLongFrameException per full HTTP message 2013-05-09 19:44:39 +02:00
Norman Maurer
c43950a03f [maven-release-plugin] prepare for next development iteration 2013-05-08 18:19:51 +02:00
Norman Maurer
ae76502040 [maven-release-plugin] prepare release netty-4.0.0.CR2 2013-05-08 18:19:38 +02:00
Norman Maurer
b65c8716a5 Correctly handle multipart disposition 2013-05-08 17:20:44 +02:00
Frederic Bregier
6c0b2be412 Same fix for Netty V4 for issue #1313
Remove encodeAttribute/decodeAttribute for Multipart element
Replace where necessary by cleanString (to remove '"') on name part (not
on value part)
2013-05-08 15:18:30 +02:00
Norman Maurer
c07234ed72 [#1346] Make sure HttpPostRequestEncoder.nextChunk() return LastHttpContent once all chunks are read 2013-05-08 15:11:08 +02:00
Norman Maurer
97bdabad9c [#1293] Fix IllegalBufferAccessException in HttpPostRequestDecoder
* Also let HttpPostRequestDecoder extends Iterator and let its Exceptiosn extend DecoderException
2013-05-06 21:36:30 +02:00
Norman Maurer
a170f05b4b [#1293] Fix handling of chunked requests in HttpPostRequestEncoder and the multipart examples 2013-05-06 15:00:18 +02:00
Frederic Bregier
c230afaed1 Fix for #1313 and #1332
Add TEXTPLAIN in HttpHeaders
Remove all coding/decoding Attribute using URL scheme for name and
attribute
Add text/plain to contant-type
2013-05-05 21:36:38 +02:00
Jeff Pinner
128bbe3225 SPDY: refactor SpdyHttpDecoder to allow subclasses to access messageMap 2013-05-04 20:55:28 +02:00
Trustin Lee
1e0c83db23 Introduce AddressedEnvelope message type for generic representation of an addressed message
- Fixes #1282 (not perfectly, but to the extent it's possible with the current API)
- Add AddressedEnvelope and DefaultAddressedEnvelope
- Make DatagramPacket extend DefaultAddressedEnvelope<ByteBuf, InetSocketAddress>
- Rename ByteBufHolder.data() to content() so that a message can implement both AddressedEnvelope and ByteBufHolder (DatagramPacket does) without introducing two getter methods for the content
- Datagram channel implementations now understand ByteBuf and ByteBufHolder as a message with unspecified remote address.
2013-05-01 17:04:43 +09:00
Norman Maurer
9128d4f16a Fix checkstyle 2013-04-30 21:11:41 +02:00
Norman Maurer
ee433ea911 Fix checkstyle 2013-04-30 20:55:50 +02:00
Norman Maurer
a48ed71e86 Fix type in class name 2013-04-30 20:41:50 +02:00
Norman Maurer
57a8a9fd98 [#1321] HttpHeaders.removeTransferEncodingChunked(..) must handle the value in case insensitive manner 2013-04-30 20:41:20 +02:00
Trustin Lee
d92bcff1b6 Fix a bug where HttpContentEncoder generates an empty chunk even if it's not the last chunk
- Fixes #1312
- Added more test cases to ensure the fix
2013-04-27 15:38:28 +09:00
Trustin Lee
7884574c7b Remove freeInboundBuffer() and freeOutboundBuffer() which has no value
- Fixes #1308

freeInboundBuffer() and freeOutboundBuffer() were introduced in the early days of the new API when we did not have reference counting mechanism in the buffer. A user did not want Netty to free the handler buffers had to override these methods.

However, now that we have reference counting mechanism built into the buffer, a user who wants to retain the buffers beyond handler's life cycle can simply return the buffer whose reference count is greater than 1 in newInbound/OutboundBuffer().
2013-04-25 09:15:55 +09:00
Trustin Lee
b5989e2449 Reduce exception instantiation overhead in SslHandler / Reduce unnecessary empty array creation
- Added EmptyArrays as an internal utility class
2013-04-24 09:32:53 +09:00
Trustin Lee
94aad58627 Fix incorrect name validation in AbstractHttpData
- Fixes #1228
2013-04-23 19:26:50 +09:00
Trustin Lee
9fe5048175 No need to make CaseIgnoringComparator public
.. because it's unsed only internally
2013-04-23 18:40:49 +09:00
Norman Maurer
9c4bfa44d9 [#1294] Make sure ByteBuf is released once written to channel 2013-04-22 11:04:56 +02:00
Norman Maurer
c987dd556e [#1295] Make sure retain(..) returns the correct WebSocketFrame type 2013-04-21 13:00:50 +02:00
Norman Maurer
ca5554dfe7 [#1236] Fix problem where adding a new ChannelHandler could block the eventloop
This change also introduce a few other changes which was needed:
 * ChannelHandler.beforeAdd(...) and ChannelHandler.beforeRemove(...) were removed
 * ChannelHandler.afterAdd(...) -> handlerAdded(...)
 * ChannelHandler.afterRemoved(...) -> handlerRemoved(...)
 * SslHandler.handshake() -> SslHandler.hanshakeFuture() as the handshake is triggered automatically after
   the Channel becomes active
2013-04-19 07:00:50 +02:00