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
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
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
818bc602ee
Remove the use of ThreadLocal for performance reasons
2013-11-29 17:43:12 +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
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
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
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
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
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
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
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
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
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
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
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
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
alain
9633769909
Improve performance of encodeHeader
2013-07-02 06:32:56 +02: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
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
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
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
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
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
Trustin Lee
70eee55a48
Revamp HttpContentEncoder
...
- Use state machine to simplify the code
- Always produce a chunked response for simplicity
- Change the signature of beginEncode() - HttpContent was simply unnecessary.
- Add more test cases
- Fixes #1280
2013-04-17 12:51:22 +09:00
Trustin Lee
4b1df148a6
Fix a bug where HttpContentEncoder does not update 'Content-Length' and 'Transfer-Encoding' correctly
...
- Add 'Content-Length' and remove 'Transfer-Encoding' in case of FullHttpMessage
- Remove 'Content-Length' and add 'Transfer-Encoding: chunked' in case of non-full HttpMessage
- Fixes #1275
2013-04-16 11:49:47 +09:00
Norman Maurer
d8387fa4c3
[ #858 ] Merge ChannelPipeline.replaceAndForward into replace and removeAndForward into remove
2013-04-13 18:19:33 +02:00
Trustin Lee
b58e6787ee
Fix typo
2013-04-10 10:41:23 +09:00
irelandKen
9308625b2c
Update FullHttpMessage.java
...
I think FullHttpMessage = HttpMessage + LastHttpContent,
not that FullHttpMessage = FullHttpMessage + LastHttpContent
2013-04-08 21:12:19 +02:00
Norman Maurer
ded09fc778
No need t let SpdyOrHttpChooser extends ChannelDuplexHandler
2013-04-08 06:45:10 +02:00
Norman Maurer
3305a7df82
Also provide implementation for flush out of the box
2013-04-07 11:54:13 +02:00
Andrei Pozolotin
a3e760a003
fix #1234 - duplicate package-info.java errors in eclipse requires release of netty-build v 19 and netty-parent update.
2013-04-05 05:38:05 +09:00
Norman Maurer
af4b71a00e
Remove special handling of Object[] in codec framework (a.k.a unfolding)
...
- Fixes #1229
- Primarily written by @normanmaurer and revised by @trustin
This commit removes the notion of unfolding from the codec framework
completely. Unfolding was introduced in Netty 3.x to work around the
shortcoming of the codec framework where encode() and decode() did not
allow generating multiple messages.
Such a shortcoming can be fixed by changing the signature of encode()
and decode() instead of introducing an obscure workaround like
unfolding. Therefore, we changed the signature of them in 4.0.
The change is simple, but backward-incompatible. encode() and decode()
do not return anything. Instead, the codec framework will pass a
MessageBuf<Object> so encode() and decode() can add the generated
messages into the MessageBuf.
2013-04-03 21:44:54 +09:00
Trustin Lee
f95dbb7a4d
Make HttpPostRequestDecoder.addHttpData() and getFileUpload() protected
...
.. so that a user can extend it to get notified when changes are made
2013-04-02 16:07:31 +09:00
Norman Maurer
d9ac6638f4
[ #1221 ] Make sure HttpObjectAggregator 100-Continue buffer is not released
2013-04-02 07:38:46 +02:00
Prajwal Tuladhar
05850da863
enable checkstyle for test source directory and fix checkstyle errors
2013-03-30 13:18:57 +01:00
Jeff Pinner
b4b0be4e53
SPDY: allow multiple notification of closeSessionFuture
2013-03-28 15:15:09 +01:00
Norman Maurer
14a47075be
[ #1211 ] Fail ChannelPromise on SpdyProtocolException like it was before in 3.x
2013-03-28 07:20:34 +01:00
Norman Maurer
a97cca50df
[ #1212 ] Fire handshake status events to notify the user about handshake states
2013-03-28 06:57:04 +01:00
Norman Maurer
4a9ab4f57c
Add WebSocketFrameAggregator which takes care to aggregate fragmented websocket frames
2013-03-27 07:46:11 +01:00
Norman Maurer
71727e42de
[ #1210 ] Allow to use derived buffers with DefaultBufferHolder and so fix broken SpdySessionHandler
2013-03-27 07:30:12 +01:00
Norman Maurer
20d76610da
[ #1204 ] Correctly detect lastChunk in HttpPostRequestDecoder
2013-03-25 08:32:52 +01:00
Norman Maurer
f76e38592d
[ #1201 ] Correctly handle mix of not compressed and compressed requests
2013-03-25 08:13:12 +01:00
Norman Maurer
4bd9c0195f
Add a handler that makes writing websocket clients much easier
2013-03-22 12:11:35 +01:00
Trustin Lee
d3327e7f46
Fix inspector warnings
2013-03-18 13:10:55 +09:00
ursa
ecaba68348
Fix bug in memory-based HTTP data content initialization with input stream, add test (port from branch 3).
...
- Fixes #1170
2013-03-18 13:05:40 +09:00
Norman Maurer
d9c3f4bc05
[ #1159 ] Make sure we not produce an empty bytebuf on decodeLast(..)
2013-03-14 12:45:24 +01:00
Trustin Lee
6e0e38f09f
Fix test failures
2013-03-12 14:43:38 +09:00
Trustin Lee
c660002b4e
Add DecoderResult.UNFINISHED to represent the case where a decoder generated a message that was not decoded completely / Remove partial failure in DecoderResult which is not very useful but confusing
2013-03-12 13:04:53 +09:00
Norman Maurer
acde9a3f8e
Fix a NoSuchElementException when WebSocketClientHandshaker is used with HttpRequestEncoder. This time for real
2013-03-11 14:39:41 +01:00
Norman Maurer
978cf0d98a
Fix a NoSuchElementException when WebSocketClientHandshaker is used with HttpRequestEncoder
2013-03-11 13:54:03 +01:00
Norman Maurer
fd3f923b52
Allow to specify the used buffer type for ChannelInboundByteBufHandler and ChannelOutboundByteBufHandler by configuration. As default it tries to use a direct ByteBuf
2013-03-08 08:20:46 +01:00
Trustin Lee
a9a29bdf3f
Use I/O buffer whenever possible now that our direct buffers are as fast as heap buffers
2013-03-08 11:21:08 +09:00
Norman Maurer
6ac9b17ddd
Make WebSocket codec also work when HttpClientCodec and HttpServerCodec is used.
...
Also refactor the handshakers to share more code and make it easier to implement a new one and less error-prone
2013-03-08 08:46:47 +09:00
Trustin Lee
a8a7c4f576
Provide a way to implement an ChannelInbound/OutboundMessageHandler conveniently without extending an adapter class
...
- Add ChannelHandlerUtil and move the core logic of ChannelInbound/OutboundMessageHandler to ChannelHandlerUtil
- Add ChannelHandlerUtil.SingleInbound/OutboundMessageHandler and make ChannelInbound/OutboundMessageHandlerAdapter implement them. This is a backward incompatible change because it forces all handler methods to be public (was protected previously)
- Fixes : #1119
2013-03-05 17:27:53 +09:00
Justin Santa Barbara
6246825fda
[ #1100 ] Fix SPDY codec to work again in 4.x
2013-02-28 11:35:38 +01:00
Norman Maurer
b6038534cc
[ #1101 ] Fix NPE which accour when send a 100-continue response and using the HttpContentEncoder
2013-02-28 07:13:21 +01:00
Norman Maurer
977b6f3a28
[ #1101 ] Fix NPE which accour when send a 100-continue response and using the HttpContentDecoder
2013-02-28 07:06:39 +01:00
Trustin Lee
671f9d48d4
Use ConcurrentHashMapV8 wherever possible
...
- Fixes #1052
2013-02-26 15:54:51 -08:00
Trustin Lee
f67441354a
Move logging classes from internal to internal.logging
...
.. because internal is crowded
2013-02-26 14:54:25 -08:00
Norman Maurer
eb2aa7f6d4
Cleanup
2013-02-26 08:01:18 +01:00
Norman Maurer
a03bd5105a
[##1064] Fix problem where the LastHttpContent was changed to HttpContent and so the end was never detected
2013-02-26 07:47:30 +01:00
Norman Maurer
30e7ab2f7d
[ #1089 ] Correctly offer FullHttpContent if it is used to construct HttpPostRequestDecoder
2013-02-26 07:33:04 +01:00
Trustin Lee
9e67cce932
Use BufUtil.retain() where possible
2013-02-21 13:58:13 -08:00
Norman Maurer
43ff36cef0
Cleanup
2013-02-21 19:31:05 +01:00
Norman Maurer
00310d96af
[ #1067 ] Fix bug which can cause IllegalBufferAccessException when using aggregator and deflater the same time
2013-02-21 06:48:53 +01:00
Atsuhiko Yamanaka
8fdf788cbd
[ #1012 ] Replace forked jzlib with official jzlib and add a test.
2013-02-20 12:49:05 +01:00
Trustin Lee
1011227b88
Remove apiviz tags - we are focusing on user guide instead and putting diagrams there
2013-02-14 12:09:16 -08:00
Norman Maurer
54435a908f
Make internal class final and package private
2013-02-14 09:36:27 +01:00
Norman Maurer
5370573400
Change ReferenceCounted.retain* to return itself and so allow method chaining
2013-02-14 07:39:44 +01:00
Norman Maurer
fcba55329c
[ #1046 ] Make sure HttpContentEncoder calls ByteBuf.retain() if needed
2013-02-12 20:32:27 +01:00
Trustin Lee
b4f4b95739
Move io.netty.logging to io.netty.internal / Move Signal out of internal because we use it in Channel*MessageAdapters
2013-02-11 20:08:18 +09:00
Trustin Lee
a91c6596c4
Add TODO
2013-02-11 19:43:53 +09:00
Trustin Lee
a2e5cd94be
Prettify APIviz / Tighten visibility / Move subclasses to top level / Remove unused UnknownSocksMessage
2013-02-11 19:42:23 +09:00
Trustin Lee
bf0bfe9a69
Fix inspector warnings
2013-02-11 16:52:43 +09:00
Norman Maurer
0e47fb50e2
Tighten up visibility
2013-02-11 07:26:10 +01:00
Trustin Lee
4f6d05365a
Fix a race condition in reference counter implementation / Reference count never goes below 0
2013-02-10 14:22:14 +09:00
Trustin Lee
2f1a0b0593
Remove freeInbound/OutboundMessage(), replaced by ReferenceCounted.retain/release()
...
- Related: #1029
2013-02-10 13:31:31 +09:00
Trustin Lee
b9996908b1
Implement reference counting
...
- Related: #1029
- Replace Freeable with ReferenceCounted
- Add AbstractReferenceCounted
- Add AbstractReferenceCountedByteBuf
- Add AbstractDerivedByteBuf
- Add EmptyByteBuf
2013-02-10 13:10:09 +09:00
Trustin Lee
27190fcb7f
Fix a bug where HttpContentDecoder emits duplicate HttpMessage or raises NPE
2013-02-10 01:35:01 +09:00
Trustin Lee
2ac7983471
Do not trigger inboundBufferUpdated unnecessarily / Fix a bug in WebSocketServerProtocolHandlerTest / Fix a bug in forbiddenHttpRequestResponder()
2013-02-09 20:32:49 +09:00
Norman Maurer
42b21222dc
[ #1025 ] Allow to add extra headers to the websocket handshake response
2013-02-08 19:54:05 +01:00
Trustin Lee
ee189d1da7
Use finer grained type parameter in SPDY
2013-02-08 17:57:20 +09:00
Trustin Lee
82c46180c9
Tighten access modifier of encode/decode()
2013-02-08 17:37:16 +09:00
Trustin Lee
76eb40a4d2
Make ChannelOutboundMessageHandlerAdapter similar to ChannelInboundMessageHandlerAdapter
2013-02-08 17:07:01 +09:00
Trustin Lee
1640b1fea6
Automatically detect the message types in MessageToMessageCodec
2013-02-08 16:12:32 +09:00
Trustin Lee
fa1b49de98
More robust automatic messageType detection for ChannelInboundMessageHandlerAdapter and MessageToMessageDecoder
2013-02-08 15:45:17 +09:00
Trustin Lee
e5616c85c4
Automatic messageType detection for ChannelInboundMessageHandlerAdapter
2013-02-08 13:48:47 +09:00
Trustin Lee
d4742bbe16
Clean up abstract ChannelHandler impls / Remove ChannelHandlerContext.hasNext*()
...
- Rename ChannelHandlerAdapter to ChannelDuplexHandler
- Add ChannelHandlerAdapter that implements only ChannelHandler
- Rename CombinedChannelHandler to CombinedChannelDuplexHandler and
improve runtime validation
- Remove ChannelInbound/OutboundHandlerAdapter which are not useful
- Make ChannelOutboundByteHandlerAdapter similar to
ChannelInboundByteHandlerAdapter
- Make the tail and head handler of DefaultChannelPipeline accept both
bytes and messages. ChannelHandlerContext.hasNext*() were removed
because they always return true now.
- Removed various unnecessary null checks.
- Correct method/field names:
inboundBufferSuspended -> channelReadSuspended
2013-02-07 23:47:45 +09:00
Norman Maurer
582c6be456
[ #1023 ] WebSocketClientHandshaker00 now also work with non heap buffers
2013-02-07 14:21:11 +01:00
ursa
f09b85f4e7
Add test for HttpPostRequestDecoder: validate '\r' symbols in the end of binary stream are parsed correctly.
2013-02-06 20:21:56 +01:00
ursa
992d431a95
Fix line-end detection for binary streams upload.
...
- Related: #1016
2013-02-06 11:54:05 +09:00
Trustin Lee
2ec932798f
Replace .readable() and .writable() to .isReadable() and .isWritable()
2013-01-31 18:24:33 +01:00
Trustin Lee
42c65cca3a
Make MessageBuf bounded
...
- Move common methods from ByteBuf to Buf
- Rename ensureWritableBytes() to ensureWritable()
- Rename readable() to isReadable()
- Rename writable() to isWritable()
- Add isReadable(int) and isWritable(int)
- Add AbstractMessageBuf
- Rewrite DefaultMessageBuf and QueueBackedMessageBuf
- based on Josh Bloch's public domain ArrayDeque impl
2013-01-31 18:11:06 +01:00
Norman Maurer
ec013bf2d3
[ #983 ] Force the user to implement an actual ChannelInboundHandler or ChannelOutboundHandler
...
For this ChannelInboundHandler* and ChannelOutboundHandler* was made package private
2013-01-31 15:50:27 +01:00
Courtney Robinson
2d9cc9f63b
Allow to specify the mode the encoder uses for form params. This allows it to be used with OAUTH
...
The OAuth 1 spec has small deviations from UrlEncoder.encode's output.
+ Percent encodes the parameters
+ Added tests to verify
+ See relevant OAuth section
http://oauth.net/core/1.0/#encoding_parameters
+ Detailed explanation http://hueniverse.com/oauth/guide/authentication/
2013-01-31 07:49:34 +01:00
Norman Maurer
97ea338bce
[ #971 ] Fix a bug where the HttpContentCompressor was try to start compressing on an empty response
2013-01-30 20:58:07 +01:00
Norman Maurer
cff2edf75d
Remove not used enum
2013-01-30 19:02:29 +01:00
Norman Maurer
3843cfd702
[SPDY] Factor out headers into extra class like we did in http and support method chaining where possible
2013-01-30 08:23:07 +01:00
Norman Maurer
238e03f75b
Add setters and getters back to Http Objects
...
* This is done because we noticed that the previous change limit the usage more then it gave us any benefit. Now it is possible
again to rewrite the url on the fly or reuse the objects when writing a proxy and so limit the GC pressure.
* Fixes also #979
2013-01-30 07:42:18 +01:00
Trustin Lee
c5ccaee506
Fix a bug in HttpPostRequestDecoder where character encoding is ignored when reading a line
...
- Fixed #992 (backported from 3)
- 9650cda163
- b38bde2d2b
2013-01-29 15:59:15 +09:00
Norman Maurer
d7bfd44e10
[ #982 ] [ #977 ] [ #858 ] Allow to transfer the content a ChannelHandlers inbound/outbound buffer on removal/replacement
...
This changes the behavior of the ChannelPipeline.remove(..) and ChannelPipeline.replace(..) methods in that way
that after invocation it is not possible anymore to access any data in the inbound or outbound buffer. This is
because it empty it now to prevent side-effects. If a user want to preserve the content and forward it to the
next handler in the pipeline it is adviced to use one of the new methods which where introduced.
- ChannelPipeline.removeAndForward(..)
- ChannelPipeline.replaceAndForward(..)
2013-01-28 10:25:38 +01:00
Norman Maurer
29bed32a89
[ #963 ] Fix invalid free-up of messages if they are only passed-throught in HttpContentEncoder and HttpContentDecoder
2013-01-21 10:41:23 +01:00
Norman Maurer
c1e827fd72
[ #942 ] Add an option to disable decoding of chunked transfer encoding in HttpObjectDecoder
2013-01-20 10:40:54 +01:00
Trustin Lee
b60e0b6a51
Modernize InternalLogger API and enable logging framework autodetection
...
- Borrow SLF4J API which is the best of the best
- InternalLoggerFactory now automatically detects the logging framework
using static class loading. It tries SLF4J, Log4J, and then falls back
to java.util.logging.
- Remove OsgiLogger because it is very likely that OSGi container
already provides a bridge for existing logging frameworks
- Remove JBossLogger because the latest JBossLogger implementation seems
to implement SLF4J binding
- Upgrade SLF4J to 1.7.2
- Remove tests for the untestable logging frameworks
- Remove TestAny
2013-01-19 20:50:52 +09:00
Norman Maurer
e8636050ca
[ #864 ] Switch to single decoding mode on the protocol upgrade to prevent races
2013-01-18 09:56:17 +01:00
Trustin Lee
cfa300f431
Fix APIviz panic
2013-01-18 14:12:35 +09:00
Norman Maurer
8a9e602a66
Prevent possible ClassCastException
2013-01-17 09:37:17 +01:00
Trustin Lee
4472fe9795
Remove 'get' prefix
2013-01-17 15:06:46 +09:00
Trustin Lee
eacc474cda
Remove 'get' prefix
2013-01-17 14:48:03 +09:00
Norman Maurer
dfbecb796c
[ #910 ] Make use of ByteBufHolder in SPDY, HTTP multipart and WebSockets to allow for buffer pooling
2013-01-17 06:34:52 +01:00
Jeff Pinner
a192cfdbf0
SPDY: fix improper use of SYNC_FLUSH in SpdyHeaderBlockZlibCompressor
2013-01-16 10:42:24 -08:00
Trustin Lee
e95d3de1ff
Fix a bug where HttpContents are freed too early
2013-01-17 00:50:43 +09:00
Trustin Lee
4ee11cd36f
Fix bad test name
2013-01-17 00:42:51 +09:00
Trustin Lee
3b79008eda
Change the WebSocket API to use HttpHeaders instead of Map<String, String> for custom headers / Cleanup
2013-01-17 00:33:40 +09:00
Trustin Lee
540bc99549
Take advantage of invocation chaining in HttpHeaders
2013-01-16 23:56:51 +09:00
Trustin Lee
34820511ff
Second HTTP overhaul
...
- Rename message types for clarity
- HttpMessage -> FullHttpMessage
- HttpHeader -> HttpMessage
- HttpRequest -> FullHttpRequest
- HttpResponse -> FulllHttpResponse
- HttpRequestHeader -> HttpRequest
- HttpResponseHeader -> HttpResponse
- HttpContent now extends ByteBufHolder; no more content() method
- Make HttpHeaders abstract, make its header access methods public, and
add DefaultHttpHeaders
- Header accessor methods in HttpMessage and LastHttpContent are
replaced with HttpMessage.headers() and
LastHttpContent.trailingHeaders(). Both methods return HttpHeaders.
- Remove setters wherever possible and remove 'get' prefix
- Instead of calling setContent(), a user can either specify the content
when constructing a message or write content into the buffer.
(e.g. m.content().writeBytes(...))
- Overall cleanup & fixes
2013-01-16 23:46:02 +09:00
Norman Maurer
b7de868003
[ #677 ] Overhaul HTTP codec
...
This commit tries to simplify the handling of Http easier and more consistent. This has a effect of many channges. Including:
- HttpMessage was renamed to HttpHeader and the setContent and getContent methods were removed
- HttpChunk was renamed to HttpContent
- HttpChunkTrailer was renamed to LastHttpContent
- HttpCodecUtil was merged into HttpHeaders
Now a "complete" Http message (request or response) contains of the following parts:
- HttpHeader (HttpRequestHeader or HttpResponseHeader)
- 0 - n HttpContent objects which contains parts of the content of the message
- 1 LastHttpContent which marks the end of the message and contains the remaining data of the content
I also changed the sematic of HttpResponse and HttpRequest, these now represent a "complete" message which contains the HttpHeader and the HttpLastContent, and so can be used to eeasily send requests. The HttpMessageAggregator was renamed to HttpObjectAggregator and produce HttpResponse / HttpRequest message.
2013-01-15 17:51:12 +01:00
Jeff Pinner
f75b6b142c
SPDY: fix regression in SpdyFrameDecoder.decodeHeaderBlock()
2013-01-14 10:58:03 -08:00
Trustin Lee
1354b4a1ac
SPDY: allow empty header values in SPDY/3
...
Ported from 3
2013-01-14 22:59:11 +09:00
Trustin Lee
57153079a5
Chrome requires the :version: header in SPDY_SESSION_PUSHED_SYN_STREAM frames otherwise it issues a HTTP_TRANSACTION_SPDY_SEND_REQUEST_HEADERS and a SPDY_STREAM_ERROR saying "HEADERS incomplete headers, but pending data frames."
...
Ported from 3
2013-01-14 22:37:05 +09:00
Trustin Lee
64ae8b6a37
Replace and merge DetectionUtil and DirectByteBufUtil into PlatformDependent and PlatformDependent0
...
PlatformDependent delegates the operations requires sun.misc.* to PlatformDependent0 to avoid runtime errors due to missing sun.misc.* classes.
2013-01-11 14:03:27 +09:00
Norman Maurer
ec5ad7b22c
[ #921 ] Fix NPE which can be thrown on bad-timing when using WebSocketClientHandshaker07
2013-01-10 12:40:27 +01:00
Trustin Lee
eb337ff5a7
Fix various inspection warnings
2013-01-10 15:23:58 +09:00
Trustin Lee
b5e6350bcb
Fix compiler warning
2013-01-10 13:55:15 +09:00
Norman Maurer
b742dcc209
[ #902 ] Remove usage of generics for output of Encoder/Decoder to make them more flexible again
2013-01-09 07:13:31 +01:00
Trustin Lee
dd6b7969b7
Give a handler more control over how its buffers' read bytes are discarded.
...
This pull request adds two new handler methods: discardInboundReadBytes(ctx) and discardOutboundReadBytes(ctx) to ChannelInboundByteHandler and ChannelOutboundByteHandler respectively. They are called between every inboundBufferUpdated() and flush() respectively. Their default implementation is to call discardSomeReadBytes() on their buffers and a user can override this behavior easily. For example, ReplayingDecoder.discardInboundReadBytes() looks like the following:
@Override
public void discardInboundReadBytes(ChannelHandlerContext ctx) throws Exception {
ByteBuf in = ctx.inboundByteBuffer();
final int oldReaderIndex = in.readerIndex();
super.discardInboundReadBytes(ctx);
final int newReaderIndex = in.readerIndex();
checkpoint -= oldReaderIndex - newReaderIndex;
}
If a handler, which has its own buffer index variable, extends ReplayingDecoder or ByteToMessageDecoder, the handler can also override discardInboundReadBytes() and adjust its index variable accordingly.
2013-01-09 13:34:09 +09:00
Trustin Lee
218afba1f2
Do not set 'Content-Encoding' if the target encoding is 'identity'
...
- Fixes #769
2013-01-01 15:13:35 +09:00
Norman Maurer
4e77bacdf7
[ #873 ] [ #868 ] Split ChannelFuture into ChannelFuture and ChannelPromise
2012-12-31 23:27:16 +09:00
Norman Maurer
852f546b5b
[ #846 ] Tighten up visibility
2012-12-25 18:54:55 +01:00
Norman Maurer
5bd3648b3d
[ #845 ] Enable PUT of files above 2GB
2012-12-24 21:52:04 +01:00
Norman Maurer
2ea45950f1
Javadoc fixes
2012-12-23 23:03:54 +01:00
Veebs
92f1a81f47
#751 - Added support for legacy websocket v7 in order to pass SocksJS tests
2012-12-19 12:35:56 +01:00
Trustin Lee
78ccfeedf9
Save memory copy
2012-12-19 18:36:31 +09:00
Trustin Lee
937c0481e0
Do not use slice() to get the content of HTTP msg
...
- Fixes #794
2012-12-19 18:28:55 +09:00
Trustin Lee
42d466c97f
Remove cruft
2012-12-18 15:21:26 +09:00
Trustin Lee
310a87a51d
Fix #814 - Prevent IllegalBufferAccessException on write() and flush()
...
- Also fixed a incorrect port of SpdySessionHandler
- Previously, it closed the connection too early when sending a GOAWAY frame
- After this fix, SpdySessionHandlerTest now passes again without the previous fix
2012-12-18 04:53:37 +09:00
Trustin Lee
e59ac8e79b
Do not call inbound event methods directly
...
- Fixes #831
This commit ensures the following events are never triggered as a direct
invocation if they are triggered via ChannelPipeline.fire*():
- channelInactive
- channelUnregistered
- exceptionCaught
This commit also fixes the following issues surfaced by this fix:
- Embedded channel implementations run scheduled tasks too early
- SpdySessionHandlerTest tries to generate inbound data even after the
channel is closed.
- AioSocketChannel enters into an infinite loop on I/O error.
2012-12-18 03:04:26 +09:00
Trustin Lee
3f9441f4c1
Add missing free() on SpdySessionHandler buffers
2012-12-17 19:29:36 +09:00
Trustin Lee
def12a171c
Rename ChannelBuf to Buf and ChannelBufType to BufType
...
- Fixes #825
2012-12-17 17:43:45 +09:00
Trustin Lee
eb23c9d27c
Add missing 'operation(args, future)' for 'operation(args)'
...
- Fixes #818
- Fix inspector warnings
2012-12-14 19:42:58 +09:00
Trustin Lee
5a4a59406b
Merge ByteBuf.hasNioBuffer() and hasNioBuffers()
...
- Fixes #797
2012-12-14 12:20:33 +09:00
Veebs
0c5fd38eb6
#722 - Make WebSocketClientHandshakerFactory a static utility class
2012-12-13 07:34:05 +01:00
Veebs
2704efc056
Added documentation to websocket classes.
2012-12-13 07:13:46 +01:00
Norman Maurer
312810d415
[ #795 ] Fix WebSocketClientHandshaker13 and WebSocketClientHandshaker08 finishHandshake() method.
2012-12-07 20:14:11 +01:00
Trustin Lee
33c0c89fef
Remove unnecessary empty lines
2012-12-03 19:58:13 +09:00
Norman Maurer
717bde05e2
[786] Fix possible corruption of first WebSocketFrame caused by WebSocketServerHandshaker*
2012-12-02 19:55:45 +01:00
Trustin Lee
81e2db10fa
ByteBufAllocator API w/ ByteBuf perf improvements
...
This commit introduces a new API for ByteBuf allocation which fixes
issue #643 along with refactoring of ByteBuf for simplicity and better
performance. (see #62 )
A user can configure the ByteBufAllocator of a Channel via
ChannelOption.ALLOCATOR or ChannelConfig.get/setAllocator(). The
default allocator is currently UnpooledByteBufAllocator.HEAP_BY_DEFAULT.
To allocate a buffer, do not use Unpooled anymore. do the following:
ctx.alloc().buffer(...); // allocator chooses the buffer type.
ctx.alloc().heapBuffer(...);
ctx.alloc().directBuffer(...);
To deallocate a buffer, use the unsafe free() operation:
((UnsafeByteBuf) buf).free();
The following is the list of the relevant changes:
- Add ChannelInboundHandler.freeInboundBuffer() and
ChannelOutboundHandler.freeOutboundBuffer() to let a user free the
buffer he or she allocated. ChannelHandler adapter classes implement
is already, so most users won't need to call free() by themselves.
freeIn/OutboundBuffer() methods are invoked when a Channel is closed
and deregistered.
- All ByteBuf by contract must implement UnsafeByteBuf. To access an
unsafe operation: ((UnsafeByteBuf) buf).internalNioBuffer()
- Replace WrappedByteBuf and ByteBuf.Unsafe with UnsafeByteBuf to
simplify overall class hierarchy and to avoid unnecesary instantiation
of Unsafe instances on an unsafe operation.
- Remove buffer reference counting which is confusing
- Instantiate SwappedByteBuf lazily to avoid instantiation cost
- Rename ChannelFutureFactory to ChannelPropertyAccess and move common
methods between Channel and ChannelHandlerContext there. Also made it
package-private to hide it from a user.
- Remove unused unsafe operations such as newBuffer()
- Add DetectionUtil.canFreeDirectBuffer() so that an allocator decides
which buffer type to use safely
2012-11-22 15:10:59 +09:00
Norman Maurer
2adebc4c54
[ #755 ] SPDY: fix header block values truncation in decompression
2012-11-20 20:09:59 +01:00
Mike Heath
ff14feeb54
The handshake handler should not handle the exception and simply close the socket. The exception should be propagated to the WebSocketServerProtocolHandler to send the appropriate response and then close the socket.
2012-11-20 10:00:28 +01:00
Jeff Pinner
ef26ffe9d8
SPDY: remove deprecated methods
2012-11-17 19:30:42 +01:00
Jeff Pinner
97d07253e2
SPDY: fixed session status (internal error misdocumented)
2012-11-17 19:30:42 +01:00
Norman Maurer
d28eca7138
[ #740 ] Fix WebSocketClientHandshaker00.finishHandshake() validations
2012-11-15 13:06:48 +01:00
Norman Maurer
46d713970b
[ #737 ] WebSocketClientHandshaker00 should set Content-Length header do workaround problem with proxy
2012-11-14 10:08:44 +01:00
Norman Maurer
3b729848dc
[ #735 ] Improve the notification of the handshake future
2012-11-13 20:05:54 +01:00
Norman Maurer
efaa5c2ff5
[ #735 ] Make sure the handshake ChannelFuture is notified after the right encoder is present in the ChannelPipeline
2012-11-13 09:26:32 +01:00
Norman Maurer
2d5028bfd6
[ #729 ] Correctly handle urls with empty abs_path in it when issue the websocket handshake
2012-11-12 15:29:02 +01:00
Trustin Lee
9ac522382a
Fix visibility warnings from the inspector.
2012-11-12 14:03:43 +09:00
Trustin Lee
a05064d3eb
Fix more inspection warnings + compilation errors
2012-11-12 13:25:00 +09:00
Trustin Lee
36c8eb02e8
Fix parameter namings + some more
2012-11-12 12:59:37 +09:00
Trustin Lee
6f2840193a
Fix inspection warnings related with JUnit usage
2012-11-12 12:45:06 +09:00
Trustin Lee
aedf8790c3
Fix various Javadoc issues / Do not use argN parameter names
2012-11-12 12:26:19 +09:00
Trustin Lee
ea4a0e3535
Prefer {@code ...} to <code>...</code> / Fix deprecation warnings
2012-11-12 11:51:23 +09:00
Trustin Lee
15642f2cd8
Do not call static methods via instances
2012-11-12 11:23:06 +09:00
Trustin Lee
9746bb2036
Make a member field final wherever possible
2012-11-12 09:43:55 +09:00
Trustin Lee
4dce19b814
Replace a variable with a constant wherever possible
2012-11-12 09:43:14 +09:00
Trustin Lee
aa7cd691df
Remove redundant 'else' branches.
2012-11-12 09:31:40 +09:00
Trustin Lee
91a61d7f43
Remove unnecessary qualifiers
2012-11-12 09:11:48 +09:00
Trustin Lee
61d872d6e2
Suppress false-positive inspection warnings /
2012-11-12 09:05:16 +09:00
Trustin Lee
a07fb94fe7
Prefer "str".equals(var) to var.equals("str") / Add proper null checks
2012-11-12 08:59:54 +09:00
Trustin Lee
b4f796c5e3
Use 'x' over "x" wherever possible / String.equals("") -> isEmpty()
2012-11-10 08:03:52 +09:00
Trustin Lee
05c416b674
Add 'static' modifier to the methods that don't need to be member methods
2012-11-10 07:54:33 +09:00
Trustin Lee
5a4b2ec07e
Replace keySet() + unnecessary map lookup with entrySet()
2012-11-10 07:36:42 +09:00
Trustin Lee
f77f13faf0
Make classes static wherever possible
2012-11-10 07:32:53 +09:00
Trustin Lee
9f2c1c4774
Use foreach loop wherever possible / Prefer String.contains() to indexOf() >= 0 / Prefer StringUtil.split() to String.split()
2012-11-10 07:24:54 +09:00
Trustin Lee
3f4b3314cc
DefaultHttpDataFactory.MINSIZE must be final
2012-11-10 07:11:31 +09:00
Trustin Lee
4e0f455e69
Remove methods overridden but identical with the super implementation / Make constructors of abstract classes protected rather than non-sense public
...
AbstractWrappedByteBuf.capacity(int) should raise a UnsupportedOperationException rather than ReadOnlyBufferException.
2012-11-10 07:10:30 +09:00
Trustin Lee
d6a0fe54fd
Remove unnecessary throws clauses for unchecked exceptions
2012-11-10 07:07:37 +09:00
Trustin Lee
0d0eb0abfb
Remove unused imports
2012-11-10 07:05:18 +09:00
Trustin Lee
23883d25ee
Remove various unnecessary qualifiers
2012-11-10 07:03:07 +09:00
Norman Maurer
211b4059b1
[ #719 ] Handle http requests without an absolute path the right way when encoding them, which is adding / to it
2012-11-09 20:09:07 +01:00
Trustin Lee
8ad50a3e9c
Remove recundant type casting
2012-11-10 02:13:15 +09:00
Trustin Lee
27dc582e2b
Fix a regression in HttpMessageDecoder due to a mistake during yak shaving
2012-11-10 01:55:33 +09:00
Trustin Lee
b8f5ef0423
Remove unnecessary null check before equals()
2012-11-10 01:34:39 +09:00
Trustin Lee
58ba0de659
Remove unnecessarily qualified static access
2012-11-10 01:32:21 +09:00
Trustin Lee
bbcb035246
Prefer isEmpty() over size() == 0 or length() == 0
2012-11-10 01:24:04 +09:00
Trustin Lee
957154c005
Remove redundant no-arg constructors
2012-11-10 01:08:18 +09:00
Trustin Lee
3d364c7f75
Enum should not have a non-final value
2012-11-10 00:53:37 +09:00
Trustin Lee
e21dc5925d
Replace dynamic regular expressions with precompiled Patterns or new StringUtil.split()
2012-11-10 00:41:22 +09:00
Trustin Lee
8842f8ef90
Add missing @Override annotation
2012-11-09 17:34:34 +09:00
Trustin Lee
2ab38d8685
Remove pointless bitwise expressions
2012-11-09 17:26:11 +09:00
Trustin Lee
994a8db8fc
Fix overly-strong type casts
2012-11-09 17:14:59 +09:00
Norman Maurer
90c0481ecf
[ #712 ] Fix parsing dates in the past bug in CookieDecoder
2012-11-08 09:38:32 +01:00
Veebs
36ac52a4bd
Port http multipart package. See #709
2012-11-04 13:59:50 +01:00
Norman Maurer
0526e1cb06
[ #706 ] Fix SpdyHttpResponseStreamIdHandler which was ported incorrectly
2012-11-02 19:50:41 +01:00
Norman Maurer
87ba8cb4b0
[ #705 ] Fix SpdyOrHttpChooser
2012-11-02 17:58:19 +01:00
Jeff Pinner
be6ddb74aa
HTTP method should be case sensitive (RFC-2616 Sec. 5.1.1)
2012-11-01 22:52:23 -07:00
Cruz Julian Bishop
93d0226c03
Small checkstyle fixes
...
Netty can build again, now.
Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
2012-10-30 21:57:26 +10:00
Norman Maurer
4696fcde1f
[ #691 ] Correctly handle SpdyRstStreamFrame
2012-10-30 08:48:09 +01:00
Norman Maurer
e726ff63d9
Cleanup
2012-10-29 20:21:38 +01:00
Trustin Lee
a6c4f651a7
[ #661 ] WebSocketClientHandshaker is broken.
...
- Remove HttpRequestEncoder after handshaking is complete
- Fix a bug in the WebSocket client example where it sends a frame even before handshake is complete
2012-10-16 14:40:39 -07:00
Norman Maurer
7eef61580e
No need to use a concurrent Queue with out new thread-model. See #626
2012-10-02 20:16:35 +02:00
Norman Maurer
09d9f46e58
Merge pull request #630 from ngocdaothanh/master
...
Add CORS headers
2012-10-01 21:49:38 -07:00
Norman Maurer
59cd054fe3
Merge SpdyOrHttpChooser and SpdyHttpResponseStreamIdHandler into master. See #626
2012-09-30 21:18:54 +02:00
Ngoc Dao
7751daf2a4
Add ACCESS_CONTROL_EXPOSE_HEADERS
2012-09-28 19:18:21 +09:00
Ngoc Dao
f5e94d27e0
Add CORS headers
...
http://en.wikipedia.org/wiki/Cross-origin_resource_sharing
https://developer.mozilla.org/en-US/docs/HTTP_access_control
2012-09-28 17:19:50 +09:00
Trustin Lee
94838ee274
[ #441 ] Provide a better way to handle decoder failures
...
* Rename isPartial() to isPartialFailure()
* Add isCompleteFailure() and isFailure()
2012-09-28 15:46:17 +09:00
Trustin Lee
623956b838
[ #441 ] Provide a better way to handle decoder failures
...
* Make HttpChunkAggregator handle DecoderResult properly
2012-09-28 15:26:38 +09:00
Trustin Lee
9155f58c64
Rename get/setDecodeResult() to get/setDecoderResult()
2012-09-28 15:20:02 +09:00
Trustin Lee
bf808b3486
Rename DecodeResult to DecoderResult
2012-09-28 15:19:08 +09:00
Trustin Lee
41e0ef2e9a
[ #441 ] Provide a better way to handle decoder failures
...
* Update toString() of all HttpObject implementations
* HttpMessageDecoder does not raise an exception but sets decoderResult property of the decoded message.
* HttpMessageDecoder discards inbound traffic once decoding fails, by adding a new state called BAD_MESSAGE.
* Add a test case that tests this behavior.
2012-09-28 15:16:29 +09:00
Trustin Lee
b923d0c51f
Use supertype HttpObject instead of HttpMessage + HttpChunk where possible
2012-09-28 14:00:07 +09:00
Trustin Lee
adebda1560
[ #441 ] Provide a better way to handle decoder failures
...
* Add DecodeResult that represents the result of decoding a message
* Add HttpObject which HttpMessage and HttpChunk extend.
** HttpObject has a property 'decodeResult'
2012-09-28 13:48:17 +09:00
Trustin Lee
2ecf26c8eb
Fix #525 Add CORS preflight headers to HttpHeaders.Names
2012-09-27 19:16:02 +09:00
Trustin Lee
a156f67804
[ #624 ] Add varargs constructor to MessageToByteEncoder, MessageToMessage(Encoder|Decoder|Codec) to implement default isEncodable/isDecodable()
...
.. and modify all their subtypes to take advantage of this improvement.
2012-09-23 17:01:31 +09:00
norman
8ab1ef1432
Fix checkstyle
2012-09-10 12:10:24 +02:00
norman
0233a3dd63
Close the channel after the response was written to the client on a WebSocketHandshakeException. See #587
2012-09-10 07:22:35 +02:00
norman
6c2053bae5
Check if WebSocketServerProtocolHandshakeHandler is already in the pipeline before adding it. See #587
2012-09-10 07:18:26 +02:00
norman
6e39192462
Rename WebSocketServerHandshakeHandler to WebSocketServerProtocolHnadshakeHandler and also make it public. See #587
2012-09-10 07:15:59 +02:00
Norman Maurer
4353aa6794
Use Secure websockets if SslHandler is present in the ChannelPipeline. See #587
2012-09-09 19:48:53 +02:00
Norman Maurer
bd557a6330
Remove not necessary try / catch block. See #587
2012-09-09 19:35:56 +02:00
Jeff Smick
416c026efe
Upgrade client connection after completed response
2012-09-09 08:54:46 -07:00
Daniel Bevenius
150e8b4105
WebSocket enhancements
...
- Refactoring and adding suggestions from Norman and Vibul.
2012-09-09 08:30:40 +02:00
Norman Maurer
c6436ad470
Also move the replacement of the decoder to the ChannelFutureListener for the websocket upgrade. See #586
2012-09-09 08:21:32 +02:00
Jeff Smick
90d15c4627
Upgrade connection after completed response
...
Channel handlers above the HttpEncoder may delay the repsonse being
written to the socket. We need to wait for the response to complete
before upgrading the pipeline.
2012-09-08 20:54:43 -07:00
Trustin Lee
a43f686d64
[ #527 ] Add Javadoc for HttpTransferEncoding
2012-08-21 14:05:04 +09:00
Trustin Lee
ec2b29f0b6
[ #539 ] Potential direct memory leak in HttpContentEn/Decoder
2012-08-20 13:38:14 +09:00
Trustin Lee
10f26f3205
[ #539 ] Potential direct memory leak in HttpContentEn/Decoder
2012-08-20 12:18:39 +09:00
Trustin Lee
7f3f792017
Fix a bug where CookieDecoder sets the default maxAge to -1
...
.. which should be Long.MIN_VALUE
2012-08-20 12:05:47 +09:00
Trustin Lee
b7ac3edf02
Add static modifier where static member is just enough.
2012-08-19 19:12:32 +09:00
Trustin Lee
602f976e41
[ #527 ] Add a new property to HttpMessage to help clarify its transfer encoding
...
- Add an enum: HttpTransferEncoding
- consists of SINGLE, STREAMED, and CHUNKED
- Add HttpMessage.transferEncoding
- replaces is/setChunked()
2012-08-19 19:06:47 +09:00
Norman Maurer
c22b559dfa
Set maxAge to Integer.MIN_VALUE by default. See #534
2012-08-19 11:55:15 +03:00
Norman Maurer
e80abf0b39
Update codec-http/src/main/java/io/netty/handler/codec/http/DefaultCookie.java
...
Allow to set a negative value for maxAge of DefaultCookie. See #533
2012-08-19 11:48:51 +03:00
Trustin Lee
0a99a33540
Use String.getBytes(Charset) wherever possible
2012-08-17 11:43:59 +09:00
Trustin Lee
de37d75871
[ #521 ] Encode URI using UTF-8 charset
...
- Forwardport @jpinner's pull request #522
- Use Charset instead of charset name
2012-08-17 11:39:36 +09:00
Trustin Lee
00d6010916
[ #494 ] Automatically adding chunked encoding header breaks streaming
...
Add a missing statement dropped while forwardporting
2012-08-17 11:34:35 +09:00
Trustin Lee
e530ccaeb8
Fix typo
2012-08-17 11:31:40 +09:00
Trustin Lee
0baf359202
[ #494 ] Automatically adding chunked encoding header breaks streaming
...
Forwardport @jamestyrrell's pull request
2012-08-17 11:30:08 +09:00
Jeff Pinner
d3d52edb31
SPDY: introduce SpdyControlFrame tag interface
2012-08-14 18:00:39 -07:00
Jeff Pinner
a0d9bed8f9
SPDY: remove deprecated data compressed flag
2012-08-14 17:58:22 -07:00
norman
ba1c7c5c55
Replace usage of QueueFactory with ConcurrentLinkedQueue and LinkedBlockingQueue. See #477
2012-07-30 08:01:46 +02:00
norman
bdde5a20f6
Allow to set Expires attribute
...
to a date in theast. See #479
2012-07-30 07:44:53 +02:00
Trustin Lee
8d813b127c
Replace free() with reference counting / Fix SlicedByteBuf.unsafe()
...
- based on @normanmaurer's feed back
- Added Unpooled.compositeBuffer(int)
2012-07-20 12:33:17 +09:00
Trustin Lee
5a613f379e
Make ByteBuf dynamic / Introduce an interface for composite buffers
...
- Replace ByteBufferBackedByteBuf with DirectByteBuf
- Make DirectByteBuf and HeapByteBuf dynamic
- Remove DynamicByteBuf
- Replace Unpooled.dynamicBuffer() with Unpooled.buffer() and
directBuffer()
- Remove ByteBufFactory (will be replaced with ByteBufPool later)
- Add ByteBuf.Unsafe (might change in the future)
2012-07-19 20:25:47 +09:00
Trustin Lee
250b40ec3b
Fix typo in test samples
2012-07-19 20:25:47 +09:00
Frédéric Brégier
e36c4c77bf
fix header to out
2012-07-18 11:50:28 +03:00
Frédéric Brégier
56a72c6456
writesBytes as in V3 instead of writeInt (RFC says 0 to 4 bytes)
2012-07-18 11:46:56 +03:00
Frédéric Brégier
92334b919e
Fix for issue #456 related to payload using 2 differents RANDOM while only one should be used
2012-07-18 11:43:36 +03:00
Trustin Lee
e157ea1a66
Allow a user use any type as a ReplayingDecoder state / AIO cleanup
...
- Removed VoidEnum because a user can now specify Void instead
- AIO: Prefer discardReadBytes to clear
- AIO: Fixed a potential bug where notifyFlushFutures() is not called
if flush() was requested with no outbound data
2012-07-09 20:40:43 +09:00
Trustin Lee
9af7512c35
Use String.CASE_INSENSITIVE_ORDER instead of custom Comparator
2012-07-07 13:30:28 +09:00
norman
a7a4081e70
Fix checkstyle
2012-07-04 15:27:10 +02:00
norman
1784283d29
Correctly format cookies. This fix some bug which lead to expiring of cookies to not work. See #426
2012-07-04 15:20:47 +02:00
norman
61a7c78a53
Port fix for #433
2012-07-04 15:14:05 +02:00
norman
ac4dacd84f
Minimize byte copies by using a CompositeByteBuf to concat the chunks. See #413
2012-07-03 10:37:11 +02:00
Norman Maurer
c35f90f920
Port enhancement to reduce memory copy if possible. See #412
2012-06-29 13:26:13 +02:00
Norman Maurer
cd95dc5924
Merge pull request #422 from Massive-Dynamics/http-doc
...
Even more documentation changes (mainly) - HTTP
2012-06-29 02:55:20 -07:00
Cruz Julian Bishop
3792693468
Changed "Gets the" to "Returns the" - Requested by @trustin
2012-06-29 19:25:31 +10:00
Cruz Julian Bishop
f3fff2d3e8
Documentation redone for Cookie
2012-06-29 18:59:12 +10:00
Cruz Julian Bishop
26ed1a9972
Documentation and slight internal refactoring of HttpCodecUtil
2012-06-29 17:03:47 +10:00
Norman Maurer
d0c8c10681
Merge pull request #420 from Massive-Dynamics/fix-failed-javadoc
...
Fixes a bit of javadoc that was broken by a failed merge
2012-06-28 23:51:05 -07:00
Cruz Julian Bishop
4d5e4c3433
Make HttpResponse's javadoc a bit easier to read
2012-06-29 16:39:39 +10:00
Cruz Julian Bishop
a818cad45a
Make HttpRequest's documentation easier to read
2012-06-29 16:37:40 +10:00
Cruz Julian Bishop
59bb92171b
Made the documentation in HttpMessage a bit easier to understand
2012-06-29 16:33:14 +10:00
Cruz Julian Bishop
9f9b36f579
Redid documentation for WebSocketUtil
2012-06-29 15:12:59 +10:00
Cruz Julian Bishop
be57cf3b51
Fixes a bit of javadoc that was broken by a failed merge
2012-06-29 15:03:41 +10:00
Norman Maurer
2610a94de9
Fix SpdyHttpHeaders.setScheme setting the wrong header. See #417
2012-06-28 13:36:21 +02:00
Trustin Lee
90d9febbc0
Add more cookie decoding test case
2012-06-27 12:41:37 +09:00
Trustin Lee
a5d35f89d2
Add missing license headers
2012-06-26 17:33:05 +09:00
Trustin Lee
3b945bca78
Remove a method of no use
2012-06-26 05:30:07 +09:00
Trustin Lee
6d2f6d697d
Make CookieEncoder and CookieDecoder stateless
...
- Also: CookieEncoder is split into ServerCookieEncoder and
ClientCookieEncoder
2012-06-26 05:26:54 +09:00
Trustin Lee
7b2992a95a
Fix #218 : CookieDecoder.decode() throws StackOverflowError
...
- Rewrote key-value decoder not using a regular expression
2012-06-24 18:07:47 +09:00
Trustin Lee
ee8091f6fb
Fix #397 : Allow all cookie names that conform to the RFC
...
- Lenient flag is not needed anymore
2012-06-24 14:17:13 +09:00
Trustin Lee
0eb7a42c69
Fix test failures
2012-06-24 13:42:05 +09:00
Trustin Lee
a6e3d7d0ca
Fix #405 : CookieEncoder should refuse to encode more than one cookie
...
.. if on server mode
2012-06-24 12:59:44 +09:00
Trustin Lee
9ec51d01d6
Add ChannelMetadata and remove unnecessary disconnect() impls
...
- Add Channel.metadata() and remove Channel.bufferType()
- DefaultPipeline automatically redirects disconnect() request to
close() if the channel has no disconnect operation
- Remove unnecessary disconnect() implementations
2012-06-19 10:39:30 +09:00
Trustin Lee
1f69e664fb
Forward-port JDK ZlibEncoder patch ( #404 )
...
- Rename ZlibEncoder/Decoder to JZlibEncoder/Decoder
- Define a new ZlibEncoder/Decoder class
- Add JdkZlibEncoder
- All JZlib* and JdkZlib* extends ZlibEncoder/Decoder
- Add ZlibCodecFactory and use it everywhere
2012-06-19 09:54:25 +09:00
Trustin Lee
91fe9f4b38
serverID -> serverId ( #393 Ensure all fields follow naming convention)
2012-06-12 21:20:27 +09:00
Trustin Lee
a35aeb8cd9
StreamID -> StreamId ( #393 Ensure all fields follow naming convention)
2012-06-12 21:06:45 +09:00
Trustin Lee
9bf0ad8329
ID -> Id ( #393 Ensure all fields follow our naming convention)
2012-06-12 20:29:06 +09:00
Trustin Lee
60de50d89e
ID -> Id ( #393 Ensure all fields follow our naming convention)
2012-06-12 20:25:21 +09:00
Trustin Lee
154198a385
ID -> Id ( #393 Ensure all fields follow our naming convention)
2012-06-12 20:20:24 +09:00
Trustin Lee
676b81a4cd
getPersist(ed) -> isPersist(ed) ( #393 )
2012-06-12 20:05:12 +09:00
Trustin Lee
fdb66b6294
Add 'is' prefix to boolean getters if their meaning is ambiguous
...
- plus minor code cleanup
- ID -> Id or id
2012-06-12 17:58:22 +09:00
Trustin Lee
ecd0ae5406
Prefer MessageBuf over Queue where possible
...
- Also replaced thread safe queues with non-thread-safe ones where
possible
- Unpooled.wrappedBuffer(Queue<T>) does not wrap MessageBuf anymore
2012-06-12 17:02:00 +09:00
Trustin Lee
e1faea035e
Automatic clean-up with Eclipse
...
- Mostly import organization & whitespace removal
2012-06-11 23:04:04 +09:00
Trustin Lee
6211e53e86
Code clean-up based on IntelliJ code analysis
2012-06-11 22:54:28 +09:00
Trustin Lee
754392aaa9
Add ByteBuf.order(ByteOrder) method to simplify little endian access
...
- Removed all methods that requires ByteOrder as a parameter
from Unpooled (formerly ByteBufs/ChannelBuffers)
- Instead, a user calls order(ByteOrder) to get a little endian
version of the user's buffer
- This gives less overwhelming number of methods in Unpooled.
2012-06-11 20:24:44 +09:00
Trustin Lee
876847fd20
Merge MessageBufs and ByteBufs into Unpooled
...
- e.g. Unpooled.messageBuffer()
- It will make much more sense once we introduce pooling:
- i.e. Pooled.buffer()
2012-06-11 17:02:29 +09:00
Trustin Lee
7d36f936c8
Fix failing tests
2012-06-11 11:35:07 +09:00
Trustin Lee
574d84e98e
Remove ChannelBufferHolder / Add more handler interfaces for type safety
...
- ChannelInboundHandler and ChannelOutboundHandler does not have a type
parameter anymore.
- User should implement ChannelInboundMessageHandler or
ChannelOutboundMessageHandler.
2012-06-10 12:22:32 +09:00
Trustin Lee
a849d11877
ChannelBuffers -> ByteBufs / Add MessageBuf & ChannelBuf
...
- Add MessageBuf which replaces java.util.Queue
- Add ChannelBuf which is common type of ByteBuf and ChannelBuf
- ChannelBuffers was renamed to ByteBufs
- Add MessageBufs
- All these changes are going to replace ChannelBufferHolder.
2012-06-10 11:31:39 +09:00
Trustin Lee
5164d91255
Rename ChannelBuffer to ByteBuf as discussed before
...
- ChannelBuffer gives a perception that it's a buffer of a
channel, but channel's buffer is now a byte buffer or a message
buffer. Therefore letting it be as is is going to be confusing.
2012-06-10 11:08:43 +09:00
Trustin Lee
e376888d48
Replace 'Stream' with 'Byte'
...
- In computing, 'stream' means both byte stream and message stream,
which is confusing.
- Also, we were already mixing stream and byte in some places and
it's better use the terms consistently.
(e.g. inboundByteBuffer & inbound stream)
2012-06-09 21:05:59 +09:00
Trustin Lee
468a3228a4
Fit every line into 120 columns
2012-06-08 19:28:12 +09:00
Trustin Lee
748de5ea83
Fix a compilation error
2012-06-08 10:02:44 +09:00
Trustin Lee
92cbe6f980
Support long Expires dates and commas in cookie values ( #96 )
...
- Contribution by @valodzka
2012-06-08 09:25:39 +09:00
Trustin Lee
4a23c2a6eb
Fix checkstyle errors
2012-06-07 22:01:59 +09:00