Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
Tatsuhiro Tsujikawa | 4c76aaeea4 | |
Tatsuhiro Tsujikawa | 2b51ad67d3 | |
Tatsuhiro Tsujikawa | 708379dcab | |
Tatsuhiro Tsujikawa | 73106b0d0d |
|
@ -24,12 +24,12 @@
|
|||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
# XXX using 1.8.90 instead of 1.9.0-DEV
|
||||
project(nghttp2 VERSION 1.32.0)
|
||||
project(nghttp2 VERSION 1.32.1)
|
||||
|
||||
# See versioning rule:
|
||||
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
||||
set(LT_CURRENT 30)
|
||||
set(LT_REVISION 2)
|
||||
set(LT_REVISION 3)
|
||||
set(LT_AGE 16)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
|
|
|
@ -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.32.0], [t-tujikawa@users.sourceforge.net])
|
||||
AC_INIT([nghttp2], [1.32.1], [t-tujikawa@users.sourceforge.net])
|
||||
AC_CONFIG_AUX_DIR([.])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
@ -45,7 +45,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
|||
dnl See versioning rule:
|
||||
dnl http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
||||
AC_SUBST(LT_CURRENT, 30)
|
||||
AC_SUBST(LT_REVISION, 2)
|
||||
AC_SUBST(LT_REVISION, 3)
|
||||
AC_SUBST(LT_AGE, 16)
|
||||
|
||||
major=`echo $PACKAGE_VERSION |cut -d. -f1 | sed -e "s/[^0-9]//g"`
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "H2LOAD" "1" "May 08, 2018" "1.32.0" "nghttp2"
|
||||
.TH "H2LOAD" "1" "Aug 25, 2018" "1.32.1" "nghttp2"
|
||||
.SH NAME
|
||||
h2load \- HTTP/2 benchmarking tool
|
||||
.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "NGHTTP" "1" "May 08, 2018" "1.32.0" "nghttp2"
|
||||
.TH "NGHTTP" "1" "Aug 25, 2018" "1.32.1" "nghttp2"
|
||||
.SH NAME
|
||||
nghttp \- HTTP/2 client
|
||||
.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "NGHTTPD" "1" "May 08, 2018" "1.32.0" "nghttp2"
|
||||
.TH "NGHTTPD" "1" "Aug 25, 2018" "1.32.1" "nghttp2"
|
||||
.SH NAME
|
||||
nghttpd \- HTTP/2 server
|
||||
.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.\" Man page generated from reStructuredText.
|
||||
.
|
||||
.TH "NGHTTPX" "1" "May 08, 2018" "1.32.0" "nghttp2"
|
||||
.TH "NGHTTPX" "1" "Aug 25, 2018" "1.32.1" "nghttp2"
|
||||
.SH NAME
|
||||
nghttpx \- HTTP/2 proxy
|
||||
.
|
||||
|
|
|
@ -3797,10 +3797,13 @@ nghttp2_priority_spec_check_default(const nghttp2_priority_spec *pri_spec);
|
|||
* .. warning::
|
||||
*
|
||||
* This function returns assigned stream ID if it succeeds. But
|
||||
* that stream is not opened yet. The application must not submit
|
||||
* that stream is not created yet. The application must not submit
|
||||
* frame to that stream ID before
|
||||
* :type:`nghttp2_before_frame_send_callback` is called for this
|
||||
* frame.
|
||||
* frame. This means `nghttp2_session_get_stream_user_data()` does
|
||||
* not work before the callback. But
|
||||
* `nghttp2_session_set_stream_user_data()` handles this situation
|
||||
* specially, and it can set data to a stream during this period.
|
||||
*
|
||||
*/
|
||||
NGHTTP2_EXTERN int32_t nghttp2_submit_request(
|
||||
|
|
|
@ -7085,12 +7085,42 @@ int nghttp2_session_set_stream_user_data(nghttp2_session *session,
|
|||
int32_t stream_id,
|
||||
void *stream_user_data) {
|
||||
nghttp2_stream *stream;
|
||||
nghttp2_frame *frame;
|
||||
nghttp2_outbound_item *item;
|
||||
|
||||
stream = nghttp2_session_get_stream(session, stream_id);
|
||||
if (!stream) {
|
||||
if (stream) {
|
||||
stream->stream_user_data = stream_user_data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (session->server || !nghttp2_session_is_my_stream_id(session, stream_id) ||
|
||||
!nghttp2_outbound_queue_top(&session->ob_syn)) {
|
||||
return NGHTTP2_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
stream->stream_user_data = stream_user_data;
|
||||
return 0;
|
||||
|
||||
frame = &nghttp2_outbound_queue_top(&session->ob_syn)->frame;
|
||||
assert(frame->hd.type == NGHTTP2_HEADERS);
|
||||
|
||||
if (frame->hd.stream_id > stream_id ||
|
||||
(uint32_t)stream_id >= session->next_stream_id) {
|
||||
return NGHTTP2_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
for (item = session->ob_syn.head; item; item = item->qnext) {
|
||||
if (item->frame.hd.stream_id < stream_id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item->frame.hd.stream_id > stream_id) {
|
||||
break;
|
||||
}
|
||||
|
||||
item->aux_data.headers.stream_user_data = stream_user_data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return NGHTTP2_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
int nghttp2_session_resume_data(nghttp2_session *session, int32_t stream_id) {
|
||||
|
|
|
@ -43,13 +43,13 @@ int main() {
|
|||
|
||||
/* initialize the CUnit test registry */
|
||||
if (CUE_SUCCESS != CU_initialize_registry())
|
||||
return CU_get_error();
|
||||
return (int)CU_get_error();
|
||||
|
||||
/* add a suite to the registry */
|
||||
pSuite = CU_add_suite("libnghttp2_TestSuite", init_suite1, clean_suite1);
|
||||
if (NULL == pSuite) {
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
return (int)CU_get_error();
|
||||
}
|
||||
|
||||
/* add the tests to the suite */
|
||||
|
@ -62,7 +62,7 @@ int main() {
|
|||
!CU_add_test(pSuite, "failmalloc_frame", test_nghttp2_frame) ||
|
||||
!CU_add_test(pSuite, "failmalloc_hd", test_nghttp2_hd)) {
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
return (int)CU_get_error();
|
||||
}
|
||||
|
||||
/* Run all tests using the CUnit Basic interface */
|
||||
|
@ -74,6 +74,6 @@ int main() {
|
|||
return (int)num_tests_failed;
|
||||
} else {
|
||||
printf("CUnit Error: %s\n", CU_get_error_msg());
|
||||
return CU_get_error();
|
||||
return (int)CU_get_error();
|
||||
}
|
||||
}
|
||||
|
|
10
tests/main.c
10
tests/main.c
|
@ -55,13 +55,13 @@ int main() {
|
|||
|
||||
/* initialize the CUnit test registry */
|
||||
if (CUE_SUCCESS != CU_initialize_registry())
|
||||
return CU_get_error();
|
||||
return (int)CU_get_error();
|
||||
|
||||
/* add a suite to the registry */
|
||||
pSuite = CU_add_suite("libnghttp2_TestSuite", init_suite1, clean_suite1);
|
||||
if (NULL == pSuite) {
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
return (int)CU_get_error();
|
||||
}
|
||||
|
||||
/* add the tests to the suite */
|
||||
|
@ -316,6 +316,8 @@ int main() {
|
|||
test_nghttp2_session_pause_data) ||
|
||||
!CU_add_test(pSuite, "session_no_closed_streams",
|
||||
test_nghttp2_session_no_closed_streams) ||
|
||||
!CU_add_test(pSuite, "session_set_stream_user_data",
|
||||
test_nghttp2_session_set_stream_user_data) ||
|
||||
!CU_add_test(pSuite, "http_mandatory_headers",
|
||||
test_nghttp2_http_mandatory_headers) ||
|
||||
!CU_add_test(pSuite, "http_content_length",
|
||||
|
@ -411,7 +413,7 @@ int main() {
|
|||
test_nghttp2_bufs_next_present) ||
|
||||
!CU_add_test(pSuite, "bufs_realloc", test_nghttp2_bufs_realloc)) {
|
||||
CU_cleanup_registry();
|
||||
return CU_get_error();
|
||||
return (int)CU_get_error();
|
||||
}
|
||||
|
||||
/* Run all tests using the CUnit Basic interface */
|
||||
|
@ -423,6 +425,6 @@ int main() {
|
|||
return (int)num_tests_failed;
|
||||
} else {
|
||||
printf("CUnit Error: %s\n", CU_get_error_msg());
|
||||
return CU_get_error();
|
||||
return (int)CU_get_error();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10442,6 +10442,39 @@ void test_nghttp2_session_no_closed_streams(void) {
|
|||
nghttp2_option_del(option);
|
||||
}
|
||||
|
||||
void test_nghttp2_session_set_stream_user_data(void) {
|
||||
nghttp2_session *session;
|
||||
nghttp2_session_callbacks callbacks;
|
||||
int32_t stream_id;
|
||||
int user_data1, user_data2;
|
||||
int rv;
|
||||
const uint8_t *datap;
|
||||
ssize_t datalen;
|
||||
|
||||
memset(&callbacks, 0, sizeof(nghttp2_session_callbacks));
|
||||
|
||||
nghttp2_session_client_new(&session, &callbacks, NULL);
|
||||
|
||||
stream_id = nghttp2_submit_request(session, NULL, reqnv, ARRLEN(reqnv), NULL,
|
||||
&user_data1);
|
||||
|
||||
rv = nghttp2_session_set_stream_user_data(session, stream_id, &user_data2);
|
||||
|
||||
CU_ASSERT(0 == rv);
|
||||
|
||||
datalen = nghttp2_session_mem_send(session, &datap);
|
||||
|
||||
CU_ASSERT(datalen > 0);
|
||||
|
||||
CU_ASSERT(&user_data2 ==
|
||||
nghttp2_session_get_stream_user_data(session, stream_id));
|
||||
|
||||
CU_ASSERT(NGHTTP2_ERR_INVALID_ARGUMENT ==
|
||||
nghttp2_session_set_stream_user_data(session, 2, NULL));
|
||||
|
||||
nghttp2_session_del(session);
|
||||
}
|
||||
|
||||
static void check_nghttp2_http_recv_headers_fail(
|
||||
nghttp2_session *session, nghttp2_hd_deflater *deflater, int32_t stream_id,
|
||||
int stream_state, const nghttp2_nv *nva, size_t nvlen) {
|
||||
|
|
|
@ -156,6 +156,7 @@ void test_nghttp2_session_cancel_from_before_frame_send(void);
|
|||
void test_nghttp2_session_removed_closed_stream(void);
|
||||
void test_nghttp2_session_pause_data(void);
|
||||
void test_nghttp2_session_no_closed_streams(void);
|
||||
void test_nghttp2_session_set_stream_user_data(void);
|
||||
void test_nghttp2_http_mandatory_headers(void);
|
||||
void test_nghttp2_http_content_length(void);
|
||||
void test_nghttp2_http_content_length_mismatch(void);
|
||||
|
|
Loading…
Reference in New Issue