rat-hole 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ = 1.1.10
2
+
3
+ * Allow different preparation of POST.
4
+
1
5
  = 0.1.9
2
6
 
3
7
  * test tidy
data/README.rdoc CHANGED
@@ -61,7 +61,7 @@ You can also modify the response from the server to cleanup html tweak headers e
61
61
  end
62
62
 
63
63
  == INSTALL:
64
- * sudo gem install mikehale-rat-hole
64
+ * sudo gem install rat-hole
65
65
 
66
66
  == How it Works
67
67
  User Request --->
@@ -71,6 +71,7 @@ You can also modify the response from the server to cleanup html tweak headers e
71
71
  User Response <---
72
72
 
73
73
  == TODO
74
+ * Currently tests fail (and probably production things fail) with Rack > 1.0
74
75
  * handle server down
75
76
  * handle gziped content (accept-encoding, transfer-encoding)
76
77
  * maybe use a pool of Net::HTTP connections to speed things up
@@ -82,11 +83,12 @@ You can also modify the response from the server to cleanup html tweak headers e
82
83
  == Credits
83
84
  * Michael Hale (http://halethegeek.com)
84
85
  * David Bogus
86
+ * Nathaniel Talbott
85
87
 
86
88
  == LICENSE
87
89
  The MIT License
88
90
 
89
- Copyright (c) 2008-2009 Michael Hale & David Bogus
91
+ Copyright (c) 2008-2010 Michael Hale & David Bogus & Nathaniel Talbott
90
92
 
91
93
  Permission is hereby granted, free of charge, to any person obtaining a copy
92
94
  of this software and associated documentation files (the "Software"), to deal
data/Rakefile ADDED
@@ -0,0 +1,57 @@
1
+ require 'rake'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |s|
6
+ s.name = "rat-hole"
7
+ s.summary = 'Rack compliant http proxy'
8
+ s.email = "mikehale@gmail.com"
9
+ s.homepage = "http://github.com/mikehale/rat-hole"
10
+ s.description = "Rat Hole is a handy library for creating a rack compliant http proxy that allows you to modify the request from the user and the response from the server."
11
+ s.authors = ["Michael Hale", "David Bogus", "Nathaniel Talbott"]
12
+ s.add_dependency('rack', '< 1.0')
13
+ s.has_rdoc = false
14
+ # s.extra_dev_deps << ['rr', '>= 0.6.0']
15
+ # s.extra_dev_deps << ['hpricot', '>= 0.6.164']
16
+ # s.extra_dev_deps << ['newgem', '>= 1.1.0']
17
+ # s.extra_dev_deps << ['cucumber', '>= 0.1.12']
18
+ end
19
+ rescue LoadError
20
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
21
+ end
22
+
23
+ require 'rake/rdoctask'
24
+ Rake::RDocTask.new do |rdoc|
25
+ rdoc.rdoc_dir = 'rdoc'
26
+ rdoc.title = 'rat-hole'
27
+ rdoc.options << '--line-numbers' << '--inline-source'
28
+ rdoc.rdoc_files.include('README*')
29
+ rdoc.rdoc_files.include('lib/**/*.rb')
30
+ end
31
+
32
+ require 'rake/testtask'
33
+ Rake::TestTask.new(:test) do |t|
34
+ t.libs << 'lib' << 'test'
35
+ t.pattern = 'test/**/test_*.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+ begin
40
+ require 'rcov/rcovtask'
41
+ Rcov::RcovTask.new do |t|
42
+ t.libs << 'test'
43
+ t.test_files = FileList['test/**/*_test.rb']
44
+ t.verbose = true
45
+ end
46
+ rescue LoadError
47
+ puts "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
48
+ end
49
+
50
+ begin
51
+ require 'cucumber/rake/task'
52
+ Cucumber::Rake::Task.new(:features)
53
+ rescue LoadError
54
+ puts "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
55
+ end
56
+
57
+ task :default => :test
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 9
4
+ :patch: 10
data/lib/rat_hole.rb CHANGED
@@ -18,6 +18,10 @@ class RatHole
18
18
  def process_server_response(rack_response, rack_request)
19
19
  rack_response
20
20
  end
21
+
22
+ def prepare_post(request, post)
23
+ post.form_data = request.POST
24
+ end
21
25
 
22
26
  def call(env)
23
27
  Net::HTTP.start(@host) do |http|
@@ -37,7 +41,7 @@ class RatHole
37
41
  response = http.get(request_uri, source_headers)
38
42
  elsif source_request.post?
39
43
  post = Net::HTTP::Post.new(request_uri, source_headers)
40
- post.form_data = source_request.POST
44
+ prepare_post(source_request, post)
41
45
  response = http.request(post)
42
46
  end
43
47
 
data/rat-hole.gemspec ADDED
@@ -0,0 +1,55 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{rat-hole}
8
+ s.version = "0.1.10"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Michael Hale", "David Bogus", "Nathaniel Talbott"]
12
+ s.date = %q{2010-01-12}
13
+ s.description = %q{Rat Hole is a handy library for creating a rack compliant http proxy that allows you to modify the request from the user and the response from the server.}
14
+ s.email = %q{mikehale@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "CHANGELOG.rdoc",
21
+ "Manifest.txt",
22
+ "README.rdoc",
23
+ "Rakefile",
24
+ "VERSION.yml",
25
+ "lib/rat_hole.rb",
26
+ "lib/rat_hole_test.rb",
27
+ "lib/util.rb",
28
+ "rat-hole.gemspec",
29
+ "test/mock_request.rb",
30
+ "test/test_rat_hole.rb"
31
+ ]
32
+ s.homepage = %q{http://github.com/mikehale/rat-hole}
33
+ s.rdoc_options = ["--charset=UTF-8"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = %q{1.3.5}
36
+ s.summary = %q{Rack compliant http proxy}
37
+ s.test_files = [
38
+ "test/mock_request.rb",
39
+ "test/test_rat_hole.rb"
40
+ ]
41
+
42
+ if s.respond_to? :specification_version then
43
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
+ s.specification_version = 3
45
+
46
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
+ s.add_runtime_dependency(%q<rack>, ["< 1.0"])
48
+ else
49
+ s.add_dependency(%q<rack>, ["< 1.0"])
50
+ end
51
+ else
52
+ s.add_dependency(%q<rack>, ["< 1.0"])
53
+ end
54
+ end
55
+
@@ -1,5 +1,7 @@
1
1
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
2
2
 
3
+ require 'rubygems'
4
+
3
5
  require 'rr'
4
6
  require 'delegate'
5
7
  require 'test/unit'
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rat-hole
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hale
8
8
  - David Bogus
9
+ - Nathaniel Talbott
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
13
 
13
- date: 2009-02-26 00:00:00 -05:00
14
+ date: 2010-01-12 00:00:00 -05:00
14
15
  default_executable:
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
@@ -19,9 +20,9 @@ dependencies:
19
20
  version_requirement:
20
21
  version_requirements: !ruby/object:Gem::Requirement
21
22
  requirements:
22
- - - ">="
23
+ - - <
23
24
  - !ruby/object:Gem::Version
24
- version: 0.9.1
25
+ version: "1.0"
25
26
  version:
26
27
  description: Rat Hole is a handy library for creating a rack compliant http proxy that allows you to modify the request from the user and the response from the server.
27
28
  email: mikehale@gmail.com
@@ -29,16 +30,19 @@ executables: []
29
30
 
30
31
  extensions: []
31
32
 
32
- extra_rdoc_files: []
33
-
33
+ extra_rdoc_files:
34
+ - README.rdoc
34
35
  files:
36
+ - .gitignore
35
37
  - CHANGELOG.rdoc
36
38
  - Manifest.txt
37
39
  - README.rdoc
40
+ - Rakefile
38
41
  - VERSION.yml
39
42
  - lib/rat_hole.rb
40
43
  - lib/rat_hole_test.rb
41
44
  - lib/util.rb
45
+ - rat-hole.gemspec
42
46
  - test/mock_request.rb
43
47
  - test/test_rat_hole.rb
44
48
  has_rdoc: true
@@ -47,7 +51,6 @@ licenses: []
47
51
 
48
52
  post_install_message:
49
53
  rdoc_options:
50
- - --inline-source
51
54
  - --charset=UTF-8
52
55
  require_paths:
53
56
  - lib
@@ -68,7 +71,8 @@ requirements: []
68
71
  rubyforge_project:
69
72
  rubygems_version: 1.3.5
70
73
  signing_key:
71
- specification_version: 2
74
+ specification_version: 3
72
75
  summary: Rack compliant http proxy
73
- test_files: []
74
-
76
+ test_files:
77
+ - test/mock_request.rb
78
+ - test/test_rat_hole.rb