End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Net::HTTPHeader#content_length
content_length
lib/net/http/header.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/net/http/header.rb, line 310
def content_length
return nil unless key?('Content-Length')
len = self['Content-Length'].slice(/\d+/) or
raise Net::HTTPHeaderSyntaxError, 'wrong Content-Length format'
len.to_i
end
Returns an Integer object which represents the HTTP Content-Length: header field, or nil if that field was not provided.
See also
#content_length=
#connection_keep_alive?
#connection_close?
#content_range
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1