From 9f5f724147f15c67633ddcd1a7f08045223208c4 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 2 Feb 2015 00:20:44 +0900 Subject: [PATCH] nghttpd, nghttpx: Don't log error NGHTTP2_ERR_BAD_PREFACE --- src/HttpServer.cc | 12 ++++++++---- src/shrpx_http2_upstream.cc | 6 ++++-- 2 files changed, 12 insertions(+), 6 deletions(-) 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; }