Skip to content

Commit 3e932f6

Browse files
authored
Merge commit from fork
1 parent 537f50c commit 3e932f6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Messages.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,12 @@ function mkheaders(h, headers=Vector{Header}(undef, length(h)))::Headers
209209
for (i, head) in enumerate(h)
210210
head isa String && throw(ArgumentError("header must be passed as key => value pair: `$head`"))
211211
length(head) != 2 && throw(ArgumentError("invalid header key-value pair: $head"))
212-
headers[i] = SubString(string(head[1])) => SubString(string(head[2]))
212+
key = SubString(string(head[1]))
213+
value = SubString(string(head[2]))
214+
if !occursin(r"^[!#$%&'*+\-.^_`|~[:alnum:]]+$", key) || !occursin(r"^[!-~]+$", value)
215+
throw(ArgumentError("Invalid header key or value"))
216+
end
217+
headers[i] = key => value
213218
end
214219
return headers
215220
end

0 commit comments

Comments
 (0)