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).
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.
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.
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.
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.
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