Commit Graph

248 Commits

Author SHA1 Message Date
Norman Maurer
891cf343ca Remove fixed TODO 2013-02-18 06:22:03 +01:00
Norman Maurer
e5c326949d Update proxy example to show to implement a proxy with manual read operations for optimal memory usage 2013-02-17 08:38:16 +01:00
Norman Maurer
2f737d4e70 Make use of AUTO_READ to not accept traffic before connection is complete 2013-02-17 08:26:06 +01:00
Norman Maurer
151cf0c782 [#1041] Fix reference to HttpObjectAggregator 2013-02-11 20:32:59 +01:00
Trustin Lee
5218f38ed0 Use InternalLogger in our code / Use jul in examples 2013-02-11 20:37:31 +09:00
Trustin Lee
3f16f0b4d2 Do NOT use InternalLogger in examples 2013-02-11 20:17:35 +09: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
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
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
Trustin Lee
801f563e80 Take advantage of buffering in HttpSnoopServer
- 50% higher requests/sec with pipeline enabled
2013-02-08 23:33:10 +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
e5616c85c4 Automatic messageType detection for ChannelInboundMessageHandlerAdapter 2013-02-08 13:48:47 +09:00
Trustin Lee
d8c0bf3be2 Add the 'nextBufferType' parameter to ByteArrayEncoder like did to StringEncoder / Consistent parameter order 2013-02-08 01:36:41 +09:00
Norman Maurer
5b81e1692d Move non socket specific stuff out of the socket package, part 2 2013-02-01 10:32:27 +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
Trustin Lee
071b067b3f Add missing file
- Related issue: #1003
2013-01-31 12:28:27 +09:00
Trustin Lee
073517dc63 Rename localtime to worldtime so that a user thinks it's a local transport example
- Fixes #1003
2013-01-31 12:27:57 +09:00
Trustin Lee
39357f3835 Enable TCP_NODELAY and SCTP_NODELAY by default
- Fixes #939
- Add PlatformDependent.canEnableTcpNoDelayByDefault()
  - Currently returns false on Android. Will change if necessary later.
2013-01-31 12:17:09 +09:00
Trustin Lee
604b359d9e Use InetSocketAddress(0) if no localAddress is specified for connect() operation in UDT 2013-01-31 10:22:03 +09:00
Andrei Pozolotin
82f876f7db [#999] Refactor UDT transport to make use of the ServerChannel interface 2013-01-30 21:17:23 +01:00
Norman Maurer
641db5cdfe Only write the header as it should be 2013-01-30 20:40:06 +01:00
Trustin Lee
788d7e9b8b Remove Bootstrap operations that require a promise and add various ad-hoc bind() and connect() operations
- Update examples to use the newly added bind() and connect()
  operations.
2013-01-30 20:11:00 +09: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
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
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
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
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
895bce6cd5 [#917] Move transport depending ChannelOption to the specific transport to make it consistent 2013-01-16 08:04:09 +01: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
Norman Maurer
201df99ee0 Rename from io.netty.transport.* to io.netty.channel.* 2013-01-14 21:34:58 +01:00
Jestan Nirojan
983a70805c Moved sctp transport classes from io.netty.channel.socket.sctp to it's own subpackage io.netty.channel.sctp 2013-01-14 21:27:49 +01:00
Trustin Lee
3fe9a58f41 Fix checkstyle 2013-01-10 15:35:36 +09:00
Trustin Lee
eb337ff5a7 Fix various inspection warnings 2013-01-10 15:23:58 +09:00
Luke Wood
c094abad7b [#561] [#912] Add Rxtx transport 2013-01-09 21:32:51 +01: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
Norman Maurer
0d76e329a0 Add example which start a server in a applet to show there is no issue anymore. Related to [#689] 2013-01-08 10:39:45 +01:00
Andrei.Pozolotin
20aa2e1968 [#844] [#867] Add UDT transport 2013-01-07 21:06:22 +01:00
Norman Maurer
ccb5409f58 [#884] Split SCTP transport into extra module 2013-01-03 22:19:06 +01:00
Norman Maurer
4e77bacdf7 [#873] [#868] Split ChannelFuture into ChannelFuture and ChannelPromise 2012-12-31 23:27:16 +09:00
Trustin Lee
0909878581 Read only when requested (read-on-demand)
This pull request introduces a new operation called read() that replaces the existing inbound traffic control method. EventLoop now performs socket reads only when the read() operation has been issued. Once the requested read() operation is actually performed, EventLoop triggers an inboundBufferSuspended event that tells the handlers that the requested read() operation has been performed and the inbound traffic has been suspended again. A handler can decide to continue reading or not.

Unlike other outbound operations, read() does not use ChannelFuture at all to avoid GC cost. If there's a good reason to create a new future per read at the GC cost, I'll change this.

This pull request consequently removes the readable property in ChannelHandlerContext, which means how the traffic control works changed significantly.

This pull request also adds a new configuration property ChannelOption.AUTO_READ whose default value is true. If true, Netty will call ctx.read() for you. If you need a close control over when read() is called, you can set it to false.

Another interesting fact is that non-terminal handlers do not really need to call read() at all. Only the last inbound handler will have to call it, and that's just enough. Actually, you don't even need to call it at the last handler in most cases because of the ChannelOption.AUTO_READ mentioned above.

There's no serious backward compatibility issue. If the compiler complains your handler does not implement the read() method, add the following:

public void read(ChannelHandlerContext ctx) throws Exception {
    ctx.read();
}

Note that this pull request certainly makes bounded inbound buffer support very easy, but itself does not add the bounded inbound buffer support.
2012-12-31 23:26:00 +09:00
Veebs
0c5fd38eb6 #722 - Make WebSocketClientHandshakerFactory a static utility class 2012-12-13 07:34:05 +01:00
Norman Maurer
a9af028077 [#787] Move the socks package to the right place 2012-12-04 09:14:05 +01:00
Trustin Lee
9c0b2ad75c Update netty-build to the latest version
From this commit, checkstyle considers an unnecessary empty line as a
violation.
2012-12-04 16:46:46 +09:00
Norman Maurer
760cc95115 Cleanup 2012-12-03 19:58:03 +01:00
Norman Maurer
f9225df0a9 Add back support for FileRegion. See #668 2012-12-03 12:08:17 +01:00
Trustin Lee
33c0c89fef Remove unnecessary empty lines 2012-12-03 19:58:13 +09:00
Trustin Lee
00c4b944e4 Fix more inspector warnings introduced by recent mergences 2012-12-01 00:10:42 +09:00
Trustin Lee
6208c62888 Fix inspector warnings introduced by recent mergences 2012-11-30 23:01:57 +09:00
Matthias Wessendorf
b33df8399e fixing type on event/send argument 2012-11-27 19:29:29 +01:00
Daniel Bevenius
b1cd953d02 Adding WebSocket Example using WebSocketServerProtocolHandler. 2012-11-25 11:44:19 +01:00
alexey
5d2b41c094 basic support for socks5 codec 2012-11-17 20:03:16 +01: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
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
aa7cd691df Remove redundant 'else' branches. 2012-11-12 09:31:40 +09:00
Trustin Lee
361703b319 Remove unnecessary 'return's / Clean up QueryStringDecoder 2012-11-12 09:15:33 +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
5a4b2ec07e Replace keySet() + unnecessary map lookup with entrySet() 2012-11-10 07:36:42 +09:00
Trustin Lee
0d0eb0abfb Remove unused imports 2012-11-10 07:05:18 +09:00
Trustin Lee
958d04a42b Remove redundant throws clauses / Suppress inspections for some false positives 2012-11-10 06:47:59 +09:00
Trustin Lee
a5a19efb4b Remove unnecessary this, parenthesis, and semicolons 2012-11-10 02:27:33 +09:00
Trustin Lee
a9cfde97f0 Add missing final modifiers 2012-11-10 02:19:11 +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
e21dc5925d Replace dynamic regular expressions with precompiled Patterns or new StringUtil.split() 2012-11-10 00:41:22 +09:00
Trustin Lee
1ec7f55ac6 Simplify SingletonHolder by using interface instead of static class 2012-11-09 17:32:43 +09:00
Trustin Lee
994a8db8fc Fix overly-strong type casts 2012-11-09 17:14:59 +09:00
Trustin Lee
86b777a919 [#710] flush() requests made before SSL handshake completion are not executed after completion
- Ensure SslHandler flushes its outbound buffer on handshake completion
- Enable SSL in HttpSnoopClient example
2012-11-05 16:37:40 +09:00
Veebs
36ac52a4bd Port http multipart package. See #709 2012-11-04 13:59:50 +01: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
Veebs
24678e2d00 update docs on running autobahn tests 2012-10-29 03:59:54 -07:00
Trustin Lee
8bab0aae9e Fix a bug in the SecureChat example where greeting is generated too soon 2012-10-16 15:00:32 -07: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
6e98a04813 Fix the detection of encrypted data. See #655 2012-10-16 14:03:40 +02:00
Jestan Nirojan
8a75442419 Merge remote-tracking branch 'upstream/master' 2012-09-29 17:21:58 +08:00
Trustin Lee
ce35386805 Prevent cross-site scripting 2012-09-29 17:18:18 +09:00
Jestan Nirojan
6904b62c2f Resolved conflicts in SctpData/SctpMessage refactoring 2012-09-29 02:01:00 +08:00
Trustin Lee
9f6505192c Simplify if 2012-09-28 16:59:51 +09:00
Trustin Lee
eae7b2d662 [#532] HttpStaticFileServer should generate an index page
* Add index page listing and directory redirection
2012-09-28 16:58:26 +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
045b621b3f [#441] Update HTTP examples so that they understand DecoderResult 2012-09-28 15:42:38 +09:00
Trustin Lee
bd8ee64366 Pull #625 from @CruzBishop selectively 2012-09-27 19:04:35 +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
Jestan Nirojan
942f05d336 Corrected cmd args in SCTP Sample clients 2012-09-23 14:16:26 +08:00
Jestan Nirojan
b268f0b333 Added SCTP Codec Handlers + minor refactoring 2012-09-23 14:12:32 +08:00
Jestan Nirojan
bf22173ed1 Added Multi-Homing in SctpOioChannel 2012-09-21 12:16:06 +08:00
Jestan Nirojan
db4a3a4789 Merge remote-tracking branch 'upstream/master' 2012-09-21 11:56:47 +08:00
Jestan Nirojan
47eafa386c Added SCTP OIO Transport
- Sctp OioChannel/ServeChannel implementation.
- Changed interrupt handling in OioEventLoop.
- SctpOioEchoClient/Server Example.
2012-09-21 11:56:13 +08:00
norman
df72356d7d Rename classes as result of descussion on #594 2012-09-12 14:04:41 +02:00