Commit Graph

936 Commits

Author SHA1 Message Date
Norman Maurer
71f5bb84a6 Fix buffer leaks in SPDY test
Motivation:

Fix leaks reported during SPDY test.

Modifications:

Use ReferenceCountUtil.releaseLater(...) to make sure everything is released once the tests are done.

Result:

No more leak reports during run the tests.
2014-04-16 06:51:26 +02:00
Jeff Pinner
7808b9926d 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 19:57:38 +02:00
Daniel Bevenius
4fc9afa102 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:48 +02:00
Brendt Lucas
6bce61bf1b [#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:15:06 +01:00
Daniel Bevenius
110878fe2c 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:44:54 +01:00
Daniel Bevenius
74f418bace 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:40:59 +01:00
Frederic Bregier
397f81f253 [#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:45:40 +01:00
David Dossot
4f069e5c36 added support for empty query parameters 2014-03-10 06:46:08 +01:00
Chris Mowforth
01daefe925 Add content length and date headers to CORS response 2014-03-06 21:00:27 +01:00
Dao Ngoc
fcc6b544a4 Fix #2275 %s WebSocket version %s server handshake 2014-02-28 17:19:18 -08:00
Trustin Lee
ac5592fc05 Fix checkstyle 2014-02-26 16:18:19 -08:00
Trustin Lee
24fc1b9b37 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:53:53 -08:00
Jeff Pinner
b02531f0aa SPDY: remove SPDY/3 support 2014-02-20 15:00:32 -08:00
Trustin Lee
738d3f77b9 Fix another leak in HttpObjectAggregatorTest by removing redundant code 2014-02-20 14:30:25 -08:00
Trustin Lee
874a66c8fb Fix a memory leak in HttpObjectAggregatorTest 2014-02-20 13:49:35 -08:00
Trustin Lee
2c4aff13c7 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:41:54 -08:00
Trustin Lee
e278b57489 Added a test for oversized HTTP responses 2014-02-20 11:46:41 -08:00
Trustin Lee
fcc41a62bd Overall clean-up of HttpObjectAggregator / Handle oversized response differently
- Related: #2211
2014-02-20 11:36:56 -08:00
Chris Mowforth
91376263d7 Expose a callback in HttpObjectAggregator to handle oversized messages
- Related: #2211
2014-02-20 11:36:56 -08:00
Trustin Lee
ddb6e3672c 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:31:53 -08:00
Trustin Lee
396a81c811 Ensure that the last bad chunk is LastHttpChunk 2014-02-19 15:19:35 -08:00
Trustin Lee
b1f27d9aa8 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:18 -08:00
Trustin Lee
99beb188c4 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:26:43 -08:00
Trustin Lee
abcb39b638 Do not use String.format() for log message generation
- It's slow.
2014-02-13 19:31:17 -08:00
Trustin Lee
7e1db4feb7 Deprecate CombinedChannelDuplexHandler in favor of ChannelHandlerAppender
- Fixes #2233
2014-02-13 19:20:25 -08:00
Trustin Lee
ac70dc4546 Update the version to 4.1.0.Alpha1-SNAPSHOT 2014-02-13 18:32:26 -08:00
Trustin Lee
5226f75cfa Clean up HttpObjectAggregator 2014-02-13 18:25:15 -08:00
Trustin Lee
8837afddf8 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-02-13 18:16:25 -08:00
Trustin Lee
45e70d9935 Add ReferenceCounted.touch() / Add missing retain() overrides
- Fixes #2163
- Inspector warnings
2014-02-13 18:10:11 -08:00
Trustin Lee
77d1f97b57 Add an HTML5 encoder mode for HttpPostRequestEncoder
- backported from 709be30442 by @igstan
2014-02-13 17:55:07 -08:00
Trustin Lee
4b0634b06a Revive the deleted methods in HttpDataFactory and deprecate them 2014-02-13 17:48:13 -08:00
Michael Nitschinger
574480e332 Rename HttpDataFactory.*datas to *data. Fixes #2094 2014-02-13 17:45:36 -08:00
Trustin Lee
df346a023b 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
2014-02-13 17:19:26 -08:00
Frederic Bregier
9bd44a1d7c Add support for 'charset' property for multipart boundaries
- Fixes #2004
2014-02-13 17:12:59 -08:00
Trustin Lee
bea2acdf12 Allow specifying a custom charset for a multipart Attribute
- Fixed #2025
- Adapted from @BabyDuncan's pull request: #2031
- Overall ugliness clean-up
2014-02-13 16:55:22 -08:00
Norman Maurer
f6ffc5c1c7 [#1682] HttpVersion.valueOf(...) should not convert to uppercase 2014-02-13 16:36:36 -08:00
Daniel Bevenius
fa33529ca5 Adding check for zero readable bytes in WebSocket08FrameDecoder decode. 2014-02-13 15:49:44 -08:00
Trustin Lee
a327a25a6c Use StringUtil.simpleClassName(..) instead of Class.getSimpleName() where necessary
- Class.getSimpleName() doesn't render anonymous classes very well
- + some minor cleanup
2014-02-13 15:37:16 -08:00
Trustin Lee
a5f33f4020 Fix some inspector warnings 2014-02-13 15:25:09 -08:00
fredericBregier
651c7b056a 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
2014-02-13 15:24:45 -08:00
Trustin Lee
499033d44f Add a shortcut method for collision-free naming 2014-02-13 15:17:09 -08:00
Norman Maurer
60acd54c7e [#1876] Make use of proper state machine in WebSocket08FrameDecoder for performance reasons 2014-02-13 14:34:34 -08:00
Norman Maurer
85ab9b5982 [#1710] Add missing duplicate() overrides in interfaces 2014-02-13 13:57:28 -08:00
Norman Maurer
084db044cd [#2219] Fix javadocs of HttpObjectAggregator to show correct handler order in pipeline 2014-02-09 17:10:09 +01:00
Trustin Lee
060eed9e80 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:27 -08:00
Daniel Bevenius
2e064ee87f Fixing spelling of 'request' for handler names. 2014-02-07 13:50:39 +01:00
Trustin Lee
2598223d0e Fix resource leaks in WebSocketServerProtocol(Handshake)Handler
- Related: #1975
2014-02-06 21:22:01 -08:00
Norman Maurer
dddfb149a5 [#2173] Fix regression that let HttpRequestDecoder fail if the websocket response and a websocketframe are send in one go 2014-02-06 10:34:05 +01:00
Norman Maurer
407e12d99b Not throw an exception if subprotocol is not supported but just drop the header as stated in the RFC's 2014-01-26 11:01:00 +01:00
Trustin Lee
6b790f1868 Fix a compilation error 2014-01-24 20:07:33 +09:00
Trustin Lee
bea7039c3e Add a log message on deletion failure 2014-01-24 16:45:48 +09:00
Frederic Bregier
2249437225 Fix fileChannel not closed, preventing delete to occur correctly 2014-01-24 16:45:48 +09:00
Norman Maurer
d67184b488 [maven-release-plugin] prepare for next development iteration 2014-01-21 08:18:32 +01:00
Norman Maurer
287515210d [maven-release-plugin] prepare release netty-4.0.15.Final 2014-01-21 08:18:26 +01:00
Frederic Bregier
da5da8e212 Fix try to delete file while it does not exist anymore (see #2102 and #1713) in reference to this issue 2014-01-21 14:17:34 +09:00
Trustin Lee
149c7e82a2 Add HttpPostrequestEncoderTest by @igstan 2014-01-19 22:22:08 +09:00
Trustin Lee
95bcbe5e08 Backport the HttpPostRequestEncoder fixes by @igstan 2014-01-19 22:21:24 +09:00
Trustin Lee
f3482670f9 Fix IllegalReferenceCountException which occurs when multipart data is stored in memory
- Fixes #2102
2014-01-19 17:50:48 +09:00
Trustin Lee
2389c71e81 Fix resource leak in InternalAttribute.setValue() 2014-01-19 16:53:43 +09:00
Trustin Lee
9b38e8778c Prettify / Saner initial capacity 2014-01-19 15:09:41 +09:00
Norman Maurer
faf8becf2e 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:08 +01:00
Stephane Landelle
8930709940 += won't let compile optimize String concats 2014-01-16 20:10:07 +01:00
Daniel Bevenius
75b0360867 Adding a Cross Origin Resource Sharing (CORS) handler. 2014-01-16 08:18:16 +01:00
Norman Maurer
437a9403b0 Fix inspector warnings 2014-01-15 17:18:19 +01:00
Veebs
2df690b0e4 Add HttpChunkedInput for easier streaming of chunked content 2014-01-15 17:18:19 +01:00
Trustin Lee
f66be21ee3 Use the source frame's allocator instead of the unpooled allocator 2014-01-14 14:22:37 +09:00
Trustin Lee
febc53daaa Port the changes in SpdyHeaderBlockRawDecoder to master & 4.0
Somehow it slipped away.
2014-01-13 23:08:07 +09:00
Trustin Lee
b8de47484a Port the changes in SpdyHeaderBlockZlibEncoder to master & 4.0
Somehow it slipped away.
2014-01-13 23:00:41 +09:00
Trustin Lee
cead74f84d Fix checkstyle 2014-01-13 22:57:34 +09:00
Trustin Lee
06cbac922a Fix a bug where SpdyHeaderBlockZlibDecoder fails to decompress
- Forward-port 4c35b593c1, originally written by @wgallagher
- Fixes #2077
2014-01-13 22:42:24 +09:00
Veebs
1326ba54ee Replaced deprecated 'sendUnsupportedWebSocketVersionResponse()' with 'sendUnsupportedVersionResponse()' 2014-01-13 06:33:57 +01:00
Norman Maurer
eca5613534 Cleanup and remove get prefix of method to be more inline with our API 2014-01-11 14:21:29 +01:00
Leonardo Freitas Gomes
3ce35c710a 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 14:21:13 +01:00
Trustin Lee
8d431679d7 Fix a compilation error 2014-01-10 16:36:48 +09:00
Trustin Lee
b24494abeb 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:17:08 +09:00
Norman Maurer
b9bbded84e [#2090] Correctly format DefaultHttpRequest#toString() 2014-01-06 17:34:46 +01:00
Norman Maurer
7d90c5b756 [#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:11:08 +01:00
Trustin Lee
e83d2e0b4e [maven-release-plugin] prepare for next development iteration 2013-12-22 21:57:48 +09:00
Trustin Lee
cdb700c7a4 [maven-release-plugin] prepare release netty-4.0.14.Final 2013-12-22 21:57:40 +09:00
Trustin Lee
0b7aedb13b [maven-release-plugin] rollback the release of netty-4.0.14.Final 2013-12-22 21:53:24 +09:00
Trustin Lee
4bf6ec7171 [maven-release-plugin] prepare release netty-4.0.14.Final 2013-12-22 21:52:56 +09:00
Trustin Lee
9c1a49c58e [maven-release-plugin] rollback the release of netty-4.0.14.Final 2013-12-22 21:47:35 +09:00
Trustin Lee
008a049bf4 [maven-release-plugin] prepare for next development iteration 2013-12-22 21:43:55 +09:00
Trustin Lee
f6cb9088c6 [maven-release-plugin] prepare release netty-4.0.14.Final 2013-12-22 21:43:45 +09:00
Trustin Lee
dd49b1cfac Use LinkedHashSet for HttpHeaders.names() and add Javadoc about the performance of names() and entries() 2013-12-22 19:17:27 +09:00
Trustin Lee
47d0a85720 Fix a leak in HttpResponseDecoderTest 2013-12-19 01:13:30 +09:00
Norman Maurer
0052d83db1 Limit the access of the HttpHeaders for performance reasons 2013-12-18 15:13:11 +01:00
Trustin Lee
e9f09ea9f5 Stop decoding after protocol upgrade / Do not use singleDecode option 2013-12-18 15:13:04 +01:00
Trustin Lee
0f76b3c357 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 15:12:55 +01:00
Trustin Lee
2b09d92c37 Improve the unit test for #1742 2013-12-16 21:55:59 +09:00
Trustin Lee
3444c06654 Fix a bug where HttpObjectAggregator fails to send a '100 Continue' response
- Fixes #1742
2013-12-16 21:44:44 +09:00
Jeff Pinner
c3891a3df4 SPDY: add SETTINGS_MINOR_VERSION 2013-12-16 14:21:07 +09:00
Jeff Pinner
6447777ac2 SPDY: code cleanup 2013-12-16 14:19:33 +09:00
Jeff Pinner
db59b38db3 SPDY: remove SPDY/2 support 2013-12-16 14:18:01 +09:00
Trustin Lee
49587791b7 Fix a compilation error 2013-12-16 14:17:47 +09:00
Bill Gallagher
c1704039f0 bring back entries() 2013-12-16 14:13:43 +09:00
Bill Gallagher
e6eb7fa466 minor gc optimization: better DefaultSpdyHeaders.iterator() 2013-12-16 14:13:23 +09:00
Jeff Pinner
39ae2dd3f1 SPDY: add SPDY/3.1 support
- with Michael Schore <mschore@twitter.com>
2013-12-16 14:11:52 +09:00
Norman Maurer
e965318398 Optimize encoding of websocket frames by merge if possible 2013-12-13 11:44:22 +01:00
Trustin Lee
3812b897e6 Fix buffer leak in AbstractMemoryHttpData 2013-12-07 11:14:08 +09:00
Norman Maurer
b3d8c81557 Fix all leaks reported during tests
- One notable leak is from WebSocketFrameAggregator
- All other leaks are from tests
2013-12-07 00:44:56 +09:00
Norman Maurer
05c10fae05 Replace usage of StringBuilder by AppendableCharSequence for performance reasons 2013-12-03 12:04:07 +01:00
Norman Maurer
17f5865e38 [maven-release-plugin] prepare for next development iteration 2013-11-29 19:31:01 +01:00
Norman Maurer
ead617fdcc [maven-release-plugin] prepare release netty-4.0.14.Beta1 2013-11-29 19:30:55 +01:00
Norman Maurer
818bc602ee Remove the use of ThreadLocal for performance reasons 2013-11-29 17:43:12 +01:00
Norman Maurer
6cf2748dbb [maven-release-plugin] prepare for next development iteration 2013-11-28 15:04:51 +01:00
Norman Maurer
5fe7596f49 [maven-release-plugin] prepare release netty-4.0.13.Final 2013-11-28 15:04:46 +01:00
Norman Maurer
0918f3edb2 Fix test 2013-11-28 13:49:39 +01:00
Norman Maurer
3dace666a3 Merge buffers for performance reasons if possible when encode http requests/responses. 2013-11-28 13:48:00 +01:00
Norman Maurer
7f57c5ed05 Backport HTTP encoding / decoding optimizations which were introduced by #2007.
The backport is partly done to keep backward compatibility
2013-11-28 10:46:27 +01:00
Trustin Lee
14327706a3 Add test case for HttpHeaders.equalsIgnoreCase(...) 2013-11-28 18:24:22 +09:00
Trustin Lee
313365cd5c Fix NPE raised by HttpHeaders.equalsIgnoreCases() when one of its arguments is null 2013-11-28 15:51:48 +09:00
Trustin Lee
407f0a36f5 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:01:46 +09:00
Norman Maurer
8753412d07 [#2006] Correctly handle HttpMessage / HttpContent implementations 2013-11-26 10:57:24 +01:00
Norman Maurer
04e8d25792 [#2005] Allow to use HttpContentDecompressor in strict mode 2013-11-26 08:22:01 +01:00
Norman Maurer
fd4435e6e3 Respect validateHeaders when duplicate/copy the response/request 2013-11-26 08:09:14 +01:00
Norman Maurer
80f72a8270 Optimize DefaultHttpHeaders.contains(...) 2013-11-24 14:40:25 +01:00
Norman Maurer
da84afe9cc Optimize check for equals header name and value 2013-11-24 14:35:49 +01:00
Norman Maurer
5de4b23c7a [#1982] Limit the usage of ThreadLocal.get() for performance reasons 2013-11-14 09:33:40 +01:00
Norman Maurer
8bfbf77b58 Also allow to disable header validation via HttpServerCodec and HttpClientCodec. Related to [#1981] 2013-11-14 08:19:49 +01:00
Norman Maurer
c4130e0cf7 Allow to disable validation of HTTP headers which shows a 5k perf improvement here when disabled 2013-11-14 07:45:03 +01:00
Norman Maurer
db78581bbb [maven-release-plugin] prepare for next development iteration 2013-11-07 18:11:45 +01:00
Norman Maurer
2386777af8 [maven-release-plugin] prepare release netty-4.0.12.Final 2013-11-07 18:11:38 +01:00
Trustin Lee
6cd9045b96 Fix checkstyle 2013-11-04 19:49:19 +09:00
Trustin Lee
54db9ec725 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:46:15 +09:00
Trustin Lee
285f51d5ba Instead of complicated capacity estimation, just use thread local buffers.
Fixes #1951
2013-11-02 19:22:44 +09:00
Trustin Lee
40c9de1b74 Create StringBuilder with saner initial capacity when encoding a Cookie
Fixes #1951
2013-11-02 19:17:01 +09:00
Trustin Lee
1c2352e6a0 Replace constructor calls on UniqueName and its subtypes with valueOf() wherever possible 2013-10-25 20:58:53 +09:00
Trustin Lee
926479e904 Make all mutable fields in WebSocketClientHandshaker volatile
- Fixes #1945
2013-10-24 17:39:50 +09:00
Norman Maurer
ceab146b54 [maven-release-plugin] prepare for next development iteration 2013-10-21 07:43:42 +02:00
Norman Maurer
27a89d6032 [maven-release-plugin] prepare release netty-4.0.11.Final 2013-10-21 07:41:49 +02:00
Norman Maurer
35cd13d10e [#1933] Correctly add the wsencoder before the httpencoder as the httpencoder also handle ByteBuf 2013-10-19 20:54:18 +02:00
Norman Maurer
45524ea43e 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:22:20 +02:00
Trustin Lee
14e3c2c0d4 Make sure HttpVersion checks if the version string is not empty
.. which was the behavior in 3.x.
2013-10-17 20:26:51 +09:00
Norman Maurer
812b0d11c2 No need to slice before copy. Part of #1848 2013-10-12 20:04:33 +02:00
Michael Grove
951dcc6c10 copy all sliced buffers, fixes #1848 2013-10-12 19:54:43 +02:00
Bill Gallagher
b5f5175338 minor gc optimization: better DefaultSpdyHeaders.iterator() 2013-10-12 10:05:31 +02:00
Norman Maurer
ff6a06a9be Add HttpHeaders.contains(name, value, ...) to save creation of LinkedList for simple checks 2013-10-11 21:39:53 +02:00
Bill Gallagher
1542b36e80 minor gc optimization: better DefaultHttpHeaders.iterator() 2013-10-11 20:44:07 +02:00
Norman Maurer
5317995a13 [#1881] Use correct field name in NullPointerException 2013-10-04 09:54:41 +02:00
Norman Maurer
d7da19f745 [maven-release-plugin] prepare for next development iteration 2013-10-02 15:48:52 +02:00
Norman Maurer
d35768ae11 [maven-release-plugin] prepare release netty-4.0.10.Final 2013-10-02 15:48:45 +02:00
Norman Maurer
ee192f0321 [#1880] Use ByteBufAllocator when read bytes into new chunks 2013-10-01 10:10:43 +02:00
Norman Maurer
7e6649fd66 [#1879] Correctly validate close frame 2013-10-01 07:32:23 +02:00
Norman Maurer
f70ceeab58 [#1878] Fix leak of ByteBuf when masked payload is used 2013-10-01 07:18:41 +02:00
Norman Maurer
be126395e3 [#1874] WebSocket08FrameDecoder may leak memory if channel is closed before the full frame was received 2013-09-30 20:44:55 +02:00
Arron Norwell
ce58e76e13 HttpRequestEncoder should append '/' to absolute path requests only when needed 2013-09-22 13:41:35 +02:00
Norman Maurer
3957ee32bb [#1833] Add testcase for fix 2013-09-14 12:00:05 +02:00
Phillip Schichtel
2243970294 [#1833] Replace ; with & only in the QueryString and not the whole URI 2013-09-14 11:59:58 +02:00
Norman Maurer
36c8ac5e5c [#1819] Remove HTTP compressor and decompressor from the pipeline after websockets handshake completes 2013-09-09 11:55:58 +02:00
Norman Maurer
0065006824 [#1818] Pass through message as they are when no compression is needed 2013-09-09 11:32:37 +02:00
Norman Maurer
ffab456aca Bump up version to reflect correct one 2013-09-09 11:20:12 +02:00
Norman Maurer
363531caf9 [maven-release-plugin] rollback the release of netty-4.0.9.Final 2013-09-06 09:18:34 +02:00
Norman Maurer
9d53573ee8 [maven-release-plugin] prepare for next development iteration 2013-09-06 09:17:15 +02:00
Norman Maurer
845a7c5753 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:17:43 +02:00
Derek Troy-West
12fe7b52b6 HTTP Chunk, wrong delimiter written 2013-08-27 18:11:21 +09: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