Class: ICAPrb::Server::RequestBody

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

Overview

This class represents the Body of an HTTP request. It has to come after the headers in ICAP messages. It will be used if the request contains data (usually POST)

Use the << operator to concatenate the strings as + would return a string and your ICAP answer would fail.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from String

#chunk_to_s, #to_chunk

Constructor Details

#initialize(string, ieof = false) ⇒ RequestBody

initializes a new RequestBody which is a String but has an ieof tag additionally.



81
82
83
84
# File 'lib/icaprb/server/data_structures.rb', line 81

def initialize (string, ieof = false)
  super string
  @ieof = ieof
end

Instance Attribute Details

#ieofObject

true if we are in the preview



78
79
80
# File 'lib/icaprb/server/data_structures.rb', line 78

def ieof
  @ieof
end

Instance Method Details

#<=>(other) ⇒ Object

A body comes after the headers



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/icaprb/server/data_structures.rb', line 86

def <=>(other)
  case other
    when RequestHeader
      1
    when ResponseHeader
      1
    when RequestBody
      0
    when ResponseBody
      0
    when NullBody
      -1
  end
end