From 802c47a037b9a4bac360e86d06b3bd779d3c2c7f Mon Sep 17 00:00:00 2001 From: HoneyryderChuck Date: Tue, 10 Aug 2021 10:20:06 +0100 Subject: [PATCH] multipart decoding: fail if no boundary found in header --- lib/httpx/plugins/multipart/decoder.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/httpx/plugins/multipart/decoder.rb b/lib/httpx/plugins/multipart/decoder.rb index 09e4bb5b..4cf09f3e 100644 --- a/lib/httpx/plugins/multipart/decoder.rb +++ b/lib/httpx/plugins/multipart/decoder.rb @@ -49,7 +49,9 @@ module HTTPX::Plugins def initialize(response) @boundary = begin m = response.headers["content-type"].to_s[BOUNDARY_RE, 1] - m && m.strip + raise Error, "no boundary declared in content-type header" unless m + + m.strip end @buffer = "".b @parts = {}