Commit Graph

54 Commits

Author SHA1 Message Date
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 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 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 f8fcee122a Check that empty name and NULL value are not included in nv 2012-08-21 23:19:15 +09:00
Tatsuhiro Tsujikawa ad13e56617 Removed unused variable 2012-05-25 19:07:01 +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 b06fa25ad2 Fixed compile error with -Wshadow. Fixed const cast. 2012-05-20 17:40:29 +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 67e83e09a6 Fixed duplicate name/value header block detection 2012-03-29 23:50:08 +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 9e716eb635 Code cleanup: C89 and old-style-prototypes and definition. 2012-03-23 02:17:48 +09:00
Tatsuhiro Tsujikawa 02924b6dd0 Added spdylay_submit_settings 2012-03-10 18:41:01 +09:00
Tatsuhiro Tsujikawa d05d29b507 Added SPDY/3 SETTINGS frame pack/unpack 2012-03-08 23:49:26 +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
Tatsuhiro Tsujikawa e29bb449e9 Exposed spdylay_frame_alloc_{pack,unpack}_nv for easy performance test 2012-03-01 23:52:15 +09:00
Tatsuhiro Tsujikawa a9d9126229 Assign 0 to GOAWAY status_code for SPDY/2 2012-03-01 22:39:26 +09:00
Tatsuhiro Tsujikawa abfc100edb Added convenient function spdylay_frame_nv_norm_copy() 2012-02-28 23:38:40 +09:00
Tatsuhiro Tsujikawa d5cc71c636 Added status_code handling to GOAWAY 2012-02-26 16:26:38 +09:00
Tatsuhiro Tsujikawa 88cd97843f Fixed GOAWAY length in SPDY/3 2012-02-26 01:48:18 +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 75bdfbf256 Made data_prd argument const. 2012-02-23 23:22:58 +09:00
Tatsuhiro Tsujikawa 33cd4b5946 Updated doc 2012-02-21 23:56:51 +09:00
Tatsuhiro Tsujikawa b182179aca Check frame length strictly for GOAWAY, RST_STREAM and PING. 2012-02-18 21:51:57 +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 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
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 c1aefb3ba5 Added flags argument to spdylay_submit_data() and spdylay_frame_data_init().
The intention is make spdylay_submit_data() more generic, allowing trailing
DATA and/or HEADERS frames.
2012-02-15 23:02:51 +09:00
Tatsuhiro Tsujikawa d4c5f39cf9 Don't check multiple in-sequence NULL in spdylay_frame_count_unpack_nv_space
If we return negative error code in that function, it means frame will not
unpacked and ends up to lose any information the frame contains.
The spec says it should send RST_STREAM with PROTOCOL_ERROR, so we need
at least stream ID.
Therefore, the check should be performed in
spdylay_session_on_syn_stream_received().
2012-02-05 21:57:55 +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 24eb3a3b36 SETTINGS ID is little endian in wire format despite the fact that spec/2 says it is network byte order. 2012-02-01 01:13:17 +09:00
Tatsuhiro Tsujikawa 0b75800c23 Added SETTINGS frame and its pack/unpack functions. 2012-02-01 00:26:26 +09:00
Tatsuhiro Tsujikawa aed626bfa5 Added GOAWAY handling 2012-01-28 19:22:38 +09:00
Tatsuhiro Tsujikawa b35f019811 Added callback functions for DATA frames. Fixed unpacking length field. 2012-01-28 03:54:53 +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 9461147968 Added pack/unpack of PING 2012-01-27 19:35:05 +09:00
Tatsuhiro Tsujikawa 74673013ae Define constant for nv pair offset. Defined SPDYLAY_PROTO_VERSION. 2012-01-27 18:28:29 +09:00
Tatsuhiro Tsujikawa 1c0ec66a2b Added HEADERS frame. Added SPDYLAY_FRAME_HEAD_LENGTH. 2012-01-27 18:21:14 +09:00
Tatsuhiro Tsujikawa 83b4e245d9 Removed debug output 2012-01-27 17:47:39 +09:00