Class: ICAPrb::Server::HTTP_Header

Inherits:
Hash
  • Object
show all
Defined in:
lib/icaprb/server/data_structures.rb

Overview

This class is the base for the HTTP header classes. It is a subclass of Hash.

Direct Known Subclasses

RequestHeader, ResponseHeader

Instance Method Summary collapse

Instance Method Details

#to_sObject

Converts the array to a String and which will be the complete HTTP Header, witch contains the request or status line.

It will join the headers with \r\n and ends with \r\n\r\n



29
30
31
32
33
34
35
# File 'lib/icaprb/server/data_structures.rb', line 29

def to_s
  data = []
  each do |key, value|
    data << "#{key}: #{value}"
  end
  request_line + data.join("\r\n") + "\r\n\r\n"
end