Commit Graph

125 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa 9314e30987 Support transmission of CONTINUATION, change nghttp2_frame_hd
The maximum frame size including header block is still limited
to NGHTTP2_HD_MAX_BUFFER_LENGTH, which is 32KB.
2014-01-26 23:10:33 +09:00
Tatsuhiro Tsujikawa 91401cfe26 Support CONTINUATION frame reception 2014-01-26 20:31:28 +09:00
Tatsuhiro Tsujikawa e7fc2951b8 nghttp2_hd: Define dedicated struct for HPACK deflater and inflater 2014-01-26 17:53:04 +09:00
Tatsuhiro Tsujikawa 45a9f0b637 Remove nghttp2_frame_unpack_* functions 2014-01-26 16:46:18 +09:00
Tatsuhiro Tsujikawa dba2406aba nghttp2_sesson_mem_recv: Process incoming data in streaming fashion
Now incoming data is processed in very small buffer (up to 8 bytes)
using state machine. GOAWAY debug data can get to 16K - 1, and we
don't have callback for it. Since we don't want to buffer that
amount of data just for debugging, we currently discard it.
This change also makes parse_error callback not function.
It probably be removed from API.
2014-01-26 15:44:43 +09:00
Tatsuhiro Tsujikawa 8317559090 nghttp2_hd: Implement stream header inflater
This stream inflater can inflate incoming header block in streaming
fashion. Currently, we buffer up single name/value pair, but we chose
far more smaller buffer size than HTTP/2 frame size.
2014-01-25 18:24:15 +09:00
Tatsuhiro Tsujikawa 6540ac1bab Fix crash 2014-01-23 21:25:49 +09:00
Tatsuhiro Tsujikawa 62e394b3e3 Fix memory leak 2014-01-23 00:28:23 +09:00
Tatsuhiro Tsujikawa d647799c6f Take int account received data length to check flow control error 2014-01-20 19:50:11 +09:00
Tatsuhiro Tsujikawa 594e1caad6 Code cleanup 2014-01-20 00:01:10 +09:00
Tatsuhiro Tsujikawa d0968ea609 Tear down session if GOAWAY with stream ID != 0 2014-01-19 00:37:45 +09:00
Tatsuhiro Tsujikawa 2a95da6bee Code cleanup 2014-01-18 16:25:44 +09:00
Tatsuhiro Tsujikawa b6d039e888 Make nghttp2_is_fatal public API 2014-01-18 16:24:44 +09:00
Tatsuhiro Tsujikawa e960c56aad Don't call on_request_recv_callback if header decompression failed 2014-01-17 23:49:40 +09:00
Tatsuhiro Tsujikawa 22a4e3eab8 Remove nghttp2_session_continue
nghttp2_session_continue is removed. Now just call
nghttp2_session_mem_recv to continue after NGHTTP2_ERR_PAUSE.
2014-01-17 22:52:30 +09:00
Tatsuhiro Tsujikawa b2bf18d40f Code cleanup 2014-01-17 10:15:14 +09:00
Tatsuhiro Tsujikawa 5d535766bf inflate_header_block: Terminate session on compression error
Code cleanup is done as well
2014-01-17 10:13:33 +09:00
Tatsuhiro Tsujikawa 0e4b3d435e Emit header name/value pair using callback functions
Now, in nghttp2_on_frame_recv_callback, nva and nvlen in
HEADERS and PUSH_PROMISE frames are always NULL and 0 respectively.
The header name/value pairs are emitted successive
nghttp2_on_header_callback functions. The end of header fields are
signaled with nghttp2_on_end_headers_callback function.

Since NGHTTP2_ERR_PAUSE for nghttp2_on_frame_recv_callback is
introduced to handle header block, it is now deprecated.
Instead, nghttp2_on_header_callback can be paused using
NGHTTP2_ERR_PAUSE.
2014-01-17 01:49:43 +09:00
Tatsuhiro Tsujikawa a85a11c1d9 Update priority for the stream to get response only 2014-01-09 23:30:45 +09:00
Tatsuhiro Tsujikawa 5aa487c5ba nghttp2_stream: flags is now nghttp2_stream_flags
We use this flag to know whether it is pushed or not
2014-01-09 23:01:02 +09:00
Tatsuhiro Tsujikawa 45837a2cfa Ensure PRIORITY frame reception/transmission rule 2014-01-09 22:06:38 +09:00
Tatsuhiro Tsujikawa fe1a39ed10 Allow client side to send PUSH_PROMISE 2014-01-09 21:39:29 +09:00
Tatsuhiro Tsujikawa 9cb8754d09 Rename nghttp2_session_fail_session as nghttp2_session_terminate_session 2013-12-26 00:23:07 +09:00
Tatsuhiro Tsujikawa dfcdea894b Move header name/value pair validation to on_*_received functions 2013-12-25 23:38:55 +09:00
Tatsuhiro Tsujikawa 794633f894 Add nghttp2_session_set_stream_user_data API function 2013-12-23 17:40:34 +09:00
Tatsuhiro Tsujikawa 650f63c728 Fail session on the reception of DATA in closed stream or illegal state 2013-12-15 16:23:01 +09:00
Tatsuhiro Tsujikawa 41104f7b63 Abandon DATA frame priority adjustment (again)
We tried several times about this subject, but for the current
HTTP/2.0 priority scheme, we think it is best to serve the highest
priroty streams first (interleaving streams if there are several
higest ones). There are an issue when aggregating several frontend
connections to one connection in backend, but it is HTTP/2.0
spec issue, rather than implementation.
2013-12-14 17:02:59 +09:00
Tatsuhiro Tsujikawa 364501a2cd Get rid of magic value NGHTTP2_PRI_DECAY
For now we just double the priority value on each DATA frame
transmission. If priority is 0, it becomes to 1 and goes all
the way to (1 << 30) - 1.
2013-12-13 22:26:09 +09:00
Tatsuhiro Tsujikawa e17f888944 Lower priority by constant value 2013-12-11 23:20:59 +09:00
Tatsuhiro Tsujikawa d773b42a2d Ensure that pri goes to the lowest value 2013-12-07 16:14:39 +09:00
Tatsuhiro Tsujikawa 1dea4e154b Reintroduce priority adjustment for DATA frame
This mechanism existed but was deleted. We bring it back in order to
prevent lower priority streams from starving.
2013-12-05 23:12:18 +09:00
Tatsuhiro Tsujikawa a3c888d7d1 nghttp2_map: Implement hash table 2013-12-05 00:53:03 +09:00
Tatsuhiro Tsujikawa d0d0009a50 Use largest valid stream ID which passed to callback as last-stream-ID
Previously we use largest stream ID received so far as last-stream-ID,
and it is irrevant that it is passed to the callback (thus upper layer).
Now the stream ID which is passed to callback is eligible to
last-stream-ID.
2013-11-28 23:26:34 +09:00
Tatsuhiro Tsujikawa bc21edf5b6 Interleave streams with the same priority 2013-11-19 23:59:10 +09:00
Tatsuhiro Tsujikawa 45c3c5b80f Cleanup nghttp2_session_mem_recv 2013-11-12 10:52:03 +09:00
Tatsuhiro Tsujikawa a39a816a63 Cleanup nghttp2_session_next_data_read 2013-11-12 10:48:29 +09:00
Tatsuhiro Tsujikawa 5044b59453 Handle error from nghttp2_session_push_back_deferred_data 2013-11-12 10:44:04 +09:00
Tatsuhiro Tsujikawa 2ae788eddd Replace nghttp2_set_option with nghttp2_session_{client,server}_new2
nghttp2_session_client_new2 and nghttp2_session_server_new2 take
additional parameters which specifies session options.
nghttp2_set_option is somewhat crumsy because of type checking.
Now we use nghttp2_opt_set, which specifies individual options with
types. We changed the value of nghttp2_opt, so this change will
require re-compile.
2013-11-08 00:12:39 +09:00
Tatsuhiro Tsujikawa 4bc44b0c0b Implement SETTINGS_ENABLE_PUSH
It is not clear that SETTINGS_ENABLE_PUSH = 0 disallows HEADERS
to the reserved streams. For now, we just check the reception
and transmission of PUSH_PROMISE against SETTINGS_ENABLE_PUSH.
2013-11-02 16:53:06 +09:00
Tatsuhiro Tsujikawa 29ef3fde8b Initialize settings in common function 2013-11-02 16:23:56 +09:00
Tatsuhiro Tsujikawa 2e7bc014e1 Return 0 if recv_window_size is negative; add tests 2013-10-30 01:58:38 +09:00
Tatsuhiro Tsujikawa dfa1194804 Add new API to return effective recv data/win size for connection
Using this feature, connection level flow control is now enabled
in nghttpx.
2013-10-30 00:51:01 +09:00
Tatsuhiro Tsujikawa 6c23c34d77 Add new API to return effective received data length and local window size 2013-10-30 00:07:35 +09:00
Tatsuhiro Tsujikawa a4cf37306a Enfoce flow control error strictly
Now we have SETTINGS synchronization, flow control error can be
detected strictly. If DATA frame is received with length > 0 and
current received window size is equal to or larger than local
window size (latter happens when we shirnk window size), it is
subject to FLOW_CONTROL_ERROR,
2013-10-29 22:46:30 +09:00
Tatsuhiro Tsujikawa 67ce60544e Change maximum frame length to 16383 2013-10-27 21:17:09 +09:00
Tatsuhiro Tsujikawa cfb9857f27 Use FRAME_SIZE_ERROR for invalid payload length 2013-10-27 20:55:44 +09:00
Tatsuhiro Tsujikawa 431f78f008 Rename NGHTTP2_ERR_FRAME_TOO_LARGE as NGHTTP2_ERR_FRAME_SIZE_ERROR 2013-10-27 19:35:36 +09:00
Tatsuhiro Tsujikawa 5ace898392 Update error code 2013-10-27 19:31:24 +09:00
Tatsuhiro Tsujikawa a46ccdb144 Apply initiated SETTINGS changes on reception of ACK 2013-10-27 19:22:51 +09:00
Tatsuhiro Tsujikawa 8f8c841df0 Merge branch 'master' into hpack-exp 2013-10-25 22:51:51 +09:00