[ruby/net-http] Fix previous commit

https://github.com/ruby/net-http/commit/1b276e2654
This commit is contained in:
NAKAMURA Usaku 2023-03-30 21:41:03 +09:00 committed by git
parent d8b8294c28
commit eedcd696a5

View File

@ -191,10 +191,10 @@ module Net::HTTPHeader
warn "net/http: nil HTTP header: #{key}", uplevel: 3 if $VERBOSE
else
value = value.strip # raise error for invalid byte sequences
if key.bytesize > MAX_KEY_LENGTH
if key.to_s.bytesize > MAX_KEY_LENGTH
raise ArgumentError, "too long (#{key.bytesize} bytes) header: #{key[0, 30].inspect}..."
end
if value.bytesize > MAX_FIELD_LENGTH
if value.to_s.bytesize > MAX_FIELD_LENGTH
raise ArgumentError, "header #{key} has too long field vallue: #{value.bytesize}"
end
if value.count("\r\n") > 0