Commit Graph

490 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa e453759637 Add nghttp2_option_set_no_auto_ping_ack() option
This option prevents the nghttp2 library from sending PING frame with
ACK flag set in the reply to incoming PING frame.  To allow the
application to send PING with ACK flag set, nghttp2_submit_ping() now
recognizes NGHTTP2_FLAG_PING in its flags parameter.
2016-02-29 23:39:50 +09:00
Tatsuhiro Tsujikawa 40c1b29f36 Handle extension frame in session_inbound_frame_reset 2016-02-25 21:18:59 +09:00
Tatsuhiro Tsujikawa 56bdfd1df2 Revert "Handle extension frame in session_inbound_frame_reset"
This reverts commit dbffb8995b.
2016-02-25 00:58:24 +09:00
Tatsuhiro Tsujikawa dbffb8995b Handle extension frame in session_inbound_frame_reset 2016-02-25 00:45:24 +09:00
Tatsuhiro Tsujikawa 827abb57e9 Simplified bitfield calculation of extension frame 2016-02-24 23:59:01 +09:00
Tatsuhiro Tsujikawa 34bf153653 Merge branch 'master' into simple-extensions 2016-02-24 23:21:03 +09:00
Tatsuhiro Tsujikawa 3e72711e23 Cap 100 limit for remembering idle streams 2016-02-23 01:09:45 +09:00
Tatsuhiro Tsujikawa 61dda40b44 Don't pass NULL to memcpy 2016-02-12 22:31:47 +09:00
Tatsuhiro Tsujikawa 304ff6a6f9 Don't send extension frame in closing state 2016-02-07 21:12:36 +09:00
Tatsuhiro Tsujikawa fc39f2d9d2 Merge branch 'master' into simple-extensions 2016-02-07 21:09:08 +09:00
Tatsuhiro Tsujikawa 4c05558273 Evaluate nghttp2_session_want_read and nghttp2_session_want_write when determining session is about to close 2016-02-03 00:25:11 +09:00
Tatsuhiro Tsujikawa 4a78f59e7b Rename nghttp2_session.sent_stream_id as last_sent_stream_id
This is more accurate, and there is symmetric relation between
last_sent_stream_id and last_recv_stream_id, which is bettern fit in
my sense.
2016-01-23 14:47:39 +09:00
Tatsuhiro Tsujikawa 4ceb9fd767 Cancel stream if flow control window gets overflow
Previously, we did terminate session, but it did not actually cancel
streams.  Now we just cancel streams in this case.
2016-01-23 00:24:12 +09:00
Tatsuhiro Tsujikawa 15ea11d5db Fix bug that HTTP upgrade was not working 2016-01-12 21:05:05 +09:00
Tatsuhiro Tsujikawa e14da859b6 Merge branch 'master' into simple-extensions 2016-01-11 16:39:35 +09:00
Tatsuhiro Tsujikawa 9cea986819 Strict outgoing idle stream detection
Previously, we use session->next_stream_id to detect that given stream
ID was idle or not.  But this was suboptimal, since it was updated
when stream ID was assigned, and it did not necessarily mean that it
actually has been sent to the peer.  Now we introduced
session->sent_stream_id, which only updated when HEADERS/PUSH_PROMISE
has sent.  Using sent_stream_id instead of next_stream_id tightens
idle stream detection, and misbehaved peer which sends frame with
stream ID that has not been generated.

This commit also overhauls test code which involves opening streams.
Now we have some wrapper functions for nghttp2_session_open_stream()
which also take care of updating next_stream_id and
last_recv_stream_id.  They are crucial for some tests.
2016-01-11 00:31:52 +09:00
Tatsuhiro Tsujikawa 0caefe20ef Merge branch 'master' into simple-extensions 2016-01-09 19:08:28 +09:00
kumagi f3a37b2ef1 fix typos: heder->header alreay->already reponse->response 2016-01-05 22:19:33 +09:00
Tatsuhiro Tsujikawa 894c1bd02e Create idle stream on client side
With the presence of idle stream related API (e.g.,
nghttp2_create_idle_stream()), it is more predictable for client to
create idle streams with its dependency to another idle stream.
Previously, we didn't create complete parent idle stream in this case.
Now we create idle streams as we do on server side.
2015-12-25 00:10:37 +09:00
Tatsuhiro Tsujikawa 92a56d034f Fix bug that idle/closed stream may be destroyed while it is referenced 2015-12-23 16:38:30 +09:00
Tatsuhiro Tsujikawa ca4a40b8e0 Don't schedule response HEADERS with priority tree
Previously we scheduled the transmission of response HEADERS using
priority tree in the belief that it allows more better utilization of
bandwidth for prioritized streams.  But to reduce the overhead of
reconstruction of priority queue when connection level flow control
window is depleted, we just don't check priority tree in this case.
This means that response HEADERS frames are not sent even though they
are not flow controlled.  This could waste bandwidth.  To improve this
situation, we stop scheduling response HEADERS with priority tree for
now.  Now they are just sent in the order they submitted.  The
response body DATA continued to be scheduled with priority tree as
before.
2015-12-21 21:33:58 +09:00
Tatsuhiro Tsujikawa cb73ba948d Simplify HEADERS handling; handle push response in one function 2015-12-20 23:47:16 +09:00
Tatsuhiro Tsujikawa e957147249 Make obvious implementation error connection error 2015-12-20 23:29:24 +09:00
Tatsuhiro Tsujikawa 010726a875 Simplify error handling in nghttp2_session_on_headers_received
return session_inflate_handle_invalid_stream(...) case is for streams
for INITIAL state, but this is rare case.  In general, we'd like to
reduce RST_STREAM transmission, and it is suffice to ignore this frame
for now.
2015-12-20 23:20:14 +09:00
Tatsuhiro Tsujikawa 19146211d7 Update doc 2015-12-20 13:20:21 +09:00
Tatsuhiro Tsujikawa 9f0083309e Fix strange use of session_detect_idle_stream 2015-12-20 13:19:29 +09:00
Tatsuhiro Tsujikawa 80f7abb565 Fix crash caused by the regression in 9f8fc7b2bb 2015-12-17 22:25:28 +09:00
Tatsuhiro Tsujikawa 9f8fc7b2bb Strict error handling for frames which are not allowed after closed (remote)
This makes h2spec strict mode a bit happier.  We still one failing
test with h2spec -S (strict mode).
2015-12-17 21:31:20 +09:00
Tatsuhiro Tsujikawa 9cfda0c070 Update doc 2015-12-17 18:04:16 +09:00
Tatsuhiro Tsujikawa 68c5deea5a Clarify the condition when opening new stream from remote is allowed 2015-12-11 21:23:49 +09:00
Tatsuhiro Tsujikawa f14ac74316 At least check stream ID is valid when PUSH_PROMISE is received in goaway mode 2015-12-10 23:54:54 +09:00
Tatsuhiro Tsujikawa 0c70ff5658 Simplify 2015-12-10 23:18:02 +09:00
Tatsuhiro Tsujikawa 4bcc14fc67 Reschedule stream when only weight is changed
Previously, we only updated stream's weight field when only weight was
changed by PRIORITY frame.  If stream is queued, it would be better to
actually reschedule it based on new weight.  This could be especially
useful if weight is increased.
2015-12-07 23:14:22 +09:00
Tatsuhiro Tsujikawa 9c84f60ba0 Merge branch 'master' into simple-extensions 2015-12-04 23:48:40 +09:00
Tatsuhiro Tsujikawa a151a44caf Set max number of outgoing concurrent streams to 100 by default
Instead of using nonsensical large value for max outgoing concurrent
streams, use more sensible value, 100.
2015-12-03 23:45:03 +09:00
Tatsuhiro Tsujikawa 93d8636fb0 Keep incoming streams only at server side
We should only keep incoming closed streams because we only keep at
most max concurrent streams, which only applied to incoming streams.
2015-12-03 22:48:41 +09:00
Tatsuhiro Tsujikawa 2288ee8060 Create stream object for pushed resource during nghttp2_submit_push_promise()
Previously, stream object for pushed resource was not created during
nghttp2_submit_push_promise().  It was created just before
nghttp2_before_frame_send_callback was called for that PUSH_PROMISE
frame.  This means that application could not call
nghttp2_submit_response for the pushed resource before
nghttp2_before_frame_send_callback was called.  This could be solved
by callback chaining, but for web server with back pressure from
backend stream, it is a bit unnecessarily hard to use.

This commit changes nghttp2_submit_push_promise() behaviour so that
stream object is created during that call.  It makes application call
nghttp2_submit_response right after successful
nghttp2_submit_push_promise call.
2015-12-02 21:16:30 +09:00
Tatsuhiro Tsujikawa 12b2e0a2b3 Add nghttp2_session_create_idle_stream() API
See GH-436
2015-11-28 15:23:44 +09:00
Tatsuhiro Tsujikawa aacac613af Assert dep_stream is non-null to shut up scan-build 2015-11-28 00:50:29 +09:00
Tatsuhiro Tsujikawa a70445e122 Retain stream in reserved state on client side
Application may use it using nghttp2_stream_* functions, and traverse
its dependency.
2015-11-27 22:54:55 +09:00
Tatsuhiro Tsujikawa f23e34fa3c Handle response in nghttp2_on_begin_frame_callback
Previously, nghttp2_session_end_request_headers_received assumes
stream is still writable (in other words, local endpoint has not sent
END_STREAM).  But this assumption is false, because application can
send response in nghttp2_on_begin_frame_callback.  Probably, this
assumption was made before the callback was introduced.  This commit
addresses this issue.  Since all
nghttp2_session_end_*_headers_received functions are identical, we
refactored them into one function.
2015-11-27 22:50:13 +09:00
Tatsuhiro Tsujikawa 3d1d54e2ce Remove dead code 2015-11-27 21:13:44 +09:00
Tatsuhiro Tsujikawa b08d5b1975 Explicitly treat stream_id 0 as error in nghttp2_session_change_stream_priority 2015-11-24 22:34:36 +09:00
Tatsuhiro Tsujikawa b53b1381b7 Fix bug that nghttp2_session_find_stream(session, 0) returned NULL
Previously, nghttp2_session_find_stream(session, 0) returned NULL
despite the fact that documentation said that it should return root
stream.  Now it is corrected, and it returns root stream as
documented.
2015-11-24 22:30:12 +09:00
Tatsuhiro Tsujikawa 8f970dec0e Update doc 2015-11-23 21:05:25 +09:00
Tatsuhiro Tsujikawa aa317c89ea Add API to change stream priority without sending PRIORITY frame
The added API is nghttp2_session_change_stream_priority().  This
provides the same functionality to re-prioritize stream when PRIORITY
frame.  is received, but we do it without PRIORITY frame.  This could
be useful for server to change pushed stream's priority silently.
2015-11-21 18:32:42 +09:00
Tatsuhiro Tsujikawa 63a50b1ccf Add nghttp2_session_check_server_session() API
This is very simple API, and it returns nonzero if session is
initialized as server.
2015-11-21 15:07:55 +09:00
Tatsuhiro Tsujikawa d7b0768ab8 Fix bug that dep_stream->sum_dep_weight was not updated 2015-11-20 21:24:54 +09:00
Tatsuhiro Tsujikawa 3bbb05f59b Optimize the case when only weight is changed 2015-11-20 00:19:02 +09:00
Tatsuhiro Tsujikawa 83cc2511e3 Remove flags parameter from nghttp2_pack_extension_callback
It has no usecase at the moment.  It is most likely that applications
know the flags when it submitted extension frame, no need to modify it
later.  Possibly feature bloat.
2015-11-17 21:29:21 +09:00