Commit Graph

1484 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa 8c2386c221 Add a server option to fallback to RFC 7540 priorities
Add nghttp2_option_set_server_fallback_rfc7540_priorities.  If it is
set to nonzero, and server submits SETTINGS_NO_RFC7540_PRIORITIES = 1,
but it does not receive SETTINGS_NO_RFC7540_PRIORITIES from client,
server falls back to RFC 7540 priorities.  Only minimal set of
features are enabled in this fallback case.
2022-06-14 23:47:42 +09:00
Tatsuhiro Tsujikawa b0fbb93022 Add PRIORITY_UPDATE frame support
This commit adds PRIORITY_UPDATE frame support.  Applying incoming
PRIORITY_UPDATE frame to server push stream is not implemented.

Client can send PRIORITY_UPDATE frame by calling
nghttp2_submit_priority_update.

Server opts to receive PRIORITY_UPDATE frame by the call
nghttp2_option_set_builtin_recv_extension_type(option,
NGHTTP2_PRIORITY_UPDATE), and passing the option to
nghttp2_session_server_new2 or nghttp2_session_server_new3.
2022-06-13 20:04:30 +09:00
Tatsuhiro Tsujikawa c10a55588b Implement RFC 9218 extensible prioritization scheme
This commit implements RFC 9218 extensible prioritization scheme.  It
is enabled when a local endpoint submits
SETTINGS_NO_RFC7540_PRIORITIES = 1.  This commit only handles priority
signal in HTTP request header field.  Priority header field in
PUSH_PROMISE is not supported.

HTTP messaging must be enabled to take advantage of this
prioritization scheme because HTTP fields are not parsed if HTTP
messaging is disabled.
2022-06-12 16:06:04 +09:00
Tatsuhiro Tsujikawa 4ffb63a737 nghttp2_pq_init never fail 2022-06-11 17:36:48 +09:00
Tatsuhiro Tsujikawa ac3f846f29
Merge pull request #1727 from nghttp2/host-in-resp-field-section
Do not verify host field specific characters for response field
2022-06-11 17:33:44 +09:00
Tatsuhiro Tsujikawa a26bad3324 Do not verify host field specific characters for response field
Do not verify host field specific characters for response field
section because host field in response field section is undefined.
2022-06-11 17:08:51 +09:00
Tatsuhiro Tsujikawa 9812a0bc81 Add SETTINGS_NO_RFC7540_PRIORITIES
Add SETTINGS_NO_RFC7540_PRIORITIES to disable RFC7540 priorities.  If
disabled, streams are served in FIFO.
2022-06-11 16:50:07 +09:00
Tatsuhiro Tsujikawa 129daeff6f Fix stream stall when initial window size is decreased
Fix the bug that causes a stream to stall when a receiver, which
enables nghttp2_option_set_no_auto_window_update() option on, sends
SETTINGS_INITIAL_WINDOW_SIZE with the value that is less than or equal
to the amount of data received.  Previously, in this particular case,
when SETTINGS is acknowledged by the sender, the receiver does not try
to send WINDOW_UPDATE frame.  The sender is unable to send more data
because its stream-level window size is smaller than or equal to the
amount of data it has sent.
2022-03-12 17:05:42 +09:00
Dimitris Apostolou ad0c9eebf7 Fix typos 2022-01-16 21:53:44 +09:00
Tatsuhiro Tsujikawa deb390cf85 Fix decoder table size update
When applying new header table size acknowledged with SETTINGS ACK by
an encoder, change the header table size on a decoder only when it
strictly lowers the current maximum table size set by Dynamic Table
Size Update from the encoder or the default size 4096 if no Dynamic
Table Size Update is received.

Previously, the header table size on a decoder is always changed.  If
a maximum size in SETTINGS are increased (e.g., 4096 -> 8192), and
then decreased to the previous value, the decoder incorrectly requires
Dynamic Table Size Update from an encoder.
2022-01-11 19:50:45 +09:00
Tatsuhiro Tsujikawa 7eb179069d Remove useless assignments 2021-11-05 22:51:36 +09:00
Shelley Vohr 59a76c6d39
chore: fix -Wunreachable-code-return 2021-10-11 12:56:23 +02:00
Tatsuhiro Tsujikawa cb6aea9aa9 Compile with -DNDEBUG 2021-10-06 21:28:00 +09:00
Tatsuhiro Tsujikawa 31b5b78dc1 Use switch to avoid many if-else-if 2021-09-04 17:35:33 +09:00
Tatsuhiro Tsujikawa 2f941c7fb3 Update doc 2021-09-04 17:32:57 +09:00
Tatsuhiro Tsujikawa ba483b4032 Update doc 2021-09-04 17:30:06 +09:00
Tatsuhiro Tsujikawa 977b0ceee4 make clang-format 2021-09-04 17:27:43 +09:00
Michael Kaufmann 83c063346d Stricter checks for pseudo-headers :method and :path
Check the allowed characters for ":method" (see RFC 7230, section 3.2.6) and
":path". For ":path", the space and tab characters are now forbidden, but
other special characters are still allowed for compatibility reasons.

Update genvchartbl.py so that it generates the same table as in the code.

Fixes #1611
2021-08-31 21:47:35 +02:00
Amir Livneh af15b22b03
Fix reference to non-existing nghttp2_option_set_max_send_header_block_size() in comment 2021-08-19 13:14:58 -04:00
Jacky_Yin 8113974b26 doc: update document for nghttp2_session_mem_recv 2021-08-09 23:54:07 +08:00
Tatsuhiro Tsujikawa 29cbf8b83f clang-format-12 2021-08-04 15:04:58 +09:00
Tatsuhiro Tsujikawa 9e6c0685a2 Fix build failure 2021-05-15 13:51:24 +09:00
Tatsuhiro Tsujikawa ebad3d4755 Port new ngtcp2 map implementation 2021-05-13 15:01:58 +09:00
Tatsuhiro Tsujikawa b419bfd95f Remove unused field 2021-02-24 20:58:15 +09:00
Tatsuhiro Tsujikawa 2f2b211766 Add LIBTOOL_LDFLAGS configure variable 2021-02-21 21:32:48 +09:00
Tatsuhiro Tsujikawa 3c17299a92 Update enum references 2020-12-29 17:47:57 +09:00
Reza Tavakoli d8c71d5fdb
Added new nghttp2_ksl.c to Windows makefile 2020-12-02 17:38:03 +03:30
Tatsuhiro Tsujikawa 4ecdc2903d Amend 7a57b039a6 2020-07-26 15:31:54 +09:00
Tatsuhiro Tsujikawa 7a57b039a6 Fix cmake build 2020-07-26 15:19:19 +09:00
Tatsuhiro Tsujikawa 1ce628529b nghttp2_map backed by nghttp2_ksl 2020-07-26 15:13:43 +09:00
Tatsuhiro Tsujikawa 7f92b1e0e8
Merge pull request #1489 from tomaskrizek/doc-session-send
doc: nghttp2_session_send is also affected by max concurrent streams
2020-07-19 12:14:53 +09:00
Tomas Krizek 5497a1dfa7
doc: nghttp2_session_send is also affected by max concurrent streams
Further clarify the function also takes into account maximum concurrent
streams.

Closes #691
Closes #817
2020-06-19 17:22:55 +02:00
Tatsuhiro Tsujikawa c8bf8c6521 Don't send RST_STREAM to idle stream 2020-06-18 11:59:06 +09:00
Tomas Krizek f76ac19627
doc: clarify flow control behaviour for nghttp2_session_send()
The previous wording implied that if send_callback doesn't return
NGHTTP2_ERR_WOULDBLOCK, this function would always send all
submitted requests / data. This is not the case, since flow control can
cause some data to remain queued until WINDOW_UPDATE is received.
2020-06-17 17:19:30 +02:00
Tatsuhiro Tsujikawa 1ecc7940b8 Fix compile error with gcc 2020-06-06 00:48:33 +09:00
Tatsuhiro Tsujikawa ab11b2bba5 clang-format 2020-06-05 23:16:01 +09:00
Tatsuhiro Tsujikawa cf094bd56b Fix ubsan applying zero offset to null pointer occurred in unit test 2020-06-05 23:13:08 +09:00
Asra Ali 78a56cf66f fix ubsan errors
Signed-off-by: Asra Ali <asraa@google.com>
2020-06-05 23:13:08 +09:00
James M Snell f8da73bd04
Earlier check for settings flood 2020-05-05 11:55:38 -07:00
James M Snell 336a98feb0
Implement max settings option 2020-05-05 11:55:32 -07:00
Tatsuhiro Tsujikawa 2ec585518e Fix receiving stream data stall
Previously, if automatic window update is enabled (which is default),
after window size is set to 0 by
nghttp2_session_set_local_window_size, once the receiving window is
exhausted, even after window size is increased by
nghttp2_session_set_local_window_size, no more data cannot be
received.  This is because nghttp2_session_set_local_window_size does
not submit WINDOW_UPDATE.  It is only triggered when new data arrives
but since window is filled up, no more data cannot be received, thus
dead lock happens.

This commit fixes this issue.  nghttp2_session_set_local_window_size
submits WINDOW_UPDATE if necessary.

https://github.com/curl/curl/issues/4939
2020-02-20 10:40:38 +09:00
Viktor Szakats 9bc2c75e38 lib/CMakeLists.txt: Make hard-coded static lib suffix optional
It can be set via the `STATIC_LIB_SUFFIX` variable.

This fixes every existing dependent project that relied on the name
having no suffix and thus capable of using either a static or shared
flavour depending on which one is present on this or how the linker
is configured.

Ref: https://github.com/nghttp2/nghttp2/pull/1394
2019-11-15 20:53:50 +00:00
Tatsuhiro Tsujikawa 5ae9bb8925 Fail fast if huffman decoding context is in failure state 2019-11-09 17:18:11 +09:00
Tatsuhiro Tsujikawa 77f5487a58 Add nghttp2_check_authority as public API 2019-11-02 00:33:59 +09:00
Tatsuhiro Tsujikawa 6ce4835eea Fix the bug that stream is closed with wrong error code
This commit fixes the bug that stream is closed with wrong error code
(0).  This happens when STREAM or DATA frame with END_STREAM flag set
is received and it violates HTTP messaging rule (i.e., content-length
does not match) and the other side of stream has been closed.  In this
case, nghttp2_on_stream_close_callback should be called with nonzero
error code, but previously it is called with 0 (NO_ERROR).
2019-10-29 21:04:52 +09:00
Tatsuhiro Tsujikawa 5d6964cf81 Faster huffman decoding 2019-10-12 14:30:31 +09:00
Tatsuhiro Tsujikawa 0d855bfc1b Faster huffman encoding 2019-10-12 14:30:31 +09:00
William A Rowe Jr 28b1f0b90f Avoid filename collision of static and dynamic lib
Renames the output of the ENABLE_STATIC_LIB library/archive output
to nghttp2_static.lib/.a to avoid filenames colliding with the output
name for ENABLE_SHARED_LIB library/archive, when both are enabled.

Signed-off-by: William A Rowe Jr <wrowe@pivotal.io>
Signed-off-by: Yechiel Kalmenson <ykalmenson@pivotal.io>
2019-09-16 08:48:35 -07:00
Tatsuhiro Tsujikawa 0a6ce87c22 Add nghttp2_option_set_max_outbound_ack 2019-08-14 11:43:55 +09:00
Tatsuhiro Tsujikawa 7a5908933e Fix clang-8 warning 2019-06-22 17:44:16 +09:00