Commit Graph

576 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa a85a11c1d9 Update priority for the stream to get response only 2014-01-09 23:30:45 +09:00
Tatsuhiro Tsujikawa 5aa487c5ba nghttp2_stream: flags is now nghttp2_stream_flags
We use this flag to know whether it is pushed or not
2014-01-09 23:01:02 +09:00
Tatsuhiro Tsujikawa 45837a2cfa Ensure PRIORITY frame reception/transmission rule 2014-01-09 22:06:38 +09:00
Tatsuhiro Tsujikawa 95b0b6cb79 Update doc 2014-01-09 21:42:44 +09:00
Tatsuhiro Tsujikawa fe1a39ed10 Allow client side to send PUSH_PROMISE 2014-01-09 21:39:29 +09:00
Tatsuhiro Tsujikawa dacfecf41a lib, src, hdtest: Ensure that config.h is included 2014-01-08 23:30:02 +09:00
Tatsuhiro Tsujikawa 63e7b21b35 nghttp2_hd: Fix lower bound search in static table 2014-01-08 21:32:39 +09:00
Tatsuhiro Tsujikawa 0fb4d32d6a nghttp2_hd: Binary search static table 2014-01-07 23:41:09 +09:00
Tatsuhiro Tsujikawa 468d0fccd3 nghttp2_hd: Use hash to speed up name/value pair search 2014-01-07 22:43:34 +09:00
Tatsuhiro Tsujikawa d703197a50 nghttp2_hd: Mitigate timing attack 2014-01-07 21:51:48 +09:00
Tatsuhiro Tsujikawa 9eb031ce83 nghttp2_hd: Avoid nghttp2_hd_huff_decode_count
Huffman decoding is costly. It is faster to do geometric realloc
than calling nghttp2_hd_huff_decode_count to know the length in
advance.
2014-01-07 21:44:56 +09:00
Tatsuhiro Tsujikawa 4ac1652c70 nghttp2_hd: Remove invalid nghttp2_downcase call 2014-01-07 21:18:45 +09:00
Tatsuhiro Tsujikawa 295a01ef91 Reformat valid character table for header field name/value pair 2014-01-04 11:19:07 +09:00
Tatsuhiro Tsujikawa 888792a949 nghttp2_hd: Allow HTAB and obs-text characters for field-content 2014-01-03 22:46:40 +09:00
Tatsuhiro Tsujikawa 74d82aac56 Update doc 2014-01-02 01:00:11 +09:00
Tatsuhiro Tsujikawa 9cb8754d09 Rename nghttp2_session_fail_session as nghttp2_session_terminate_session 2013-12-26 00:23:07 +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 779366640a Update doc 2013-12-24 19:27:03 +09:00
Tatsuhiro Tsujikawa 794633f894 Add nghttp2_session_set_stream_user_data API function 2013-12-23 17:40:34 +09:00
Tatsuhiro Tsujikawa 2c1739a24e Add comment to category in HEADERS and reorder 2013-12-22 19:23:37 +09:00
Tatsuhiro Tsujikawa 7c4dbb6ffc nghttp2_hd: Don't malloc if huffman encoded string has 0 length 2013-12-19 23:19:14 +09:00
Tatsuhiro Tsujikawa 7a9eca1f7d nghttp2_hd: Simplify huffman encode 2013-12-19 23:02:48 +09:00
Tatsuhiro Tsujikawa 5ca0cfa018 nghttp2_hd: Search hd table once 2013-12-18 21:45:15 +09:00
Tatsuhiro Tsujikawa 12144acf4d nghttp2_hd: Check last byte of huffman encoded byte string strictly 2013-12-18 21:27:16 +09:00
Tatsuhiro Tsujikawa 01266182e9 nghttp2_hd: Match deflate_hd_tablelen to hd_table.len on decoder side 2013-12-17 21:39:21 +09:00
Tatsuhiro Tsujikawa 595493a0ec Add debug output in nghttp2_hd 2013-12-16 23:54:20 +09:00
Tatsuhiro Tsujikawa 650f63c728 Fail session on the reception of DATA in closed stream or illegal state 2013-12-15 16:23:01 +09:00
Tatsuhiro Tsujikawa 65e54ca7b0 Add nghttp2_free() 2013-12-14 23:49:16 +09:00
Tatsuhiro Tsujikawa bc7473182c Update doc 2013-12-14 19:18:14 +09:00
Tatsuhiro Tsujikawa 0867b57c39 Update doc 2013-12-14 18:59:09 +09:00
Tatsuhiro Tsujikawa e61876ccbd nghttp2_hd: Provide dedicated function to enable no reference set feature 2013-12-14 18:48:41 +09:00
Tatsuhiro Tsujikawa 41104f7b63 Abandon DATA frame priority adjustment (again)
We tried several times about this subject, but for the current
HTTP/2.0 priority scheme, we think it is best to serve the highest
priroty streams first (interleaving streams if there are several
higest ones). There are an issue when aggregating several frontend
connections to one connection in backend, but it is HTTP/2.0
spec issue, rather than implementation.
2013-12-14 17:02:59 +09:00
Tatsuhiro Tsujikawa 364501a2cd Get rid of magic value NGHTTP2_PRI_DECAY
For now we just double the priority value on each DATA frame
transmission. If priority is 0, it becomes to 1 and goes all
the way to (1 << 30) - 1.
2013-12-13 22:26:09 +09:00
Tatsuhiro Tsujikawa bcee1b27a7 Update doc 2013-12-12 00:30:15 +09:00
Tatsuhiro Tsujikawa e17f888944 Lower priority by constant value 2013-12-11 23:20:59 +09:00
Tatsuhiro Tsujikawa 9d49f9a356 Add copyright notice 2013-12-09 23:25:59 +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 d6212a6055 Fix doc 2013-12-08 17:35:14 +09:00
Tatsuhiro Tsujikawa d773b42a2d Ensure that pri goes to the lowest value 2013-12-07 16:14:39 +09:00
Tatsuhiro Tsujikawa 6ea91e57e0 Adjust struct/class alignment 2013-12-06 23:17:38 +09:00
Tatsuhiro Tsujikawa 84d1fffb3f Announce HTTP-draft-09/2.0 2013-12-05 23:23:39 +09:00
Tatsuhiro Tsujikawa 1dea4e154b Reintroduce priority adjustment for DATA frame
This mechanism existed but was deleted. We bring it back in order to
prevent lower priority streams from starving.
2013-12-05 23:12:18 +09:00
Tatsuhiro Tsujikawa 3fde4c7669 nghttp2_map: Code cleanup 2013-12-05 19:26:16 +09:00
Tatsuhiro Tsujikawa a3c888d7d1 nghttp2_map: Implement hash table 2013-12-05 00:53:03 +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 e57b3a2139 Set protocol ID to draft-08 temporarily 2013-11-21 21:58:45 +09:00
Tatsuhiro Tsujikawa bc21edf5b6 Interleave streams with the same priority 2013-11-19 23:59:10 +09:00
Tatsuhiro Tsujikawa e5e4fc9d14 nghttp2_hd: Define some headers not for indexing based on our research 2013-11-19 21:41:02 +09:00
Tatsuhiro Tsujikawa 8915e91b17 nghttp2_hd: Enlarge buffers used in inflation process dynamically 2013-11-16 23:13:46 +09:00
Tatsuhiro Tsujikawa 3d863ed254 nghttp2_hd: Clear reference set with index 0 2013-11-16 17:05:18 +09:00
Tatsuhiro Tsujikawa 5696a65c5e nghttp2_hd: Update doc 2013-11-16 16:33:38 +09:00
Tatsuhiro Tsujikawa 94ec4dbe42 nghttpd_hd: Update static table and use 1-based index
The specification now says that index to the header table entry is
1-based. Since 0-based index is very handy to access arrays, we
internally uses 0-based index. We just convert it to 1-based when
we emit to the block and convert 1-based to 0-based on decoding.
2013-11-16 16:18:44 +09:00
Tatsuhiro Tsujikawa 1f3840f4a2 Update doc 2013-11-15 00:57:15 +09:00
Tatsuhiro Tsujikawa 40347487c9 Don't sort headers in library code
Remove sorting headers from library code. The application must sort
them if necessary. nghttpx and nghttpd do the sorting of the headers
in stable way if names are equal.
2013-11-13 23:56:02 +09:00
Tatsuhiro Tsujikawa 45c3c5b80f Cleanup nghttp2_session_mem_recv 2013-11-12 10:52:03 +09:00
Tatsuhiro Tsujikawa a39a816a63 Cleanup nghttp2_session_next_data_read 2013-11-12 10:48:29 +09:00
Tatsuhiro Tsujikawa 5044b59453 Handle error from nghttp2_session_push_back_deferred_data 2013-11-12 10:44:04 +09:00
Tatsuhiro Tsujikawa 415b8ed674 Code cleanup 2013-11-08 01:47:29 +09:00
Tatsuhiro Tsujikawa ac354d3b91 Fix compile error with --enable-maintainer-mode 2013-11-08 01:35:15 +09:00
Tatsuhiro Tsujikawa 2ae788eddd Replace nghttp2_set_option with nghttp2_session_{client,server}_new2
nghttp2_session_client_new2 and nghttp2_session_server_new2 take
additional parameters which specifies session options.
nghttp2_set_option is somewhat crumsy because of type checking.
Now we use nghttp2_opt_set, which specifies individual options with
types. We changed the value of nghttp2_opt, so this change will
require re-compile.
2013-11-08 00:12:39 +09:00
Tatsuhiro Tsujikawa d92a161c46 nghttp2_hd_huffman: Code cleanup 2013-11-05 23:34:58 +09:00
Tatsuhiro Tsujikawa 0d6faa74b7 nghttp2_hd_huffman: Avoid memset on encoding 2013-11-03 22:31:06 +09:00
Tatsuhiro Tsujikawa 2d08d30409 nghttp2_hd: Fix crash 2013-11-03 17:46:10 +09:00
Tatsuhiro Tsujikawa 4bc44b0c0b Implement SETTINGS_ENABLE_PUSH
It is not clear that SETTINGS_ENABLE_PUSH = 0 disallows HEADERS
to the reserved streams. For now, we just check the reception
and transmission of PUSH_PROMISE against SETTINGS_ENABLE_PUSH.
2013-11-02 16:53:06 +09:00
Tatsuhiro Tsujikawa 29ef3fde8b Initialize settings in common function 2013-11-02 16:23:56 +09:00
Tatsuhiro Tsujikawa 66fce93d98 Update doc 2013-10-31 02:12:48 +09:00
Tatsuhiro Tsujikawa b0f76773e1 nghttp2_hd: Use defalte_hd_table_bufsize for decoder as well 2013-10-31 01:51:16 +09:00
Tatsuhiro Tsujikawa c8a9f8d312 nghttp2_hd: Fix crash on fail 2013-10-31 01:26:37 +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 2e7bc014e1 Return 0 if recv_window_size is negative; add tests 2013-10-30 01:58:38 +09:00
Tatsuhiro Tsujikawa dfa1194804 Add new API to return effective recv data/win size for connection
Using this feature, connection level flow control is now enabled
in nghttpx.
2013-10-30 00:51:01 +09:00
Tatsuhiro Tsujikawa 6c23c34d77 Add new API to return effective received data length and local window size 2013-10-30 00:07:35 +09:00
Tatsuhiro Tsujikawa a4cf37306a Enfoce flow control error strictly
Now we have SETTINGS synchronization, flow control error can be
detected strictly. If DATA frame is received with length > 0 and
current received window size is equal to or larger than local
window size (latter happens when we shirnk window size), it is
subject to FLOW_CONTROL_ERROR,
2013-10-29 22:46:30 +09:00
Tatsuhiro Tsujikawa 6c99ff12c9 nghttp2_hd: Rename local as deflate 2013-10-29 00:42:08 +09:00
Tatsuhiro Tsujikawa 683253e334 Declare HTTP-draft-07/2.0 2013-10-27 23:16:49 +09:00
Tatsuhiro Tsujikawa bfa7dfb37e Use bit shift for easy reading 2013-10-27 23:09:10 +09:00
Tatsuhiro Tsujikawa 34b3833c71 Update doc 2013-10-27 21:27:48 +09:00
Tatsuhiro Tsujikawa 67ce60544e Change maximum frame length to 16383 2013-10-27 21:17:09 +09:00
Tatsuhiro Tsujikawa cfb9857f27 Use FRAME_SIZE_ERROR for invalid payload length 2013-10-27 20:55:44 +09:00
Tatsuhiro Tsujikawa 431f78f008 Rename NGHTTP2_ERR_FRAME_TOO_LARGE as NGHTTP2_ERR_FRAME_SIZE_ERROR 2013-10-27 19:35:36 +09:00
Tatsuhiro Tsujikawa 5ace898392 Update error code 2013-10-27 19:31:24 +09:00
Tatsuhiro Tsujikawa a46ccdb144 Apply initiated SETTINGS changes on reception of ACK 2013-10-27 19:22:51 +09:00
Tatsuhiro Tsujikawa 22df6f4190 nghttp2_hd: Fix bug on local_hd_table_bufsize_max > hd_table_bufsize_max 2013-10-26 23:30:48 +09:00
Tatsuhiro Tsujikawa cbdd44c4ae nghttp2_hd: Implement local header table size limit for encoder 2013-10-26 18:49:23 +09:00
Tatsuhiro Tsujikawa 8f8c841df0 Merge branch 'master' into hpack-exp 2013-10-25 22:51: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 abfc00983d nghttp2_hd: Fix memory leak and bad free 2013-10-24 23:49:37 +09:00
Tatsuhiro Tsujikawa 0c3cb104e9 nghttp2_hd: Share static table globally 2013-10-24 22:09:40 +09:00
Tatsuhiro Tsujikawa 5a81e03497 nghttp2_hd: Add static table entry to dynamic table on emission 2013-10-24 21:52:02 +09:00
Tatsuhiro Tsujikawa d5ccc89fc4 Update huffman table and static table
Use huffman table in https://github.com/grmocg/httpbis-header-compression
2013-10-21 23:56:14 +09:00
Tatsuhiro Tsujikawa 9e50ae46d9 nghttp_hd: Use NGHTTP2_HD_SIDE_{REQUEST,RESPONSE} instead of {CLIENT,SERVER}
This change conveys better notion about compression context.
2013-10-21 00:44:39 +09:00
Tatsuhiro Tsujikawa 8ef134a702 nghttp_hd: Refactor emit_indname_block and emit_newname_block 2013-10-21 00:22:14 +09:00
Tatsuhiro Tsujikawa 28aea5c6b7 nghttp_hd: Use huffman encoding only when it is usable
We use huffman encoding only when its encoded length is strictly less
than the original length.
As noted in the HPACK draft, the length of name/value is now 7-bit
prefix and its MSB is 1 if the following string is huffman encoded.
2013-10-20 23:59:15 +09:00
Tatsuhiro Tsujikawa a658f1367e encode_length: Or-ing first byte with prefix mask
So that we can preserve leading bits.
2013-10-20 16:28:52 +09:00
Tatsuhiro Tsujikawa 4e4fab01b1 Merge branch 'master' into hpack-exp
Conflicts:
	lib/nghttp2_hd.c
2013-10-18 20:06:36 +09:00
Tatsuhiro Tsujikawa 7b87d71121 nghttp2_hd: Fix missing return value handling 2013-10-18 19:48:15 +09:00
Tatsuhiro Tsujikawa 0efa6e657f Fix outbound flow control count
We wrongly added the whole payload length even if we sent part of it.
2013-10-18 19:43:59 +09:00
Tatsuhiro Tsujikawa 7bd145fd23 Fix out of bound array access in decode_length 2013-10-18 19:30:04 +09:00
Tatsuhiro Tsujikawa f7389ff2e6 Revert 622b05aa31
It turns out that 0-bit prefix is wrong, and the author now
clearly stated that the intention is 8-bit prefix for 8+ fields.
2013-10-18 19:28:01 +09:00