From b924ef5fff3f5fc15db133074d30a7333d835264 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Fri, 8 Apr 2016 23:24:51 +0900 Subject: [PATCH] altsvc: Discard altsvc when it is received by server in earlier point --- lib/nghttp2_session.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 9b37c575..8af22bd7 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -4666,9 +4666,7 @@ int nghttp2_session_on_altsvc_received(nghttp2_session *session, altsvc = frame->ext.payload; - if (session->server) { - return 0; - } + /* session->server case has been excluded */ if (frame->hd.stream_id == 0) { if (altsvc->origin_len == 0) { @@ -5567,6 +5565,12 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, iframe->frame.hd.flags = NGHTTP2_FLAG_NONE; iframe->frame.ext.payload = &iframe->ext_frame_payload.altsvc; + if (session->server) { + busy = 1; + iframe->state = NGHTTP2_IB_IGN_PAYLOAD; + break; + } + if (iframe->payloadleft < 2) { busy = 1; iframe->state = NGHTTP2_IB_FRAME_SIZE_ERROR;