Compare commits

..

11 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa
68f6df61e5 Update man pages 2015-06-27 10:58:25 +09:00
Tatsuhiro Tsujikawa
078337de3c Bump up version number to 1.0.5, LT revision to 14:5:0 2015-06-27 10:55:54 +09:00
Tatsuhiro Tsujikawa
9e82687cbe Fix compile error with --enable-werror 2015-06-26 23:21:01 +09:00
Tatsuhiro Tsujikawa
660f90e13f Add switch STREAM_DEP_DEBUG to enable runtime validation of depedency tree 2015-06-26 23:02:18 +09:00
Tatsuhiro Tsujikawa
2eec42df39 Merge branch 'master' of https://github.com/tatsuhiro-t/nghttp2 2015-06-26 00:03:04 +09:00
Tatsuhiro Tsujikawa
34b92a30de Merge pull request #268 from Andersbakken/typo
Fix typo
2015-06-26 00:02:46 +09:00
Tatsuhiro Tsujikawa
bab99af565 Fix unusual control flow in stream_update_dep_set_rest 2015-06-25 22:31:15 +09:00
Anders Bakken
2e8e38ec35 Fix typo 2015-06-24 13:56:50 -07:00
Tatsuhiro Tsujikawa
d6ca95a0c9 Fix sibling's item is not queued when ancestor's item is detached 2015-06-24 22:18:07 +09:00
Tatsuhiro Tsujikawa
285c74c394 nghttpx: Fix crash with --http2-bridge and both frontend and backend TLS 2015-06-24 21:31:17 +09:00
Tatsuhiro Tsujikawa
7780c07838 Bump up version number to 1.0.5-DEV 2015-06-23 23:25:22 +09:00
9 changed files with 267 additions and 21 deletions

View File

@@ -25,7 +25,7 @@ dnl Do not change user variables!
dnl http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
AC_PREREQ(2.61)
AC_INIT([nghttp2], [1.0.4], [t-tujikawa@users.sourceforge.net])
AC_INIT([nghttp2], [1.0.5], [t-tujikawa@users.sourceforge.net])
AC_USE_SYSTEM_EXTENSIONS
LT_PREREQ([2.2.6])
@@ -48,7 +48,7 @@ AC_CONFIG_HEADERS([config.h])
dnl See versioning rule:
dnl http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
AC_SUBST(LT_CURRENT, 14)
AC_SUBST(LT_REVISION, 4)
AC_SUBST(LT_REVISION, 5)
AC_SUBST(LT_AGE, 0)
major=`echo $PACKAGE_VERSION |cut -d. -f1 | sed -e "s/[^0-9]//g"`

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "H2LOAD" "1" "June 23, 2015" "1.0.4" "nghttp2"
.TH "H2LOAD" "1" "June 27, 2015" "1.0.5" "nghttp2"
.SH NAME
h2load \- HTTP/2 benchmarking tool
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "NGHTTP" "1" "June 23, 2015" "1.0.4" "nghttp2"
.TH "NGHTTP" "1" "June 27, 2015" "1.0.5" "nghttp2"
.SH NAME
nghttp \- HTTP/2 experimental client
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "NGHTTPD" "1" "June 23, 2015" "1.0.4" "nghttp2"
.TH "NGHTTPD" "1" "June 27, 2015" "1.0.5" "nghttp2"
.SH NAME
nghttpd \- HTTP/2 experimental server
.

View File

@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "NGHTTPX" "1" "June 23, 2015" "1.0.4" "nghttp2"
.TH "NGHTTPX" "1" "June 27, 2015" "1.0.5" "nghttp2"
.SH NAME
nghttpx \- HTTP/2 experimental proxy
.

View File

@@ -308,7 +308,7 @@ const char *nghttp2_strerror(int error_code) {
case NGHTTP2_ERR_CALLBACK_FAILURE:
return "The user callback function failed";
case NGHTTP2_ERR_BAD_CLIENT_MAGIC:
return "Received bad clinet magic byte string";
return "Received bad client magic byte string";
default:
return "Unknown error code";
}

View File

@@ -155,6 +155,8 @@ int32_t nghttp2_stream_dep_distributed_weight(nghttp2_stream *stream,
}
static void stream_update_dep_set_rest(nghttp2_stream *stream) {
nghttp2_stream *si;
if (stream == NULL) {
return;
}
@@ -167,14 +169,12 @@ static void stream_update_dep_set_rest(nghttp2_stream *stream) {
if (stream->dpri == NGHTTP2_STREAM_DPRI_TOP) {
stream->dpri = NGHTTP2_STREAM_DPRI_REST;
stream_update_dep_set_rest(stream->sib_next);
return;
}
stream_update_dep_set_rest(stream->sib_next);
stream_update_dep_set_rest(stream->dep_next);
for (si = stream->dep_next; si; si = si->sib_next) {
stream_update_dep_set_rest(si);
}
}
/*
@@ -315,9 +315,146 @@ static nghttp2_stream *stream_get_dep_blocking(nghttp2_stream *stream) {
return NULL;
}
#ifdef STREAM_DEP_DEBUG
static size_t check_stream_num(nghttp2_stream *stream) {
size_t n = 1;
nghttp2_stream *si;
for (si = stream->dep_next; si; si = si->sib_next) {
n += check_stream_num(si);
}
if (n != stream->num_substreams) {
fprintf(stderr, "num_substreams = %zu; want %zu\n", n,
stream->num_substreams);
assert(0);
}
return n;
}
static void ensure_rest_or_no_item(nghttp2_stream *stream) {
nghttp2_stream *si;
switch (stream->dpri) {
case NGHTTP2_STREAM_DPRI_TOP:
fprintf(stderr, "NGHTTP2_STREAM_DPRI_TOP; want REST or NO_ITEM\n");
assert(0);
break;
case NGHTTP2_STREAM_DPRI_REST:
case NGHTTP2_STREAM_DPRI_NO_ITEM:
for (si = stream->dep_next; si; si = si->sib_next) {
ensure_rest_or_no_item(si);
}
break;
default:
fprintf(stderr, "invalid dpri %d\n", stream->dpri);
assert(0);
}
}
static void check_dpri(nghttp2_stream *stream) {
nghttp2_stream *si;
switch (stream->dpri) {
case NGHTTP2_STREAM_DPRI_TOP:
if (!stream->item->queued) {
fprintf(stderr, "stream->item->queued is not nonzero while it is in "
"NGHTTP2_STREAM_DPRI_TOP\n");
assert(0);
}
/* fall through */
case NGHTTP2_STREAM_DPRI_REST:
for (si = stream->dep_next; si; si = si->sib_next) {
ensure_rest_or_no_item(si);
}
break;
case NGHTTP2_STREAM_DPRI_NO_ITEM:
for (si = stream->dep_next; si; si = si->sib_next) {
check_dpri(si);
}
break;
default:
fprintf(stderr, "invalid dpri %d\n", stream->dpri);
assert(0);
}
}
static void check_sum_dep(nghttp2_stream *stream) {
nghttp2_stream *si;
int32_t n = 0;
for (si = stream->dep_next; si; si = si->sib_next) {
n += si->weight;
}
if (n != stream->sum_dep_weight) {
fprintf(stderr, "sum_dep_weight = %d; want %d\n", n,
stream->sum_dep_weight);
assert(0);
}
for (si = stream->dep_next; si; si = si->sib_next) {
check_sum_dep(si);
}
}
static int check_sum_norest(nghttp2_stream *stream) {
nghttp2_stream *si;
int32_t n = 0;
switch (stream->dpri) {
case NGHTTP2_STREAM_DPRI_TOP:
return 1;
case NGHTTP2_STREAM_DPRI_REST:
return 0;
case NGHTTP2_STREAM_DPRI_NO_ITEM:
for (si = stream->dep_next; si; si = si->sib_next) {
if (check_sum_norest(si)) {
n += si->weight;
}
}
break;
default:
fprintf(stderr, "invalid dpri %d\n", stream->dpri);
assert(0);
}
if (n != stream->sum_norest_weight) {
fprintf(stderr, "sum_norest_weight = %d; want %d\n", n,
stream->sum_norest_weight);
assert(0);
}
return n > 0;
}
static void check_dep_prev(nghttp2_stream *stream) {
nghttp2_stream *si;
for (si = stream->dep_next; si; si = si->sib_next) {
if (si->dep_prev != stream) {
fprintf(stderr, "si->dep_prev = %p; want %p\n", si->dep_prev, stream);
assert(0);
}
check_dep_prev(si);
}
}
#endif /* STREAM_DEP_DEBUG */
#ifdef STREAM_DEP_DEBUG
static void validate_tree(nghttp2_stream *stream) {
if (!stream) {
return;
}
for (; stream->dep_prev; stream = stream->dep_prev)
;
check_stream_num(stream);
check_dpri(stream);
check_sum_dep(stream);
check_sum_norest(stream);
check_dep_prev(stream);
}
#else /* !STREAM_DEP_DEBUG */
static void validate_tree(nghttp2_stream *stream _U_) {}
#endif /* !STREAM_DEP_DEBUG*/
static int stream_update_dep_on_attach_item(nghttp2_stream *stream,
nghttp2_session *session) {
nghttp2_stream *blocking_stream;
nghttp2_stream *blocking_stream, *si;
int rv;
stream->dpri = NGHTTP2_STREAM_DPRI_REST;
@@ -327,6 +464,7 @@ static int stream_update_dep_on_attach_item(nghttp2_stream *stream,
/* If we found REST or TOP in ascendants, we don't have to update
any metadata. */
if (blocking_stream) {
validate_tree(stream);
return 0;
}
@@ -334,7 +472,9 @@ static int stream_update_dep_on_attach_item(nghttp2_stream *stream,
if (stream->sum_norest_weight == 0) {
stream_update_dep_sum_norest_weight(stream->dep_prev, stream->weight);
} else {
stream_update_dep_set_rest(stream->dep_next);
for (si = stream->dep_next; si; si = si->sib_next) {
stream_update_dep_set_rest(si);
}
}
if (!stream->item->queued) {
@@ -346,13 +486,17 @@ static int stream_update_dep_on_attach_item(nghttp2_stream *stream,
}
}
validate_tree(stream);
return 0;
}
static int stream_update_dep_on_detach_item(nghttp2_stream *stream,
nghttp2_session *session) {
int rv;
if (stream->dpri == NGHTTP2_STREAM_DPRI_REST) {
stream->dpri = NGHTTP2_STREAM_DPRI_NO_ITEM;
validate_tree(stream);
return 0;
}
@@ -360,6 +504,7 @@ static int stream_update_dep_on_detach_item(nghttp2_stream *stream,
/* nghttp2_stream_defer_item() does not clear stream->item, but
set dpri = NGHTTP2_STREAM_DPRI_NO_ITEM. Catch this case
here. */
validate_tree(stream);
return 0;
}
@@ -367,10 +512,18 @@ static int stream_update_dep_on_detach_item(nghttp2_stream *stream,
if (stream_update_dep_set_top(stream) == 0) {
stream_update_dep_sum_norest_weight(stream->dep_prev, -stream->weight);
validate_tree(stream);
return 0;
}
return stream_update_dep_queue_top(stream->dep_next, session);
rv = stream_update_dep_queue_top(stream, session);
if (rv != 0) {
return rv;
}
validate_tree(stream);
return 0;
}
int nghttp2_stream_attach_item(nghttp2_stream *stream,
@@ -550,6 +703,8 @@ void nghttp2_stream_dep_insert(nghttp2_stream *dep_stream,
stream_update_dep_length(dep_stream, 1);
++stream->roots->num_streams;
validate_tree(stream);
}
static void set_dep_prev(nghttp2_stream *stream, nghttp2_stream *dep) {
@@ -679,6 +834,8 @@ void nghttp2_stream_dep_add(nghttp2_stream *dep_stream,
}
++stream->roots->num_streams;
validate_tree(stream);
}
void nghttp2_stream_dep_remove(nghttp2_stream *stream) {
@@ -726,8 +883,10 @@ void nghttp2_stream_dep_remove(nghttp2_stream *stream) {
if (stream->sib_prev) {
unlink_sib(stream);
validate_tree(stream->sib_prev->dep_prev);
} else if (stream->dep_prev) {
unlink_dep(stream);
validate_tree(stream->dep_prev);
} else {
nghttp2_stream_roots_remove(stream->roots, stream);
@@ -743,6 +902,8 @@ void nghttp2_stream_dep_remove(nghttp2_stream *stream) {
nghttp2_stream_roots_add(si->roots, si);
validate_tree(si);
si = next;
}
}
@@ -767,6 +928,7 @@ int nghttp2_stream_dep_insert_subtree(nghttp2_stream *dep_stream,
nghttp2_stream *blocking_stream;
nghttp2_stream *si;
size_t delta_substreams;
int rv;
DEBUGF(fprintf(stderr, "stream: dep_insert_subtree dep_stream(%p)=%d "
"stream(%p)=%d\n",
@@ -776,6 +938,10 @@ int nghttp2_stream_dep_insert_subtree(nghttp2_stream *dep_stream,
blocking_stream = stream_get_dep_blocking(dep_stream);
if (blocking_stream) {
stream_update_dep_set_rest(stream);
}
if (dep_stream->dep_next) {
/* dep_stream->num_substreams includes dep_stream itself */
stream->num_substreams += dep_stream->num_substreams - 1;
@@ -786,7 +952,9 @@ int nghttp2_stream_dep_insert_subtree(nghttp2_stream *dep_stream,
dep_next = dep_stream->dep_next;
if (!blocking_stream && dep_stream->sum_norest_weight) {
stream_update_dep_set_rest(dep_next);
for (si = dep_next; si; si = si->sib_next) {
stream_update_dep_set_rest(si);
}
}
link_dep(dep_stream, stream);
@@ -812,25 +980,33 @@ int nghttp2_stream_dep_insert_subtree(nghttp2_stream *dep_stream,
stream_update_dep_length(dep_stream, delta_substreams);
if (blocking_stream) {
stream_update_dep_set_rest(stream);
validate_tree(dep_stream);
return 0;
}
if (stream_update_dep_set_top(stream) == 0) {
validate_tree(dep_stream);
return 0;
}
dep_stream->sum_norest_weight = stream->weight;
stream_update_dep_sum_norest_weight(dep_stream->dep_prev, dep_stream->weight);
return stream_update_dep_queue_top(stream, session);
rv = stream_update_dep_queue_top(stream, session);
if (rv != 0) {
return rv;
}
validate_tree(dep_stream);
return 0;
}
int nghttp2_stream_dep_add_subtree(nghttp2_stream *dep_stream,
nghttp2_stream *stream,
nghttp2_session *session) {
nghttp2_stream *blocking_stream;
int rv;
DEBUGF(fprintf(stderr, "stream: dep_add_subtree dep_stream(%p)=%d "
"stream(%p)=%d\n",
@@ -856,15 +1032,18 @@ int nghttp2_stream_dep_add_subtree(nghttp2_stream *dep_stream,
NGHTTP2_DPRI_TOP. Just dfs under stream here. */
stream_update_dep_set_rest(stream);
validate_tree(dep_stream);
return 0;
}
if (stream->dpri == NGHTTP2_STREAM_DPRI_TOP) {
stream_update_dep_sum_norest_weight(dep_stream, stream->weight);
validate_tree(dep_stream);
return 0;
}
if (stream_update_dep_set_top(stream) == 0) {
validate_tree(dep_stream);
return 0;
}
@@ -872,7 +1051,14 @@ int nghttp2_stream_dep_add_subtree(nghttp2_stream *dep_stream,
sum_norest_weight */
stream_update_dep_sum_norest_weight(dep_stream, stream->weight);
return stream_update_dep_queue_top(stream, session);
rv = stream_update_dep_queue_top(stream, session);
if (rv != 0) {
return rv;
}
validate_tree(dep_stream);
return 0;
}
void nghttp2_stream_dep_remove_subtree(nghttp2_stream *stream) {
@@ -911,6 +1097,8 @@ void nghttp2_stream_dep_remove_subtree(nghttp2_stream *stream) {
stream->sum_norest_weight))) {
stream_update_dep_sum_norest_weight(dep_prev, -stream->weight);
}
validate_tree(dep_prev);
}
stream->sib_prev = NULL;
@@ -920,16 +1108,26 @@ void nghttp2_stream_dep_remove_subtree(nghttp2_stream *stream) {
int nghttp2_stream_dep_make_root(nghttp2_stream *stream,
nghttp2_session *session) {
int rv;
DEBUGF(fprintf(stderr, "stream: dep_make_root stream(%p)=%d\n", stream,
stream->stream_id));
nghttp2_stream_roots_add(stream->roots, stream);
if (stream_update_dep_set_top(stream) == 0) {
validate_tree(stream);
return 0;
}
return stream_update_dep_queue_top(stream, session);
rv = stream_update_dep_queue_top(stream, session);
if (rv != 0) {
return rv;
}
validate_tree(stream);
return 0;
}
int

View File

@@ -543,6 +543,14 @@ void ConnectionHandler::proceed_next_cert_ocsp() {
auto ssl_ctx = all_ssl_ctx_[ocsp_.next];
auto tls_ctx_data =
static_cast<ssl::TLSContextData *>(SSL_CTX_get_app_data(ssl_ctx));
// client SSL_CTX is also included in all_ssl_ctx_, but has no
// tls_ctx_data.
if (!tls_ctx_data) {
++ocsp_.next;
continue;
}
auto cert_file = tls_ctx_data->cert_file;
if (start_ocsp_update(cert_file) != 0) {

View File

@@ -6429,6 +6429,46 @@ void test_nghttp2_session_stream_attach_item(void) {
CU_ASSERT(0 == b->sum_norest_weight);
nghttp2_session_del(session);
nghttp2_session_server_new(&session, &callbacks, NULL);
a = open_stream(session, 1);
b = open_stream_with_dep(session, 3, a);
c = open_stream_with_dep(session, 5, a);
d = open_stream_with_dep(session, 7, c);
/* a
* |
* c--b
* |
* d
*/
da = create_data_ob_item(mem);
db = create_data_ob_item(mem);
dc = create_data_ob_item(mem);
nghttp2_stream_attach_item(a, da, session);
nghttp2_stream_attach_item(b, db, session);
nghttp2_stream_attach_item(c, dc, session);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_REST == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_REST == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == d->dpri);
/* check that all children's item get queued */
nghttp2_stream_detach_item(a, session);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == a->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == b->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_TOP == c->dpri);
CU_ASSERT(NGHTTP2_STREAM_DPRI_NO_ITEM == d->dpri);
CU_ASSERT(1 == db->queued);
CU_ASSERT(1 == dc->queued);
nghttp2_session_del(session);
}
void test_nghttp2_session_stream_attach_item_subtree(void) {