Commit Graph

335 Commits

Author SHA1 Message Date
Simone Bordet feed8ea158 Small refactoring of HTTP/2 upgrade code. 2015-03-12 19:08:26 +01:00
Greg Wilkins b7d719be5f 459845 - Support upgrade from http1 to http2
Parse setting frame.
2015-03-13 00:54:33 +11:00
Simone Bordet a7cfc3dc2d Renamed methods in FlowControlStrategy. 2015-03-11 20:38:40 +01:00
Simone Bordet 1dbf2be343 423974 - Optimize flow control.
Don't send the window update if the stream is closed.
2015-03-11 17:11:16 +01:00
Simone Bordet 48887377c9 459081 - http2 push failures.
Introduced ExecutionStrategy.dispatch() to handle the case where
resources that are being pushed block.
2015-03-11 00:12:57 +01:00
Simone Bordet 73821e7ac6 461052 - Local streams created after INITIAL_WINDOW_SIZE setting have wrong send window.
Fixed by tracking both send and recv initial stream windows.
This is needed because both client and server may send an
INITIAL_WINDOW_SIZE setting, and they must be treated
separately.
2015-02-27 19:21:35 +01:00
Joakim Erdfelt aac427ab8c Fixing compile error 2015-02-23 18:16:30 -07:00
Simone Bordet 59ae845d30 Guarding against null streams when resetting.
This is possible when receiving a frame for a non-existent stream:
it is replied with a reset, but the stream object is never created.
2015-02-18 23:00:37 +01:00
Simone Bordet d4809e9b79 Improved handling of the stream close state.
Now the stream close state is updated when the frame has been
successfully written, and when it is received.
The stream is closed in case of failures.
Just after the stream close state update, if the stream is closed
then it is removed from the session.
2015-02-18 23:00:37 +01:00
Greg Wilkins e18573f4a3 460211 Fixed Idle race in ExecuteProduceRun
Reimplemented ExecuteProduceRun with a spin lock
2015-02-18 21:47:22 +11:00
Simone Bordet ff7e0e626a Implemented notification of session failure events. 2015-02-13 14:18:08 +01:00
Simone Bordet 9677988960 Removed TODO. 2015-02-13 13:11:59 +01:00
Greg Wilkins 4db654ad32 Organised http2 imports 2015-02-13 13:43:32 +11:00
Greg Wilkins 98e3a28794 459845 - Support upgrade from http1 to http2/websocket
Added test harness for h2c upgrade.
2015-02-13 13:41:14 +11:00
Greg Wilkins c3332e7d2e 459845 - Support upgrade from http1 to http2/websocket
Added support for unofficial "upgrade" from http/1 to h2c
2015-02-13 12:16:03 +11:00
Simone Bordet 0677735550 Simplified HTTP/2 parser and its listener.
It is not possible to perform asynchronous processing of the content
of DATA frames, because otherwise the parser has to stop, stalling
all other streams.
Parser.Listener methods were returning boolean in a vestigial attempt
to handle asynchronous data processing, and have now been converted to
return void.
2015-02-12 19:43:52 +01:00
Jan Bartel b45389ad87 Fix http2 osgi manifests and tests 2015-02-12 10:32:16 +11:00
Simone Bordet 360b72a29e HTTP/2 API Javadocs. 2015-02-11 17:44:05 +01:00
Simone Bordet be860741d5 459655 - Remove SPDY and NPN.
Cleanup of javadocs, comments, XML and other text files.
2015-02-11 16:18:07 +01:00
Simone Bordet 44d262c65a Renamed GatheringCallback to CountingCallback. 2015-02-10 13:16:41 +01:00
Simone Bordet d0f0aa7c9f Fixed removal of streams upon sending the response HEADERS frame. 2015-02-09 13:26:01 +01:00
Simone Bordet 7066f65e8c 423974 - Optimize flow control.
Implemented a buffering FlowControlStrategy that reduces the amount
of WindowUpdate exchanges.
2015-02-09 13:25:32 +01:00
Simone Bordet fa72356d1d Fixed failure of stalled frames. 2015-02-09 09:11:56 +01:00
Simone Bordet 02b5732720 First take at implementing the HttpClientTransport for HTTP2. 2015-02-09 09:11:56 +01:00
Greg Wilkins e1cc5fb487 Merge remote-tracking branch 'origin/master' into jetty-9.3-ewyk
Conflicts:
	jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
	jetty-server/src/main/java/org/eclipse/jetty/server/QueuedHttpInput.java
	jetty-util/src/main/java/org/eclipse/jetty/util/thread/NonBlockingThread.java
2015-01-08 15:21:01 +01:00
Joakim Erdfelt a3201a3c81 Happy New Year 2015 2015-01-07 17:06:59 -07:00
Simone Bordet 5bed6323c1 Reworked buffer releasing to ensure that it is always executed before
fillInterested() is called.
This is needed to avoid race conditions where fillInterested()
triggers a new thread entering onFillable() and acquiring a new buffer
while the previous thread is releasing the previous buffer.
2015-01-02 18:43:07 +01:00
Greg Wilkins beacb948b1 Allow configuration of ExecutionStrategy
eg -Dorg.eclipse.jetty.io.ManagedSelector.ExecutionStrategy=org.eclipse.jetty.util.thread.ExecutionStrategy$ExecuteProduceRun
2015-01-01 17:04:00 +01:00
Greg Wilkins 3af9b145a3 Deprecated the AbstractConnection dispatchIO mechanism 2015-01-01 16:18:13 +01:00
Simone Bordet 448f150ac4 Cleaned up ExecutionStrategy by adding javadocs, removing methods not
used and renaming classes and methods to better names.
2014-12-19 11:25:09 +01:00
Simone Bordet 4ccd5207b5 Switched ExecutionStrategy to EWYK. 2014-12-18 17:14:34 +01:00
Simone Bordet e35c51eb7d Implemented dispatch to the application using an ExecutionStrategy.
Now instead of having the channel to dispatch when it detects that it
has to call the application (upon receiving a HEADERS frame, or upon
a push "fake" request), now the whole mechanism is controlled by an
ExecutionStrategy.
2014-12-18 17:14:34 +01:00
Simone Bordet 7f98b64658 Clearing the buffer in case of parser errors that lead to a
connection failure.
2014-12-18 17:14:34 +01:00
Greg Wilkins 2536c1cc3f Handle HTTP2-16 black listed ciphers 2014-12-04 14:17:25 +01:00
Greg Wilkins c3472f01c4 updated hpack for draft 10 name changes 2014-12-04 10:27:14 +01:00
Simone Bordet 8d2efaf7eb 445167 - Allow configuration of dispatch after select.
Introduced parameter "dispatchIO" in the relevant factories so that
they can be configured by users and connections will be created
taking into account this parameter.

For less configurable connection factories, this parameter is
currently hardcoded to either true or false depending on the case.
For example, ALPN and NPN connections have it to false, since they
don't do any blocking operation in onFillable().
2014-09-26 10:13:16 +02:00
Simone Bordet 8af9ea4030 Calling notIdle() to avoid the idle timeout triggers when sending frames. 2014-09-26 10:13:16 +02:00
Greg Wilkins fc4bfc8a66 improved debug logging 2014-09-21 15:03:54 +10:00
Greg Wilkins 0acee9851f minor cleanups of exceptions 2014-09-18 18:23:48 +10:00
Simone Bordet 17c8f71724 Renamed onConnect() to onAccept() to reflect its server-side role. 2014-08-21 11:54:03 +02:00
Simone Bordet c07ea68b51 Improved configurability of stream idle timeout. 2014-08-21 11:54:03 +02:00
Simone Bordet 75c1322adc Rewritten close workflow to make sure that connections are correctly closed. 2014-08-21 11:54:03 +02:00
Simone Bordet 7a61c96ba1 Removed debug logging (wrongly assumes the ByteBuffer has a backing array). 2014-08-21 11:54:03 +02:00
Simone Bordet c15480644f 442083 - Client resets stream, pending server data is failed, connection closed.
Introduced ResetException, and using it when failing frames of streams
that have been reset already.

HttpTransportOverHTTP2.abort(Throwable) checks for this exception and
does not close the connection.
2014-08-19 18:40:01 +02:00
Simone Bordet d4f140ff65 Ignoring HEADERS, PUSH_PROMISE and DATA if the stream cannot be found.
This typically happens when the stream has been reset.
2014-08-19 13:43:24 +02:00
Simone Bordet 20076fcdc5 Moved reset() from Session to Stream. 2014-08-19 13:41:52 +02:00
Simone Bordet 09d54eacab Accounting for the session flow control window in case of reset streams. 2014-08-19 13:38:43 +02:00
Simone Bordet 728a7c3442 Made push functionality honor configuration parameter sent via SETTINGS. 2014-08-15 18:34:20 +02:00
Greg Wilkins b47f9ef605 cleaned up OSGi manifest creation 2014-08-15 19:35:49 +10:00
Simone Bordet 48b1f9f3f1 Implemented HTTP/2 push functionality.
A PushCacheFilter contains the logic to associate secondary resources
to primary resources.
PushCacheFilter calls a Jetty-specific API on the request dispatcher:
Dispatcher.push(ServletRequest). This is a technology preview of the
push functionality slated for Servlet 4.0.
The push() invocation arrives to the transport and it is converted to
HTTP/2 specific PUSH_PROMISE, along with the mechanism to simulate
the request for the secondary resource.
2014-08-14 23:05:35 +02:00
Greg Wilkins 68a3ca8e31 improved debug logging of settings 2014-08-13 12:00:32 +10:00
Simone Bordet a97d4642ab Improved toString() methods for frames. 2014-08-12 23:01:03 +02:00
Simone Bordet e147ce9528 Updated flow control implementation to detect when senders exceed
allowed windows.
2014-08-12 16:37:41 +02:00
Simone Bordet 107a4fff20 Fixed handling of INITIAL_WINDOW_SIZE setting.
It must update only stream windows, and not the session window.
2014-08-11 18:43:50 +02:00
Simone Bordet 187c42fa4a Closing the flusher instead of just disconnecting after a GO_AWAY.
This ensures that frames that may have been added to the flusher queue
concurrently after the GO_AWAY are properly failed and the queue
drained.
2014-08-11 11:30:49 +02:00
Simone Bordet 59a9c0890c Fixed off-by-one in counting the padding bytes. 2014-08-08 23:53:18 +02:00
Simone Bordet f8086dc7c2 Refactored the send of the SETTINGS frame from the client.
It's now sent after a call to onPreface(), which has been moved to
the common interface Session.Listener (from ServerSession.Listener),
so that client applications can customize the SETTINGS to send to the
server.
2014-08-08 23:52:20 +02:00
Simone Bordet ab96bf775f Removed unneeded casting to DataFrame. 2014-08-08 18:19:02 +02:00
Simone Bordet 69927b935e Don't send a window update if the length is zero. 2014-08-08 01:11:59 +02:00
Simone Bordet abd139cc1b Reworked flow control implementation. Splitted HTTP2Flusher out of HTTP2Session.
Flow control window updates are now processed by the flusher, so that
it is the only component that handles window updates.
In the process of this refactoring, HTTP2Flusher was refactored out
of HTTP2Session.
2014-08-06 15:42:36 +02:00
Simone Bordet 2cd53831c0 Refactored onReadTimeout() to parent class. 2014-08-06 15:39:29 +02:00
Simone Bordet 22cdca9131 Merge branch 'jetty-http2' into http2_flow_control 2014-08-05 10:01:30 +02:00
Simone Bordet 636c7eaeae Fixed handling of max concurrent streams.
There is a difference between the value set via configuration, that
always refer to remote streams (streams initiated by remote peers),
and the value received via SETTINGS frame, that always refer to local
streams (streams initiated locally).
2014-08-05 02:01:34 +02:00
Simone Bordet ac7aa4decc Flow control needs improvements. 2014-08-05 00:28:06 +02:00
Simone Bordet 20925ded97 Fixed insertion of frame header buffer at the right index.
In case the lease is not empty, the frame header buffer must not be
inserted at index 0, but just before the frame body buffer.
2014-08-04 12:15:14 +02:00
Simone Bordet 8d554b54a8 Fixed checks for headers too big. 2014-08-03 00:27:28 +02:00
Simone Bordet e332aa9c43 Improved logging. 2014-08-03 00:27:28 +02:00
Simone Bordet dcc8bfcd10 Fixed a reentrancy issue that caused a stack overflow.
The case was that shutdown was called, ShutdownFlusherEntry called
flusher.close(), which called super.close(), which called
onCompleteFailure(), which looped over the active items to fail them,
calling again ShutdownFlusherEntry, which called again flusher.close(),
etc.
2014-08-02 00:38:24 +02:00
Simone Bordet 7004d71996 Reporting FRAME_SIZE_ERROR in case wrong frame lengths. 2014-08-01 16:22:36 +02:00
Simone Bordet cddfa033f0 Implemented handling of SETTINGS_HEADER_TABLE_SIZE configuration property. 2014-08-01 16:20:20 +02:00
Simone Bordet 346b726c47 Taking into account the padding bytes in flow control length. 2014-08-01 15:54:12 +02:00
Simone Bordet 89a045855c Moved http2.frames.Flag to http2.Flags. 2014-08-01 15:04:14 +02:00
Simone Bordet 67fd213263 Moved http2.parser.ErrorCode to http2.ErrorCodes. 2014-08-01 15:03:49 +02:00
Simone Bordet 168a8f7dbf Reporting FRAME_SIZE_ERROR in case wrong frame lengths. 2014-08-01 15:01:03 +02:00
Simone Bordet 3283232f02 Added initial support for parsing CONTINUATION frames, and nothing more. 2014-08-01 14:02:11 +02:00
Simone Bordet 6b6267ed31 Updated implementation to draft-14. 2014-08-01 13:32:56 +02:00
Greg Wilkins 9c3eedfea8 Updates to hpack for hpack-09 draft 2014-07-31 13:26:23 +10:00
Greg Wilkins 30123607c6 Major refactor of metadata and HttpURI
This refactor strives to remove duplication between the Metadata class and the HttpURI class.

Both classes have been made mutable (as they partially were anyway so best not to pretend).

HttpURI now holds the decomposed strings rather than a single string with indexes. This allows it to be rebuilt after changing just parts of the URI. It is now a lot more similar to the
JVM URI class and we could consider replacing it (after checking peformance).

Next step is to refactor the Request class to prevent it duplicating these fields.
2014-07-24 15:49:52 +10:00
Greg Wilkins d6f841bb87 fixed refactor uri issue 2014-07-23 09:03:52 +10:00
Greg Wilkins f9ffefbe13 refactored to avoid copying MetaData.Request instances 2014-07-11 16:35:25 +10:00
Greg Wilkins ca1a9ceb7c fixed merge issues 2014-07-04 23:22:40 +10:00
Simone Bordet 603985dcd2 Implemented gentler shutdown in case of reading -1.
This allows big responses to be sent even if the request half closes
the connection.
2014-06-27 17:06:07 +02:00
Simone Bordet 2608af8f0d Merged branch 'origin/master' into 'jetty-http2'. 2014-06-26 11:54:50 +02:00
Simone Bordet 4c2c7e8352 Guarded calls to LOG.debug() with if (LOG.isDebugEnabled()) to reduce allocation of varargs Object[]. 2014-06-25 12:37:05 +02:00
Simone Bordet 02454ec8de Improved handling of errors for streams. 2014-06-24 13:52:03 +02:00
Simone Bordet 05616d1e9d Cosmetics. 2014-06-24 13:50:52 +02:00
Simone Bordet e94b8745f2 PING frames are now processed as soon as possible. 2014-06-24 12:35:06 +02:00
Simone Bordet 7625844dff Closing the connection if frames that carry headers don't have the
END_HEADERS flag.
2014-06-24 12:35:06 +02:00
Simone Bordet 8016fb6d0f Strengthened the checks to avoid to exceed the max frame length. 2014-06-24 12:35:06 +02:00
Simone Bordet f09b81835e Improved handling of RST_STREAM frames. 2014-06-24 12:35:06 +02:00
Simone Bordet 4211653095 Fixed tests. 2014-06-18 16:09:52 +02:00
Simone Bordet 14dba64164 Fixed handling of zero-length hpacked headers. 2014-06-18 16:09:52 +02:00
Simone Bordet 9d9260e634 Implemented idle timeout functionality for streams. 2014-06-18 13:57:37 +02:00
Simone Bordet 4dca6a71d3 Update Parser constructor to take additional parameters needed by
HpackDecoder.
2014-06-18 11:40:11 +02:00
Simone Bordet 9c95e29088 Implemented idle timeout functionality for both client and server. 2014-06-18 11:18:48 +02:00
Simone Bordet 690cd01933 Made sure that exceptions thrown by the generator are caught and the
connection closed.
2014-06-18 11:18:48 +02:00
Simone Bordet c0e0b802d9 Made sure that exceptions thrown by the parser are caught and the
connection closed.
2014-06-18 11:18:48 +02:00
Greg Wilkins 7fa4f1e9f8 cleaned up authority handling 2014-06-17 19:40:09 +02:00
Simone Bordet 82a2dfd03a Fixed infinite loop when receiving a SETTINGS frame. 2014-06-17 18:51:09 +02:00
Simone Bordet 6d1e5c9a07 Fixed tests to make the generator and the parser have the same scope. 2014-06-17 11:04:32 +02:00
Greg Wilkins 4c2a3dfbe6 better hpack debug 2014-06-17 11:04:10 +02:00
Greg Wilkins 25295456ae renamed HTTP/2.0 to HTTP/2 2014-06-17 00:12:57 +02:00
Greg Wilkins 272e1d8da5 Refactored HttpChannel to not have direct HttpParser dependency 2014-06-17 00:02:50 +02:00
Simone Bordet 334db9fe72 Updated version to 9.3.0-SNAPSHOT. 2014-06-16 21:33:03 +02:00
Simone Bordet e6e68c5557 Added license header. 2014-06-16 16:09:47 +02:00
Simone Bordet 9af8eb9fa7 Replying to SETTINGS frame as requested by the specification. 2014-06-16 15:45:10 +02:00
Simone Bordet 849360717e Implemented PUSH_PROMISE generator/parser. 2014-06-16 15:35:48 +02:00
Simone Bordet 907d303774 Added checks on the validity of the streamId. 2014-06-16 12:46:26 +02:00
Simone Bordet 75b0a7088b Fixed onPing() method: replaced call to ping() with control() since
ping() should not be called to reply to a ping.
2014-06-13 23:13:26 +02:00
Simone Bordet 363c18a29e Improved logging. 2014-06-13 23:03:37 +02:00
Simone Bordet 2b86d34d5a Properly closing the stream and eventually removing it when receiving data frames. 2014-06-13 23:03:17 +02:00
Simone Bordet d4783369bc Fixed generation of sliced data frames, setting the end stream flag
only when all the content has been generated.
2014-06-13 22:59:48 +02:00
Simone Bordet a58a5f8268 Fixed handling of zero length body, that must be HPACK decoded. 2014-06-13 22:57:40 +02:00
Simone Bordet b3aa67e0a9 Implemented PING functionality. 2014-06-13 17:59:17 +02:00
Simone Bordet 8681511f08 Wrapping debug log statements with LOG.isDebugEnabled(). 2014-06-13 17:10:38 +02:00
Simone Bordet 388262227e Split the generation of frames into 2: flow-controlled and
non-flow-controlled.
This gives better code separation and proper removal of streams when
flow controlled frames complete.
2014-06-13 16:28:54 +02:00
Simone Bordet fb93973c9d Improved flow control logging. 2014-06-13 15:22:03 +02:00
Simone Bordet b30152df27 Removed generation of padding bytes, which simplified the code a lot.
Implemented slicing of flow controlled data to never exceed the flow
control window.
2014-06-13 14:08:56 +02:00
Simone Bordet 5ed4f312cd Implemented flow control. 2014-06-13 13:51:42 +02:00
Simone Bordet 22c42151bd Implemented logic to handle a GO_AWAY frame. 2014-06-11 22:43:08 +02:00
Simone Bordet 5a7f954262 Fixed generation of frames via Session API methods. 2014-06-11 21:21:49 +02:00
Simone Bordet 8e4c6b7fdd Put some more flesh on the HTTP2 implementation. 2014-06-11 18:26:48 +02:00
Simone Bordet 78cbed1236 Added headerTableSize parameter. 2014-06-11 18:24:02 +02:00
Greg Wilkins f258ff1565 improved debug 2014-06-11 17:05:39 +02:00
Simone Bordet 347324b71b Improved logging. 2014-06-11 08:56:39 +02:00
Simone Bordet 7c5492acad Properly linking stream object with HEADERS frame. 2014-06-11 08:56:23 +02:00
Simone Bordet 3c6663ff21 Fixed parsing in case of zero-length header block and zero-length data. 2014-06-10 22:54:32 +02:00
Greg Wilkins 6b77226517 improved debug 2014-06-10 20:28:52 +02:00
Greg Wilkins d024a46327 debug 2014-06-10 19:05:43 +02:00
Simone Bordet 630bee5887 Implemented HTTP2 connection preface. 2014-06-10 18:33:13 +02:00
Simone Bordet 36e7c41b2f Improved logging. 2014-06-10 16:02:24 +02:00
Simone Bordet ad034f4d54 Reworked generation of frames (split into different generators) and
sketched server-side handling and linking with channel.
2014-06-10 12:02:54 +02:00
Simone Bordet e0474108d0 Updated Frame inheritance. 2014-06-10 12:01:16 +02:00
Greg Wilkins b2296cc2d4 simplified startRequest 2014-06-09 14:12:46 +02:00
Simone Bordet c1247ff677 Reorganized HTTP2 modules. 2014-06-09 14:01:16 +02:00