Commit Graph

875 Commits

Author SHA1 Message Date
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
Tatsuhiro Tsujikawa eb0a894ede Merge branch 'Wshadow' of https://github.com/alagoutte/nghttp2 into alagoutte-Wshadow 2014-06-04 23:34:04 +09:00
Alexis La Goutte 6b08534ffc Fix declaration of ‘index’ shadows a global declaration [-Werror=shadow]
I have this error with some old gcc (4.6) release (Ubuntu 12.04 or Travis...)
2014-06-03 10:20:05 +02:00
Tatsuhiro Tsujikawa 99aaaccf03 Update doc 2014-06-02 22:33:23 +09:00
Tatsuhiro Tsujikawa 4f7223e89f Add note to manual how to submit frames to new stream ID 2014-05-31 22:01:18 +09:00
Tatsuhiro Tsujikawa 88b69bb669 Reduce huffman decoding table
Previously we have uint16_t as state member variable in
nghttp2_huff_decode structure to express -1 as failure.  This is
because we have 256 valid states.  However, we can express failed
state using flags member variable and make state uint8_t.  This commit
does this and as a result the size of decoding table is reduced.
2014-05-31 00:19:30 +09:00
Tatsuhiro Tsujikawa 832f2fc00f Call on_data_chunk_recv_callback only when stream is active 2014-05-29 22:18:52 +09:00
Tatsuhiro Tsujikawa d113055899 nghttp2_hd: Use single buffer for an name/value pair
Previously we use 2 separate buffer for each name and value.  The
problem is we would waste buffer space for name because it is usually
small.  Also tuning buffer size for each buffer separately is not
elegant and current HTTP server practice is that one buffer for 1
name/value pair.  This commit unifies 2 buffers into 1.
2014-05-28 23:33:37 +09:00
Tatsuhiro Tsujikawa 5e6a2fa256 Assert ctx->state >= 0 in huffman decoding 2014-05-28 00:30:11 +09:00
Tatsuhiro Tsujikawa d733c87567 Make state in nghttp2_hd_huff_decode_context int16_t to make compiler happy 2014-05-26 21:50:54 +09:00
Tatsuhiro Tsujikawa 589d3e71a3 Merge branch 'misc' of https://github.com/alagoutte/nghttp2 into alagoutte-misc 2014-05-26 21:48:30 +09:00
Alexis La Goutte db354b228a Remove unused include (stdint.h) 2014-05-26 08:58:15 +02:00
Tatsuhiro Tsujikawa 9677788317 Don't count closed streams in nghttp2_session_want_{read,write} 2014-05-23 22:23:38 +09:00
Tatsuhiro Tsujikawa 78a55935ac Define constant for the length of priority related fields 2014-05-22 21:41:43 +09:00
Tatsuhiro Tsujikawa 2aa84019c7 Define constants for ALTSVC frame parsing 2014-05-22 21:36:12 +09:00
Tatsuhiro Tsujikawa 1ac028e166 Take into account that pending_local_max_concurrent_stream could be too large
pending_local_max_concurrent_stream is, once local settings applied,
becomes NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS, which is very large
number.  When adjusting number of streams, we have to take min of
local effective SETTINGS_MAX_CONCURRENT_STREAMS and pending one.
2014-05-16 22:32:08 +09:00
Tatsuhiro Tsujikawa 2778e4aafc Remove useless debug code in nghttp2_stream_roots_add() 2014-05-16 22:30:59 +09:00
Tatsuhiro Tsujikawa 7b9a8acc22 Add HPACK deflation API 2014-05-13 23:42:55 +09:00
Tatsuhiro Tsujikawa 062d6a8398 Remove outdated comment 2014-05-12 22:58:05 +09:00
Tatsuhiro Tsujikawa ad4a4ee567 Add missing library error code to nghttp2_error() 2014-05-12 22:58:04 +09:00
Tatsuhiro Tsujikawa ab76468971 Return NGHTTP2_ERR_BUFFER_ERROR from nghttp2_hd_{deflate,inflate}_hd
It is generally useful to know what is the cause of the error.  Since
we expose HPACK API, it is friendly to tell application the
insufficient buffer size is a culprit.
2014-05-12 22:58:04 +09:00
Tatsuhiro Tsujikawa bc6d952361 Check max SETTINGS_HEADER_TABLE_SIZE in nghttp2_iv_check()
Hide NGHTTP2_MAX_HEADER_TABLE_SIZE from public API.  Now it is defined
as ((1u << 31) - 1) in nghttp2_frame.h, which is sufficiently big
enough.
2014-05-12 21:28:49 +09:00
Tatsuhiro Tsujikawa f85c592818 Fix compile error with clang -Wunreachable-code 2014-05-12 21:11:27 +09:00
Tatsuhiro Tsujikawa 9683f88e6a Add NGHTTP2_DEFAULT_HEADER_TABLE_SIZE macro
Use this macro in Python sources.  Python module constant
HD_DEFLATE_HD_TABLE_BUFSIZE_MAX was renamed as
DEFLATE_MAX_HEADER_TABLE_SIZE since the previous name was awkward.
2014-05-11 21:38:30 +09:00
Tatsuhiro Tsujikawa 2e5c7f598f Fix bug HPACK deflater does not send context update after table size change 2014-05-11 21:25:27 +09:00
Tatsuhiro Tsujikawa 4fffd23dd3 Code cleanup 2014-05-11 13:53:42 +09:00
Tatsuhiro Tsujikawa b187895e1d nghttp2_bufs_remove: Prevent NULL from being passed to memcpy 2014-05-11 13:51:46 +09:00
Tatsuhiro Tsujikawa dc791a641d Update doc 2014-05-10 21:43:16 +09:00
Tatsuhiro Tsujikawa 0707720b11 Code cleanup 2014-05-10 18:27:53 +09:00
Tatsuhiro Tsujikawa 4c8d4f8a85 Code cleanup 2014-05-10 00:13:40 +09:00
Tatsuhiro Tsujikawa 3ebb3faf32 Remove nghttp2_ prefix from static function, part 2 2014-05-08 23:54:07 +09:00
Tatsuhiro Tsujikawa 65bbdf56cd Remove nghttp2_ prefix from static function 2014-05-08 23:37:56 +09:00
Tatsuhiro Tsujikawa 3e3d51842b Interleave stream DATA more naturally
We simulate resource sharing by decreasing weight.  The thing is if
weight is wrapped, that item continues to send DATA until its weight
gets lowered under the other items.  This commits fix this issue.
2014-05-08 23:07:29 +09:00
Tatsuhiro Tsujikawa d2890dfb91 Remove adjust_priority_callback
Since we have stream ID immediately available from nghttp2_submit_*,
we don't need adjust_priority_callback.
2014-05-07 23:43:45 +09:00
Tatsuhiro Tsujikawa e8de437d5c Return new stream ID from nghttp2_submit_{request, headers, push_promise}
Previously stream ID was assigned just before HEADERS or PUSH_PROMISE
was serialized and nghttp2_submit_{request, headers, push_promise} did
not return stream ID.  The application has to check assigned stream ID
using before_frame_send_callback.  Now it is apparent that priority is
meant to DATA transfer only.  Also application can reorder the
requests if it wants. Therefore we can assign stream ID in
nghttp2_submit_* functions and return stream ID from them.  With this
change, now application does not have to check stream ID using
before_frame_send_callback and its code will be simplified.
2014-05-07 23:24:07 +09:00
Tatsuhiro Tsujikawa 51e79c5a3d Remove debug output 2014-05-07 23:23:43 +09:00
Alexis La Goutte 8e22eadc76 Fix typo 2014-05-06 17:05:47 +02:00
Tatsuhiro Tsujikawa 9228e223fa Remove NGHTTP2_ERR_GZIP error code 2014-05-06 23:42:57 +09:00
Tatsuhiro Tsujikawa 4f027c1562 libnghttp2: Remove dependency to zlib
We inherited gzip compression API from spdylay codebase.  In spdylay,
the cost of having such API is almost free because spdylay requires
zlib for header compression.  nghttp2 no longer uses gzip to header
compression.  zlib dependency exists just for gzip compression API,
which is not an essential.  So we decided to move gzip code to under
src and remove zlib dependency from libnghttp2 itself.  As nghttp2
package, we depend on zlib to compile tools under src.
2014-05-06 23:10:50 +09:00
Tatsuhiro Tsujikawa 704f362804 nghttp2.h: Use hex style flag definition 2014-05-06 18:49:24 +09:00
Tatsuhiro Tsujikawa e2535df505 Code cleanup 2014-05-06 18:39:04 +09:00
Tatsuhiro Tsujikawa f207089604 Update doc 2014-05-06 18:34:48 +09:00
Tatsuhiro Tsujikawa 7b7b0ebcca Update doc 2014-05-06 18:08:41 +09:00
Tatsuhiro Tsujikawa 8289943a58 nghttp2_frame: Add assertion to available buffer size in first buffer 2014-05-06 18:06:46 +09:00
Tatsuhiro Tsujikawa 56d6784d8d nghttp2_frame: Return NGHTTP2_ERR_FRAME_SIZE_ERROR instead of .._BUFFER_ERROR
Also updates docs
2014-05-06 18:02:26 +09:00
Tatsuhiro Tsujikawa 9125499dd0 src: Implement per-frame DATA compression
Currently, nghttpd server only compresses files whose extensions are
one of .html, .js, .css and .txt.  nghttp advertises its support of
per-frame compression in SETTINGS frame.  To implement this feature,
we added 2 public API: nghttp2_session_get_remote_settings() and
nghttp2_gzip_inflate_finished().
2014-05-03 00:02:17 +09:00
Tatsuhiro Tsujikawa 3fc1d2dfaa Merge branch 'gcc' of https://github.com/alagoutte/nghttp2 into alagoutte-gcc 2014-05-01 10:29:40 +09:00
Tatsuhiro Tsujikawa 855f39743a Fix crash when indexed repr index=0 2014-05-01 09:06:54 +09:00
Tatsuhiro Tsujikawa 3c431da6aa Fix bug that server treats reception of ENABLE_PUSH=0 as connection error 2014-05-01 08:38:28 +09:00
Alexis La Goutte 33a6851abe Fix GCC build with -Werror
nghttp2_session.c:1615:9: error: C++ style comments are not allowed in ISO C90 [-Werror]
2014-04-30 17:09:06 +02:00
Alexis La Goutte 763cdc3499 Fix GCC when use -Wpedantic
nghttp2_stream.h:94:43: error: comma at end of enumerator list [-Werror=pedantic]
2014-04-30 17:09:05 +02:00
Alexis La Goutte 0f5c28ac46 Fix GCC when use -Wpedantic
nghttp2_hd.h:115:30: error: comma at end of enumerator list [-Werror=pedantic]
2014-04-30 17:09:05 +02:00
Alexis La Goutte 941236948f Fix GCC when use -Wpedantic
nghttp2_int.h:50:33: error: comma at end of enumerator list [-Werror=pedantic]
2014-04-30 17:09:05 +02:00
Tatsuhiro Tsujikawa 660c536275 Extend namelen and valuelen in nghttp2_nv to size_t 2014-04-30 23:08:34 +09:00
Tatsuhiro Tsujikawa 52b74144ee Fix 0 size malloc, part 2 2014-04-30 22:40:43 +09:00
Tatsuhiro Tsujikawa 1b79114d2d Fix compiler warnings 2014-04-30 22:16:21 +09:00
Tatsuhiro Tsujikawa ab634853df Fix 0 size malloc 2014-04-30 22:09:02 +09:00
Tatsuhiro Tsujikawa d2e64317ba Code cleanup, include nghttp2_int.h explicitly to ensure debug macro 2014-04-30 22:08:32 +09:00
Alexis La Goutte b2f07b1d8c Fix Dead Store (Dead assignement/Dead increment) warning found by Clang Analyzer 2014-04-30 22:06:42 +09:00
Alexis La Goutte eff5c7d0d0 Fix Dead Store (Dead assignement/Dead increment) warning found by Clang Analyzer 2014-04-30 22:06:42 +09:00
Alexis La Goutte e00b8f1f73 Fix Dead Store (Dead assignement/Dead increment) warning found by Clang Analyzer 2014-04-30 22:06:42 +09:00