Commit Graph

920 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa 8be17f077a Add nghttp2_check_header_name and nghttp2_check_header_value APIs
These are promoted to public API from src/http2.h
2014-02-01 19:31:50 +09:00
Tatsuhiro Tsujikawa 08ff95d402 Detect frame reception for idle stream and make it connection error
Only stream ID which larger than currently used stream ID is
detected as idle.
2014-02-01 17:03:55 +09:00
Tatsuhiro Tsujikawa 2402b46cf3 Fix bug header block is not ignored as properly 2014-01-30 21:26:18 +09:00
Tatsuhiro Tsujikawa ab684a9f30 Remove nghttp2_on_request_recv_callback
It is easy enough to check the end of incoming data by evaluating
frame->hd.flags & NGHTTP2_FLAG_END_STREAM in on_frame_recv_callback
2014-01-29 21:56:01 +09:00
Tatsuhiro Tsujikawa 652228a9d2 Update doc 2014-01-29 21:35:39 +09:00
Tatsuhiro Tsujikawa bbdc015e84 Call on_frame_recv_callback for DATA even if stream has been closed
This makes the callback semantics consistent with the other
frames like HEADERS/PUSH_PROMISE.
2014-01-29 21:34:48 +09:00
Tatsuhiro Tsujikawa e186e01933 Replace on_end_headers_callback with on_begin_headers_callback
Previously, there is inconsistency when on_frame_recv_callback
is called between HEADERS/PUSH_PROMISE and the other frames.
For former case, it is called before header block, in latter
case, it is called after whole frame is received. To make it
consistent, we call on_frame_recv_callback for HEADERS/PUSH_PROMISE
after its frame is fully received. Since on_frame_recv_callback
can signal the end of header block, we replaced on_end_headers_callback
with on_begin_headers_callback, which is called when the reception
of the header block is started.
2014-01-29 21:23:13 +09:00
Tatsuhiro Tsujikawa 4a56c0ae3d Update doc 2014-01-28 01:59:21 +09:00
Tatsuhiro Tsujikawa f308b7b512 Allow NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE return from on_headers_callback 2014-01-28 01:17:23 +09:00
Tatsuhiro Tsujikawa 1382067976 Update doc 2014-01-27 23:31:42 +09:00
Tatsuhiro Tsujikawa 7f5a87395e Refactor a bit 2014-01-27 23:28:45 +09:00
Tatsuhiro Tsujikawa a3193bee69 Code cleanup 2014-01-27 23:00:08 +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 04b7350719 Fix compile error 2014-01-27 21:14:41 +09:00
Tatsuhiro Tsujikawa 58cbecbf95 nghttp2_buffer: Set minimum buffer size to 8 2014-01-27 00:48:45 +09:00
Tatsuhiro Tsujikawa 545f24bc1b Remove nghttp2_on_frame_recv_parse_error_callback 2014-01-26 23:23:07 +09:00
Tatsuhiro Tsujikawa 9314e30987 Support transmission of CONTINUATION, change nghttp2_frame_hd
The maximum frame size including header block is still limited
to NGHTTP2_HD_MAX_BUFFER_LENGTH, which is 32KB.
2014-01-26 23:10:33 +09:00
Tatsuhiro Tsujikawa 91401cfe26 Support CONTINUATION frame reception 2014-01-26 20:31:28 +09:00
Tatsuhiro Tsujikawa e7fc2951b8 nghttp2_hd: Define dedicated struct for HPACK deflater and inflater 2014-01-26 17:53:04 +09:00
Tatsuhiro Tsujikawa 45a9f0b637 Remove nghttp2_frame_unpack_* functions 2014-01-26 16:46:18 +09:00
Tatsuhiro Tsujikawa dba2406aba nghttp2_sesson_mem_recv: Process incoming data in streaming fashion
Now incoming data is processed in very small buffer (up to 8 bytes)
using state machine. GOAWAY debug data can get to 16K - 1, and we
don't have callback for it. Since we don't want to buffer that
amount of data just for debugging, we currently discard it.
This change also makes parse_error callback not function.
It probably be removed from API.
2014-01-26 15:44:43 +09:00
Tatsuhiro Tsujikawa 8317559090 nghttp2_hd: Implement stream header inflater
This stream inflater can inflate incoming header block in streaming
fashion. Currently, we buffer up single name/value pair, but we chose
far more smaller buffer size than HTTP/2 frame size.
2014-01-25 18:24:15 +09:00
Tatsuhiro Tsujikawa f8a446fbeb nghttp2_hd: Rewrite huffman decoding 2014-01-24 21:56:19 +09:00
Tatsuhiro Tsujikawa 6540ac1bab Fix crash 2014-01-23 21:25:49 +09:00
Tatsuhiro Tsujikawa 62e394b3e3 Fix memory leak 2014-01-23 00:28:23 +09:00
Tatsuhiro Tsujikawa 201ab1a140 nghttp2_hd: Adjust maximum size to index based on table size 2014-01-21 21:49:53 +09:00
Tatsuhiro Tsujikawa d647799c6f Take int account received data length to check flow control error 2014-01-20 19:50:11 +09:00
Tatsuhiro Tsujikawa 594e1caad6 Code cleanup 2014-01-20 00:01:10 +09:00
Tatsuhiro Tsujikawa d0968ea609 Tear down session if GOAWAY with stream ID != 0 2014-01-19 00:37:45 +09:00
Tatsuhiro Tsujikawa 2a95da6bee Code cleanup 2014-01-18 16:25:44 +09:00
Tatsuhiro Tsujikawa b6d039e888 Make nghttp2_is_fatal public API 2014-01-18 16:24:44 +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 0f30fb98a9 Update doc 2014-01-18 00:35:41 +09:00
Tatsuhiro Tsujikawa e960c56aad Don't call on_request_recv_callback if header decompression failed 2014-01-17 23:49:40 +09:00
Tatsuhiro Tsujikawa 3882bbebdc Update doc 2014-01-17 22:55:36 +09:00
Tatsuhiro Tsujikawa 22a4e3eab8 Remove nghttp2_session_continue
nghttp2_session_continue is removed. Now just call
nghttp2_session_mem_recv to continue after NGHTTP2_ERR_PAUSE.
2014-01-17 22:52:30 +09:00
Tatsuhiro Tsujikawa b2bf18d40f Code cleanup 2014-01-17 10:15:14 +09:00
Tatsuhiro Tsujikawa 5d535766bf inflate_header_block: Terminate session on compression error
Code cleanup is done as well
2014-01-17 10:13:33 +09:00
Tatsuhiro Tsujikawa 1daf6de102 Update doc 2014-01-17 09:41:39 +09:00
Tatsuhiro Tsujikawa 073e6d3a01 nghttp2_hd: Remove unused variables 2014-01-17 09:36:38 +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 0e4b3d435e Emit header name/value pair using callback functions
Now, in nghttp2_on_frame_recv_callback, nva and nvlen in
HEADERS and PUSH_PROMISE frames are always NULL and 0 respectively.
The header name/value pairs are emitted successive
nghttp2_on_header_callback functions. The end of header fields are
signaled with nghttp2_on_end_headers_callback function.

Since NGHTTP2_ERR_PAUSE for nghttp2_on_frame_recv_callback is
introduced to handle header block, it is now deprecated.
Instead, nghttp2_on_header_callback can be paused using
NGHTTP2_ERR_PAUSE.
2014-01-17 01:49:43 +09:00
Tatsuhiro Tsujikawa 5d788e9753 nghttp2_hd: Move pointer variables before size_t 2014-01-12 19:28:57 +09:00
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
Tatsuhiro Tsujikawa 5add90489f Protocol ID change for HPACK experiment 2013-10-16 01:19:06 +09:00
Tatsuhiro Tsujikawa a2735ed025 Fix leak on failure 2013-10-16 00:12:33 +09:00
Tatsuhiro Tsujikawa ed43635c7b Updated latest initial static header table 2013-10-16 00:09:00 +09:00
Tatsuhiro Tsujikawa 50cdcca911 Implement static Huffman for header compression
The current implementation uses Huffman code tables described
in http://tools.ietf.org/html/draft-rpeon-httpbis-header-compression-03
2013-10-15 23:55:12 +09:00
Tatsuhiro Tsujikawa 5b1fc35e82 Make max header table size configurable 2013-10-13 19:24:21 +09:00
Tatsuhiro Tsujikawa afd5cd0585 Remove NGHTTP2_HD_INVALID_INDEX 2013-10-13 17:44:58 +09:00
Tatsuhiro Tsujikawa 6d7bcabe4c Don't allocate name when indexing with name in static table 2013-10-12 22:56:29 +09:00
Tatsuhiro Tsujikawa 8cf3731802 Experiment HPACK with upcoming changes
* remove substitution
* reversed insertion and removal from header table
* unified initial static table
2013-10-12 21:49:01 +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 622b05aa31 Fix HPACK using 0-bit prefix instead of 8-bits 2013-10-10 23:58:33 +09:00
Tatsuhiro Tsujikawa 2b9d4efa68 Refactor predicate_*_send functions 2013-10-04 22:42:34 +09:00
Tatsuhiro Tsujikawa 252c77f775 Return NGHTTP2_ERR_INVALID_STREAM_STATE for DATA, WINDOW_UPDATE to reserved
Use NGHTTP2_ERR_INVALID_STREAM_STATE when trying to send DATA or
WINDOW_UPDATE to reserved stream.
Also a bit refactored nghttp2_session_predicate_window_update_send
and nghttp2_session_predicate_data_send
2013-10-04 21:59:44 +09:00
Tatsuhiro Tsujikawa bddb4de946 Fix data_stream_id and data_flags are not assigned 2013-10-03 22:51:58 +09:00
Tatsuhiro Tsujikawa f30a238e41 Update doc 2013-09-28 23:13:55 +09:00
Tatsuhiro Tsujikawa 21d76dcc75 Add nghttp2_session_continue API function
The NGHTTP2_ERR_PAUSE library error code is introduced to pause
the execution of nghttp2_session_mem_recv() when that error code
is returned from nghttp2_on_frame_recv_callback or
nghttp2_on_data_chunk_recv_callback. If this happens, the parameters
available for both callbacks are retained until the application
calls nghttp2_session_continue(). The application must retain
input bytes which was used to produce the frame.
After successful call of nghttp2_session_continue, the application
can continue to call nghttp2_session_mem_recv() to process
additional data.
2013-09-28 17:59:24 +09:00
Tatsuhiro Tsujikawa 99ba622fed Add NGHTTP2_OPT_PEER_MAX_CONCURRENT_STREAMS option
And utilize it in nghttp to limit initial max concurrent streams.
2013-09-14 19:41:49 +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 f233a1a45e nghttp2.h: mention where user_data is set in the other callbacks as well 2013-09-07 23:45:18 +09:00
Daniel Stenberg f7dffc69b3 nghttp2.h: mention where user_data is set in the send_callback docs
Just to make it easier to find the info.
2013-09-07 21:00:51 +09:00
Daniel Stenberg 2bf08650de nghttp2.h: clarify nghttp2_pack_settings_payload docs 2013-09-07 20:53:49 +09:00
Tatsuhiro Tsujikawa c751a6e935 Fix cosmetic errors 2013-09-07 16:38:21 +09:00
Tatsuhiro Tsujikawa 2c127b5cb6 Remove unused functions/macros 2013-09-07 15:48:16 +09:00
Tatsuhiro Tsujikawa 3390c2356e Update doc 2013-09-07 15:28:43 +09:00
Tatsuhiro Tsujikawa 4db8338012 Fix resource leak 2013-09-07 01:45:54 +09:00
Tatsuhiro Tsujikawa 4dcf9ad4f2 Make hd encoder ordering aware and one-pass
The encoder algorithm is simplified and it now preserves ordering
of the headers. It also becomes one-pass encoder.
2013-09-06 21:53:28 +09:00
Tatsuhiro Tsujikawa 16076cbc2f Increase NGHTTP2_HD_MAX_ENTRY_SIZE to 3072 2013-09-06 00:17:46 +09:00
Tatsuhiro Tsujikawa a3762b5b1f Add doc about returning 0 from recv_callback 2013-09-05 23:23:17 +09:00
Tatsuhiro Tsujikawa 87abc8b951 nghttp2_session_on_window_update_received: Split into 2 functions 2013-09-05 23:21:00 +09:00
Tatsuhiro Tsujikawa 464f141593 Refactor deeply nested if blocks 2013-09-05 23:17:16 +09:00
Tatsuhiro Tsujikawa 2c264f60a6 Update doc 2013-09-04 21:53:38 +09:00
Tatsuhiro Tsujikawa 61c4250e20 nghttp2_info: Format doc for API doc generator 2013-09-04 21:46:35 +09:00
Daniel Stenberg 2f992a68f8 NGHTTP2_VERSION_NUM: have configure generate the define 2013-09-04 21:30:00 +09:00
Daniel Stenberg 66b89006d5 nghttp2_version: new function, returns info about this nghttp2
This returns run-time information about the lib
2013-09-04 21:30:00 +09:00
Daniel Stenberg e8ca112749 nghttp2.h: avoid compiler warnings due to comma after last enum
warning: comma at end of enumerator list [-Werror=pedantic]
2013-09-04 00:28:38 +09:00
Tatsuhiro Tsujikawa 7a9cff9b5a Fix typo 2013-09-03 21:44:18 +09:00
Tatsuhiro Tsujikawa faae05157c Merge branch 'bagder-master' 2013-09-03 21:43:42 +09:00
Tatsuhiro Tsujikawa 1723912f35 Call nghttp2_hd_end_headers from nghttp2_hd_deflate_hd 2013-09-03 21:41:22 +09:00
Tatsuhiro Tsujikawa d960cf8953 Add const to read-only nghttp2_frame* parameter in callbacks 2013-09-03 21:24:14 +09:00
Daniel Stenberg 96446ff295 libnghttp2.pc: use full name, fix Libs.private
Since the name of the file is 'libnghttp2*' I think we should use the
full name within it as well (for the Name: field), as it gets confusing
otherwise for users and for pkg-config.

Also, 'Requires.private' breaks pkg-config's ability to extract -I etc
from the Cflags below it. I believe it should be 'Libs.private' and the
right side should then list the libs with -l.

With these changes, I've successfully written a configure script to
find and use libnghttp2.
2013-09-02 23:05:39 +02:00
Tatsuhiro Tsujikawa a7bd4f33a3 Call on_stream_close_callback for stream in NGHTTP2_STREAM_INITIAL state
We call on_stream_close_callback even if stream->state is
NGHTTP2_STREAM_INITIAL. This will happen while sending request
HEADERS, a local endpoint receives RST_STREAM for that
stream. It may be PROTOCOL_ERROR, but without notifying stream
closure will hang the stream in a local endpoint.
2013-09-02 23:09:36 +09:00
Daniel Stenberg d192a602f4 session: remove unused struct field 'version'
Also the comment referred to non-existing SPDY defines
2013-09-01 16:04:04 +02:00
Tatsuhiro Tsujikawa 59286adc5e Add int return value to nghttp2_on_unknown_frame_recv_callback 2013-08-29 23:10:18 +09:00
Tatsuhiro Tsujikawa db4f519500 Add int return value to nghttp2_on_frame_recv_parse_error_callback 2013-08-29 23:07:07 +09:00
Tatsuhiro Tsujikawa 053c444769 Add int return value to nghttp2_on_request_recv_callback 2013-08-29 23:03:21 +09:00
Tatsuhiro Tsujikawa 81653c1d1b Add int return value to nghttp2_on_stream_close_callback 2013-08-29 22:58:05 +09:00
Tatsuhiro Tsujikawa 5a7f65f1f7 Add int return value to on_data_send_callback 2013-08-29 21:55:04 +09:00
Tatsuhiro Tsujikawa b9d2f9b6b0 Add int return value to on_frame_not_send_callback 2013-08-29 21:51:58 +09:00
Tatsuhiro Tsujikawa d4852b0f11 Add int return value to on_frame_send_callback 2013-08-29 21:48:34 +09:00
Tatsuhiro Tsujikawa a51cdaacfc Add int return value to nghttp2_before_frame_send_callback 2013-08-29 21:45:10 +09:00
Tatsuhiro Tsujikawa 544ac9f61f Add int return value to nghttp2_on_data_recv_callback 2013-08-29 21:41:33 +09:00
Tatsuhiro Tsujikawa 972b47d6af Add int return value to nghttp2_on_data_chunk_recv_callback 2013-08-29 21:39:32 +09:00
Tatsuhiro Tsujikawa fb7d22fcb9 Add int return value to nghttp2_on_invalid_frame_recv_callback 2013-08-29 21:37:26 +09:00
Tatsuhiro Tsujikawa a59cd3be82 Add int return value to nghttp2_on_frame_recv_callback 2013-08-29 21:33:52 +09:00
Tatsuhiro Tsujikawa 39d50f9b88 Update doc 2013-08-29 00:29:25 +09:00
Tatsuhiro Tsujikawa 66e5ac03a6 Connection error if header continuation is used by peer for now 2013-08-28 23:38:56 +09:00
Tatsuhiro Tsujikawa 5c6ef84b97 Use COMPRESSION_ERROR if the cause of error comes from compressor 2013-08-28 23:32:37 +09:00
Tatsuhiro Tsujikawa 83b0c89e3c Handle indexing entry greater than header table limit without error 2013-08-28 23:16:23 +09:00
Tatsuhiro Tsujikawa 4fe056d208 nghttp2_hd.c: Use rv != 0 instead of rv < 0 2013-08-28 21:35:18 +09:00
Tatsuhiro Tsujikawa f0ef6e980f Refactor nghttp2_hd_inflate_hd 2013-08-28 21:33:57 +09:00
Tatsuhiro Tsujikawa b37f99ca03 Connection error if payload size is strictly greater than (1 << 14) - 1
It would be desired to add option to make this limit configurable.
Fix scripted_recv_callback in tests.
2013-08-28 02:13:57 +09:00
Tatsuhiro Tsujikawa 1f3b96e233 nghttpx: Rewrite header handling 2013-08-28 00:09:46 +09:00
Tatsuhiro Tsujikawa 82b9f78fc7 Check incoming header field name strictly
The validation rule is described in
http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-02#section-4.1.2
2013-08-25 17:39:29 +09:00
Tatsuhiro Tsujikawa 091f38a99d Revise common header processing
Instead of emitting common headers on decoder side, encoder
now keeps track of removed common headers and encode it
as necessary.
2013-08-24 22:58:26 +09:00
Tatsuhiro Tsujikawa 2d41c99289 Connection error if header continuation is employed by peer for now 2013-08-24 19:28:57 +09:00
Tatsuhiro Tsujikawa 005e60a5ed Rework header compression 2013-08-23 23:38:28 +09:00
Tatsuhiro Tsujikawa 93e5b9e562 Fix bug common header disappear if it is evicted 2013-08-23 03:45:26 +09:00
Tatsuhiro Tsujikawa 346fafde3f Implement draft-ietf-httpbis-header-compression-02 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa 0b005e3f22 Change the value of END_PUSH_PROMISE flag as per the spec 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa d154faa9ab Set protocol version draft-06 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa 30d3ea7c93 Use old C style comment 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa 35229b250f Treat reception of DATA in reserved stream as connection error 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa 618a1e0782 Update doc 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa e278efdf38 Strict handling of connection error
Following cases are now treated as connection error of type
PROTOCOL_ERROR.

* Receiving HEADERS from client in reserved (local)
* Receiving PUSH_PROMISE against peer-initiated stream
* Receiving WINDOW_UPDATE against in reserved (local, remote)
2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa 0c9703fa2c Remove NGHTTP2_FLAG_END_FLOW_CONTROL 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa f222403970 Update doc 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
Tatsuhiro Tsujikawa 591f73e043 Return error if nghttp2_gzip_inflate is invoked after Z_STREAM_END 2013-08-21 01:03:24 +09:00
Tatsuhiro Tsujikawa 407027452c Update doc 2013-08-17 22:34:57 +09:00
Tatsuhiro Tsujikawa 3ee7ca2cdd Handle non-fatal error from nghttp2_submit_data 2013-08-10 15:26:12 +09:00
Tatsuhiro Tsujikawa a52ca391a2 Do not RST_STREAM for DATA against nonexistent stream
This may be useful to the misbehaving implementation, but it could
result in lots of RST_STREAM, so just ignore it for now.
2013-08-10 15:13:53 +09:00
Tatsuhiro Tsujikawa 6ed8a8957b Early termination if stream is not found
Add this check in nghttp2_submit_{priority, window_update, data,
push_promise}.
2013-08-10 00:02:24 +09:00
Tatsuhiro Tsujikawa 80bacd0a54 Disable local flow control in nghttp2_submit_window_update() 2013-08-09 23:46:12 +09:00
Tatsuhiro Tsujikawa 1155606d5e Rewrite re-prioritization with PRIORITY 2013-08-09 23:40:41 +09:00
Tatsuhiro Tsujikawa 0dec04921d Remove priority adjustment for a DATA frame
Simply it does not work as expected.
2013-08-09 21:21:14 +09:00
Tatsuhiro Tsujikawa 6d8ab6ed0a Update doc 2013-08-09 01:51:45 +09:00
Tatsuhiro Tsujikawa 5dd6d86d66 Code cleanup 2013-08-09 01:46:07 +09:00
Tatsuhiro Tsujikawa a3ff4cb50b Rename window_size member of nghttp2_session as remote_window_size 2013-08-09 01:31:15 +09:00
Tatsuhiro Tsujikawa 19377fb3cd Allow disabling auto WINDOW_UPDATE for connection and stream individually
Now NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE is split into 2 options:
NGHTTP2_OPT_NO_AUTO_STREAM_WINDOW_UPDATE and
NGHTTP2_OPT_NO_AUTO_CONNECTION_WINDOW_UPDATE.
This is preparation for the upcoming removal of END_FLOW_CONTROL
flag. For nghttpx, instead of using END_FLOW_CONTROL to disable
connection-level flow control, increase window size by large
enough value, which is friendly way to current chromium
implementation.
2013-08-09 01:23:39 +09:00
Tatsuhiro Tsujikawa b979d2e8d2 Support increment/reduction of local window size by WINDOW_UPDATE 2013-08-09 00:58:52 +09:00
Tatsuhiro Tsujikawa e67096fef3 Handle overflow in initial window update in stream
Rename window_size in nghttp2_stream as remote_window_size.
2013-08-08 21:12:49 +09:00
Tatsuhiro Tsujikawa dcfa421d6f Fix connection-level flow control (local)
Fix the bug that connection-level local window is not updated
for the data is the last part of the stream. For the stream
level window may ignore this, connection-level window must
be updated. Also this change fixes the bug that connection-level
window is not updated for the ignored DATA frames.
2013-08-07 22:02:30 +09:00
Tatsuhiro Tsujikawa 55b074e96e Rename NGHTTP2_MAX_FRAME_SIZE as NGHTTP2_MAX_FRAME_LENGTH 2013-08-06 21:59:41 +09:00
Tatsuhiro Tsujikawa 73563de8d4 Specify max length for header value and header block
The max length of header block is not used right now. It will
be used when header continuation is implemented.
2013-08-06 21:57:26 +09:00
Tatsuhiro Tsujikawa c0a5ec8562 Update API doc 2013-08-04 18:27:07 +09:00
Tatsuhiro Tsujikawa ec733a6108 Remove unused nghttp2_mem_chunk 2013-08-04 18:03:41 +09:00
Tatsuhiro Tsujikawa b14d9d622f Fix error string 2013-08-03 23:45:10 +09:00
Tatsuhiro Tsujikawa ea5a1b60cf Change NGHTTP2_INITIAL_MAX_CONCURRENT_STREAMS
The previous value 100 is non-standard, and if it is not sent with
SETTINGS, session will be closed with protocol error.
2013-08-03 18:05:53 +09:00
Tatsuhiro Tsujikawa 737ac01d91 Add API for HTTP Upgrade 2013-08-03 18:05:14 +09:00
Tatsuhiro Tsujikawa bd64619cf5 Fix segmentation fault
Fix segmentation fault if DATA frame is received for the stream
which is already closed.
2013-07-31 20:32:44 +09:00
Tatsuhiro Tsujikawa 061b54fb72 Update doc 2013-07-28 19:39:43 +09:00
Tatsuhiro Tsujikawa 8033152e80 Disable local flow control on FLOW_CONTROL_OPTIONS = 1 2013-07-28 19:05:51 +09:00
Tatsuhiro Tsujikawa 608a493925 Change initial window size to 65535 2013-07-27 21:26:47 +09:00
Tatsuhiro Tsujikawa 7021a9fc5e Incremental indexing only when the entry size if less than threshold 2013-07-27 20:48:04 +09:00
Tatsuhiro Tsujikawa f74674aa7f Fix header compression (again) 2013-07-27 19:23:05 +09:00
Tatsuhiro Tsujikawa ddd04e8ced Fix header compression bug, and perform always incremental indexing 2013-07-27 00:58:38 +09:00
Tatsuhiro Tsujikawa 20173b5f61 NGHTTP2_SETTINGS_FLOW_CONTROL_OPTIONS: Check least significant bit only 2013-07-26 23:11:41 +09:00
Tatsuhiro Tsujikawa 459a269049 Define HTTP/2.0 protocol version ID 2013-07-26 01:38:04 +09:00
Tatsuhiro Tsujikawa 9c54e63871 Remove bogus assert 2013-07-26 01:34:57 +09:00
Tatsuhiro Tsujikawa e496800cb7 Fix header compression bug 2013-07-26 01:34:28 +09:00
Tatsuhiro Tsujikawa 48d7453a21 Rename SPDY terms 2013-07-25 21:18:13 +09:00
Tatsuhiro Tsujikawa 1056d8690e Rename functions related to HEADERS 2013-07-25 21:07:38 +09:00
Tatsuhiro Tsujikawa 3cc71a707e Rename nghttp2_headers_category members
Add NGHTTP2_HCAT_PUSH_RESPONSE
2013-07-25 20:57:50 +09:00
Tatsuhiro Tsujikawa 442e10cc78 Update doc 2013-07-25 02:13:13 +09:00
Tatsuhiro Tsujikawa 84cbebf4f7 Implement server push 2013-07-25 01:59:48 +09:00
Tatsuhiro Tsujikawa 321136b042 nghttp2_hd: Don't malloc if namelen/valuelen are zero 2013-07-23 23:10:53 +09:00
Tatsuhiro Tsujikawa 0000d3e7f9 Add test for nghttp2_nv_array_from_cstr 2013-07-23 23:03:18 +09:00
Tatsuhiro Tsujikawa b7ff05c4c6 Fail session if header compression failed on send 2013-07-23 22:47:15 +09:00
Tatsuhiro Tsujikawa 65cb559431 Change priority update scheme 2013-07-23 21:33:28 +09:00
Tatsuhiro Tsujikawa 3c9e31da87 Don't substitute if same indexed header field name is already in working set 2013-07-23 02:52:08 +09:00
Tatsuhiro Tsujikawa cca1d19d3d Fix WINDOW_UPDATE enum value 2013-07-23 02:08:32 +09:00
Tatsuhiro Tsujikawa ef3caffe8b Remove push related members from nghttp2_stream 2013-07-23 00:46:55 +09:00
Tatsuhiro Tsujikawa 4b6885ce9f Send PRIORITY with current stream priority 2013-07-23 00:36:20 +09:00
Tatsuhiro Tsujikawa 6f28d44bef Call nghttp2_session_handle_invalid_connection if stream_id == 0 or != 0 case 2013-07-23 00:33:47 +09:00
Tatsuhiro Tsujikawa 0bcf90d32d Support PRIORITY frame send and receive 2013-07-23 00:28:00 +09:00
Tatsuhiro Tsujikawa 9e9a7fb160 Add nghttpd and 24 bytes client connection header support 2013-07-22 21:56:19 +09:00
Tatsuhiro Tsujikawa 1dd21c1e30 Handle invalid stream ID (== 0 or != 0) cases 2013-07-21 18:40:47 +09:00
Tatsuhiro Tsujikawa ed39044273 nghttp2_session_handle_invalid_stream: Remove stream_id parameter 2013-07-21 18:26:29 +09:00
Tatsuhiro Tsujikawa ce47881e73 nghttp2_session_handle_parse_error: Call nghttp2_session_fail_session 2013-07-21 18:23:50 +09:00
Tatsuhiro Tsujikawa d96da77412 Add nghttp2_session_handle_invalid_connction to simply code 2013-07-21 18:20:23 +09:00
Tatsuhiro Tsujikawa 94258cd0b8 Move NGHTTP2_PRI_* to nghttp2.h, fix too small pri data type in src 2013-07-20 01:59:43 +09:00
Tatsuhiro Tsujikawa 8b3a3efadc Change priority increasing scheme 2013-07-20 01:58:44 +09:00
Tatsuhiro Tsujikawa 68afda92ac Cleanup 2013-07-20 01:28:52 +09:00
Tatsuhiro Tsujikawa b92b49f882 Cleanup 2013-07-20 01:27:26 +09:00
Tatsuhiro Tsujikawa 9c58004a86 Cleanup 2013-07-20 01:24:34 +09:00
Tatsuhiro Tsujikawa e92b74d66e Use substitution as long as no eviction is required 2013-07-20 01:19:00 +09:00
Tatsuhiro Tsujikawa aa87130711 Fix uninitialized nghttp2_hd_ws_entry index 2013-07-20 01:02:01 +09:00
Tatsuhiro Tsujikawa 00b2d06850 Refactor nghttp2_hd 2013-07-20 01:02:01 +09:00
Tatsuhiro Tsujikawa fb43f8aa93 Update doc 2013-07-20 00:28:25 +09:00
Tatsuhiro Tsujikawa aa4df35a10 Remove NGHTTP2_OPT_MAX_RECV_CTRL_FRAME_BUFFER option 2013-07-20 00:24:25 +09:00
Tatsuhiro Tsujikawa b5810479a4 Remove NGHTTP2_ERR_CREDENTIAL_PENDING check 2013-07-20 00:22:12 +09:00
Tatsuhiro Tsujikawa 3186dede72 Add comment 2013-07-20 00:21:07 +09:00
Tatsuhiro Tsujikawa 30d2c86a7a Remove old zlib compression and other cleanup 2013-07-20 00:20:16 +09:00
Tatsuhiro Tsujikawa 61bf7c6b02 Integrate new header compression 2013-07-20 00:08:14 +09:00
Tatsuhiro Tsujikawa 45c2245bfb Implement header compression draft 01 2013-07-19 16:50:31 +09:00
Tatsuhiro Tsujikawa 76b430c26b Invoke on_invalid_frame_recv_callback on session failure 2013-07-16 23:47:56 +09:00
Tatsuhiro Tsujikawa f9911a6251 Use realloc in nghttp2_reserve_buffer 2013-07-16 22:22:57 +09:00
Tatsuhiro Tsujikawa a3bdda68f8 End flow control by WINDOW_UPDATE 2013-07-16 21:30:36 +09:00
Tatsuhiro Tsujikawa d54cfb88ff Add connection-level flow control 2013-07-16 20:54:24 +09:00
Tatsuhiro Tsujikawa 1fdaa7e59a Disable flow control entirely with FLOW_CONTROL_OPTIONS 2013-07-16 18:26:57 +09:00
Tatsuhiro Tsujikawa 24cab312cf Make spdycat and spdyd barely work 2013-07-16 00:15:04 +09:00
Tatsuhiro Tsujikawa 48cb017245 Implement HTTP-draft-04/2.0 2013-07-15 21:45:59 +09:00
Tatsuhiro Tsujikawa 0edce70343 Rebranding nghttp2 2013-07-13 00:43:06 +09:00
Tatsuhiro Tsujikawa 9fc5c7c299 Adjust priority of outbound DATA frames so that it does not starve others 2013-05-26 15:40:16 +09:00
Tatsuhiro Tsujikawa f47bf214e5 Allow server initiated stream ID in associated-stream-id 2013-04-05 23:24:28 +09:00
Tatsuhiro Tsujikawa 439b34f49f Don't allow control characters in outgoing name/value pairs
This check is done in spdylay_submit_* family functions and they will
return error if they found control characters.
2013-03-23 21:23:13 +09:00
Tatsuhiro Tsujikawa 10c54e44ba Don't pack multiple empty header values in one header field
SPDY spec does not allow multiple empty header values in one header
field. This change makes out-going framer ignore such empty header
value if there is non-empty header value with the same name.
2013-03-23 19:31:22 +09:00
Tatsuhiro Tsujikawa 2ca7b51eb6 Fix the incoming last empty header value is not checked properly
This change fixes the bug that spdylay_frame_unpack_nv does not check
the size of header value if it is the last value in NULL separated
list.
2013-03-23 18:50:36 +09:00
Tatsuhiro Tsujikawa fc0cfc7faf Document about flags of spdylay_send_callback and spdylay_recv_callback 2013-03-01 21:01:45 +09:00
Tatsuhiro Tsujikawa cbb819aed7 spdylay_session_prep_frame: Remove dead code 2013-01-25 01:00:12 +09:00
Tatsuhiro Tsujikawa 258c7f1e65 spdylay_frame_pack_syn_reply: Make nv_offset ssize_t 2013-01-25 00:55:30 +09:00
Tatsuhiro Tsujikawa 0649a7ea61 Add spdylay_buffer_reader_count to replace bunch of 1 byte read 2013-01-22 00:12:15 +09:00
Tatsuhiro Tsujikawa 5adfd07e7c Fix SPDY/3 priority pack and unpack handling 2013-01-20 19:04:04 +09:00
Tatsuhiro Tsujikawa d81827c073 Update GOAWAY INTERNAL_ERROR value according to SPDY/3 spec change 2012-11-14 21:17:04 +09:00
Tatsuhiro Tsujikawa 46e7da2166 Get rid of flags member in spdylay_map 2012-10-05 23:41:49 +09:00
Tatsuhiro Tsujikawa 24e932dfa2 Iterative treap implementation
This change implements spdylay_map functions in iterative approach
instead of original recursive approach. The iterative version is
overall faster than recursive one. The traversal function
(spdylay_map_each) is slightly slower but it is not noticeable.
2012-10-05 00:46:03 +09:00
Tatsuhiro Tsujikawa 58619a4f97 Enable name/value header compression on server side 2012-09-15 00:47:17 +09:00
Tatsuhiro Tsujikawa 088e4f15a2 Check frame length after packing a frame
If resultant length of a frame exceeds the maximum value (which is
2**24 - 1 for SPDY/2 and 3), SPDYLAY_ERR_FRAME_TOO_LARGE is used to
indicate this error. This error will be notified by
on_ctrl_not_send_callback.
2012-09-14 22:41:55 +09:00
Tatsuhiro Tsujikawa 744f35e7ea Disable header compression for now 2012-09-14 21:43:41 +09:00
Tatsuhiro Tsujikawa b8d0b4034c Eliminate malloc in spdylay_map
We use intrusive style pattern in spdylay_stream, which now has
spdylay_map_entry has its first member.
2012-09-12 00:13:02 +09:00
Tatsuhiro Tsujikawa 4e5e741907 Add spdylay_npn_get_proto_list() public API function.
spdylay_npn_get_proto_list() returns a pointer to the supported SPDY
version list. The element of the list is spdylay_npn_proto struct. It
contains all SPDY version information this library supports. The
application can use this information to configure NPN protocol
offerings/selection.
2012-08-27 23:16:44 +09:00
Tatsuhiro Tsujikawa d8c4b19351 Fix error with w64-mingw32 cross compiler. Add --enable-example option. 2012-08-24 02:15:57 +09:00
Tatsuhiro Tsujikawa c59c591ee0 Updated doc 2012-08-22 21:33:35 +09:00
Tatsuhiro Tsujikawa c28b731ef0 Updated doc 2012-08-22 01:11:10 +09:00
Tatsuhiro Tsujikawa bafcbfde88 Remove unused zlib.h header file from spdylay.h 2012-08-22 00:14:02 +09:00
Tatsuhiro Tsujikawa f8fcee122a Check that empty name and NULL value are not included in nv 2012-08-21 23:19:15 +09:00
Tatsuhiro Tsujikawa 5dcdf95a67 Fix doc 2012-08-21 01:03:22 +09:00
Tatsuhiro Tsujikawa 7cc1c73120 Updated doc 2012-08-03 22:35:38 +09:00
Tatsuhiro Tsujikawa 05e6d527b1 Fix compile error on netbsd
Include config.h from sources under examples.  Added kevent.udata type
check.
2012-07-27 22:11:13 +09:00
Tatsuhiro Tsujikawa 5236394c1c Take into account shut_flags when accepting DATA frame 2012-06-14 22:39:44 +09:00
Tatsuhiro Tsujikawa adefcad530 Don't call on_data_recv_callback and on_data_chunk_recv_callback if
stream was closed or being closed.
2012-06-08 23:48:35 +09:00
Tatsuhiro Tsujikawa d654ad0cc6 Fixed bug on_ctrl_recv_callback not called for RST_STREAM 2012-06-04 23:44:18 +09:00
Tatsuhiro Tsujikawa 3c49a31a07 Fixed typo 2012-05-30 21:20:38 +09:00
Tatsuhiro Tsujikawa ad13e56617 Removed unused variable 2012-05-25 19:07:01 +09:00
Tatsuhiro Tsujikawa e13152c0a5 Made spdylay_strerror(0) return "Success" 2012-05-25 14:44:25 +09:00
Tatsuhiro Tsujikawa 4dd9c32c25 Added SPDYLAY_OPT_MAX_RECV_CTRL_FRAME_BUFFER option.
This option sets maximum receive buffer size for incoming control
frame.  Basically the library checks the length field of the incoming
control frame. For frames with name/value header block, the library
also checks the length of inflated block is also under the limit. This
is done while incrementally inflating block. If the length of frames
with name/value header block exceeds the limit, the library will issue
RST_STREAM with FRAME_TOO_LARGE. For other frames, it will issue
GOAWAY.
2012-05-25 13:49:18 +09:00
Tatsuhiro Tsujikawa a6ae4fc72c Incremental name/value block decompression 2012-05-25 10:46:40 +09:00
Tatsuhiro Tsujikawa a18f04e8c7 Fixed buffer overrun in spdylay_pq_push 2012-05-24 21:35:27 +09:00
Tatsuhiro Tsujikawa b06fa25ad2 Fixed compile error with -Wshadow. Fixed const cast. 2012-05-20 17:40:29 +09:00
Tatsuhiro Tsujikawa 6f066d7f64 Avoid overflow of spdylay_stream.recv_window_size 2012-05-20 16:13:26 +09:00
Tatsuhiro Tsujikawa b95e9a8c4c Made spdylay_submit_window_update() not be bounded by recv_window_size
Current SPDY/3 spec does not clearly prohibit to send
delta_window_size which makes resulting window size more than initial
window size. For this reason, spdylay_submit_window_update() can send
delta_window_size in [1, (1 << 31)-1], inclusive, without bounded by
stream's recv_window_size. Of course, the application is now
responsible to keep the resulting window size <= (1 << 31)-1.

spdylay_submit_window_update() now returns
SPDYLAY_ERR_INVALID_ARGUMENT if delta_window_size is 0 or negative.
2012-05-20 16:09:57 +09:00
Tatsuhiro Tsujikawa 3be09efbde Fixed the bug that erase_rotate_recur() erases parent node. 2012-05-19 00:49:15 +09:00
Tatsuhiro Tsujikawa f96c7f8720 Updated doc 2012-05-16 23:48:27 +09:00
Tatsuhiro Tsujikawa c53e7613c9 Renamed index in spdylay_get_credential_cert prototype to idx
This is because compiler may warn that name `index` shadows global
declaration if the application code uses the prototype argument names
as is.
2012-05-13 17:40:18 +09:00
Tatsuhiro Tsujikawa 88599228f8 Prefer spdy/3 to spdy/2 in spdylay_select_next_protocol() 2012-05-12 18:23:17 +09:00
Tatsuhiro Tsujikawa 5c187b950f spdylay_data_source_read_callback can return
SPDYLAY_ERR_TEMPORAL_CALLBACK_FAILURE to signal stream error.
2012-05-12 18:19:05 +09:00
Tatsuhiro Tsujikawa 42c0e3c758 Renamed error as error_code in spdylay_on_ctrl_not_send_callback prototype 2012-05-11 23:33:46 +09:00
Tatsuhiro Tsujikawa 93593a76ec spdylay_session_pack_data() now returns error code as specified in the doc. 2012-05-11 23:23:46 +09:00
Tatsuhiro Tsujikawa ef2bd10d94 Check window size is positive when bringing back deferred DATA frame
when WINDOW_UPDATE is received.
2012-05-11 23:02:13 +09:00
Tatsuhiro Tsujikawa 9b619e5dd7 Bring back deferred DATA to the outbound queue when SETTINGS with
INITIAL_WINDOW_SIZE is received and the window size becomes positive.
2012-05-11 23:01:40 +09:00
Tatsuhiro Tsujikawa 3e2dc04264 Fixed the bug that spdylay_recv does not return SPDYLAY_ERR_EOF. 2012-05-11 00:21:36 +09:00
Tatsuhiro Tsujikawa 0288bedabb Renamed FRAME_TOO_LARGE as SPDYLAY_FRAME_TOO_LARGE 2012-05-09 23:29:33 +09:00
Tatsuhiro Tsujikawa b371a0ae19 Updated doc 2012-05-09 23:25:31 +09:00
Tatsuhiro Tsujikawa 1158de22a3 Added status_code argument to spdylay_on_invalid_ctrl_recv_callback 2012-05-09 23:10:52 +09:00
Tatsuhiro Tsujikawa 649e62bd33 Updated doc 2012-05-09 23:03:16 +09:00
Tatsuhiro Tsujikawa d377fe0dc6 Added spdylay_strerror() public API. 2012-05-09 23:01:46 +09:00
Tatsuhiro Tsujikawa c68a0b5e6d Added spdylay_on_unknown_ctrl_recv_callback.
This callback function is invoked when the unknown frame type is received.
Added debug output using this callback to spdycat.
2012-05-09 22:41:08 +09:00
Tatsuhiro Tsujikawa 171bede1fa Added spdylay_session_on_ctrl_recv_parse_error_callback.
This callback function is invoked when the received frame data could not
be parsed correctly.
Added debug output using this callback to spdycat.
2012-05-09 21:55:21 +09:00
Tatsuhiro Tsujikawa b7429e7c2d Added spdylay_submit_window_update() public API. 2012-05-08 23:41:59 +09:00
Tatsuhiro Tsujikawa fa04757ff4 Don't send WINDOW_UPDATE automatically if SPDYLAY_OPT_NO_AUTO_WINDOW_UPDATE
is set.
2012-05-08 23:29:24 +09:00
Tatsuhiro Tsujikawa d6a03f74b7 Updated doc 2012-05-08 23:00:32 +09:00
Tatsuhiro Tsujikawa 13ea7c60ba Added spdylay_session_set_option() public API. 2012-05-08 22:59:34 +09:00
Tatsuhiro Tsujikawa 02e4440e4a Having the number of server and client streams be limited separately
using SETTINGS_MAX_CONCURRENT_STREAMS
2012-05-08 00:59:26 +09:00
Tatsuhiro Tsujikawa 67eca8d078 Use local_settings' INITIAL_WINDOW_SIZE when deciding to send WINDOW_UPDATE. 2012-05-08 00:08:24 +09:00
Tatsuhiro Tsujikawa 7972bd79b9 Initialized opaque with Z_NULL 2012-05-07 22:57:07 +09:00
Tatsuhiro Tsujikawa 5412ccf129 Renamed spdylay_gzip API. Added test for them. 2012-05-07 22:56:28 +09:00
Jim Morrison 1a384a6000 Move inflate functions to libspdylay from examples. 2012-04-30 12:36:37 -07:00
Tatsuhiro Tsujikawa a87303a731 Added zlib to Requires.private and updated Description 2012-04-26 23:32:17 +09:00
Tatsuhiro Tsujikawa b7392acf46 Document markup fix 2012-04-25 21:33:38 +09:00
Tatsuhiro Tsujikawa f21c0ee3d9 Don't call spdylay_zlib_inflate_free when inflateInit failed. 2012-04-24 22:40:59 +09:00
Tatsuhiro Tsujikawa 36ba636e30 Fixed memory leak in out of memory situation 2012-04-06 23:36:10 +09:00
Tatsuhiro Tsujikawa c89fc13c80 Fixed segmentation fault in out of memory situation 2012-04-06 23:35:30 +09:00
Tatsuhiro Tsujikawa d2b189e573 Updated doc 2012-04-06 21:29:37 +09:00
Tatsuhiro Tsujikawa 08d53318cd Updated doc 2012-04-06 02:34:45 +09:00
Tatsuhiro Tsujikawa 94650de16e Exposed spdylay_session_fail_session() to the public API. 2012-04-06 02:16:01 +09:00
Tatsuhiro Tsujikawa ab0bd62b14 Changed SPDYLAY_ERR_CREDENTIAL_PENDING code 2012-04-06 02:07:29 +09:00
Tatsuhiro Tsujikawa a5c7301f4b Updated doc 2012-04-06 02:07:08 +09:00
Tatsuhiro Tsujikawa 9627d5355a Moved SPDYLAY_SETTINGS_MAX inside spdylay_settings_id. 2012-04-06 02:04:54 +09:00
Tatsuhiro Tsujikawa d1d0a16fba Wrote SETTINGS ID pack/unpack without WORDS_BIGENDIAN 2012-04-06 02:02:19 +09:00
Tatsuhiro Tsujikawa d83d1cd33a Added CREDENTIAL frame support. 2012-04-06 01:45:39 +09:00
Tatsuhiro Tsujikawa 4456d2506d Added callbacks for CREDENTIAL frame. 2012-04-02 22:44:37 +09:00
Tatsuhiro Tsujikawa 169857742b Call on_ctrl_send_callback and before_ctrl_send_callback for WINDOW_UPDATE. 2012-03-30 00:17:01 +09:00
Tatsuhiro Tsujikawa 90c2739a9c Renamed spdylay_frame.common as spdylay_frame.ctrl 2012-03-30 00:07:27 +09:00
Tatsuhiro Tsujikawa db04143f32 Use assert instead of abort 2012-03-30 00:02:42 +09:00
Tatsuhiro Tsujikawa ba56ed6c48 Hide spdylay_data from public API.
The spdylay_data contains full of implementation details and is not
used in public API. It should be hidden.
The spdylay_frame union now only contains the control frame.
2012-03-29 23:59:51 +09:00
Tatsuhiro Tsujikawa 67e83e09a6 Fixed duplicate name/value header block detection 2012-03-29 23:50:08 +09:00
Tatsuhiro Tsujikawa efebc1e1af Made SPDYLAY_PROTO_SPDY2 and SPDYLAY_PROTO_SPDY3 enum 2012-03-27 18:23:05 +09:00
Tatsuhiro Tsujikawa 200012f1b5 Removed SPDYLAY_SPDY2_PRI_LOWEST and SPDYLAY_SPDY3_PRI_LOWEST macros.
Made spdylay_session_get_pri_lowest() to get the lowest priority value
for the current session.

This change allows the application code to get the lowest priority value
without knowing the protocol version which the current session uses.
2012-03-26 23:35:20 +09:00
Tatsuhiro Tsujikawa 262cda86e8 Issue RST_STREAM with PROTOCOL_ERROR if invalid header block is received.
We say the header block is invalid if at least one of the following
condition is true:
There are duplicate header names; or the header names are not
encoded in US-ASCII character set and not lower cased; or the
header name is zero-length string; or the header value contains
multiple in-sequence NUL bytes.

spdylay_frame_unpack_nv() returns SPDYLAY_ERR_INVALID_HEADER_BLOCK
if the unpacking suceeded but it found the header block is invalid.
This means that caller treats it as success, but do additional
processing for invalid header block if it wants.
The functions calling spdylay_frame_unpack_nv() also return
SPDYLAY_ERR_INVALID_HEADER_BLOCK.
2012-03-26 23:19:58 +09:00
Tatsuhiro Tsujikawa 5deef03687 Moved include of arpa/inet.h to spdylay_net.h
spdylay_net.h is compatibility layer for network related header files.
In the nature of spdylay library it should not depend on the actual
networking implementations, but we need some system headers for
optimization. Currently, arpha/inet.h and netinet/in.h are needed for
ntoh*/hton* functions.
2012-03-24 00:14:04 +09:00
Tatsuhiro Tsujikawa e9b56ab1f6 Added @DEFS@ to CPPFLAGS/CFLAGS. 2012-03-24 00:07:56 +09:00
Tatsuhiro Tsujikawa 9e716eb635 Code cleanup: C89 and old-style-prototypes and definition. 2012-03-23 02:17:48 +09:00
Tatsuhiro Tsujikawa f40615a3dc Updated doc 2012-03-19 00:47:15 +09:00
Tatsuhiro Tsujikawa 33e86024d9 Updated doc 2012-03-17 23:44:49 +09:00
Tatsuhiro Tsujikawa 742a8bbac9 Added spdylay_session_mem_recv()
spdylay_session_mem_recv() processes input bytes as the received data
from the remote endpoint. spdylay_session_recv() uses it internally.
The spdylay_inbound_buffer and ibuf member in spdylay_session is removed.
The buffer is allocated in the stack when spdylay_session_recv() is called.
2012-03-17 23:39:38 +09:00
Tatsuhiro Tsujikawa 8f038ae4b6 Added spdylay_session_get_outbound_queue_size() 2012-03-15 23:06:28 +09:00
Tatsuhiro Tsujikawa b8e4116f9a Updated doc 2012-03-15 22:39:26 +09:00
Tatsuhiro Tsujikawa 488b5acec7 Sort nv after 3to2 and 2to3 translation. 2012-03-14 22:53:14 +09:00
Tatsuhiro Tsujikawa a01b63b37a Added doc about the required members for spdylay_session_callbacks when
it is passed to spdylay_session_{client,server}_new().
2012-03-14 00:36:53 +09:00
Tatsuhiro Tsujikawa 07b02404c3 Added API reference generator script.
Formatted the public APIs with Sphinx syntax.
2012-03-14 00:32:52 +09:00
Tatsuhiro Tsujikawa 686c2ea95d Merge git://github.com/sorced-jim/spdylay into sorced-jim-master 2012-03-11 22:44:39 +09:00
Tatsuhiro Tsujikawa 6024106695 Issue stream error with the status code STREAM_IN_USE if multiple SYN_REPLY
frames are received for the same active stream ID.
2012-03-11 22:42:22 +09:00
Tatsuhiro Tsujikawa ce6dc1303e Issue session error with PROTOCOL_ERROR if SYN_STREAM with a stream ID
which is less than any previously received SYN_STREAM.
2012-03-11 19:27:33 +09:00
Tatsuhiro Tsujikawa 8284746163 spdylay_submit_syn_stream: Return SPDYLAY_ERR_INVALID_ARGUMENT if even
Associated-To-Stream-ID is specified.
Check the Associated-To-Stream is active before sending SYN_STREAM.
2012-03-11 18:55:40 +09:00
Tatsuhiro Tsujikawa 94c7e89742 Renamed SPDYLAY_CONCURRENT_STREAMS_MAX as
SPDYLAY_INITIAL_MAX_CONCURRENT_STREAMS
2012-03-10 18:49:25 +09:00