Commit Graph

771 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa 3b4aedd566 Add HPACK decoder public API 2014-04-29 15:53:46 +09:00
Tatsuhiro Tsujikawa 8c5db539b3 Change NGHTTP2_MAX_HEADER_TABLE_SIZE to 256MiB 2014-04-28 22:50:43 +09:00
Tatsuhiro Tsujikawa 6d5f402380 Add nghttp2_adjust_priority_callback
Callback function invoked to adjust priority value for request
HEADERS.

Since the application doesn’t know stream ID when it submits
requests, it may not be able to add correct priority value to HEADERS
frame and forced to use follwing PRIORITY frame. The purpose of this
callback is give the chance to the application to adjust priority
value with the latest information it has just before transmission so
that correct priority is included in HEADERS frame and it doesn’t
have to send additional PRIORITY frame.
2014-04-27 14:48:43 +09:00
Tatsuhiro Tsujikawa cc7929bdcc Fix possible SIGFPE 2014-04-27 14:40:10 +09:00
Tatsuhiro Tsujikawa 59e42c1c69 Update doc 2014-04-25 01:39:40 +09:00
Tatsuhiro Tsujikawa d49733a5c9 Declare h2-12 for now 2014-04-25 01:33:29 +09:00
Tatsuhiro Tsujikawa 052be3296c Implement compressed DATA
The library interface supports compressed DATA.  The library does not
deflate nor inflate data payload.  When sending data, an application
has to compress data and set NGHTTP2_DATA_FLAG_COMPRESSED to
data_flags parameter in nghttp2_data_source_read_callback.  On
receiving, flags parameter in nghttp2_on_data_chunk_recv_callback
includes NGHTTP2_FLAG_COMPRESSED.  An application should check the
flags and inflate data as necessary.  Since compression context is per
frame, when DATA is seen in nghttp2_on_frame_recv_callback, an
application should reset compression context.
2014-04-25 01:27:18 +09:00
Tatsuhiro Tsujikawa 6bb410d603 Implement BLOCKED frame 2014-04-25 00:38:24 +09:00
Tatsuhiro Tsujikawa 2d4b92fc2b Merge branch 'priority' 2014-04-24 23:48:37 +09:00
Tatsuhiro Tsujikawa ee26469cd9 Handle circular dependency
Handle the situation if a stream is told to depend on its descendant.
This is what
http://tools.ietf.org/html/draft-ietf-httpbis-http2-12#section-5.3.3
says.
2014-04-24 23:44:34 +09:00
Tatsuhiro Tsujikawa 853c9888d9 Distribute effective weight among only streams with marked as top
If stream with dpri value of no_data, we check any its descendant has
stream with dpri value of top.  If so, we have to distribute of its
portion of weight to its descendants.
2014-04-24 23:37:40 +09:00
Tatsuhiro Tsujikawa 5aa0a0d099 Check protocol length so that scanner don't overrun buffer 2014-04-22 23:20:33 +09:00
Tatsuhiro Tsujikawa aa4d43f31e Allow exclusive dependency to stream 0 2014-04-17 21:18:18 +09:00
Tatsuhiro Tsujikawa ac86b51e37 Implement simplified dependency based priority 2014-04-15 22:55:07 +09:00
Tatsuhiro Tsujikawa 27a91fc30e Allow NGHTTP2_PRIORITY_TYPE_NONE in nghttp2_submit_{request,headers} 2014-04-10 23:29:56 +09:00
Tatsuhiro Tsujikawa ece6521d26 Check stream availability when sending ALTSVC with stream_id != 0 2014-04-10 23:27:10 +09:00
Tatsuhiro Tsujikawa 792938d410 Update doc 2014-04-09 00:16:04 +09:00
Tatsuhiro Tsujikawa 9b3d5a8be5 Harden check for submit functions
nghttp2_submit_{headers,request}: Return NGHTTP2_ERR_INVAILD_ARGUMENT
if pri_spec->type is invalid.

nghttp2_submit_push_promise: Return NGHTTP2_ERR_PROTO if issued by
client.

nghttp2_submit_altsvc: Return NGHTTP2_ERR_PROTO instead of
NGHTTP2_ERR_INVALID_STATE if issued by client.
2014-04-09 00:13:11 +09:00
Tatsuhiro Tsujikawa 7563839756 Update doc 2014-04-06 21:13:44 +09:00
Tatsuhiro Tsujikawa ffcbffc28b Revert f763d76110 2014-04-06 17:56:48 +09:00
Tatsuhiro Tsujikawa 1aa69e334d Fix compile error on 32-bit systems 2014-04-06 17:34:44 +09:00
Tatsuhiro Tsujikawa f763d76110 Revert NGHTTP2_DATA_PAYLOADLEN to 4086 2014-04-05 23:42:37 +09:00
Tatsuhiro Tsujikawa 8f23c0c38b Name unnamed union in nghttp2_priority_spec so that we can be C90 compatible 2014-04-05 18:40:44 +09:00
Tatsuhiro Tsujikawa c1060f0d48 Announce h2-11 2014-04-05 18:26:48 +09:00
Tatsuhiro Tsujikawa e7ad3633c7 nghttp2_data_source_read_callback: Replace eof with uint32_t *data_flags
Replace int *eof with uint32_t *data_flags so that we can easily
extend functionality if we have to (but we don't do if possible).
2014-04-05 17:59:24 +09:00
Tatsuhiro Tsujikawa 124da7720f Fix compile error 2014-04-05 17:45:06 +09:00
Tatsuhiro Tsujikawa d668d2448b Hide session option from public API
To make adding new option easier, we decided to make the details of
option struct private and hide it from public API.  We provide
functions to set individual option value.
2014-04-04 21:57:47 +09:00
Tatsuhiro Tsujikawa 21ab2f135b Connection error if client changes SETTINGS_ENABLE_PUSH to nonzero 2014-04-04 20:36:09 +09:00
Tatsuhiro Tsujikawa 1e38ceb1cd Allow empty SETTINGS in upgrade 2014-04-04 20:23:46 +09:00
Tatsuhiro Tsujikawa 5d80d18f31 Cosmetic change 2014-04-03 16:06:03 +09:00
Tatsuhiro Tsujikawa 37e1626478 Update doc 2014-04-03 16:01:30 +09:00
Tatsuhiro Tsujikawa 6cddfaf263 nghttp2_stream_resume_deferred_data: Call stream_update_dep_on_attach_data
.. instead of nghttp2_stream_attach_data() internal API
2014-04-03 15:52:21 +09:00
Tatsuhiro Tsujikawa ac2a8ef4a2 Fix bug that transfer stuck when stream marked as top is deferred 2014-04-03 15:48:51 +09:00
Tatsuhiro Tsujikawa b1edb1f3ae Don't index name/value pair bearing NO_INDEX flag when forwarding it 2014-04-03 11:22:11 +09:00
Tatsuhiro Tsujikawa c53c1dc669 nghttp2_session_resume_data: Return error if no deferred data exist 2014-04-03 00:01:35 +09:00
Tatsuhiro Tsujikawa 580a19e097 nghttp2_stream_detach_deferred_data -> nghttp2_stream_resume_deferred_data 2014-04-02 22:58:06 +09:00
Tatsuhiro Tsujikawa ef40879b5f Refactor nghttp2_stream
Combine deferred_data and data into data_item and merge deferred_flags
into flags.
2014-04-02 22:55:49 +09:00
Tatsuhiro Tsujikawa 2685e3405f Rename NGHTTP2_DATA_PAYLOAD_LENGTH as NGHTTP2_DATA_PAYLOADLEN 2014-04-02 20:35:07 +09:00
Tatsuhiro Tsujikawa 9c4c99bf96 Adjust transmission frame buffer size to support maximum payload size 2014-04-02 20:33:01 +09:00
Tatsuhiro Tsujikawa c9f90924a9 Add flags parameter to nghttp2_on_header_callback 2014-04-02 02:10:35 +09:00
Tatsuhiro Tsujikawa e5b0303481 Update huffman codes 2014-04-02 01:44:39 +09:00
Tatsuhiro Tsujikawa b1722cbe28 Update static table 2014-04-02 01:30:50 +09:00
Tatsuhiro Tsujikawa 7877b676e3 Honor NGHTTP2_NV_FLAG_NO_INDEX in deflater and inflater 2014-04-02 01:25:44 +09:00
Tatsuhiro Tsujikawa c55df4a30b Fix compile error with --enable-werror 2014-04-02 01:18:27 +09:00
Tatsuhiro Tsujikawa 24cb90806d Add flags to nghttp2_nv structure
This is preliminary change for upcoming HPACK updates.  The flags are
used to determine the name/value pair is indexable or not.
2014-04-01 23:17:50 +09:00
Tatsuhiro Tsujikawa da5db205ca Make group weight range [1, 256], inclusive
We do -+1 on serialization and deserialization since the field is 1
byte.  This change also parameterized range so that we can change it
easily.
2014-04-01 22:54:20 +09:00
Tatsuhiro Tsujikawa f2d945734e Rename framebuflen as framerv, cause it is not a length 2014-04-01 21:59:26 +09:00
Tatsuhiro Tsujikawa f5ead55f0e Check payload length when submitting GOAWAY and ALTSVC 2014-04-01 21:55:29 +09:00
Tatsuhiro Tsujikawa f785e56dba Implement ALTSVC frame 2014-04-01 21:47:51 +09:00
Tatsuhiro Tsujikawa 6afb7442b5 Adjust weight when pushing data to queue 2014-03-31 23:01:05 +09:00
Tatsuhiro Tsujikawa b85e2ab7f7 Share stream_group weight among streams marked as top 2014-03-31 22:51:33 +09:00
Tatsuhiro Tsujikawa 34581d830d Define NGHTTP2_CLEARTEXT_PROTO_VERSION_ID
This identifier string is used if HTTP/2 is used over cleartext TCP.
2014-03-30 21:30:47 +09:00
Tatsuhiro Tsujikawa 60a2c260a5 Define NGHTTP2_CLIENT_CONNECTION_PREFACE macro
NGHTTP2_CLIENT_CONNECTION_PREFACE has the same content with
NGHTTP2_CLIENT_CONNECTION_HEADER, which is now obsoleted by
NGHTTP2_CLIENT_CONNECTION_PREFACE.
2014-03-30 21:02:25 +09:00
Tatsuhiro Tsujikawa ab2dc5967d Replace HTTP/2.0 with HTTP/2 2014-03-30 19:26:37 +09:00
Tatsuhiro Tsujikawa 705051ceb7 Update doc 2014-03-30 19:00:42 +09:00
Tatsuhiro Tsujikawa d3962becf4 Ignore priority request if resultant tree has cycle 2014-03-30 18:48:32 +09:00
Tatsuhiro Tsujikawa 21d5986157 Fail nghttp2_submit_settings if there is pending SETTINGS frame in-flight
pending_local_max_concurrent_stream is now set in
nghttp2_session_add_settings, rather than after frame was sent.
2014-03-30 18:07:52 +09:00
Tatsuhiro Tsujikawa 74daa16a1c Retain incoming closed streams for dependency tree
The number of closed stream to keep is limited by
MAX_CONCURRENT_STREAMS - current active stream.
2014-03-30 17:41:54 +09:00
Tatsuhiro Tsujikawa a9d97d9d35 Update doc 2014-03-30 01:34:13 +09:00
Tatsuhiro Tsujikawa c12b6bc360 Call on_stream_close_callback for a stream in reserved state
This is useful because application may allocate resources for it and
wants to free the resources if they are not used anymore.
2014-03-30 01:24:16 +09:00
Tatsuhiro Tsujikawa 58da463ad6 Make deflater bad state if parsing HEADERS/PUSH_PROMISE failed 2014-03-30 01:24:16 +09:00
Tatsuhiro Tsujikawa 36c8de9da5 Limit the number of streams in one dependency tree 2014-03-30 01:24:16 +09:00
Tatsuhiro Tsujikawa f7162ab702 Implement dependency based priority 2014-03-30 01:24:16 +09:00
Tatsuhiro Tsujikawa dbb82b0f9c Make opaque_data parameter in nghttp2_submit_goaway const 2014-03-22 19:05:58 +09:00
Tatsuhiro Tsujikawa e1eebf08fb Support DEBUG_DATA in GOAWAY again 2014-03-22 18:59:59 +09:00
Tatsuhiro Tsujikawa 01586f473d Wrap small inbound buffer by nghttp_buf 2014-03-22 18:27:38 +09:00
Tatsuhiro Tsujikawa 3c631b5625 Code cleanup 2014-03-22 17:16:25 +09:00
Tatsuhiro Tsujikawa 774cf88f68 Don't add RST_STREAM frame if stream is in NGHTTP2_STREAM_CLOSING 2014-03-22 00:51:40 +09:00
Tatsuhiro Tsujikawa 1dfe2f8670 Add nghttp2_session_get_stream_remote_window_size public API function 2014-03-22 00:34:25 +09:00
Tatsuhiro Tsujikawa d0fbbe6932 Less cryptic debug message 2014-03-20 00:27:39 +09:00
Tatsuhiro Tsujikawa c945d4ebbe Fix compile error with --enable-debug 2014-03-19 23:24:46 +09:00
Tatsuhiro Tsujikawa 68b392817b nghttp2_bufs: Add chunk_keep to specify the number of buffers to keep on reset 2014-03-16 21:38:13 +09:00
Tatsuhiro Tsujikawa 5b81f7c713 Don't show PAD_HIGH and PAD_LOW flags to user callback 2014-03-14 21:53:03 +09:00
Tatsuhiro Tsujikawa 2ec4b10805 Add nghttp2_buf tests 2014-03-14 21:40:14 +09:00
Tatsuhiro Tsujikawa 781d1a2b70 Code cleanup 2014-03-14 02:23:50 +09:00
Tatsuhiro Tsujikawa 142b433533 nghttp2_hd: Treat prematurely ended compressed header block as error properly 2014-03-14 00:52:44 +09:00
Tatsuhiro Tsujikawa 344d663e90 deflate_hd: Fix mishandled error return from emit_indexed_block 2014-03-14 00:25:03 +09:00
Tatsuhiro Tsujikawa d48eca60cf Fix broken nghttp2_bufs_avail 2014-03-14 00:24:34 +09:00
Tatsuhiro Tsujikawa aefc0d1ebb Use calloc instead of malloc + memset; remove useless memset 2014-03-13 23:27:14 +09:00
Tatsuhiro Tsujikawa 1be8d1b797 inflate_header_block: Issue RST_STREAM if header decompression failed 2014-03-13 23:02:33 +09:00
Tatsuhiro Tsujikawa 0fa4779d38 Don't call on_frame_recv_callback after stream close or being closed 2014-03-13 22:49:37 +09:00
Tatsuhiro Tsujikawa d07bb1ddff Rework outbound frame buffers 2014-03-13 22:11:02 +09:00
Tatsuhiro Tsujikawa 0666a73e10 Remove nghttp2_buffer 2014-03-11 21:20:51 +09:00
Tatsuhiro Tsujikawa 3f56c938d8 nghttp2_hd: Use nghttp2_bufs, avoiding realloc() 2014-03-11 21:18:28 +09:00
Tatsuhiro Tsujikawa 7b2d585896 Return 0 if nghttp2_session_prep_frame succeeds rather than frame length 2014-03-11 02:15:05 +09:00
Tatsuhiro Tsujikawa 74f899fc01 Replace NGHTTP2_MAX_FRAME_LENGTH with NGHTTP2_MAX_PAYLOADLEN 2014-03-11 02:01:08 +09:00
Tatsuhiro Tsujikawa e803c6b65e Replace NGHTTP2_FRAME_HEAD_LENGTH with NGHTTP2_FRAME_HDLEN 2014-03-11 01:55:42 +09:00
Tatsuhiro Tsujikawa 358b4386d3 Introduce nghttp2_buf to ease buffer management 2014-03-11 01:47:38 +09:00
Tatsuhiro Tsujikawa 54dab50015 Support END_SEGMENT in nghttp2_submit_data() 2014-03-06 00:19:02 +09:00
Tatsuhiro Tsujikawa b60679808b Filter supported flags in received frame 2014-03-05 23:25:42 +09:00
Tatsuhiro Tsujikawa 547d6d1fb5 Use 4086 as max DATA payload size to make DATA frame fit into 4K buffer 2014-03-05 22:48:17 +09:00
Tatsuhiro Tsujikawa 79c5032708 nghttp2_hd: Fix crash with multiple threads execution 2014-03-03 00:53:04 +09:00
Tatsuhiro Tsujikawa 979feaecc6 Mitigate heap fragmentation when lots of concurrent http2 sessions run 2014-03-02 16:34:23 +09:00
Tatsuhiro Tsujikawa 1fee4fd2df nghttp2_hd: Fail inflate immediately if ctx.bad is nonzero
Doing inflation after error produces invalid results, especially, if
it is in NGHTTP2_HD_STATE_READ_INDEX, the inflater->left could be 0,
which causes assertion error.  Add sanity assertion for index
2014-02-26 23:20:52 +09:00
Tatsuhiro Tsujikawa 18357512ed nghttp2_hd: Fix integer decoding bug 2014-02-26 21:44:48 +09:00
Tatsuhiro Tsujikawa d1c1deaf03 Add promised_stream_user_data parameter to nghttp2_submit_push_promise
This is very useful to associate application specific data to promised
stream.

nghttp2_nv_array_copy now does not complain the header field is large.
2014-02-25 00:26:12 +09:00
Tatsuhiro Tsujikawa 5e88be0b2c Update doc 2014-02-21 21:29:23 +09:00
Tatsuhiro Tsujikawa fc25143418 Remove END_PUSH_PROMISE in favor of END_HEADERS 2014-02-21 21:23:51 +09:00
Tatsuhiro Tsujikawa 9703c5de5c Code cleanup 2014-02-20 23:12:42 +09:00
Tatsuhiro Tsujikawa 3395f7158f Strict handling of max concurrent streams
Exceeding ACKed max concurrent streams results in connection error.
This change fixes the bug that num_{incoming,outgoing}_streams
is decremented wrongly if a stream is in reserved state and
RST_STREAM is send and its state is changed to NGHTTP2_STREAM_CLOSING.
This change also fixes the bug that transmission of push response
HEADERS does not increase num_outgoing_streams.
2014-02-20 23:10:32 +09:00