Commit Graph

878 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa c55df4a30b Fix compile error with --enable-werror 2014-04-02 01:18:27 +09:00
Tatsuhiro Tsujikawa 24cb90806d Add flags to nghttp2_nv structure
This is preliminary change for upcoming HPACK updates.  The flags are
used to determine the name/value pair is indexable or not.
2014-04-01 23:17:50 +09:00
Tatsuhiro Tsujikawa da5db205ca Make group weight range [1, 256], inclusive
We do -+1 on serialization and deserialization since the field is 1
byte.  This change also parameterized range so that we can change it
easily.
2014-04-01 22:54:20 +09:00
Tatsuhiro Tsujikawa f2d945734e Rename framebuflen as framerv, cause it is not a length 2014-04-01 21:59:26 +09:00
Tatsuhiro Tsujikawa f5ead55f0e Check payload length when submitting GOAWAY and ALTSVC 2014-04-01 21:55:29 +09:00
Tatsuhiro Tsujikawa f785e56dba Implement ALTSVC frame 2014-04-01 21:47:51 +09:00
Tatsuhiro Tsujikawa 6afb7442b5 Adjust weight when pushing data to queue 2014-03-31 23:01:05 +09:00
Tatsuhiro Tsujikawa b85e2ab7f7 Share stream_group weight among streams marked as top 2014-03-31 22:51:33 +09:00
Tatsuhiro Tsujikawa 34581d830d Define NGHTTP2_CLEARTEXT_PROTO_VERSION_ID
This identifier string is used if HTTP/2 is used over cleartext TCP.
2014-03-30 21:30:47 +09:00
Tatsuhiro Tsujikawa 60a2c260a5 Define NGHTTP2_CLIENT_CONNECTION_PREFACE macro
NGHTTP2_CLIENT_CONNECTION_PREFACE has the same content with
NGHTTP2_CLIENT_CONNECTION_HEADER, which is now obsoleted by
NGHTTP2_CLIENT_CONNECTION_PREFACE.
2014-03-30 21:02:25 +09:00
Tatsuhiro Tsujikawa ab2dc5967d Replace HTTP/2.0 with HTTP/2 2014-03-30 19:26:37 +09:00
Tatsuhiro Tsujikawa 705051ceb7 Update doc 2014-03-30 19:00:42 +09:00
Tatsuhiro Tsujikawa d3962becf4 Ignore priority request if resultant tree has cycle 2014-03-30 18:48:32 +09:00
Tatsuhiro Tsujikawa 21d5986157 Fail nghttp2_submit_settings if there is pending SETTINGS frame in-flight
pending_local_max_concurrent_stream is now set in
nghttp2_session_add_settings, rather than after frame was sent.
2014-03-30 18:07:52 +09:00
Tatsuhiro Tsujikawa 74daa16a1c Retain incoming closed streams for dependency tree
The number of closed stream to keep is limited by
MAX_CONCURRENT_STREAMS - current active stream.
2014-03-30 17:41:54 +09:00
Tatsuhiro Tsujikawa a9d97d9d35 Update doc 2014-03-30 01:34:13 +09:00
Tatsuhiro Tsujikawa c12b6bc360 Call on_stream_close_callback for a stream in reserved state
This is useful because application may allocate resources for it and
wants to free the resources if they are not used anymore.
2014-03-30 01:24:16 +09:00
Tatsuhiro Tsujikawa 58da463ad6 Make deflater bad state if parsing HEADERS/PUSH_PROMISE failed 2014-03-30 01:24:16 +09:00
Tatsuhiro Tsujikawa 36c8de9da5 Limit the number of streams in one dependency tree 2014-03-30 01:24:16 +09:00
Tatsuhiro Tsujikawa f7162ab702 Implement dependency based priority 2014-03-30 01:24:16 +09:00
Tatsuhiro Tsujikawa dbb82b0f9c Make opaque_data parameter in nghttp2_submit_goaway const 2014-03-22 19:05:58 +09:00
Tatsuhiro Tsujikawa e1eebf08fb Support DEBUG_DATA in GOAWAY again 2014-03-22 18:59:59 +09:00
Tatsuhiro Tsujikawa 01586f473d Wrap small inbound buffer by nghttp_buf 2014-03-22 18:27:38 +09:00
Tatsuhiro Tsujikawa 3c631b5625 Code cleanup 2014-03-22 17:16:25 +09:00
Tatsuhiro Tsujikawa 774cf88f68 Don't add RST_STREAM frame if stream is in NGHTTP2_STREAM_CLOSING 2014-03-22 00:51:40 +09:00
Tatsuhiro Tsujikawa 1dfe2f8670 Add nghttp2_session_get_stream_remote_window_size public API function 2014-03-22 00:34:25 +09:00
Tatsuhiro Tsujikawa d0fbbe6932 Less cryptic debug message 2014-03-20 00:27:39 +09:00
Tatsuhiro Tsujikawa c945d4ebbe Fix compile error with --enable-debug 2014-03-19 23:24:46 +09:00
Tatsuhiro Tsujikawa 68b392817b nghttp2_bufs: Add chunk_keep to specify the number of buffers to keep on reset 2014-03-16 21:38:13 +09:00
Tatsuhiro Tsujikawa 5b81f7c713 Don't show PAD_HIGH and PAD_LOW flags to user callback 2014-03-14 21:53:03 +09:00
Tatsuhiro Tsujikawa 2ec4b10805 Add nghttp2_buf tests 2014-03-14 21:40:14 +09:00
Tatsuhiro Tsujikawa 781d1a2b70 Code cleanup 2014-03-14 02:23:50 +09:00
Tatsuhiro Tsujikawa 142b433533 nghttp2_hd: Treat prematurely ended compressed header block as error properly 2014-03-14 00:52:44 +09:00
Tatsuhiro Tsujikawa 344d663e90 deflate_hd: Fix mishandled error return from emit_indexed_block 2014-03-14 00:25:03 +09:00
Tatsuhiro Tsujikawa d48eca60cf Fix broken nghttp2_bufs_avail 2014-03-14 00:24:34 +09:00
Tatsuhiro Tsujikawa aefc0d1ebb Use calloc instead of malloc + memset; remove useless memset 2014-03-13 23:27:14 +09:00
Tatsuhiro Tsujikawa 1be8d1b797 inflate_header_block: Issue RST_STREAM if header decompression failed 2014-03-13 23:02:33 +09:00
Tatsuhiro Tsujikawa 0fa4779d38 Don't call on_frame_recv_callback after stream close or being closed 2014-03-13 22:49:37 +09:00
Tatsuhiro Tsujikawa d07bb1ddff Rework outbound frame buffers 2014-03-13 22:11:02 +09:00
Tatsuhiro Tsujikawa 0666a73e10 Remove nghttp2_buffer 2014-03-11 21:20:51 +09:00
Tatsuhiro Tsujikawa 3f56c938d8 nghttp2_hd: Use nghttp2_bufs, avoiding realloc() 2014-03-11 21:18:28 +09:00
Tatsuhiro Tsujikawa 7b2d585896 Return 0 if nghttp2_session_prep_frame succeeds rather than frame length 2014-03-11 02:15:05 +09:00
Tatsuhiro Tsujikawa 74f899fc01 Replace NGHTTP2_MAX_FRAME_LENGTH with NGHTTP2_MAX_PAYLOADLEN 2014-03-11 02:01:08 +09:00
Tatsuhiro Tsujikawa e803c6b65e Replace NGHTTP2_FRAME_HEAD_LENGTH with NGHTTP2_FRAME_HDLEN 2014-03-11 01:55:42 +09:00
Tatsuhiro Tsujikawa 358b4386d3 Introduce nghttp2_buf to ease buffer management 2014-03-11 01:47:38 +09:00
Tatsuhiro Tsujikawa 54dab50015 Support END_SEGMENT in nghttp2_submit_data() 2014-03-06 00:19:02 +09:00
Tatsuhiro Tsujikawa b60679808b Filter supported flags in received frame 2014-03-05 23:25:42 +09:00
Tatsuhiro Tsujikawa 547d6d1fb5 Use 4086 as max DATA payload size to make DATA frame fit into 4K buffer 2014-03-05 22:48:17 +09:00
Tatsuhiro Tsujikawa 79c5032708 nghttp2_hd: Fix crash with multiple threads execution 2014-03-03 00:53:04 +09:00
Tatsuhiro Tsujikawa 979feaecc6 Mitigate heap fragmentation when lots of concurrent http2 sessions run 2014-03-02 16:34:23 +09:00
Tatsuhiro Tsujikawa 1fee4fd2df nghttp2_hd: Fail inflate immediately if ctx.bad is nonzero
Doing inflation after error produces invalid results, especially, if
it is in NGHTTP2_HD_STATE_READ_INDEX, the inflater->left could be 0,
which causes assertion error.  Add sanity assertion for index
2014-02-26 23:20:52 +09:00
Tatsuhiro Tsujikawa 18357512ed nghttp2_hd: Fix integer decoding bug 2014-02-26 21:44:48 +09:00
Tatsuhiro Tsujikawa d1c1deaf03 Add promised_stream_user_data parameter to nghttp2_submit_push_promise
This is very useful to associate application specific data to promised
stream.

nghttp2_nv_array_copy now does not complain the header field is large.
2014-02-25 00:26:12 +09:00
Tatsuhiro Tsujikawa 5e88be0b2c Update doc 2014-02-21 21:29:23 +09:00
Tatsuhiro Tsujikawa fc25143418 Remove END_PUSH_PROMISE in favor of END_HEADERS 2014-02-21 21:23:51 +09:00
Tatsuhiro Tsujikawa 9703c5de5c Code cleanup 2014-02-20 23:12:42 +09:00
Tatsuhiro Tsujikawa 3395f7158f Strict handling of max concurrent streams
Exceeding ACKed max concurrent streams results in connection error.
This change fixes the bug that num_{incoming,outgoing}_streams
is decremented wrongly if a stream is in reserved state and
RST_STREAM is send and its state is changed to NGHTTP2_STREAM_CLOSING.
This change also fixes the bug that transmission of push response
HEADERS does not increase num_outgoing_streams.
2014-02-20 23:10:32 +09:00
Tatsuhiro Tsujikawa 30b3855194 nghttp2_session_mem_send tiny doc fix
Patch from Dave Beckett
2014-02-19 21:18:24 +09:00
Tatsuhiro Tsujikawa 4ced1c1622 Code cleanup 2014-02-19 01:08:52 +09:00
Tatsuhiro Tsujikawa 2966ad2d15 Update doc 2014-02-19 00:16:25 +09:00
Tatsuhiro Tsujikawa 649586fff6 Add nghttp2_session_mem_send() API function
This function behaves like nghttp2_session_send(), but it does not
use nghttp2_send_callback to send data. Instead, it returns the
serialized data to trasmit and its length to the caller.
2014-02-18 23:23:11 +09:00
Tatsuhiro Tsujikawa 62b73133e5 Code cleanup 2014-02-15 18:56:20 +09:00
Tatsuhiro Tsujikawa 66832e9f4e Allow NGHTTP2_FLAG_END_SEGMENT in nghttp2_submit_headers() 2014-02-15 18:55:52 +09:00
Tatsuhiro Tsujikawa 0da79865b8 Don't set PAD_HIGH and PAD_LOW flags to HEADERS/PUSH_PROMISE object to user cb 2014-02-15 17:12:17 +09:00
Tatsuhiro Tsujikawa 3f3f258cd6 Add padding to PUSH_PROMISE 2014-02-15 16:30:43 +09:00
Tatsuhiro Tsujikawa 1e95c8b313 Allow always max 1024 padding for HEADERS
We need paddings regardless of payload and frame boundary to mitigate
certain attacks.

Since we handles CONTINUATION internally, we don't show FLAG_PAD_HIGH
and PAD_LOW flags of HEADERS in nghttp/nghttpd. We just show the
total paddings in HEADERS + CONTINUATION.
2014-02-15 01:34:04 +09:00
Tatsuhiro Tsujikawa 622f783675 Disallow PUSH_PROMISE from client side 2014-02-14 16:12:04 +09:00
Tatsuhiro Tsujikawa 7ab4206269 Tear down connection if SETTINGS makes window size overflow 2014-02-14 16:08:39 +09:00
Tatsuhiro Tsujikawa fd88c6160d HPACK post -05 updates
* Use 1 Huffman code table for both request and response
* Remove complicated deflater side table size management
* Add encoding context update
* Fix memory leak in inflater
2014-02-13 23:22:52 +09:00
Tatsuhiro Tsujikawa 082876d92d Contribute flow control window for each byte PAD_HIGH and _LOW in DATA
This may help the pathological situation where window is too small.
2014-02-12 21:35:40 +09:00
Tatsuhiro Tsujikawa c7a17093cb Fix compile errors with --enable-maintainer-mode 2014-02-11 21:39:35 +09:00
Tatsuhiro Tsujikawa bac31e844a Add more debug output 2014-02-11 21:35:41 +09:00
Tatsuhiro Tsujikawa 7822bbd7e8 Fix PAD_HIGH and PAD_LOW are not counted in flow control 2014-02-11 21:30:44 +09:00
Tatsuhiro Tsujikawa dbb131d13d Simplify framebufmark calculation for DATA frame 2014-02-11 18:55:22 +09:00
Tatsuhiro Tsujikawa 6364ae1a98 Fix nghttp2_active_outbound_item is not reset on DATA deferred 2014-02-11 18:43:45 +09:00
Tatsuhiro Tsujikawa 16b5e99e88 Bitwise-OR last CONTINUATION flags to first HEADERS flags 2014-02-11 17:30:38 +09:00
Tatsuhiro Tsujikawa 788072af9b Fix HEADERS padding is not added 2014-02-11 17:23:08 +09:00
Tatsuhiro Tsujikawa cf0b880b15 Error if undefined SETTINGS ID is detected in nghttp2_iv_check 2014-02-11 16:53:08 +09:00
Tatsuhiro Tsujikawa 3144bcbe20 Remove unused iframe->error_code 2014-02-11 16:34:42 +09:00
Tatsuhiro Tsujikawa eb2856f3df Add inbound_frame_reset_left() not to forget to reset iframe->buflen 2014-02-11 16:33:07 +09:00
Tatsuhiro Tsujikawa 9865b46905 Don't change state in inbound_frame_handle_pad 2014-02-11 16:24:21 +09:00
Tatsuhiro Tsujikawa e78a2100ec Merge branch 'master' into draft-10 2014-02-11 16:03:42 +09:00
Tatsuhiro Tsujikawa cacf4ecf26 Fix premature header block is not treated as connection error 2014-02-11 16:00:59 +09:00
Tatsuhiro Tsujikawa cbbecfeb41 Fix broken session_detect_idle_stream() 2014-02-11 15:35:44 +09:00
Tatsuhiro Tsujikawa 78d202ac30 Callback based padding from application
Now previous padding options are removed and instead we added
select_padding_callback to select padding length for each frame
by application. If this callback is not implemented by application,
no padding is added.

This change also fixes the broken session_detect_idle_stream()
if stream_id is our side.
2014-02-11 15:28:44 +09:00
Tatsuhiro Tsujikawa 118ed09da5 Allow disabling padding 2014-02-09 23:53:53 +09:00
Tatsuhiro Tsujikawa 5b58b4ace5 Add padding if payload length is zero 2014-02-09 22:01:07 +09:00
Tatsuhiro Tsujikawa 68b5ffc1dc Rename padding related names 2014-02-09 21:46:15 +09:00
Tatsuhiro Tsujikawa 256c97d89b Change default padding size to 16 2014-02-09 18:27:34 +09:00
Tatsuhiro Tsujikawa ba95cd936d Fix flow control error because padding is excluded 2014-02-09 18:26:46 +09:00
Tatsuhiro Tsujikawa a4070be518 Fix on_frame_recv_callback called multiple times if CONTINUATION is involved 2014-02-09 17:00:29 +09:00
Tatsuhiro Tsujikawa dffa078c11 Update doc 2014-02-09 16:49:24 +09:00
Tatsuhiro Tsujikawa 1db2195389 Implement padding for HEADERS and CONTINUATION 2014-02-09 15:17:26 +09:00
Tatsuhiro Tsujikawa 10feab02e8 Fix bufoff_ptr if no padding is made 2014-02-09 12:39:43 +09:00
Tatsuhiro Tsujikawa 9c30ed1a64 Update flags 2014-02-09 12:39:43 +09:00
Tatsuhiro Tsujikawa e9d1ba2539 Handle incoming PAD_HIGH and PAD_LOW in inbound_frame_handle_padding 2014-02-09 12:39:43 +09:00
Tatsuhiro Tsujikawa 2ff3d97b2e Add nghttp2_frame_add_pad to deal with adding pads 2014-02-09 12:39:43 +09:00
Tatsuhiro Tsujikawa b6a0eff8a8 Add more DEBUGFs 2014-02-08 00:32:50 +09:00
Tatsuhiro Tsujikawa 814d0f76f3 Implement DATA frame padding 2014-02-08 00:23:18 +09:00
Tatsuhiro Tsujikawa f26270b5b4 Change SETTINGS payload format according to the spec 2014-02-06 22:06:42 +09:00
Tatsuhiro Tsujikawa d584888601 Renumber frame types, flags and error codes 2014-02-06 21:49:16 +09:00
Tatsuhiro Tsujikawa 40a5756564 Terminate connection if unknown frame type is received 2014-02-06 21:42:49 +09:00
Tatsuhiro Tsujikawa f2c654f898 Fix reception of ENABLE_PUSH ignored; strict check for SETTINGS value 2014-02-06 21:39:58 +09:00
Tatsuhiro Tsujikawa 112b49cb9a Renumber SETTINGS 2014-02-06 00:26:12 +09:00
Tatsuhiro Tsujikawa c79adf6997 Remove flow control disabling feature 2014-02-06 00:23:20 +09:00
Tatsuhiro Tsujikawa 196406da0e Change protocol identifier to h2-10 2014-02-05 23:37:27 +09:00
Tatsuhiro Tsujikawa 9fcd35d063 Update doc 2014-02-05 23:04:42 +09:00
Tatsuhiro Tsujikawa 8c0730c281 Update doc 2014-02-01 19:46:59 +09:00
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