Module: HTTP

Defined in:
lib/http-access2/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



35
36
37
# File 'lib/http-access2/http.rb', line 35

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)


40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/http-access2/http.rb', line 40

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