lib/http/protocol/http2/framer.rb in http-protocol-0.1.1 vs lib/http/protocol/http2/framer.rb in http-protocol-0.2.0
- old
+ new
@@ -58,10 +58,14 @@
@frames = frames
@buffer = String.new.b
end
+ def close
+ @io.close
+ end
+
def write_connection_preface
@io.write(CONNECTION_PREFACE_MAGIC)
end
def read_connection_preface
@@ -95,10 +99,15 @@
frame.write(@io)
@io.flush
end
def read_header
- return Frame.parse_header(@io.read(9))
+ if buffer = @io.read(9)
+ return Frame.parse_header(buffer)
+ else
+ # TODO: Is this necessary? I thought the IO would throw this.
+ raise EOFError
+ end
end
end
end
end
end