Commit Graph

486 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa 6cd20c55d4 tests: Fix compile error with --enable-maintainer-mode 2014-01-18 00:44:32 +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 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 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 9dcd6b003d Refactor configure options
--enable-src is renamed as --enable-app. Fix build failure if
libxml2 is not available.
2014-01-10 23:19:36 +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 888792a949 nghttp2_hd: Allow HTAB and obs-text characters for field-content 2014-01-03 22:46:40 +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 7c4dbb6ffc nghttp2_hd: Don't malloc if huffman encoded string has 0 length 2013-12-19 23:19:14 +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 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 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 a3c888d7d1 nghttp2_map: Implement hash table 2013-12-05 00:53:03 +09:00
Tatsuhiro Tsujikawa 40a666e7d1 Add nghttp2_submit_response2 tests 2013-11-28 21:47:10 +09:00
Tatsuhiro Tsujikawa e57b3a2139 Set protocol ID to draft-08 temporarily 2013-11-21 21:58:45 +09:00
Tatsuhiro Tsujikawa 3d863ed254 nghttp2_hd: Clear reference set with index 0 2013-11-16 17:05:18 +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 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 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 d5c1eb04c9 Update .gitignore 2013-11-04 18:39:48 +09:00
Tatsuhiro Tsujikawa 8cd2b57f8a tests: Add test for header compression without indexing 2013-11-03 18:30:57 +09:00
Tatsuhiro Tsujikawa 7b3dade184 tests: Fix memory leak 2013-11-02 16:55:58 +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 9ee468ce62 tests: Remove unused function strcopy 2013-11-01 00:32:31 +09:00
Tatsuhiro Tsujikawa f2f8300b62 Add more tests for nghttp2_adjust_local_window_size 2013-10-31 21:26:53 +09:00
Tatsuhiro Tsujikawa 49b8ea1bf3 tests: Add failmalloc tests 2013-10-31 02:02:00 +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 6c99ff12c9 nghttp2_hd: Rename local as deflate 2013-10-29 00:42:08 +09:00
Tatsuhiro Tsujikawa 2dd44746a6 Merge branch 'master' into hpack-exp 2013-10-28 23:15:14 +09:00
Tatsuhiro Tsujikawa a416891454 tests: Fix test error on 32-bit system 2013-10-28 22:00:49 +09:00
Tatsuhiro Tsujikawa 924c858c8f tests: Add SETTINGS_HEADER_TABLE_SIZE test case 2013-10-28 01:08:09 +09:00
Tatsuhiro Tsujikawa 8c530f36cb Include std lib headers before cunit header file 2013-10-27 23:20:44 +09:00
Tatsuhiro Tsujikawa 683253e334 Declare HTTP-draft-07/2.0 2013-10-27 23:16:49 +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 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 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 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 4e4fab01b1 Merge branch 'master' into hpack-exp
Conflicts:
	lib/nghttp2_hd.c
2013-10-18 20:06:36 +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 5add90489f Protocol ID change for HPACK experiment 2013-10-16 01:19:06 +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 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 c5501dcb8d tests: Test WINDOW_UPDATE is queued when certain amount of DATA is received 2013-10-04 21:42:02 +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 b14a97a273 Update .gitignore 2013-09-14 21:18:08 +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
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 a6a394902e tests: Fix out-of-bound read 2013-09-08 23:16:25 +09:00
Tatsuhiro Tsujikawa a67d042a00 tests: Fix buffer overrun 2013-09-08 15:29:46 +09:00
Tatsuhiro Tsujikawa 2c127b5cb6 Remove unused functions/macros 2013-09-07 15:48:16 +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 d960cf8953 Add const to read-only nghttp2_frame* parameter in callbacks 2013-09-03 21:24:14 +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 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 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 66e5ac03a6 Connection error if header continuation is used by peer for now 2013-08-28 23:38:56 +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 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 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 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 346fafde3f Implement draft-ietf-httpbis-header-compression-02 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 35229b250f Treat reception of DATA in reserved stream as connection error 2013-08-23 03:33:05 +09:00
Tatsuhiro Tsujikawa da384988cd Add test for WINDOW_UPDATE against reserved 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 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 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 1155606d5e Rewrite re-prioritization with PRIORITY 2013-08-09 23:40:41 +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 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 737ac01d91 Add API for HTTP Upgrade 2013-08-03 18:05:14 +09:00
Tatsuhiro Tsujikawa f9c566ec1f Fix memory leak in unittest 2013-07-28 19:08:49 +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 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 e496800cb7 Fix header compression bug 2013-07-26 01:34:28 +09:00
Tatsuhiro Tsujikawa 1056d8690e Rename functions related to HEADERS 2013-07-25 21:07:38 +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 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 ef3caffe8b Remove push related members from nghttp2_stream 2013-07-23 00:46:55 +09:00
Tatsuhiro Tsujikawa 0bcf90d32d Support PRIORITY frame send and receive 2013-07-23 00:28:00 +09:00
Tatsuhiro Tsujikawa 9c58004a86 Cleanup 2013-07-20 01:24:34 +09:00
Tatsuhiro Tsujikawa c3ed20b75d Remove debug output 2013-07-20 01:19:33 +09:00
Tatsuhiro Tsujikawa e92b74d66e Use substitution as long as no eviction is required 2013-07-20 01:19:00 +09:00
Tatsuhiro Tsujikawa aa4df35a10 Remove NGHTTP2_OPT_MAX_RECV_CTRL_FRAME_BUFFER option 2013-07-20 00:24:25 +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 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 05c1eeac85 Disable end_to_end test
Will enable it again when spdycat and spdyd are ready for http/2.0
2013-07-13 00:46:24 +09:00
Tatsuhiro Tsujikawa 0edce70343 Rebranding nghttp2 2013-07-13 00:43:06 +09:00
Tatsuhiro Tsujikawa f47bf214e5 Allow server initiated stream ID in associated-stream-id 2013-04-05 23:24:28 +09:00
Tatsuhiro Tsujikawa e543441ccc tests: Fix compiler warning 2013-03-28 01:36:02 +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 c235800a1a Link -ldl with tests only 2013-01-27 16:48:52 +09:00
Tatsuhiro Tsujikawa 5adfd07e7c Fix SPDY/3 priority pack and unpack handling 2013-01-20 19:04:04 +09:00
Tatsuhiro Tsujikawa 8a2020362d tests: Use traditional C-style comments 2012-11-14 21:00:36 +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 e69947a054 Removed trailing spaces 2012-10-01 21:51:24 +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 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 ca415a2a15 Add --enable-src configure option
When --enable-src is given, the programs in src directory will be
built. If --disable-src is given, those programs will not be built. If
none of them are given, --enable-src is assumed.
2012-09-10 21:51:08 +09:00
Tatsuhiro Tsujikawa b0fcd68783 Move spdycat, spdyd and shrpx from examples to src
To distinguish the to-be-installed programs and non-installable
example source code, the former programs, spdycat, spdydyd and shrpx,
were moved to src directory. spdynative was removed from Makefile
because it does not appeal to any users much.
2012-09-10 21:39:51 +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 f8fcee122a Check that empty name and NULL value are not included in nv 2012-08-21 23:19:15 +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 7b8768bd3a Fixed compile error with --enable-maintainer-mode 2012-06-11 23:12:23 +09:00
Tatsuhiro Tsujikawa d12217a1c5 Removed redundant CFLAGS 2012-06-11 23:12:02 +09:00
Tatsuhiro Tsujikawa 245c7ff1b3 Return nonzero exit status if test fails. Fixed failmalloc tests. 2012-05-31 21:55:21 +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 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 e778f268de Fixed compiler warning with stricter warning options 2012-05-13 17:38:29 +09:00
Tatsuhiro Tsujikawa 164312d857 Added test for EOF from recv_callback. 2012-05-12 18:32:37 +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 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 1158de22a3 Added status_code argument to spdylay_on_invalid_ctrl_recv_callback 2012-05-09 23:10:52 +09:00
Tatsuhiro Tsujikawa b7429e7c2d Added spdylay_submit_window_update() public API. 2012-05-08 23:41:59 +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 5412ccf129 Renamed spdylay_gzip API. Added test for them. 2012-05-07 22:56:28 +09:00
Tatsuhiro Tsujikawa 7b239cc7b0 Packaging fix 2012-04-25 22:27:50 +09:00
Tatsuhiro Tsujikawa c91a4ec091 Added tests for malloc failures 2012-04-24 22:51:06 +09:00
Jim Morrison f74bfae451 Merge remote-tracking branch 'original_master/master' 2012-04-11 12:45:46 -07:00
Tatsuhiro Tsujikawa 6c32c50e23 Include spdylay_net.h instead of arpa/inet.h 2012-04-06 23:37:25 +09:00
Jim Morrison f7d1ca2740 Move timeout checking into the query parameter condition. Copy last_modified date string for file responses. 2012-04-05 11:11:02 -07:00
Tatsuhiro Tsujikawa 828b57c937 Merge branch 'master' of github.com:tatsuhiro-t/spdylay 2012-04-06 02:25:49 +09:00
Tatsuhiro Tsujikawa cb7c0ba142 Fixed typo in union selection 2012-04-06 01:50:48 +09:00
Tatsuhiro Tsujikawa d83d1cd33a Added CREDENTIAL frame support. 2012-04-06 01:45:39 +09:00
Jim Morrison 310d88c787 Add a timeout parameter to spdycat and add a crazy parameter to spdyd to test it (or test other clients) 2012-04-04 10:19:00 -07:00
Tatsuhiro Tsujikawa 93953c102b Fixed memory leak in unittest 2012-04-04 00:56:21 +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 8251fa1315 Made OpenSSL not mandatory. Don't build examples if OpenSSL is not found.
Spdylay library itself does not depend on OpenSSL. The example programs
in examples directory do. Spdylay library should be built without
OpenSSL.
2012-03-29 02:13:33 +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 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