Class: SimpleXChat::HTTPResponse

Inherits:
Net::HTTPResponse
  • Object
show all
Defined in:
lib/simplex-chat/patches.rb

Overview

Fixes regex match for status line in HTTPResponse

Class Method Summary collapse

Class Method Details

.read_status_line(sock) ⇒ Object



9
10
11
12
13
14
# File 'lib/simplex-chat/patches.rb', line 9

def read_status_line(sock)
  str = sock.readline
  m = /\AHTTP(?:\/(\d+\.\d+))?\s+(\d\d\d)(?:\s+(.*))?\Z/in.match(str) or
    raise Net::HTTPBadResponse, "wrong status line: #{str.dump}"
  m.captures
end