Commit Graph

62 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa b8a2bf2675 Remove END_SEGMENT flag 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 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 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 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 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 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 19729962a3 Check stream_id is nonzero for DATA, HEADERS, PRIORITY, RST_STREAM, PUSH_PROMISE 2014-06-07 18:48:37 +09:00
Tatsuhiro Tsujikawa 3ebb3faf32 Remove nghttp2_ prefix from static function, part 2 2014-05-08 23:54:07 +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
Alexis La Goutte b2f07b1d8c Fix Dead Store (Dead assignement/Dead increment) warning found by Clang Analyzer 2014-04-30 22:06:42 +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 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 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 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 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 ab2dc5967d Replace HTTP/2.0 with HTTP/2 2014-03-30 19:26:37 +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 54dab50015 Support END_SEGMENT in nghttp2_submit_data() 2014-03-06 00:19:02 +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 fc25143418 Remove END_PUSH_PROMISE in favor of END_HEADERS 2014-02-21 21:23:51 +09:00
Tatsuhiro Tsujikawa 4ced1c1622 Code cleanup 2014-02-19 01:08:52 +09:00
Tatsuhiro Tsujikawa 62b73133e5 Code cleanup 2014-02-15 18:56:20 +09:00
Tatsuhiro Tsujikawa 66832e9f4e Allow NGHTTP2_FLAG_END_SEGMENT in nghttp2_submit_headers() 2014-02-15 18:55:52 +09:00
Tatsuhiro Tsujikawa f26270b5b4 Change SETTINGS payload format according to the spec 2014-02-06 22:06:42 +09:00
Tatsuhiro Tsujikawa c79adf6997 Remove flow control disabling feature 2014-02-06 00:23:20 +09:00
Tatsuhiro Tsujikawa a3082b7c1e Remove nghttp2_on_data_recv_callback and nghttp2_on_data_send_callback
nghttp2_data is added to nghttp2_frame union. When DATA is
received, nghttp2_on_frame_recv_callback is called. When DATA is
sent, nghttp2_on_frame_send_callback is called.
2014-01-27 22:16:05 +09:00
Tatsuhiro Tsujikawa fc07a62337 Rename nghttp2_data as nghttp2_private_data
This is a preparation to add public nghttp2_data struct to
nghttp2_frame union.
2014-01-27 21:22:33 +09:00
Tatsuhiro Tsujikawa 2222b5ab0d Don't return NGHTTP2_ERR_STREAM_CLOSED when submitting DATA, PRIORITY, WU
Remove the check to see that stream exists at the time when submitting
DATA, PRIORITY and WINDOW_UPDATE. We will do this check when we actually
serialize and send them off to the network (or application provided
buffer).
2014-01-18 16:19:28 +09:00
Tatsuhiro Tsujikawa 707a0b4103 Move name/value validation functions to src
nghttp2 library itself now accept octet header/value pairs,
completely not restricted by HTTP/1 header name/value rule.
The applications may impose restriction about them using
validators.
2014-01-17 02:16:53 +09:00
Tatsuhiro Tsujikawa a85a11c1d9 Update priority for the stream to get response only 2014-01-09 23:30:45 +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 6c77cec270 Remove nghttp2_submit_* API functions which has char **nv parameter
The nghttp2_submit_{request,response}2 functions are renamed as
nghttp2_submit_{request, response}.
2013-12-08 21:39:43 +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 2a83fc7559 Add nghttp2_submit_response2 2013-11-28 21:35:48 +09:00
Tatsuhiro Tsujikawa ad64f11a95 Remove code submitting WINDOW_UPDATE with negative delta
It is effectively dead code because we should have already submit
WINDOW_UPDATE before this case happens.
2013-10-30 23:43:40 +09:00
Tatsuhiro Tsujikawa a46ccdb144 Apply initiated SETTINGS changes on reception of ACK 2013-10-27 19:22:51 +09:00
Tatsuhiro Tsujikawa 896db5b24f API change: Add flags parameter to all submit_* functions
The nghttp2_submit_{request,response} family do not get this change.
2013-10-25 22:50:24 +09:00
Tatsuhiro Tsujikawa e85418f045 Fix local window size adjustments
Now shrinking local window size properly limits the amount of
WINDOW_UPDATE value so that shrinked window is honored.
2013-10-12 17:02:37 +09:00
Tatsuhiro Tsujikawa 94263216fb Add nghttp2_submit_request2
This function is similar to nghttp2_submit_request and the
difference is it takes an array of nghttp2_nv as name/value pairs.
It is useful if name/value pairs is not NULL-terminated in the
application code.
2013-09-11 00:55:35 +09:00
Tatsuhiro Tsujikawa 98273b7db1 nghttp2_pack_settings_payload: Make iv const
The reordering iv in the comment is no longer applied to the current
code base, therefore it is removed and iv is made to const pointer.
2013-09-09 21:30:39 +09:00
Daniel Stenberg a1c3f89c72 nghttp2_pack_settings_payload: added a buffer size argument
To make it less likely that a user gets a buffer overflow if a
too small buffer is used.
2013-09-09 21:22:27 +09:00
Tatsuhiro Tsujikawa c751a6e935 Fix cosmetic errors 2013-09-07 16:38:21 +09:00
Tatsuhiro Tsujikawa 0c9703fa2c Remove NGHTTP2_FLAG_END_FLOW_CONTROL 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa b1ae1c30d8 Allow duplicate settings ID in SETTINGS
If multiple same ID are found, use the last one.
2013-08-23 03:33:05 +09:00