nghttp: Receive ORIGIN frame

This commit is contained in:
Tatsuhiro Tsujikawa 2018-05-10 23:19:27 +09:00
parent 8034221525
commit 325612bcde
2 changed files with 12 additions and 0 deletions

View File

@ -106,6 +106,8 @@ std::string strframetype(uint8_t type) {
return "WINDOW_UPDATE";
case NGHTTP2_ALTSVC:
return "ALTSVC";
case NGHTTP2_ORIGIN:
return "ORIGIN";
}
std::string s = "extension(0x";
@ -351,6 +353,15 @@ void print_frame(print_type ptype, const nghttp2_frame *frame) {
static_cast<int>(altsvc->field_value_len), altsvc->field_value);
break;
}
case NGHTTP2_ORIGIN: {
auto origin = static_cast<nghttp2_ext_origin *>(frame->ext.payload);
for (size_t i = 0; i < origin->nov; ++i) {
auto ent = &origin->ov[i];
print_frame_attr_indent();
fprintf(outfile, "[%.*s]\n", (int)ent->origin_len, ent->origin);
}
break;
}
default:
break;
}

View File

@ -127,6 +127,7 @@ Config::Config()
nghttp2_option_set_peer_max_concurrent_streams(http2_option,
peer_max_concurrent_streams);
nghttp2_option_set_builtin_recv_extension_type(http2_option, NGHTTP2_ALTSVC);
nghttp2_option_set_builtin_recv_extension_type(http2_option, NGHTTP2_ORIGIN);
}
Config::~Config() { nghttp2_option_del(http2_option); }