/** * Decodes the settings header and returns a {@link Http2Settings} object. */ private Http2Settings decodeSettingsHeader(ChannelHandlerContext ctx, CharSequence settingsHeader) throws Http2Exception { ByteBuf header = ByteBufUtil.encodeString(ctx.alloc(), CharBuffer.wrap(settingsHeader), CharsetUtil.UTF_8); try { // Decode the SETTINGS payload. ByteBuf payload = Base64.decode(header, URL_SAFE); // Create an HTTP/2 frame for the settings. ByteBuf frame = createSettingsFrame(ctx, payload); // Decode the SETTINGS frame and return the settings object. return decodeSettings(ctx, frame); } finally { header.release(); } }
/** * Decodes the settings header and returns a {@link Http2Settings} object. */ private Http2Settings decodeSettingsHeader(ChannelHandlerContext ctx, CharSequence settingsHeader) throws Http2Exception { ByteBuf header = ByteBufUtil.encodeString(ctx.alloc(), CharBuffer.wrap(settingsHeader), CharsetUtil.UTF_8); try { // Decode the SETTINGS payload. ByteBuf payload = Base64.decode(header, URL_SAFE); // Create an HTTP/2 frame for the settings. ByteBuf frame = createSettingsFrame(ctx, payload); // Decode the SETTINGS frame and return the settings object. return decodeSettings(ctx, frame); } finally { header.release(); } }
/** * Decodes the settings header and returns a {@link Http2Settings} object. */ private Http2Settings decodeSettingsHeader(ChannelHandlerContext ctx, CharSequence settingsHeader) throws Http2Exception { ByteBuf header = ByteBufUtil.encodeString(ctx.alloc(), CharBuffer.wrap(settingsHeader), CharsetUtil.UTF_8); try { // Decode the SETTINGS payload. ByteBuf payload = Base64.decode(header, URL_SAFE); // Create an HTTP/2 frame for the settings. ByteBuf frame = createSettingsFrame(ctx, payload); // Decode the SETTINGS frame and return the settings object. return decodeSettings(ctx, frame); } finally { header.release(); } }