Commit Graph

112 Commits

Author SHA1 Message Date
Norman Maurer
3080d14f25 Fix buffer leaks in HTTP2 codec
Motivation:
Our ci showed some buffer leaks in the http2 codec. This commit fixes all of these.

Modifications:
* Correctly release buffers in DefaultHttp2FrameWriter
* Fix buffer leaks in tests

Result:
Tests pass without leaks
2014-05-07 06:53:02 +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
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
nmittler
a992e7fb48 Cleaning up code for determining whether the HTTP/2 connection header
and initial settings frame were sent.

Motivation:

The current logic for marking the connection header and initial settings
frame is a bit complicated.

Modifications:

- Http2FrameEncoder, Http2ConnectionHandler: removed sent listeners and
set the sent flag immediately.

Result:

Just a code cleanup ... behavior is the same.
2014-04-15 20:24:36 +02:00
nmittler
e769cb3917 Adding support for HTTP/2 initialization handshake.
Motivation:

The current HTTP/2 support does not properly comply with the HTTP/2 spec
wrt startup.

Modifications:

Changed the frame codec as well as the connection handler to support
exchange of the connection preface, followed immediately by an initial
settings frame.

Result:

The HTTP/2 initialization handshake will be in compliance with the spec.
Will need more work to support the upgrade protocols, however :)
2014-04-11 06:50:42 +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
Norman Maurer
4307729ff7 Next round of cleanup of http2 codec
Motivation:
Bring the http2 codec more inline with the rest of Netty's code-base.

Modifications:

- Add null checks in constructors
- Move private static methods into inner-classes where they are used
- Use getBytes(CharsetUtil.UTf8)

Result:
More consistent code-base
2014-04-06 19:56:26 +02:00
nmittler
98bfc8e600 Removing HTTP2 module's dependency on guava
Motivation:

The use of the guava library library is fairly superficial and can
easily be removed to reduce the overall dependency list of the module.
Cleaning up the HTTP2 code to use common Netty utilities, etc.

Modifications:

- Various changes to remove use of guava preconditions and collections.
- Changed default charset to use CharsetUtil.UTF_8.
- Changed StreamState to use ArrayDeque instead of LinkedList.
- Changed precondition checks to throw NPE
- Changed implementation of Http2Headers to more closely mirror the SPDY
implementation.

Result:

The behavior of the HTTP2 module will remain unchanged.
2014-04-06 18:58:39 +02:00
Norman Maurer
22c13271d1 First round of cleanup codec-http2 2014-04-05 16:17:42 +02:00
Norman Maurer
b92b65e557 Replace 2 spaces with 4 spaces 2014-04-05 15:46:15 +02:00
nmittler
754e08796b First cut of frame encoding/decoding and session management for HTTP2
Motivation:

Needed a rough performance comparison between SPDY and HTTP 2.0 framing.
Expected performance gains were seen in HTTP 2.0 due to header
compression.

Modifications:

Added a new codec-http2 module containing all of the new source and unit
tests.  Updated the top-level pom.xml to add this as a child module.

Result:

Netty will have basic support for HTTP2.
2014-03-27 10:40:47 -07:00