Commit Graph

1177 Commits

Author SHA1 Message Date
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
4db3828fa6 Reset last_writelen to 0 when stream is removed from tree
When stream is removed from tree, stream is either closed, or its
remote flow control window is depleted.  In the latter case, we
schedule this stream as fast as possible if its remote window gets
positive, since it did not sent anything in its turn.  To achieve
this, reset last_writelen to 0 when stream is removed from tree.
2015-11-20 00:19:17 +09:00
Tatsuhiro Tsujikawa
3bbb05f59b Optimize the case when only weight is changed 2015-11-20 00:19:02 +09:00
Tatsuhiro Tsujikawa
b95a3c4b28 Consider to use CANCEL error code when closing streams with GOAWAY
For clients, CANCEL is more appropriate for both incoming/outgoing
streams.  For servers, CANCEL is appropriate for its pushed stream
(outgoing), but REFUSED_STREAM is more appropriate for incoming
stream.
2015-11-16 22:53:31 +09:00
Tatsuhiro Tsujikawa
b918f9650a Don't send push response if GOAWAY has been received 2015-11-16 22:47:12 +09:00
Tatsuhiro Tsujikawa
7463493259 Use error code CANCEL to reset pushed reserved stream from remote 2015-11-16 22:20:27 +09:00
Tatsuhiro Tsujikawa
c6ef1c02b9 Switch to clang-format-3.6 2015-11-13 00:53:29 +09:00
Tatsuhiro Tsujikawa
269a100081 Add nghttp2_session_upgrade2(), deprecate nghttp2_session_upgrade()
To validate actual response body length against the value declared in
content-length response header field, we first check request method.
If request method is HEAD, respose body must be 0 regardless of the
value in content-length.  nghttp2_session_upgrade() has no parameter
to indicate the request method is HEAD, so we failed to validate
response body if HEAD is used with HTTP Upgrade.  New
nghttp2_session_upgrade2() accepts new parameter to indicate that
request method is HEAD or not to fix this issue.  Although, this issue
affects client side only, we deprecate nghttp2_session_upgrade() in
favor of nghttp2_session_upgrade2() for both client and server side.
2015-11-07 16:13:06 +09:00
Tatsuhiro Tsujikawa
5e7e479c6c Workaround HTTP upgrade with HEAD request
By default, we check the length of response body matches
content-length.  For HEAD request, this is not necessarily true, so we
sniff request method, and if it is HEAD, make sure that response body
length is 0.  But this does not work for HTTP Upgrade, since
nghttp2_session_upgrade() has no parameter to tell the request method
was HEAD.  This commit disables this response body length validation
for the stream upgraded by HTTP Upgrade.  We will add new version of
nghttp2_session_upgrade with the parameter to pass the request method
information so that we can handle this situation properly.
2015-11-07 10:56:40 +09:00
Tatsuhiro Tsujikawa
dfbbb08124 Silence warning with scan-build 2015-11-06 20:07:40 +09:00
Tatsuhiro Tsujikawa
43b230685f Introduce NGHTTP2_NV_FLAG_NO_COPY_NAME and NGHTTP2_NV_FLAG_NO_COPY_VALUE 2015-11-05 22:48:30 +09:00
Tatsuhiro Tsujikawa
58d636abdb Revert 918f8cca36
For first scheduling, we might ignore weight.  This is OK since weight
is just a distribution of resource, rather than strict priority
ordering.
2015-11-02 23:38:29 +09:00
Tatsuhiro Tsujikawa
be0d0e2995 Rename nghttp2_session_request_allowed as nghttp2_session_check_request_allowed 2015-10-30 22:48:27 +09:00
Tatsuhiro Tsujikawa
41002a77d4 Remove bogus debug log 2015-10-29 23:01:02 +09:00
Tatsuhiro Tsujikawa
1c37abc0dd Add nghttp2_session_request_allowed() API function
This function is useful for the client application to know that there
is a chance that request can be sent.  If this function returns 0,
there is zero chance to make a request.

This commit also set error_code passed to
nghttp2_on_stream_close_callback to NGHTTP2_REFUSED_STREAM if request
is not sent.
2015-10-29 22:53:30 +09:00
Alexis La Goutte
b4f363ef53 Fix Value stored to 'rv' is never read found by Clang Analyzer 2015-10-26 15:22:13 +01:00
Tatsuhiro Tsujikawa
5d3d377c03 Add missing NGHTTP2_EXTERN to public functions 2015-10-25 16:51:50 +09:00
Tatsuhiro Tsujikawa
4960583637 Increase NGHTTP2_MAX_OBQ_FLOOD_ITEM to avoid false positives 2015-10-25 16:23:29 +09:00
Tatsuhiro Tsujikawa
25bf567cd7 Don't always expect dynamic table size update
The encoder is not required to send dynamic table size update if the
table size is not changed from the previous value after accepting new
maximum value.
2015-10-24 17:49:51 +09:00
Tatsuhiro Tsujikawa
5bc3dfa1cd Shrink to the minimum table size seen in local SETTINGS 2015-10-24 17:49:50 +09:00
Tatsuhiro Tsujikawa
ce74a30990 Use -fvisibility=hidden for internal functions
This will improve performance since we can avoid indirect call of
internal functions.  The downside is we now require libnghttp2 static
library to run unit tests.
2015-10-23 00:08:15 +09:00
Tatsuhiro Tsujikawa
46d7c30c17 Update doc 2015-10-21 00:18:27 +09:00
Tatsuhiro Tsujikawa
3f4b6f2b1c Clean up 2015-10-11 17:29:29 +09:00
Tatsuhiro Tsujikawa
ba08948307 Merge branch 'master' of https://github.com/alagoutte/nghttp2 into alagoutte-master 2015-10-04 22:02:47 +09:00
Alexis La Goutte
81addc77b4 Add (and fix) -Wredundant-decls 2015-10-04 14:48:32 +02:00
Tatsuhiro Tsujikawa
b1de6ca390 Update doc 2015-10-04 10:36:09 +09:00
Tatsuhiro Tsujikawa
45d4c9dece Add new error code NGHTTP2_ERR_PAUSE to send_data_callback
If application returns NGHTTP2_ERR_PAUSE from send_data_callback, it
means application processed all data, but wants to make
nghttp2_session_mem_send or nghttp2_session_send return immediately.
This is useful if application writes to fixed sized buffers, and there
is no room to write more data.
2015-10-03 17:16:42 +09:00
Tatsuhiro Tsujikawa
cea76226b1 Avoid excessive WINDOW_UPDATE queuing 2015-10-01 01:19:57 +09:00
Tatsuhiro Tsujikawa
d22ced77c0 Return fatal error if flooding is detected to close session immediately
This change adds new return error code from nghttp2_session_mem_recv
and nghttp2_session_recv functions, namely NGHTTP2_ERR_FLOODED.  It is
fatal error, and is returned when flooding was detected.
2015-09-30 22:19:03 +09:00
Tatsuhiro Tsujikawa
0cb8c82125 Detect flooding and tear down session 2015-09-30 00:44:08 +09:00
Tatsuhiro Tsujikawa
ad5d73738c Return type of nghttp2_submit_trailer is int 2015-09-29 00:06:20 +09:00
Tatsuhiro Tsujikawa
ef3e2c7764 Don't send WINDOW_UPDATE with 0 increment 2015-09-27 00:22:33 +09:00
Tatsuhiro Tsujikawa
b5427d9651 Remove unused nghttp2_memdup 2015-09-26 22:44:08 +09:00
Tatsuhiro Tsujikawa
2d5b42693d Don't expect NULL terminated name/value in nghttp2_hd_deflate_hd
If it is called through libnghttp2 internally, name/value pairs are
all NULL-terminated.  But it is one of public API, and we cannot
expect that applications always make NULL-terminated string for
name/value pairs.
2015-09-26 22:41:05 +09:00
Tatsuhiro Tsujikawa
637288359e Ignore 0 length header partial block if it is not final 2015-09-25 22:53:35 +09:00
Tatsuhiro Tsujikawa
93ba75b602 Fix bug that headers in CONTINUATION were ignored after HEADERS with padding 2015-09-25 22:28:03 +09:00
Tatsuhiro Tsujikawa
1f72648b0e Fix compile error with --enable-debug and --enable-werror 2015-09-25 22:19:18 +09:00
Tatsuhiro Tsujikawa
d804780c25 Fix compile error with Android NDK and --enable-werror 2015-09-25 01:45:28 +09:00
Tatsuhiro Tsujikawa
913b95336b Fix warning 'this decimal constant is unsigned only in ISO C90' 2015-09-25 00:03:38 +09:00
Tatsuhiro Tsujikawa
170f2a144a Fix warning with gcc 2015-09-23 18:26:02 +09:00
Tatsuhiro Tsujikawa
28fe3e7e89 More warning flags for --enable-werror 2015-09-23 16:49:45 +09:00
Tatsuhiro Tsujikawa
230b1f927f Use hash table for dynamic table lookup 2015-09-19 21:29:40 +09:00
Tatsuhiro Tsujikawa
eacd6eeed2 Check header block limit after new stream is opened 2015-09-16 00:40:31 +09:00
Tatsuhiro Tsujikawa
991352d201 Just assign stream->cycle to descendant_last_cycle 2015-09-14 22:20:08 +09:00
Tatsuhiro Tsujikawa
1bbef4be74 Avoid usage of typeof and replace __builtin_offsetof with offsetof 2015-09-10 21:27:14 +09:00
Tatsuhiro Tsujikawa
918f8cca36 Honor stream->weight even if stream->last_writelen is 0 2015-09-09 21:20:59 +09:00
Tatsuhiro Tsujikawa
22b39f0337 Revert "last_write_len must not be 0, which makes weight useless"
This reverts commit e260006182.
2015-09-09 21:16:53 +09:00
Tatsuhiro Tsujikawa
e260006182 last_write_len must not be 0, which makes weight useless 2015-09-08 02:27:59 +09:00
Tatsuhiro Tsujikawa
4cad48da16 Reset cycle to 0 if stream has only 1 direct descendant 2015-08-29 23:44:58 +09:00