Commit Graph

935 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa 9893ae81af Add nghttp2_bufs_realloc 2014-08-24 15:34:55 +09:00
Tatsuhiro Tsujikawa 7bfa276e96 Fix bug that NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE causes session failure
Previously returning NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE from
on_header_callback moves input offset badly and it causes header
decompression error on the subsequent frames.  This commit fix this
bug.
2014-08-24 00:50:55 +09:00
Tatsuhiro Tsujikawa 02c5621c61 Refactor functions to update consumed size 2014-08-23 18:56:04 +09:00
Tatsuhiro Tsujikawa 0c7e2fbec6 Use parenthesis explicitly for bit wise operation 2014-08-23 18:03:20 +09:00
Tatsuhiro Tsujikawa cfee9cab36 Avoid possible double-free and make nghttp2_buf{s}_free(NULL) success 2014-08-23 11:16:49 +09:00
Tatsuhiro Tsujikawa 00ead22395 Don't allow frame submission for pending new frame
This is partial revert of bbe4f5a3d1.
Only documentation is reverted.  Since we have 2 queues to handle
maximum concurrent streams, we are not ready to allow immediate frame
submission for pending new frames.
2014-08-17 21:26:56 +09:00
Tatsuhiro Tsujikawa bbe4f5a3d1 Allow frame submission immediately after nghttp2_submit_{request,headers,pp}
This commit makes handling of outgoing HEADERS and PUSH_PROMISE in the
same priority of other frames on the stream, so these frames are
processed in the order they are submitted.  This allows application to
submit frames to a stream returned by nghttp2_submit_{request,
headers, push_promise} immediately.  The only exception is
WINDOW_UPDATA frame, which requires nghttp2_stream object, which is
not created yet.
2014-08-17 17:31:43 +09:00
Tatsuhiro Tsujikawa d499803221 Fix another heap-use-after-free bug 2014-08-10 12:20:36 +09:00
Tatsuhiro Tsujikawa 894783f572 Add note how to specify error code on NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE 2014-08-10 00:18:41 +09:00
Tatsuhiro Tsujikawa 4679188069 Fix crash 2014-08-09 18:41:08 +09:00
Tatsuhiro Tsujikawa ab9b0538bc Add doc how to issue non-final response headers 2014-08-08 23:38:20 +09:00
Tatsuhiro Tsujikawa 24edd2972d Remove note about 0x00 concatenation rule and add note about pseudo-headers 2014-08-08 23:32:45 +09:00
Tatsuhiro Tsujikawa 6ccf06c6da nghtp2_hd: Calculate hash values once 2014-08-06 22:00:12 +09:00
Tatsuhiro Tsujikawa 49e3fd6862 Add some header names which won't be indexed 2014-08-06 21:50:54 +09:00
Tatsuhiro Tsujikawa 86b089f957 Fix buffer overrun in raw_sbuf 2014-08-06 01:49:36 +09:00
Alexis La Goutte ec93c9f55f Fix some other shorten-64-to-32 casting error found by MSVC (64bits)
Thanks to Pascal
2014-08-04 09:04:49 +02:00
Alexis La Goutte 6c71889552 Fix some other shorten-64-to-32 casting error found by MSVC (64bits) 2014-08-03 16:09:30 +02:00
Tatsuhiro Tsujikawa 4bbb4172aa Fix typo 2014-08-03 14:07:35 +09:00
Tatsuhiro Tsujikawa 3c603ec4ae add_hd_table_incremental: Remove unused bufs parameter 2014-08-02 16:21:42 +09:00
Tatsuhiro Tsujikawa d36bea8554 Add debug output for HPACK decoded integer 2014-08-02 10:40:25 +09:00
Tatsuhiro Tsujikawa 16101b8b3f Fix compile error with --enable-debug 2014-08-02 10:16:32 +09:00
Tatsuhiro Tsujikawa 2fb750f2e3 nghttp2_check_header_value: Disallow 0x00 2014-08-02 00:30:09 +09:00
Alexis La Goutte ac28cd7efa Fix typo 2014-08-01 09:05:37 +02:00
Tatsuhiro Tsujikawa 7952029752 Advertise h2-14 2014-07-31 23:34:54 +09:00
Tatsuhiro Tsujikawa 48734b6d05 Update doc 2014-07-31 23:18:39 +09:00
Tatsuhiro Tsujikawa d8d14a3fc9 Code cleanup 2014-07-31 23:08:51 +09:00
Tatsuhiro Tsujikawa c13329b328 Treat delta 0 WINDOW_UPDATE as error 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa b8a2bf2675 Remove END_SEGMENT flag 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 98be65a1eb Allow submission of unknown SETTINGS 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 742b28833a Rename NGHTTP2_SETTINGS_MAX_HEADER_SET_SIZE as NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 77374ac6e2 Implement SETTINGS_MAX_FRAME_SIZE and SETTINGS_MAX_HEADER_LIST_SIZE 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa c4be7d48a0 nghttp2_hd: Code cleanup 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 0752ce6701 nghttp2_hd_deflate_bound: Take into account possible 2nd context update 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 8d5422c9bb Remove check for incoming header block size
The application should be responsible for the size of incoming header
block size.  Framing layer just passes everything (we have size limit
for one header/field though) to application.
2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa dd1850aed0 Emit minimum header table size in encoding context update 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 079db14d45 Add nghttp2_session_consume() API
Reworked no automatic WINDOW_UPDATE feature.  We added new API
nghttp2_session_consume() which tells the library how many bytes are
consumed by the application.  Instead of submitting WINDOW_UPDATE by
the application, the library is now responsible to submit
WINDOW_UPDATE based on consumed bytes.  This is more reliable method,
since it enables us to properly send WINDOW_UPDATE for stream and
connection individually.  The previous implementation of nghttpx had
broken connection window management.
2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa e904842504 Update doc 2014-07-31 23:05:52 +09:00
Tatsuhiro Tsujikawa 78df530b90 Don't ignore aux_data for HEADERS with NGHTTP2_HCAT_HEADERS tag 2014-07-31 23:05:52 +09:00
Tatsuhiro Tsujikawa e147c14186 Remove ent_name member and use index solely 2014-07-31 23:05:52 +09:00
Tatsuhiro Tsujikawa 06453fb15e Remove unused role member in nghttp2_hd_context 2014-07-31 23:05:52 +09:00
Tatsuhiro Tsujikawa 744ec4dba1 Don't copy static header and put static table in front of dynamic table 2014-07-31 23:05:52 +09:00
Tatsuhiro Tsujikawa 38bfbffb1b Remove HPACK reference set 2014-07-31 23:05:52 +09:00
Tatsuhiro Tsujikawa 63398f30dd Extend frame length field to 24 bits 2014-07-31 23:05:52 +09:00
Tatsuhiro Tsujikawa 961dcf614a Fix wrong detection of neverIndex bit 2014-07-26 23:27:34 +09:00
Tatsuhiro Tsujikawa 57e9b94aaa Handle header table size up to UINT32_MAX 2014-07-22 22:38:18 +09:00
Tatsuhiro Tsujikawa 9de9b6ebd6 Remove unnecessarily code 2014-07-22 01:52:51 +09:00
Tatsuhiro Tsujikawa 44310c6de5 Fix integer decoding when it takes multiple reads 2014-07-22 01:50:29 +09:00
Tatsuhiro Tsujikawa d99e1135c8 Search static header table linearly 2014-07-20 19:13:56 +09:00
Tatsuhiro Tsujikawa 67b13ad9ff Remove unused nghttp2_nva_out 2014-07-18 21:14:07 +09:00
Tatsuhiro Tsujikawa 8dc47c6750 Fix resource leaks 2014-07-18 00:31:32 +09:00
Tatsuhiro Tsujikawa 5c305acb97 Remove unused nghttp2_io_flag 2014-07-17 23:44:03 +09:00
Tatsuhiro Tsujikawa 62423f5949 Fix double free 2014-07-15 22:47:04 +09:00
Tatsuhiro Tsujikawa 55c697e9f4 Handle multiple SETTINGS_HEADER_TABLE_SIZE in incoming SETTINGS frame
Previously we just assumed that if same settings ID is found in
SETTINGS, it is enough to process last seen entry.  But it turns out
it is not enough for SETTINGS_HEADER_TABLE_SIZE.  If we have 0 and
4096 for SETTINGS_HEADER_TABLE_SIZE in one SETTINGS, we must first
shrink dynamic table to 0 and then enlarge it to 4096.  This means
that we have to remember the minimum value and last value.
2014-07-15 00:25:31 +09:00
Tatsuhiro Tsujikawa 8f1249ab67 Check NGHTTP2_GOAWAY_SEND and NGHTTP2_GOAWAY_RECV flags explicitly 2014-07-12 23:16:25 +09:00
Tatsuhiro Tsujikawa 35ffeb5ff4 Send additional debug info when terminating session 2014-07-12 22:57:17 +09:00
Tatsuhiro Tsujikawa d3ca003346 Update android-config and fix build warning with android NDK 2014-07-06 23:32:08 +09:00
Tatsuhiro Tsujikawa 4b6f124b7e Add API to check half-closed state for both direction of stream 2014-07-03 21:44:29 +09:00
Tatsuhiro Tsujikawa e5abc475f1 Don't send more than NGHTTP2_MAX_HEADERSLEN bytes header block 2014-07-02 22:45:38 +09:00
Tatsuhiro Tsujikawa 593485c652 Put a limit for total contiguous headers length currently receiving 2014-07-02 22:25:32 +09:00
Tatsuhiro Tsujikawa 6da044cbb5 Send WINDOW_UPDATE for ignored DATA bytes when manual flow control is enabled
Since we do not call on_data_chunk_recv_callback for ignored DATA
chunk, if nghttp2_option_set_no_auto_connection_window_update is used,
application may not have a chance to send connection WINDOW_UPDATE.
To fix this, we accumulate those received bytes, and if it exceeds
certain number, we automatically send connection-level WINDOW_UPDATE.
2014-07-02 21:20:40 +09:00
Tatsuhiro Tsujikawa ed38dbf67a Add const qualifier to opaque_data parameter in nghttp2_submit_ping 2014-07-02 00:59:36 +09:00
Tatsuhiro Tsujikawa 1039dc59ea Update doc 2014-06-30 00:02:40 +09:00
Tatsuhiro Tsujikawa bd06f2cec3 Add const qualifier to nva parameter in nghttp2_hd_deflate_hd() 2014-06-29 23:43:14 +09:00
Tatsuhiro Tsujikawa d318e6a62e Support one header field size (name + value) up to 64KiB by default
This commits changes the upper bound of one header field size (the sum
of the length of name and value) to 64KiB by default.  We may add an
option to change this upper bound in the future.
2014-06-28 11:04:41 +09:00
Tatsuhiro Tsujikawa ff3a4a770f Treat larger last stream ID in GOAWAY than previous value as PROTOCOL_ERROR 2014-06-28 10:46:05 +09:00
Tatsuhiro Tsujikawa 16fef227e8 nghttp2_hd_*_new: Leave *inflater_ptr or *deflater_ptr untouched on failure 2014-06-25 21:26:47 +09:00
Tatsuhiro Tsujikawa 55c338d7af nghttp2_session_*_new: Leave session parameter untouched on failure 2014-06-25 21:21:17 +09:00
Tatsuhiro Tsujikawa 4cbfe5d3d1 Ensure that maximum padding is 256 2014-06-25 21:17:03 +09:00
Tatsuhiro Tsujikawa ad60a18fb9 Remove BLOCKED frame 2014-06-24 00:22:41 +09:00
Tatsuhiro Tsujikawa 31de732e3b Allocate header table ringbuffer lazily
Previously in inflater we reserve new ringbuffer when table size is
changed.  This may be potentially a problem if new table size is very
large number.  When inflater is not used directly by application, this
is not a problem because application can choose the buffer size.  On
the other hand, if application uses inflater directly and it does not
have control of new buffer size (e.g., protocol dissector), then we
just fail to allocate large buffer in
nghttp2_hd_inflate_change_table_size() without actually use such huge
buffer.  This change defers the actual allocation of buffer when it is
actually needed so that we will fail when it is absolutely needed.
2014-06-22 13:39:17 +09:00
Tatsuhiro Tsujikawa 9294622519 Treat unknown error code as NGHTTP2_INTERNAL_ERROR 2014-06-18 11:53:32 +09:00
Tatsuhiro Tsujikawa b78a51da0e Support graceful shutdown using multiple GOAWAY
Add last_stream_id parameter to nghttp2_submit_goaway().  To terminate
connection immediately with application chosen last stream ID,
nghttp2_session_terminate_session2() was added.
2014-06-18 11:35:08 +09:00
Tatsuhiro Tsujikawa 975524a125 Don't send GOAWAY with last stream ID larger than the value previously sent 2014-06-18 11:03:55 +09:00
Tatsuhiro Tsujikawa 817e1ce2a7 Rename last_stream_id in nghttp2_session to remote_last_stream_id
This commits also fixes last stream ID in GOAWAY uses wrong stream ID.
2014-06-18 10:56:32 +09:00
Tatsuhiro Tsujikawa 62900cd85b Allow multiple transmission of GOAWAY frame 2014-06-18 10:51:33 +09:00
Tatsuhiro Tsujikawa 174e410b93 Use hex in nghttp2_error_code and nghttp2_settings_id 2014-06-18 10:48:31 +09:00
Tatsuhiro Tsujikawa a5af621947 Change protocol ID to h2-13 2014-06-18 09:42:51 +09:00
Alexis La Goutte 9a3cdeb7e6 Fix some other shorten-64-to-32 casting error found by MSVC (64bits)
Thanks for Pascal
2014-06-16 19:17:49 +02:00
Alexis La Goutte c9b6371977 When assertions is disable, there is a warning about unused check_index_range function
Make the check for a valid index range a macro, so the compiler doesn't
whine if it's not used, but it's available if it *is* used.
2014-06-16 18:52:11 +02:00
Tatsuhiro Tsujikawa 7f6ddd0f2e Update huffman code table 2014-06-16 23:03:55 +09:00
Tatsuhiro Tsujikawa f85a213fb1 Update static header table 2014-06-14 22:24:47 +09:00
Tatsuhiro Tsujikawa dd006f8a79 Change protocol ID to h2-lc 2014-06-12 22:51:30 +09:00
Alexis La Goutte a15d4fc306 Fix nghttp2_hd_huffman.h:41:31: warning: comma at end of enumerator list [-Wpedantic] 2014-06-11 23:43:10 +09:00
Tatsuhiro Tsujikawa 9b174bf5c9 Fix compile error with -Wshorten-64-to-32
The original patch was contributed by Alexis La Goutte
2014-06-11 23:37:16 +09:00
Tatsuhiro Tsujikawa f0f5342cd4 Update doc 2014-06-11 01:40:20 +09:00
Tatsuhiro Tsujikawa cfcecca751 Make return type of inbound_frame_set_settings_entry void 2014-06-10 21:32:20 +09:00
Tatsuhiro Tsujikawa 2878e1e258 Refactor storage of settings
Now local and remote settings values are stored in dedicated structure
nghttp2_settings_storage.
2014-06-10 21:29:19 +09:00
Tatsuhiro Tsujikawa 4596f73ee0 Fix unused header_cb_arg structure 2014-06-09 23:21:55 +09:00
Tatsuhiro Tsujikawa caf3e1c035 Fix compile error with --enable-debug 2014-06-09 23:21:30 +09:00
Tatsuhiro Tsujikawa dacc9b2f1c Separate extension frames from core frames
ALTSVC and BLOCKED frames are now extension frames.  To add new
extension frame without modifying nghttp2_frame union, which causes so
name bump, we separated extension frames from core frames.
nghttp2_frame includes generic nghttp2_extension.  The payload member
of nghttp2_extension will point to the structure of extension frame
payload.  The frame types of extension frames are defined in
nghttp2_ext_frame_type.
2014-06-09 23:16:54 +09:00
Tatsuhiro Tsujikawa 317b8baa4f Set HTTP/2 protocol id to h2-13 for now 2014-06-07 19:39:14 +09:00
Tatsuhiro Tsujikawa d4602a0991 Remove reserved field from ALTSVC frame 2014-06-07 19:10:09 +09:00
Tatsuhiro Tsujikawa 3daeadcb07 Remove bogus comments 2014-06-07 18:51:20 +09:00
Tatsuhiro Tsujikawa 19729962a3 Check stream_id is nonzero for DATA, HEADERS, PRIORITY, RST_STREAM, PUSH_PROMISE 2014-06-07 18:48:37 +09:00
Tatsuhiro Tsujikawa bfaab30733 Allow transmission and reception of PRIORITY frame to a closed stream 2014-06-07 18:36:58 +09:00
Tatsuhiro Tsujikawa c46d3dafc6 Remove PAD_HIGH and Pad High field
CONTINUATION now doesn't have padding.
2014-06-07 18:15:36 +09:00
Tatsuhiro Tsujikawa 70c86979e8 Ignore unknown settings ID 2014-06-07 16:41:36 +09:00
Tatsuhiro Tsujikawa d402ba6fa2 Make settings_id 2 bytes field 2014-06-07 16:37:29 +09:00
Tatsuhiro Tsujikawa 458ccb3681 Ignore unknown frame types
Unexpected CONTINUATION frame is handled separately as connection
error.
2014-06-07 16:30:55 +09:00
Tatsuhiro Tsujikawa 3db8935e20 Remove per-frame compression 2014-06-07 16:04:43 +09:00