diff --git a/src/HttpServer.cc b/src/HttpServer.cc index d32d128e..0bace4d6 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -418,8 +418,10 @@ int Http2Handler::read_clear() { } rv = nghttp2_session_mem_recv(session_, buf, nread); if (rv < 0) { - std::cerr << "nghttp2_session_mem_recv() returned error: " - << nghttp2_strerror(rv) << std::endl; + if (rv != NGHTTP2_ERR_BAD_PREFACE) { + std::cerr << "nghttp2_session_mem_recv() returned error: " + << nghttp2_strerror(rv) << std::endl; + } return -1; } } @@ -540,8 +542,10 @@ int Http2Handler::read_tls() { auto nread = rv; rv = nghttp2_session_mem_recv(session_, buf, nread); if (rv < 0) { - std::cerr << "nghttp2_session_mem_recv() returned error: " - << nghttp2_strerror(rv) << std::endl; + if (rv != NGHTTP2_ERR_BAD_PREFACE) { + std::cerr << "nghttp2_session_mem_recv() returned error: " + << nghttp2_strerror(rv) << std::endl; + } return -1; } } diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index f2b47bf3..033580ec 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -780,8 +780,10 @@ int Http2Upstream::on_read() { if (rb->rleft()) { rv = nghttp2_session_mem_recv(session_, rb->pos, rb->rleft()); if (rv < 0) { - ULOG(ERROR, this) << "nghttp2_session_recv() returned error: " - << nghttp2_strerror(rv); + if (rv != NGHTTP2_ERR_BAD_PREFACE) { + ULOG(ERROR, this) << "nghttp2_session_recv() returned error: " + << nghttp2_strerror(rv); + } return -1; }