content_length()
public
Returns an Integer object which represents the
HTTP Content-Length: header field, or
nil if that field was not provided.
Show source
def content_length
return nil unless key?('Content-Length')
len = self['Content-Length'].slice(/\d+/) or
raise HTTPHeaderSyntaxError, 'wrong Content-Length format'
len.to_i
end