Protocol ID change for HPACK experiment

This commit is contained in:
Tatsuhiro Tsujikawa 2013-10-16 01:19:06 +09:00
parent a2735ed025
commit 5add90489f
4 changed files with 20 additions and 7 deletions

View File

@ -4,6 +4,19 @@ nghttp2 - HTTP/2.0 C Library
This is an experimental implementation of Hypertext Transfer Protocol This is an experimental implementation of Hypertext Transfer Protocol
version 2.0. version 2.0.
This branch explores upcoming HPACK changes:
* Unified request/response static header table
* Insert index 0 and remove the last one
* Drop substitution
* Huffman encoding
With these changes, the implemented protocol is not compatible with
HTTP-draft-06/2.0. Therefore, this branch uses
HTTP-nghttp2hpack-06/2.0 as protocol identifier. The following section
does not reflect this protocl identifier change. Read it by replacing
HTTP-draft-06/2.0 with HTTP-nghttp2hpack-06/2.0.
Development Status Development Status
------------------ ------------------

View File

@ -40,13 +40,13 @@ extern "C" {
* *
* The protocol version identification of this library supports. * The protocol version identification of this library supports.
*/ */
#define NGHTTP2_PROTO_VERSION_ID "HTTP-draft-06/2.0" #define NGHTTP2_PROTO_VERSION_ID "HTTP-nghttp2hpack-06/2.0"
/** /**
* @macro * @macro
* *
* The length of :macro:`NGHTTP2_PROTO_VERSION_ID`. * The length of :macro:`NGHTTP2_PROTO_VERSION_ID`.
*/ */
#define NGHTTP2_PROTO_VERSION_ID_LEN 17 #define NGHTTP2_PROTO_VERSION_ID_LEN 24
struct nghttp2_session; struct nghttp2_session;
/** /**

View File

@ -1018,11 +1018,11 @@ int HttpServer::run()
verify_callback); verify_callback);
} }
proto_list[0] = 17; proto_list[0] = NGHTTP2_PROTO_VERSION_ID_LEN;
memcpy(&proto_list[1], NGHTTP2_PROTO_VERSION_ID, memcpy(&proto_list[1], NGHTTP2_PROTO_VERSION_ID,
NGHTTP2_PROTO_VERSION_ID_LEN); NGHTTP2_PROTO_VERSION_ID_LEN);
next_proto.first = proto_list; next_proto.first = proto_list;
next_proto.second = 18; next_proto.second = proto_list[0] + 1;
SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, &next_proto); SSL_CTX_set_next_protos_advertised_cb(ssl_ctx, next_proto_cb, &next_proto);
} }

View File

@ -32,15 +32,15 @@ static void http2(void)
{ {
const unsigned char p[] = { const unsigned char p[] = {
8, 'h', 't', 't', 'p', '/', '1', '.', '1', 8, 'h', 't', 't', 'p', '/', '1', '.', '1',
17, 'H', 'T', 'T', 'P', '-', 'd', 'r', 'a', 'f', 't', '-', '0', '6', '/', 24, 'H', 'T', 'T', 'P', '-', 'n', 'g', 'h', 't', 't', 'p', '2', 'h', 'p', 'a', 'c', 'k', '-', '0', '6', '/',
'2', '.', '0', '2', '.', '0',
6, 's', 'p', 'd', 'y', '/', '3' 6, 's', 'p', 'd', 'y', '/', '3'
}; };
unsigned char outlen; unsigned char outlen;
unsigned char* out; unsigned char* out;
CU_ASSERT(1 == nghttp2_select_next_protocol(&out, &outlen, p, sizeof(p))); CU_ASSERT(1 == nghttp2_select_next_protocol(&out, &outlen, p, sizeof(p)));
CU_ASSERT(17 == outlen); CU_ASSERT(24 == outlen);
CU_ASSERT(memcmp("HTTP-draft-06/2.0", out, outlen) == 0); CU_ASSERT(memcmp(NGHTTP2_PROTO_VERSION_ID, out, outlen) == 0);
} }
static void http11(void) static void http11(void)