Module: HTTP

Defined in:
lib/httpclient/http.rb

Defined Under Namespace

Modules: Status Classes: BadResponseError, Error, Message

Constant Summary collapse

ProtocolVersionRegexp =
Regexp.new('^(?:HTTP/|)(\d+)\.(\d+)$')

Class Method Summary collapse

Class Method Details

.http_date(a_time) ⇒ Object



51
52
53
# File 'lib/httpclient/http.rb', line 51

def http_date(a_time)
  a_time.gmtime.strftime("%a, %d %b %Y %H:%M:%S GMT")
end

.keep_alive_enabled?(version) ⇒ Boolean

Returns:

  • (Boolean)


56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/httpclient/http.rb', line 56

def keep_alive_enabled?(version)
  ProtocolVersionRegexp =~ version
  if !($1 and $2)
    false
  elsif $1.to_i > 1
	true
  elsif $1.to_i == 1 and $2.to_i >= 1
	true
  else
	false
  end
end