Commit Graph

822 Commits

Author SHA1 Message Date
Norman Maurer
58423a448a Add missing override annotations 2014-04-15 20:15:30 +02:00
Jeff Pinner
350c8ef42a SPDY: refactor frame codec implementation
Motivation:

Currently, the SPDY frame encoding and decoding code is based upon
the ChannelHandler abstraction. This requires maintaining multiple
versions for 3.x and 4.x (and possibly 5.x moving forward).

Modifications:

The SPDY frame encoding and decoding code is separated from the
ChannelHandler and SpdyFrame abstractions. Also test coverage is
improved.

Result:

SpdyFrameCodec now implements the ChannelHandler abstraction and is
responsible for creating and handling SpdyFrame objects.
2014-04-15 18:42:08 +02:00
Daniel Bevenius
7c6f862d98 Adding origins whitelist support for CORS
Motivation:
Currently the CORS support only handles a single origin, or a wildcard
origin. This task should enhance Netty's CORS support to allow multiple
origins to be specified. Just being allowed to specify one origin is
particulary limiting when a site support both http and https for
example.

Modifications:
- Updated CorsConfig and its Builder to accept multiple origins.

Result:
Users are now able to configure multiple origins for CORS.

[https://github.com/netty/netty/issues/2346]
2014-03-30 19:40:59 +02:00
Brendt Lucas
98bc7b7859 [#2234] Use QueryStringDecoder.decodeComponent to decode url-encoded data instead of Java's URLDecoder.
Motivation:
Previously, we used URLDecoder.decode(...) to decode url-encoded data. This generates a lot of garbage and takes a considerable amount of time.

Modifications:
Replace URLDecoder.decode(...) with QueryStringDecoder.decodeComponent(...)

Result:
Less garbage to GC and faster decode processing.
2014-03-22 14:02:35 +01:00
Daniel Bevenius
27671e0dbd Fixing CorsConfigTest failure under Java 8.
Motivation:
When running the build with Java 8 the following error occurred:

java: reference to preflightResponseHeader is ambiguous
  both method
  <T>preflightResponseHeader(java.lang.CharSequence,java.lang.Iterable<T>)
  in io.netty.handler.codec.http.cors.CorsConfig.Builder and method
  <T>preflightResponseHeader(java.lang.String,java.util.concurrent.Callable<T>)
  in io.netty.handler.codec.http.cors.CorsConfig.Builder match

The offending class was CorsConfigTest and its shouldThrowIfValueIsNull
which contained the following line:
withOrigin("*").preflightResponseHeader("HeaderName", null).build();

Modifications:
Updated the offending method with to supply a type, and object array, to
avoid the error.

Result:
After this I was able to build with Java 7 and Java 8
2014-03-22 07:20:10 +01:00
Daniel Bevenius
321e770c9b Adding support for specifying preflight response headers.
Motivation:

An intermediary like a load balancer might require that a Cross Origin
Resource Sharing (CORS) preflight request have certain headers set.
As a concrete example the Elastic Load Balancer (ELB) requires the
'Date' and 'Content-Length' header to be set or it will fail with a 502
error code.

This works is an enhancement of https://github.com/netty/netty/pull/2290

Modifications:

CorsConfig has been extended to make additional HTTP response headers
configurable for preflight responses. Since some headers, like the
'Date' header need to be generated each time, m0wfo suggested using a
Callable.

Result:

By default, the 'Date' and 'Content-Lenght' headers will be sent in a
preflight response. This can be overriden and users can specify
any headers that might be required by different intermediaries.
2014-03-21 15:05:29 +01:00
Frederic Bregier
ef53227836 [#2305] Fix issue related to decoding post request raized an exception due to a split of information by chunk not correctly taken into account by the decoder
Motivation:

If the last item analyzed in a previous received HttpChunk/HttpContent was a part of an attribute's name, the read index was not set to the new right place and therefore raizing an exception in some case (since the "new" name analyzed is empty, which is not allowed so the exception).

What appears there is that the read index should be reset to the last valid position encountered whatever the case. Currently it was set when only when there is an attribute not already finished (name is ok, but content is possibly not).

Therefore the issue is that elements could be rescanned multiple times (including completed elements) and moreover some bad decoding can occur such as when in a middle of an attribute's name.

Modifications:

To fix this issue, since "firstpos" contains the last "valid" read index of the decoding (when finding a '&', '=', 'CR/LF'), we should add the setting of the read index for the following cases:

'lastchunk' encountered, therefore finishing the current buffer
any other cases than current attribute is not finished (name not found yet in particular)
So adding for this 2 cases:

undecodedChunk.readerIndex(firstpos);

Result:

Now the decoding is done once, content is added from chunk/content to chunk/content, name is decoded correctly even if in the middle of 2 chunks/contents.
A Junit test code was added: testChunkCorrect that should not raized any exception.
2014-03-14 09:46:58 +01:00
David Dossot
c31e8f59ba added support for empty query parameters 2014-03-10 06:29:45 +01:00
Chris Mowforth
59bfd69c9b Add content length and date headers to CORS response 2014-03-06 20:59:53 +01:00
Dao Ngoc
94bcbba324 Fix #2275 %s WebSocket version %s server handshake 2014-02-28 17:18:58 -08:00
Trustin Lee
b6aa032376 Fix checkstyle 2014-02-26 16:18:39 -08:00
Trustin Lee
c42570576e Fix a bug where HttpObjectDecoder generates two LastHttpContent consecutively
Motivation:
When an HttpResponseDecoder decodes an invalid chunk, a LastHttpContent instance is produced and the decoder enters the 'BAD_MESSAGE' state, which is not supposed to produce a message any further.  However, because HttpObjectDecoder.invalidChunk() did not clear this.message out to null, decodeLast() will produce another LastHttpContent message on a certain situation.

Modification:
Do not forget to null out HttpObjectDecoder.message in invalidChunk(), and add a test case for it.

Result:
No more consecutive LastHttpContent messages produced by HttpObjectDecoder.
2014-02-26 15:54:45 -08:00
Jeff Pinner
97f120330b SPDY: remove SPDY/3 support 2014-02-20 15:02:16 -08:00
Trustin Lee
ff8df41541 Fix another leak in HttpObjectAggregatorTest by removing redundant code 2014-02-20 14:30:42 -08:00
Trustin Lee
2e6918c21a Fix a memory leak in HttpObjectAggregatorTest 2014-02-20 13:49:56 -08:00
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
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