rrproxy 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -26,6 +26,10 @@ rrproxy takes a very simple Ruby configuration file.
26
26
  As you can probably guess, this will redirect requests for example.com's css file to a local server (while
27
27
  passing all other requests through normally).
28
28
 
29
+ Run it like this:
30
+
31
+ $ rrproxy config.rb
32
+
29
33
  Here's a more complicated example (it's also in `examples/example_config.rb`):
30
34
 
31
35
  [
@@ -43,6 +47,10 @@ is a string) or a regex match. The first match found will be used, and the host
43
47
  changed to the corresponding target host. If a replacement is provided, it will be used as a substitute for
44
48
  the first regex matching group (if the pattern is a regex) or the whole pattern (if the pattern is a string).
45
49
 
50
+ You can pass a couple of options to rrproxy:
51
+
52
+ $ rrproxy -a 127.0.0.1 -p 4444 your_config.rb
53
+
46
54
  Credits
47
55
  -------
48
56
 
@@ -1,10 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # Uncomment when running in development (i.e. running the local checkout, not the installed gem).
4
+ #$:.unshift File.join(File.dirname(__FILE__), "../lib")
5
+
3
6
  require "trollop"
4
7
  require "dedent"
5
8
  require "colorize"
6
9
 
7
10
  require "rrproxy"
11
+ require "rrproxy/version"
8
12
 
9
13
  # The goliath folks really need to take a page out of Sinatra's book and provide an easy way to start up a
10
14
  # server manually without using all their application runner and option parsing shit (in Sinatra terms,
@@ -21,6 +25,7 @@ def create_logger
21
25
  end
22
26
 
23
27
  options = Trollop.options do
28
+ version RRProxy::VERSION
24
29
  banner <<-EOS.dedent
25
30
  rrproxy is a very simple reverse http proxy that can route requests based on pattern-matching the
26
31
  URI. The configuration file is Ruby, and it must have the following form:
@@ -39,6 +44,7 @@ options = Trollop.options do
39
44
  EOS
40
45
  opt :address, "Bind address", :default => "0.0.0.0"
41
46
  opt :port, "Port", :default => 9876
47
+ opt :version, "See rrproxy version"
42
48
  end
43
49
 
44
50
  Trollop.die "You must provide a configuration file" unless ARGV[0]
@@ -37,7 +37,12 @@ class RRProxy < Goliath::API
37
37
 
38
38
  target_url = "http://#{target}#{uri}"
39
39
  headers = env["untampered_headers"]
40
- headers["HOST"] = target
40
+
41
+ # Try to make it look as much as possible like the request originates with us. This removes a bunch of
42
+ # security protections and is a reason rrproxy is only for development/testing puproses.
43
+ headers["Host"] = target
44
+ headers.delete "Referer"
45
+
41
46
  params = { :head => headers }
42
47
  params[:body] = env["params"] if [:put, :post, :patch].include? method
43
48
 
@@ -0,0 +1,3 @@
1
+ class RRProxy
2
+ VERSION = "0.0.2"
3
+ end
@@ -1,3 +1,6 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "lib")
2
+ require "rrproxy/version"
3
+
1
4
  Gem::Specification.new do |gem|
2
5
  gem.authors = ["Caleb Spare"]
3
6
  gem.email = ["cespare@gmail.com"]
@@ -9,7 +12,7 @@ Gem::Specification.new do |gem|
9
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
10
13
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
11
14
  gem.name = "rrproxy"
12
- gem.version = "0.0.1"
15
+ gem.version = RRProxy::VERSION
13
16
  gem.require_paths = ["lib"]
14
17
 
15
18
  gem.add_dependency "goliath"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rrproxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-16 00:00:00.000000000Z
12
+ date: 2012-06-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: goliath
16
- requirement: &24235400 !ruby/object:Gem::Requirement
16
+ requirement: &26962440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *24235400
24
+ version_requirements: *26962440
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: log4r
27
- requirement: &24200780 !ruby/object:Gem::Requirement
27
+ requirement: &26960440 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *24200780
35
+ version_requirements: *26960440
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: em-http-request
38
- requirement: &24199760 !ruby/object:Gem::Requirement
38
+ requirement: &26959840 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *24199760
46
+ version_requirements: *26959840
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: trollop
49
- requirement: &24197520 !ruby/object:Gem::Requirement
49
+ requirement: &26958680 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *24197520
57
+ version_requirements: *26958680
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: dedent
60
- requirement: &24196100 !ruby/object:Gem::Requirement
60
+ requirement: &26945420 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *24196100
68
+ version_requirements: *26945420
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: colorize
71
- requirement: &24194600 !ruby/object:Gem::Requirement
71
+ requirement: &26944380 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *24194600
79
+ version_requirements: *26944380
80
80
  description: rrproxy is a very simple routing reverse proxy written in Ruby.
81
81
  email:
82
82
  - cespare@gmail.com
@@ -93,6 +93,7 @@ files:
93
93
  - bin/rrproxy
94
94
  - example/example_config.rb
95
95
  - lib/rrproxy.rb
96
+ - lib/rrproxy/version.rb
96
97
  - rrproxy.gemspec
97
98
  homepage: ''
98
99
  licenses: []