Module: Watobo::Interceptor

Included in:
Gui::InterceptEditor, Gui::InterceptorFilterSettingsDialog, Gui::InterceptorUI
Defined in:
lib/watobo/core/interceptor.rb,
lib/watobo/interceptor/proxy.rb,
lib/watobo/core/intercept_carver.rb,
lib/watobo/core/intercept_filter.rb,
lib/watobo/interceptor/transparent.rb

Overview

:nodoc: all

Defined Under Namespace

Modules: Transparent Classes: Carver, CarverRule, Filter, FilterChain, FlagFilter, HttpParmsFilter, MethodFilter, Proxy, RequestCarver, RequestFilter, ResponseCarver, StatusFilter, UrlFilter

Constant Summary collapse

INTERCEPT_NONE =
0x00
INTERCEPT_REQUEST =
0x01
INTERCEPT_RESPONSE =
0x02
INTERCEPT_BOTH =
0x03
REWRITE_NONE =
0x00
REWRITE_REQUEST =
0x01
REWRITE_RESPONSE =
0x02
REWRITE_BOTH =
0x04
INTERCEPT_DEFAULT_PORT =
8081
MODE_REGULAR =
0x01
MODE_TRANSPARENT =
0x02

Class Method Summary collapse

Class Method Details

.active?Boolean

Returns:

  • (Boolean)


83
84
85
86
# File 'lib/watobo/core/interceptor.rb', line 83

def self.active?
  return false if @proxy.nil?
  return true
end

.intercept_modeObject



50
51
52
# File 'lib/watobo/core/interceptor.rb', line 50

def self.intercept_mode
  @intercept_mode
end

.intercept_mode=(mode) ⇒ Object



54
55
56
# File 'lib/watobo/core/interceptor.rb', line 54

def self.intercept_mode=(mode)
  @intercept_mode = mode
end

.intercept_requests?Boolean

Returns:

  • (Boolean)


63
64
65
66
# File 'lib/watobo/core/interceptor.rb', line 63

def self.intercept_requests?
  return true if ( @intercept_mode & INTERCEPT_REQUEST ) > 0
  return false
end

.intercept_responses?Boolean

Returns:

  • (Boolean)


68
69
70
71
# File 'lib/watobo/core/interceptor.rb', line 68

def self.intercept_responses?
  return true if ( @intercept_mode & INTERCEPT_RESPONSE ) > 0
  return false
end

.proxyObject



98
99
100
# File 'lib/watobo/core/interceptor.rb', line 98

def self.proxy
  @proxy
end

.proxy_modeObject



34
35
36
# File 'lib/watobo/core/interceptor.rb', line 34

def self.proxy_mode
  @proxy_mode
end

.proxy_mode=(mode) ⇒ Object



38
39
40
# File 'lib/watobo/core/interceptor.rb', line 38

def self.proxy_mode=(mode)
  @proxy_mode = mode
end

.rewrite_modeObject



42
43
44
# File 'lib/watobo/core/interceptor.rb', line 42

def self.rewrite_mode
  @rewrite_mode
end

.rewrite_mode=(mode) ⇒ Object



46
47
48
# File 'lib/watobo/core/interceptor.rb', line 46

def self.rewrite_mode=(mode)
  @rewrite_mode = mode
end

.rewrite_requests?Boolean

Returns:

  • (Boolean)


73
74
75
76
# File 'lib/watobo/core/interceptor.rb', line 73

def self.rewrite_requests?
  return true if ( @rewrite_mode & REWRITE_REQUEST ) > 0
  return false
end

.rewrite_responses?Boolean

Returns:

  • (Boolean)


78
79
80
81
# File 'lib/watobo/core/interceptor.rb', line 78

def self.rewrite_responses?
  return true if ( @rewrite_mode & REWRITE_RESPONSE ) > 0
  return false
end

.startObject



88
89
90
91
92
93
94
95
96
# File 'lib/watobo/core/interceptor.rb', line 88

def self.start
 # @proxy = Watobo::InterceptProxy.new()

  @proxy = Watobo::Interceptor::Proxy.start()
  puts "DEBUG: Proxy running" if $DEBUG
#   puts "* set www_auth for interceptor"
#   puts YAML.dump(@project.settings[:www_auth])
#@proxy.www_auth = Watobo.project.settings[:www_auth] unless Watobo.project.nil?
end

.stopObject



102
103
104
105
# File 'lib/watobo/core/interceptor.rb', line 102

def self.stop
  @proxy.stop
  @proxy = nil
end

.transparent?Boolean

Returns:

  • (Boolean)


58
59
60
61
# File 'lib/watobo/core/interceptor.rb', line 58

def self.transparent?
  return true if ( @proxy_mode & MODE_TRANSPARENT ) > 0
  return false
end