mojombo-proxymachine 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -26,7 +26,7 @@ correct backend server. If not, it can choose to either do nothing and wait
26
26
  for more data to arrive, or close the connection. Once the block returns an
27
27
  address, a connection to the backend is made, the buffer is replayed to the
28
28
  backend, and the client and backend connections are hooked up to form a
29
- straight proxy. This bidirectional proxy continues to exist until with the
29
+ straight proxy. This bidirectional proxy continues to exist until either the
30
30
  client or backend close the connection.
31
31
 
32
32
 
@@ -67,9 +67,9 @@ Example routing config file
67
67
  proxy do |data|
68
68
  if data =~ %r{^....git-upload-pack /([\w\.\-]+)/[\w\.\-]+\000host=\w+\000}
69
69
  name = $1
70
- GitRouter.lookup(name)
70
+ { :remote => GitRouter.lookup(name) }
71
71
  else
72
- :noop
72
+ { :noop => true }
73
73
  end
74
74
  end
75
75
 
@@ -77,10 +77,11 @@ Example routing config file
77
77
  Valid return values
78
78
  -------------------
79
79
 
80
- `String` - The host:port of the backend server that will be proxied.
81
- `:noop` - Do nothing.
82
- `:close` - Close the connection.
83
- `{:close => String}` - Close the connection after sending the String.
80
+ `{ :remote => String }` - String is the host:port of the backend server that will be proxied.
81
+ `{ :remote => String, :data => String }` - Same as above, but send the given data instead.
82
+ `{ :noop => true }` - Do nothing.
83
+ `{ :close` => true } - Close the connection.
84
+ `{ :close => String }` - Close the connection after sending the String.
84
85
 
85
86
 
86
87
  Contribute
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
+ :patch: 1
2
3
  :major: 0
3
4
  :minor: 2
4
- :patch: 0
@@ -16,9 +16,6 @@ module EventMachine
16
16
  if !@server_side
17
17
  @buffer << data
18
18
  ensure_server_side_connection
19
- else @server_side
20
- # p data
21
- @server_side.send_data(data)
22
19
  end
23
20
  rescue => e
24
21
  close_connection
@@ -55,6 +52,7 @@ module EventMachine
55
52
 
56
53
  def try_server_connect(host, port)
57
54
  @server_side = ServerConnection.request(host, port, self)
55
+ proxy_incoming_to @server_side
58
56
  if @tries > 0
59
57
  puts "Successful connection."
60
58
  end
@@ -86,6 +84,11 @@ module EventMachine
86
84
  @server_side.close_connection_after_writing if @server_side
87
85
  ProxyMachine.decr
88
86
  end
87
+
88
+ # Proxy connection has been lost
89
+ def proxy_target_unbound
90
+ @server_side = nil
91
+ end
89
92
  end
90
93
  end
91
- end
94
+ end
@@ -9,9 +9,8 @@ module EventMachine
9
9
  @client_side = conn
10
10
  end
11
11
 
12
- def receive_data(data)
13
- # p data
14
- @client_side.send_data(data)
12
+ def post_init
13
+ proxy_incoming_to @client_side
15
14
  end
16
15
 
17
16
  def unbind
@@ -19,4 +18,4 @@ module EventMachine
19
18
  end
20
19
  end
21
20
  end
22
- end
21
+ end
data/proxymachine.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{proxymachine}
5
- s.version = "0.2.0"
5
+ s.version = "0.2.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Tom Preston-Werner"]
9
- s.date = %q{2009-07-15}
9
+ s.date = %q{2009-08-06}
10
10
  s.default_executable = %q{proxymachine}
11
11
  s.email = %q{tom@mojombo.com}
12
12
  s.executables = ["proxymachine"]
@@ -31,11 +31,10 @@ Gem::Specification.new do |s|
31
31
  "test/proxymachine_test.rb",
32
32
  "test/test_helper.rb"
33
33
  ]
34
- s.has_rdoc = true
35
34
  s.homepage = %q{http://github.com/mojombo/proxymachine}
36
35
  s.rdoc_options = ["--charset=UTF-8"]
37
36
  s.require_paths = ["lib"]
38
- s.rubygems_version = %q{1.3.0}
37
+ s.rubygems_version = %q{1.3.5}
39
38
  s.summary = %q{TODO}
40
39
  s.test_files = [
41
40
  "test/proxymachine_test.rb",
@@ -46,7 +45,7 @@ Gem::Specification.new do |s|
46
45
 
47
46
  if s.respond_to? :specification_version then
48
47
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
49
- s.specification_version = 2
48
+ s.specification_version = 3
50
49
 
51
50
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
52
51
  s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.6"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mojombo-proxymachine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-15 00:00:00 -07:00
12
+ date: 2009-08-06 00:00:00 -07:00
13
13
  default_executable: proxymachine
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -47,8 +47,9 @@ files:
47
47
  - proxymachine.gemspec
48
48
  - test/proxymachine_test.rb
49
49
  - test/test_helper.rb
50
- has_rdoc: true
50
+ has_rdoc: false
51
51
  homepage: http://github.com/mojombo/proxymachine
52
+ licenses:
52
53
  post_install_message:
53
54
  rdoc_options:
54
55
  - --charset=UTF-8
@@ -69,9 +70,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
70
  requirements: []
70
71
 
71
72
  rubyforge_project:
72
- rubygems_version: 1.2.0
73
+ rubygems_version: 1.3.5
73
74
  signing_key:
74
- specification_version: 2
75
+ specification_version: 3
75
76
  summary: TODO
76
77
  test_files:
77
78
  - test/proxymachine_test.rb