Class: Rex::Proto::ApacheJP::ApacheJPHeaderName

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/rex/proto/apache_j_p.rb

Direct Known Subclasses

ApacheJPReqHeaderName, ApacheJPResHeaderName

Constant Summary collapse

COMMON_HEADERS =
[]

Instance Method Summary collapse

Instance Method Details

#getObject



44
45
46
47
48
49
50
# File 'lib/rex/proto/apache_j_p.rb', line 44

def get
  if len_or_code >= 0xa000
    self.class::COMMON_HEADERS[(len_or_code.to_i & 0xff) - 1]
  else
    self.data
  end
end

#set(v) ⇒ Object



52
53
54
55
56
57
58
59
60
61
# File 'lib/rex/proto/apache_j_p.rb', line 52

def set(v)
  if (idx = self.class::COMMON_HEADERS.index(v))
    self.len_or_code = 0xa000 | (idx + 1)
  else
    raise RuntimeError if v.length >= 0xa000

    self.len_or_code = v.length
    self.data = v
  end
end