Class: Dap::Filter::FilterDecodeURI

Inherits:
Object
  • Object
show all
Includes:
BaseDecoder
Defined in:
lib/dap/filter/http.rb

Instance Attribute Summary

Attributes included from Base

#name, #opts

Instance Method Summary collapse

Methods included from BaseDecoder

#process

Methods included from Base

#initialize, #process

Instance Method Details

#decode(data) ⇒ Object



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/dap/filter/http.rb', line 116

def decode(data)
  save = {}
  uri  = URI.parse(data) rescue nil
  return unless uri

  save["host"] = uri.host if uri.host
  save["port"] = uri.port.to_s if uri.port
  save["path"] = uri.path if uri.path
  save["query"]  = uri.query if uri.query
  save["scheme"] = uri.scheme if uri.scheme
  save["user"] = uri.user if uri.user
  save["password"] = uri.password if uri.password

  save
end