Class: Http11Server

Inherits:
Object
  • Object
show all
Includes:
EventParsers::Http11Parser
Defined in:
bin/httphere

Overview

Requires that a module includes this and defines an initialize method that defines @options

Constant Summary

Constants included from EventParsers::Http11Parser

EventParsers::Http11Parser::BlankLineRE, EventParsers::Http11Parser::HttpRequestRE, EventParsers::Http11Parser::HttpResponseRE

Instance Attribute Summary collapse

Attributes included from EventParsers::Http11Parser

#socket

Instance Method Summary collapse

Methods included from EventParsers::Http11Parser

#current_request, included, #parsing_request, #receive_data, #request_backlog, #send_response!

Constructor Details

#initialize(server, socket) ⇒ Http11Server

Returns a new instance of Http11Server.



711
712
713
714
# File 'bin/httphere', line 711

def initialize(server,socket)
  @socket = socket
  @time = Time.now
end

Instance Attribute Details

#timeObject (readonly)

Returns the value of attribute time.



710
711
712
# File 'bin/httphere', line 710

def time
  @time
end

Instance Method Details

#halt!Object



727
728
729
730
# File 'bin/httphere', line 727

def halt!
  socket.close
  throw :stop_reading
end

#process_request(request) ⇒ Object



723
724
725
# File 'bin/httphere', line 723

def process_request(request)
  request.process
end

#upon_headers_finished(request) ⇒ Object



720
721
722
# File 'bin/httphere', line 720

def upon_headers_finished(request)
  request.upon_headers_finished if request.respond_to?(:upon_headers_finished)
end

#upon_new_request(request) ⇒ Object

These just pass the call to the request to handle itself



717
718
719
# File 'bin/httphere', line 717

def upon_new_request(request)
  request.upon_new_request if request.respond_to?(:upon_new_request)
end

#upon_unbindObject



732
733
734
# File 'bin/httphere', line 732

def upon_unbind
  # puts "Client #{@socket} disconnected."
end