Commit Graph

428 Commits

Author SHA1 Message Date
nmittler
35ab47a5d5 Merging HTTP/2 preface logic into connection handler
Motivation:

The HTTP/2 connection preface logic is currently handled in two places.
Reading/writing the client preface string is handled by
Http2PrefaceHandler while the reading/writing of the initial settings
frame is handled by AbstractHttp2ConnectionHandler. Given that their
isn't much code in Http2PrefaceHandler, it makes sense to just merge it
into the preface handling logic of AbstractHttp2ConnectionHandler. This
will also make configuring the pipeline simpler for HTTP/2.

Modifications:

Removed Http2PrefaceHandler and added it's logic to
AbstractHttp2ConnectionHandler. Updated other classes depending on
Http2PrefaceHandler.

Result:

All of the HTTP/2 connection preface processing logic is now in one
place.
2014-05-10 18:48:35 +02:00
nmittler
e22aed284b Various fixes for compliance with HTTP/2 spec
Motivation:

A few items were identified where the http2 codec is out of compliance
with the spec.

Modifications:

- Fixed handling of priority weight on the wire. Now adding 1 after
reading from the wire and subtracing 1 before writing.

- Fixed handling of next stream ID. Client streamIds were starting at 3,
but they need to start at 1 to allow the upgrade from HTTP/1.1. Also
making next stream ID logic more flexible. Allowing the next created
stream to be any number in the sequence following the previously created
stream.

- Disallowing SETTINGS frames with ENABLE_PUSH specified for server
endpoints. This means that attempts to write this frame from a server,
or read it from a client will fail.

Result:

The http2 implementation will be more inline with the spec.
2014-05-09 18:05:26 +02:00
nmittler
d5148bfee9 Adding context to Http2FrameObserver
Motivation:

The Http2FrameObserver isn't provided the ChannelHandlerContext when
it's called back. This will force observers to find an alternative means
of obtaining the context if they need to do things like copying buffers.

Modifications:

Changed the Http2FrameReader and Http2FrameObserver to include the
context. Updated all other uses of these interfaces.

Result:

Frame observers will now have the channel context.
2014-05-08 18:55:19 +02:00
nmittler
ca7c53d45f Add support for HTTP/2 draft 12.
Motivation:

Draft 12 has just arrived and has quite a few changes. Need to update in
order to keep current with the spec.

Modifications:

This is a rewrite of the original (draft 10) code. There are only 2
handlers now: preface and connection. The connection handler is now
callback based rather than frame based (there are no frame classes
anymore). AbstractHttp2ConnectionHandler is the base class for any
HTTP/2 handlers. All of the stream priority logic now resides in the
outbound flow controller, and its interface exposes methods for
adding/updating priority for streams.

Upgraded to hpack 0.7.0, which is used by draft12. Also removed
draft10 code and moved draft12 code to the ../http2 package
(no draft subpackage).

Result:

Addition of a HTTP/2 draft 12 support.
2014-05-06 20:22:27 +02:00
Trustin Lee
872d4c5bc1 Synchronized between 4.1 and master again (part 2)
Motivation:
4 and 5 were diverged long time ago and we recently reverted some of the
early commits in master.  We must make sure 4.1 and master are not very
different now.

Modification:
Remove ChannelHandlerInvoker.writeAndFlush(...) and the related
implementations.

Result:
4.1 and master got closer.
2014-04-25 15:07:12 +09:00
Trustin Lee
d2614cfc01 Synchronized between 4.1 and master
Motivation:

4 and 5 were diverged long time ago and we recently reverted some of the
early commits in master.  We must make sure 4.1 and master are not very
different now.

Modification:

Fix found differences

Result:

4.1 and master got closer.
2014-04-25 00:36:01 +09:00
Scott Blum
ee3f3661f0 HTTP2 server should not send preface string
Motivation:

See: https://github.com/netty/netty/issues/2402
See: https://tools.ietf.org/html/draft-ietf-httpbis-http2-10#section-3.5

Only the client should send the preface string, the server should not.

"The server connection header consists of just a SETTINGS frame (Section 6.5)
 that MUST be the first frame the server sends in the HTTP/2 connection."

Modifications:

Split out Http2ClientPrefaceWriter and Http2ServerPrefaceReader from
Http2FrameEncoder and Http2FrameDecoder.  The new channel handlers are added
to the pipeline and remove themselves after the preface is written/read.

Result:

HTTP2 client sends preface, server does not, in compliance with spec.
2014-04-17 21:51:34 +02:00
Scott Blum
c66aae3539 HTTP2 example uses SSL and NPN.
Motivation:

HTTP2 is generally negotiated over SSL, makes more sense to provide an SSL example.

Modifications:

Copy the SDPY example to add SSL and NPN negotiation to the HTTP2 example.

Result:

Http2Server and Http2Client examples use SSL.
2014-04-17 21:11:23 +02:00
Scott Blum
9496c1a4ed HTTP2 example server should also log.
Motivation:

The HTTP2 example client logs, and it's useful to show what's
going on.  It'd be sweet if the server did too.

Modifications:

Added Http2FrameLogger to example server pipeline.

Result:

HTTP2 example server will log frames.
2014-04-15 21:00:34 +02:00
Jeff Pinner
350c8ef42a SPDY: refactor frame codec implementation
Motivation:

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

Modifications:

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

Result:

SpdyFrameCodec now implements the ChannelHandler abstraction and is
responsible for creating and handling SpdyFrame objects.
2014-04-15 18:42:08 +02:00
Matthew Leventi
8615f7a69e Add a Example for Memcache Binary Codec
Motivation:
Currently, there exists no example which shows how to use the memcache binary
protocol.

Modifications:
Add an example client and client handler to show how to utilize the binary
protocol in a memcache client with a simple interactive shell.

Result:
Users looking for an example can now start off with the provided one.
2014-04-11 11:19:02 +02:00
Norman Maurer
31a36e09ad [#2353] Use a privileged block to get ClassLoader and System property if needed
Motivation:
When using System.getProperty(...) and various methods to get a ClassLoader it will fail when a SecurityManager is in place.

Modifications:
Use a priveled block if needed. This work is based in the PR #2353 done by @anilsaldhana .

Result:
Code works also when SecurityManager is present
2014-04-08 14:13:49 +02:00
nmittler
69826637a8 Adding examples for HTTP/2 framing.
Motivation:

Provide some example code to show how to bootstrap client and server for
use with HTTP/2 framing.

Modifications:

- Fixed Http2ConnectionHandler to allow headers after stream creation.
Needed for response headers.

- Added toString() to all frame classes to help with debugging/logging

- Added example classes for HTTP/2

Result:

HTTP/2 connections now properly support response headers. Examples for
HTTP/2 provided with the distribution of examples module.

After your change, what will change.
2014-04-08 06:51:56 +02:00
Daniel Bevenius
7c6f862d98 Adding origins whitelist support for CORS
Motivation:
Currently the CORS support only handles a single origin, or a wildcard
origin. This task should enhance Netty's CORS support to allow multiple
origins to be specified. Just being allowed to specify one origin is
particulary limiting when a site support both http and https for
example.

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

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

[https://github.com/netty/netty/issues/2346]
2014-03-30 19:40:59 +02:00
Norman Maurer
6de58f5ad1 Ensure the HttpResponseEncoder is always placed before the HttpObjectAggregator. Part of [#2219] 2014-03-05 06:58:54 +01:00
Norman Maurer
13b5d8b3c2 Should be final 2014-03-03 06:50:20 +01:00
Jakob Buchgraber
a1a48051f6 Added a secure WebSocket client example
Merged WebSocketClient and WebSocketSslClient

Add private constructors to fix checkstyle errors.

More checkstyle madness.

made WebSocketClientRunner final
2014-03-03 06:47:41 +01:00
Daniel Bevenius
3e11c0c39e Fixing system dependent newline in NPN check logging. 2014-03-01 16:26:39 +01:00
Daniel Bevenius
ad83a079cd Adding a check for NPN implementation in SpdyServer example. 2014-03-01 14:08:36 +01:00
Jeff Pinner
97f120330b SPDY: remove SPDY/3 support 2014-02-20 15:02:16 -08:00
Trustin Lee
2e1fe72a95 Remove a version clause added by mistake 2014-02-08 11:07:36 -08:00
Trustin Lee
cc45b5b1f6 Fix a build error related with NPN version and JDK8 2014-02-08 10:48:05 -08:00
Trustin Lee
d8c1409820 Use smaller number of boss threads in the example
.. because usually there's no need to use many boss threads.
2014-02-07 14:42:49 -08:00
Trustin Lee
4918e4c767 Simplify exec-maven-plugin configuration
- Move the version number to the parent pom's pluginManagement section
- Remove unnecessary system properties
- Increase the scope of execution from compile to runtime
2014-02-07 13:40:41 -08:00
Trustin Lee
cc1a17e9f7 Fix indentation 2014-02-07 10:26:51 -08:00
Daniel Bevenius
891df2116c Adding ability to start spdy server/client using maven. 2014-02-07 11:26:53 +01:00
Trustin Lee
cadaeb658d Reorganize the SPDY example
- Move the server example to spdy.server
- Move the client example to spdy.client
- Fix inspection warnings
2014-02-05 15:03:03 -08:00
Leonardo Freitas Gomes
20d2fb8c2e SPDY client example
Demonstrates the usage of SPDY from a client perspective. One can also
use a SPDY-enabled browser as a client, but it’s easier to understand
the internals of the protocol from a client point-of-view if you have
some code you can debug.
2014-02-05 14:56:32 -08:00
jwilson
ce05320502 Tweak snoop example to send a full HTTP request.
Without this, future HTTP requests on this channel will
silently fail because the HttpObjectEncoder will be left
in an unhappy state.
2014-02-01 18:35:09 +01:00
Norman Maurer
2b63d2d0cd Make sure we not leak messages in the SPDY example 2014-01-21 07:34:30 +01:00
Norman Maurer
36166a4faa Make use of a Logger in the SPDY example and simplify it a bit 2014-01-21 07:17:58 +01:00
Veebs
09fdb08fe4 SPDY example app 2014-01-21 07:17:58 +01:00
Michael Nitschinger
75cb91ed0c Rename HttpDataFactory.*datas to *data. Fixes #2094 2014-01-16 09:52:25 +01:00
Daniel Bevenius
6a954d5b47 Adding a Cross Origin Resource Sharing (CORS) handler. 2014-01-16 07:58:32 +01:00
Veebs
a389d69ba8 Replaced deprecated 'sendUnsupportedWebSocketVersionResponse()' with 'sendUnsupportedVersionResponse()' 2014-01-13 06:33:25 +01:00
Trustin Lee
f3a842ecca [maven-release-plugin] prepare for next development iteration 2013-12-22 22:06:15 +09:00
Trustin Lee
888dfba76f [maven-release-plugin] prepare release netty-5.0.0.Alpha1 2013-12-22 22:06:06 +09:00
Norman Maurer
b067566a7c Optimize the decoding and encoding of HTTP for better performance
* No need to calculate the hash of known header names multiple times
* Optimize header encoding
* Also optimize the encoding of known header values
* Optimize encoding of HTTP method, version and status
2013-11-27 12:35:58 +01:00
Trustin Lee
110745b0eb Remove the distinction of inbound handlers and outbound handlers
- Fixes #1808
- Move all methods in ChannelInboundHandler and ChannelOutboundHandler up to ChannelHandler
- Remove ChannelInboundHandler and ChannelOutboundHandler
- Deprecate ChannelInboundHandlerAdapter, ChannelOutboundHandlerAdapter, and ChannelDuplexHandler
- Replace CombinedChannelDuplexHandler with ChannelHandlerAppender
  because it's not possible to combine two handlers into one easily now
- Introduce 'Skip' annotation to pass events through efficiently
- Remove all references to the deprecated types and update Javadoc
2013-11-27 17:31:28 +09:00
Trustin Lee
807d96ed6c Simplify bundle generation / Add io.netty.versions.properties to all JARs
- Fixes #2003 properly
- Instead of using 'bundle' packaging, use 'jar' packaging.  This is
  more robust because some strict build tools fail to retrieve the
  artifacts from a Maven repository unless their packaging is not 'jar'.
- All artifacts now contain META-INF/io.netty.version.properties, which
  provides the detailed information about the build and repository.
- Removed OSGi testsuite temporarily because it gives false errors
  during split package test and examination.
- Add io.netty.util.Version for easy retrieval of version information
2013-11-26 22:00:14 +09:00
Trustin Lee
132af3a485 Introduce ChannelHandlerInvoker, dedeciated for invoking event handler methods, and move most handler invocation code in ChannelHandlerContext to the default ChannelHandlerInvoker implementation
- Fixes #1912
- Add ChannelHandlerInvoker and its default implementation
- Add pipeline manipulation methods that accept ChannelHandlerInvoker
- Rename Channel(Inbound|Outbound)Invoker to
  Channel(Inbound|Outbound)Ops to avoid confusion
- Remove the Javadoc references to the package-private interfaces
2013-11-21 14:14:23 +09:00
Trustin Lee
6b0025430e Bump the version to 5.0.0.Alpha1 2013-11-04 19:14:40 +09:00
fredericBregier
cf1970c31b Split HttpPostRequestDecoder into HttpPostStandardRequestDecoder and HttpPostMultipartRequestDecoder / Add HttpData.maxSize
- Related issues: #1937 #1938 and #1946
- Add InterfaceHttpPostRequestDecoder and Make HttpPostRequestDecoder implement it
- HttpPostRequestDecoder actually delegates itself to HttpPostStandardRequestDecoder or HttpPostMultipartRequestDecoder
- Remove IncompatibleDataDecoderException because it's not thrown anywhere now
2013-11-04 17:57:13 +09:00
Trustin Lee
9d611a182f Rename SimpleChannelInboundHandler.channelRead0() to messageReceived()
- Related: #1590
2013-11-02 19:59:21 +09:00
Norman Maurer
ff9e368401 Run the Autobahn Testsuite as part of our testsuite. This ensures there are no regressions. 2013-10-28 21:09:07 +01:00
Bill Gallagher
951a65e57e minor gc optimization: better DefaultHttpHeaders.iterator() 2013-10-11 20:34:27 +02:00
Trustin Lee
4aab9e0773 No need to use an unreleasable buffer - just wrap an array 2013-09-13 14:09:51 -07:00
bgallagher
c149f4bcc0 Remove support from deregister a Channel from a EventLoop manually 2013-08-29 18:11:16 +02:00
Norman Maurer
09a748abdb Bump up version to 4.1.0.Alpha1-SNAPSHOT 2013-08-26 15:18:18 +02:00
Norman Maurer
2e39b25cd4 [maven-release-plugin] prepare for next development iteration 2013-08-26 12:01:03 +02:00
Norman Maurer
b67659a866 [maven-release-plugin] prepare release netty-4.0.8.Final 2013-08-26 12:00:54 +02:00
radimch
9acf130adb resource leak: FileInputStream was never closed 2013-08-14 07:10:10 +02:00
bk1te
65fd9c0b12 use Promise instead of CallbackNotifier 2013-08-14 06:51:03 +02:00
radimch
0d6a6bde04 resource leak: Formatter was never closed 2013-08-09 14:55:54 +02:00
Norman Maurer
1d3560e389 [maven-release-plugin] prepare for next development iteration 2013-08-08 13:53:28 +02:00
Norman Maurer
8e97e6c461 [maven-release-plugin] prepare release netty-4.0.7.Final 2013-08-08 13:53:19 +02:00
Norman Maurer
3f2000fa3a [maven-release-plugin] prepare for next development iteration 2013-08-01 10:59:55 +02:00
Norman Maurer
3f70d5caa4 [maven-release-plugin] prepare release netty-4.0.6.Final 2013-08-01 10:59:46 +02:00
Norman Maurer
e3410680de [maven-release-plugin] prepare for next development iteration 2013-07-31 20:08:14 +02:00
Norman Maurer
0e124583d6 [maven-release-plugin] prepare release netty-4.0.5.Final 2013-07-31 20:08:05 +02:00
Norman Maurer
0bc7d3f5d1 [maven-release-plugin] prepare for next development iteration 2013-07-23 10:04:23 +02:00
Norman Maurer
ca00182797 [maven-release-plugin] prepare release netty-4.0.4.Final 2013-07-23 10:04:14 +02:00
Trustin Lee
762adfcb69 Update HttpStaticFileServer example / Fix bugs related with progress notification
- Fix a bug in DefaultProgressivePromise.tryProgress() where the notification is dropped
 - Fix a bug in AbstractChannel.calculateMessageSize() where FileRegion is not counted
 - HttpStaticFileServer example now uses zero copy file transfer if possible.
2013-07-19 13:21:32 +09:00
Trustin Lee
f96a8e5951 Implement ProgressivePromise notification in NIO byte channels and ChunkedWriteHandler
- Refine the contract of GenericProgressiveFutureListener.
- Negative 'total' now means 'unknown', which is useful for ChunkedWriteHandler.
2013-07-19 12:53:23 +09:00
Trustin Lee
b130ee6a6c [maven-release-plugin] prepare for next development iteration 2013-07-18 11:17:42 +09:00
Trustin Lee
10d395e829 [maven-release-plugin] prepare release netty-4.0.3.Final 2013-07-18 11:17:31 +09:00
Norman Maurer
fc7c950b08 [maven-release-plugin] prepare for next development iteration 2013-07-17 15:58:36 +02:00
Norman Maurer
bbbf72359e [maven-release-plugin] prepare release netty-4.0.2.Final 2013-07-17 15:58:28 +02:00
Trustin Lee
57eb531eb8 [maven-release-plugin] prepare for next development iteration 2013-07-16 17:16:10 +09:00
Trustin Lee
76cefcc421 [maven-release-plugin] prepare release netty-4.0.1.Final 2013-07-16 17:15:54 +09:00
kxbmap
ed72925547 Fix sendNumbers logic 2013-07-16 07:08:21 +02:00
Norman Maurer
5297eba280 [maven-release-plugin] prepare for next development iteration 2013-07-15 15:48:15 +02:00
Norman Maurer
c5d8af446a [maven-release-plugin] prepare release netty-4.0.0.Final 2013-07-15 15:48:05 +02:00
Trustin Lee
246a3ecdcb [maven-release-plugin] prepare for next development iteration 2013-07-15 20:58:33 +09:00
Trustin Lee
e8fd209115 [maven-release-plugin] prepare release netty-4.0.0.Final 2013-07-15 20:58:21 +09:00
Norman Maurer
ecb215c12f Fix buffer leaks 2013-07-14 22:50:53 +02:00
Norman Maurer
4e604a6553 Make clear how to use HTTPS in the helloworld example 2013-07-12 11:21:51 +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
c0580cfe71 Fix examples 2013-07-11 11:25:40 +02:00
Norman Maurer
1d577b1b8b [#1561] Fix Securechat example which was broken because Channel was not flushed 2013-07-11 11:07:06 +02:00
Norman Maurer
f47fa76b9a Fix resource leakage in example 2013-07-11 10:20:38 +02: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
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
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
ec5e793a2f [maven-release-plugin] prepare for next development iteration 2013-07-02 11:41:18 +02:00
Norman Maurer
ca73eaef0d [maven-release-plugin] prepare release netty-4.0.0.CR9 2013-07-02 11:41:09 +02:00
Norman Maurer
830c559405 [maven-release-plugin] rollback the release of netty-4.0.0.CR9 2013-07-02 11:34:29 +02:00
Norman Maurer
66a16b133c [maven-release-plugin] prepare release netty-4.0.0.CR9 2013-07-02 10:45:12 +02:00
Trustin Lee
7e3a01cc51 [maven-release-plugin] prepare for next development iteration 2013-07-02 10:26:48 +09:00
Trustin Lee
149db34c19 [maven-release-plugin] prepare release netty-4.0.0.CR8 2013-07-02 10:26:32 +09:00
Trustin Lee
613547b0b9 [maven-release-plugin] prepare for next development iteration 2013-06-28 22:15:33 +09:00
Trustin Lee
a6abd2feb2 [maven-release-plugin] prepare release netty-4.0.0.CR7 2013-06-28 22:15:20 +09:00
Norman Maurer
a52eafd7e8 Fix FileServer example 2013-06-26 20:22:34 +02:00
Trustin Lee
c7c9e743ce Fix naming 2013-06-25 18:37:29 +09:00
Trustin Lee
a6795d7780 [maven-release-plugin] prepare for next development iteration 2013-06-25 11:07:15 +09:00
Trustin Lee
2221446425 [maven-release-plugin] prepare release netty-4.0.0.CR6 2013-06-25 11:07:15 +09:00
Trustin Lee
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