Commit Graph

662 Commits

Author SHA1 Message Date
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 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 425a9558d7 Fixed memory leak in unit test 2012-03-17 23:03:11 +09:00
Tatsuhiro Tsujikawa 8f038ae4b6 Added spdylay_session_get_outbound_queue_size() 2012-03-15 23:06:28 +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
Tatsuhiro Tsujikawa 02924b6dd0 Added spdylay_submit_settings 2012-03-10 18:41:01 +09:00
Tatsuhiro Tsujikawa 82e20192d8 Added functions to process received SETTINGS frame.
Now remote and local settings are stored separately.
The initial window size is included in SETTINGS frame, all active stream's
window sizes are now updated.
Removed the initial_window_size member from spdylay_stream because
it is the same as remote_settings's initial window size.
2012-03-10 00:10:11 +09:00
Tatsuhiro Tsujikawa 6c9e79e8ca Use SPDY/3 name in spdylay_settings_flag.
Added SPDYLAY_SETTINGS_CLIENT_CERTIFICATE_VECTOR_SIZE.
2012-03-09 21:38:05 +09:00
Tatsuhiro Tsujikawa d05d29b507 Added SPDY/3 SETTINGS frame pack/unpack 2012-03-08 23:49:26 +09:00
Tatsuhiro Tsujikawa 0a7c510147 Renamed SPDYLAY_ERR_STREAM_ALREADY_CLOSED as SPDYLAY_ERR_STREAM_CLOSED
Added doc for spdylay_error values
2012-03-08 00:37:18 +09:00
Tatsuhiro Tsujikawa 0e86cec673 Fixed memory leak in unit tests 2012-03-08 00:25:00 +09:00
Tatsuhiro Tsujikawa 11020146f5 Added on_ctrl_not_send_callback.
This callback function is invoked after the control frame
is not sent because of the error. The error is indicated by
the error argument, which is one of the values defined in spdylay_error.
2012-03-08 00:18:18 +09:00
Tatsuhiro Tsujikawa 00abfc8dd3 Always accept SPDY/3 style name/value pairs from spdylay_submit_* and
translate them into SPDY/2 as needed.
2012-03-07 00:38:27 +09:00
Jim Morrison ac7b87c7a5 Check Return non-zero for failed spdy requests. 2012-03-02 10:59:07 -08:00
Tatsuhiro Tsujikawa 8fd2fabef8 Made spdylay_select_next_protocol() return SPDY protocol version if one of
SPDY versions is selected.
2012-03-02 22:52:01 +09:00
Jim Morrison 4e085a21ea Verify that the expected version of spdy is used. 2012-03-01 12:41:24 -08:00
Jim Morrison 3b1b4a6ca0 Add a test for spdy version 3. 2012-03-01 12:09:31 -08:00
Jim Morrison 9c50bd4c29 Add a simple test between spdycat and spdyd. 2012-03-01 12:04:16 -08:00
Jim Morrison 097f59e3d3 Fix tests build when building outside the source tree. 2012-03-01 11:07:39 -08:00
Tatsuhiro Tsujikawa 7bea01d0ce Fixed use of uninitialized deflater 2012-03-01 22:40:09 +09:00
Tatsuhiro Tsujikawa abfc100edb Added convenient function spdylay_frame_nv_norm_copy() 2012-02-28 23:38:40 +09:00
Tatsuhiro Tsujikawa e79de111a4 Added spdylay_submit_syn_reply 2012-02-28 23:27:10 +09:00
Tatsuhiro Tsujikawa 3d1b411895 Added test for negative window_size case 2012-02-27 23:24:17 +09:00
Tatsuhiro Tsujikawa 036efc1018 Separated SPDY2 and SPDY3 tests to ease debugging 2012-02-26 16:33:53 +09:00
Tatsuhiro Tsujikawa d5cc71c636 Added status_code handling to GOAWAY 2012-02-26 16:26:38 +09:00
Tatsuhiro Tsujikawa 8693874340 Added SPDY/3 flow control. 2012-02-26 00:12:32 +09:00
Tatsuhiro Tsujikawa 4e62c75b02 Added function to pack and unpack WINDOW_UPDATE frame. 2012-02-25 01:47:37 +09:00
Tatsuhiro Tsujikawa 847830f132 Added ability to pack/unpack SPDY/3 frames.
Added SPDY/3 zlib dictionary from draft-mbelshe-httpbis-spdy-00.
2012-02-25 01:17:03 +09:00
Tatsuhiro Tsujikawa 995ccbc8e5 Added version argument to spdylay_frame_*_init. Added version member to
spdylay_session.
2012-02-24 23:33:06 +09:00
Tatsuhiro Tsujikawa 7652d3f4ca Added support for 4 bytes length in name/value pair. 2012-02-24 23:05:49 +09:00
Tatsuhiro Tsujikawa cf7da38598 Define flags separately for control and data frames. 2012-02-24 21:40:13 +09:00
Tatsuhiro Tsujikawa 769150d5f7 Added spdylay_submit_headers function. 2012-02-24 00:02:29 +09:00
Tatsuhiro Tsujikawa 9e9e281bca Added spdylay_submit_syn_stream function. 2012-02-23 23:20:05 +09:00
Tatsuhiro Tsujikawa 9fa8357bbc Made return value of spdylay_map_init() void. Updated doc. 2012-02-21 23:23:47 +09:00
Tatsuhiro Tsujikawa 37944253d2 Ensure read_callback is non-NULL for response bodies. 2012-02-21 22:04:24 +09:00
Jim Morrison 6e7025b9f5 Test that FLAG_FIN is set if the read callback is NULL. 2012-02-20 13:12:13 -08:00
Tatsuhiro Tsujikawa 2edceb1fb1 Fixed compiler warning 2012-02-19 23:49:43 +09:00
Tatsuhiro Tsujikawa 54e4c80b96 Added stream_id argument to spdylay_data_source_read_callback 2012-02-19 23:48:39 +09:00
Tatsuhiro Tsujikawa 301eb29cd4 Added ability to postpone DATA frames for asynchronous I/O. 2012-02-19 23:42:25 +09:00
Tatsuhiro Tsujikawa 4f28698572 Fixed: if bytes of one frame are received in several chunks, unpacking fails. 2012-02-19 00:05:52 +09:00
Tatsuhiro Tsujikawa 03307116a2 Send GOAWAY when spdylay_frame_unpack_* is failed with non-fatal error.
SPDYLAY_ERR_ZLIB is now moved back to non-fatal error and it is subject
to GOAWAY if it occurred.
2012-02-18 21:55:40 +09:00
Tatsuhiro Tsujikawa 122c619260 Fixed spdylay_frame_count_nv_space() bug. Check all data is processed in spdylay_frame_count_unpack_nv_space() 2012-02-18 17:25:13 +09:00
Tatsuhiro Tsujikawa 6f30bbbcb5 Fixed test name 2012-02-16 23:47:04 +09:00
Tatsuhiro Tsujikawa 6cb4259232 Merge branch 'master' of https://github.com/sorced-jim/spdylay into sorced-jim-master 2012-02-16 23:41:53 +09:00
Tatsuhiro Tsujikawa ac1629e61b Reuse buffers when unpacking frames. 2012-02-16 22:01:34 +09:00
Tatsuhiro Tsujikawa 050f33e8f9 Reuse buffers when packing frames.
Temporal name/value buffer will be shared by unpacking frame.
2012-02-16 20:54:30 +09:00
Jim Morrison 40e8fc960e Create a test that explicitly checks that a key exists only once in a name/value block. 2012-02-15 12:07:25 -08:00
Tatsuhiro Tsujikawa 85ec883d11 Lower-case names in name/value pairs in spdylay_submit_{request, response} 2012-02-15 23:54:42 +09:00
Tatsuhiro Tsujikawa 938f51964d Respond RST_STREAM with PROTOCOL_ERROR when upper cased name is present in nv. 2012-02-15 22:11:42 +09:00
Tatsuhiro Tsujikawa fd06d21638 Call on_stream_close_callback when server pushed SYN_STREAM has FIN flag set.
Don't mix status code and return value in
spdylay_session_on_syn_stream_received.
2012-02-15 00:45:09 +09:00
Tatsuhiro Tsujikawa a48ad800b2 When a stream is canceled by RST_STREAM, don't send further DATA on that stream. 2012-02-12 19:01:23 +09:00
Tatsuhiro Tsujikawa 028e1f2b8f Added test case where DATA frame is backed off by higher priority frame. 2012-02-12 18:30:19 +09:00
Tatsuhiro Tsujikawa ad50b75d75 Fixed compiler warning 2012-02-09 22:48:33 +09:00
Tatsuhiro Tsujikawa 8fac259285 For non-overlap case, made out and outlen left untouched 2012-02-09 22:46:26 +09:00
Tatsuhiro Tsujikawa f1c4427328 Added a check to see whether the installed cunit requires -lncurses 2012-02-09 22:11:30 +09:00
Tatsuhiro Tsujikawa 34f0f6be1b Refuse incoming SYN_STREAM with SPDYLAY_REFUSED_STREAM if max-concurrent-streams number is reached. 2012-02-08 23:45:48 +09:00
Tatsuhiro Tsujikawa fa312caa06 Check cunit and openssl in configure and set substitute variables. 2012-02-08 23:11:06 +09:00
Tatsuhiro Tsujikawa 14ac6f8ca8 Fixed 16bit int overflow 2012-02-08 21:50:16 +09:00
Tatsuhiro Tsujikawa 887850e2f0 Use explicit name for variables to check callback function was called. 2012-02-08 21:46:29 +09:00
Tatsuhiro Tsujikawa 679159878f Merge branch 'master' of https://github.com/sorced-jim/spdylay into sorced-jim-master
Conflicts:
	tests/main.c
	tests/spdylay_session_test.c
	tests/spdylay_session_test.h
2012-02-08 21:37:44 +09:00
Tatsuhiro Tsujikawa b8700259fd Changed behaviour of spdylay_select_next_protocol()
We use following algorithm to select protocol:

 1. If server's list contains "spdy/2", this function selects
    "spdy/2" and returns 1. The following steps are not taken.

 2. If server's list contains "http/1.1", this function selects
    "http/1.1" and returns 0. The following step is not taken.

 3. This function selects "spdy/2" and returns -1. (So called
    non-overlap case).
2012-02-08 21:20:50 +09:00
Jim Morrison 4298dc8a51 Erase the stream from the map after calling the on_stream_close callback 2012-02-07 14:17:38 -08:00
Jim Morrison 4ebfa021ba Use pkg-config to get the cunit library. 2012-02-07 14:16:55 -08:00
Tatsuhiro Tsujikawa 4630dfb4fe Added spdylay_on_request_recv_callback function.
This function invoked when request from remote peer is
received.  In other words, frame with FIN flag set is received.  In
HTTP, this means HTTP request, including request body, is fully
received.
2012-02-08 00:11:44 +09:00
Tatsuhiro Tsujikawa 00bed87537 Support max concurrent streams limit.
If max concurrent streams limit is reached, SYN_STREAM frames are not sent
and backed off. If other type of frame is waiting in the tx queue, it is
sent first. We introduced another priority queue for this purpose.
In this change we did not add code to send RST_STREAM when SYN_STREAM is
received but max concurrent stream is reached.
2012-02-06 00:14:19 +09:00
Tatsuhiro Tsujikawa d0cd362852 Changed spdylay_select_next_protocol behaviour
It now always select "spdy/2" as a next protocol regardless whether or not
the server advertises it. The NPN draft allows this.
Returning integer version number is not flexible because the selected protcol
is just a string.
The function now returns 0 if the server advertised spdy/2, or -1.
2012-02-05 21:48:20 +09:00
Tatsuhiro Tsujikawa be7cc9710f Added asserts to test_spdylay_frame_count_unpack_nv_space() 2012-02-04 23:27:05 +09:00
Tatsuhiro Tsujikawa 8b20e83652 Rewritten spdylay_frame_unpack_nv().
We use just single buffer to store name/value headers fields, instead of
allocating memory for each name/value strings.
It is now more than 2 times faster than old one.
2012-02-04 23:09:03 +09:00
Tatsuhiro Tsujikawa 1f72165549 Added stream_user_data arg to spdylay_submit_request() to identify stream ID later easily.
Specified stream_user_data_arg can be retrieved by
spdylay_session_get_stream_user_data() function. The application code can use
this function insde spdylay_on_ctrl_send_callback() and identify stream ID
for the request associated by the stream_user_data.
The sample usage is in examples/spdycat.cc.
2012-02-04 01:37:21 +09:00
Tatsuhiro Tsujikawa 876c33c562 Merge branch 'master' of https://github.com/sorced-jim/spdylay into sorced-jim-master
Conflicts:
	examples/spdylay_ssl.cc
	tests/Makefile.am
	tests/main.c

Changes:
        spdylay_select_next_protocol() returns -1 if it fails.
        Use cunit without pkg-config because debian does not provide .pc file.
        Some doc updates to suite my taste.
        Added spdylay_npn.h
2012-02-03 23:53:43 +09:00
Jim Morrison ea60bd8c6e Add an NPN callback helper that finds the correct version of spdy 2012-02-02 16:31:11 -08:00
Tatsuhiro Tsujikawa 4030c5ccf5 Closes all server-pushed streams when original stream is closed by RST_STREAM with CANCEL from client.
Fixed spdylay_session_is_my_stream_id()
2012-02-02 23:20:25 +09:00
Tatsuhiro Tsujikawa bb6a90dc4d Added spdylay_stream_add_pushed_stream
With this function and 3 new member in spdylay_stream, we can track server-
pushed streams which associate them to this stream.
2012-02-02 21:51:52 +09:00
Tatsuhiro Tsujikawa 562278194c Added server push SYN_STREAM validation. Added spdylay_session_server_new()
We still does not check "url" is in nv.
2012-02-02 00:19:31 +09:00
Tatsuhiro Tsujikawa 0b75800c23 Added SETTINGS frame and its pack/unpack functions. 2012-02-01 00:26:26 +09:00
Tatsuhiro Tsujikawa 9785b99959 Suppress warnings in test code 2012-01-31 21:38:40 +09:00
Tatsuhiro Tsujikawa afbade9e79 Fixed test error 2012-01-31 21:34:42 +09:00
Tatsuhiro Tsujikawa 3d4cf8aec3 Added data_prd arugment to spdylay_submit_request() and supported POST request. 2012-01-29 19:07:31 +09:00
Tatsuhiro Tsujikawa 06dae79b28 Discard inbound HEADERS and DATA in CLOSING state. Handle stream shutdown when DATA is received with FIN bit set. 2012-01-29 16:27:00 +09:00
Tatsuhiro Tsujikawa e212eea08a Don't send GOAWAY when it is received from peer. Fixed want_read, want_write. 2012-01-29 15:11:10 +09:00
Tatsuhiro Tsujikawa 82bcf78ec1 Fixed HFILES entries 2012-01-29 00:25:02 +09:00
Tatsuhiro Tsujikawa 971e46f563 More explicit handling of shutdown status of read and write in each stream. 2012-01-29 00:08:51 +09:00
Tatsuhiro Tsujikawa aed626bfa5 Added GOAWAY handling 2012-01-28 19:22:38 +09:00
Tatsuhiro Tsujikawa 33c62b90c6 Added check for unpacked ctrl header 2012-01-28 04:01:16 +09:00
Tatsuhiro Tsujikawa de57b6efea Sort nv in spdylay_submit_request and spdylay_submit_response 2012-01-28 00:09:01 +09:00
Tatsuhiro Tsujikawa d614325024 Fixed compiler warning. Added missing spdylay_session_on_ping_received prototype in header 2012-01-27 23:37:47 +09:00
Tatsuhiro Tsujikawa 8f53343dc3 Renamed spdylay_req_submit and spdylay_reply_submit as spdylay_submit_request and spdylay_submit_response 2012-01-27 23:35:23 +09:00
Tatsuhiro Tsujikawa d1c4c59aad Added handling of received PING 2012-01-27 23:05:29 +09:00
Tatsuhiro Tsujikawa 9461147968 Added pack/unpack of PING 2012-01-27 19:35:05 +09:00
Tatsuhiro Tsujikawa a59c3efedb Added handling when HEADERS is received. 2012-01-27 19:10:13 +09:00
Tatsuhiro Tsujikawa 1c0ec66a2b Added HEADERS frame. Added SPDYLAY_FRAME_HEAD_LENGTH. 2012-01-27 18:21:14 +09:00
Tatsuhiro Tsujikawa beb509ef39 Check stream before sending SYN_REPLY and DATA. Don't make stream if incoming SYN_STREAM has FIN and UNIDIRECTIONAL set. 2012-01-27 17:09:40 +09:00
Tatsuhiro Tsujikawa fd802300fa Fixed compiler warning 2012-01-27 01:33:44 +09:00
Tatsuhiro Tsujikawa 21e165f1f8 Added spdylay_reply_submit() and DATA frame handling after SYN_REPLY. 2012-01-27 01:17:40 +09:00
Tatsuhiro Tsujikawa f642bb98c7 Added spdylay_map_size() 2012-01-26 02:28:58 +09:00
Tatsuhiro Tsujikawa 6e627548be Added stream status change after sending SYN_STREAM and SYN_REPLY. 2012-01-26 01:04:01 +09:00
Tatsuhiro Tsujikawa 1ce2598758 Fixed bug that causes segmentation fault when erasing key which does not exist in map. 2012-01-26 00:21:31 +09:00
Tatsuhiro Tsujikawa 43c0ef8151 Check that SYN_STREAM pri is stored in stream 2012-01-25 23:56:18 +09:00
Tatsuhiro Tsujikawa cbb8dd6a8c Added pri to spdylay_stream. Refactored SYN_STREAM, SYN_REPLY handling when they are received. 2012-01-25 23:46:07 +09:00
Tatsuhiro Tsujikawa 3bfe48972c Queue RST_STREAM if invalid stream ID is received in SYN_STREAM or SYN_REPLY.
Fixed bug that Z_DATA_ERROR is not handled.
Fixed bug that spdylay_frame_alloc_pack_nv does not use nv_offset correctly.
2012-01-25 21:31:28 +09:00
Tatsuhiro Tsujikawa 5ececcd8e7 Added test 2012-01-24 23:06:58 +09:00
Tatsuhiro Tsujikawa a52ff39850 Renamed spdylay_session_init as spdylay_session_new. Added session arg to cb.
Now recv_callback and send_callback accepts session argument.
spdylay_session_free was also renamed as spdylay_session_del.
2012-01-24 22:56:26 +09:00
Tatsuhiro Tsujikawa 9c8270436f Added header deflate/inflate using zlib. Added send/recv frame. 2012-01-24 22:02:24 +09:00
Tatsuhiro Tsujikawa 1330d74b73 Added struct of fixed sized chunk buffers backed by queue 2012-01-20 01:04:13 +09:00
Tatsuhiro Tsujikawa 1000998228 Added spdylay_queue 2012-01-19 21:57:26 +09:00
Tatsuhiro Tsujikawa a03afa6a82 Added spdylay_map. Added missing tests/main.c 2012-01-19 21:36:13 +09:00
Tatsuhiro Tsujikawa 0eebf89f35 Added priority queue 2012-01-18 02:10:22 +09:00
Tatsuhiro Tsujikawa 1f5bc832f8 Added libtool files 2012-01-18 00:53:12 +09:00