pacproxy 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +35 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +30 -0
- data/Rakefile +2 -0
- data/bin/pacproxy +22 -0
- data/lib/pacproxy/pacproxy.rb +34 -0
- data/lib/pacproxy/version.rb +3 -0
- data/lib/pacproxy.rb +6 -0
- data/pacproxy/.gitignore +22 -0
- data/pacproxy.gemspec +27 -0
- data/proxy.pac +4 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 344940c273c8b3d3e9c2fa2be653bd7d9bbc3d77
|
4
|
+
data.tar.gz: 777d69da2bad17eb52abae7bf9e916aaccb53c84
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9619344c5b572ca71a437e639aace729e8a7e5660cda9873ad951e8fd363d8a064f2294cf49ce92059ddabbe7f8467abcfb177c8f9b25ce64ab54737d6ec2592
|
7
|
+
data.tar.gz: 563eb0de823d1e40777d9bdcd60283aa7c976de1ec1802bece21fa66dec307cb94f38cac4b3c1028a00655eda33ac00305b97ad08e04b9d3f33e8a07bc6cba9b
|
data/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/lib/bundler/man/
|
26
|
+
/vendor/
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
Gemfile.lock
|
31
|
+
.ruby-version
|
32
|
+
.ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 OTA Hiroshi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Pacproxy
|
2
|
+
|
3
|
+
Pacproxy provides http/https proxy routed with proxy.pac.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'pacproxy'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install pacproxy
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
$ bundle exec ruby bin/pacproxy -P proxy.pac -p 3128
|
22
|
+
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
|
26
|
+
1. Fork it ( https://github.com/otahi/pacproxy/fork )
|
27
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
28
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
29
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
30
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/pacproxy
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'pacproxy'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
port = 3128
|
7
|
+
proxy_pac = nil
|
8
|
+
|
9
|
+
OptionParser.new do |o|
|
10
|
+
o.on('-p PORT', Integer,"specify listening port. default: #{port}") { |p| port = p }
|
11
|
+
o.on('-P PROXYPAC', String, 'specify proxy.pac location') { |pac| proxy_pac = pac }
|
12
|
+
o.on('-h', 'show this help') { puts o; exit }
|
13
|
+
o.parse!
|
14
|
+
end
|
15
|
+
|
16
|
+
s = Pacproxy::Pacproxy.new({Port: port,Proxypac: proxy_pac})
|
17
|
+
|
18
|
+
Signal.trap('INT') do
|
19
|
+
s.shutdown
|
20
|
+
end
|
21
|
+
|
22
|
+
s.start
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'webrick/httpproxy'
|
2
|
+
require 'pac'
|
3
|
+
require 'uri'
|
4
|
+
|
5
|
+
module Pacproxy
|
6
|
+
class Pacproxy < WEBrick::HTTPProxyServer
|
7
|
+
def initialize(config={}, default=WEBrick::Config::HTTP)
|
8
|
+
super(config, default)
|
9
|
+
@pac = config[:Proxypac]
|
10
|
+
end
|
11
|
+
|
12
|
+
def proxy_uri(req, res)
|
13
|
+
uri = super(req,res)
|
14
|
+
return unless @pac
|
15
|
+
|
16
|
+
pac = PAC.load(@pac)
|
17
|
+
|
18
|
+
request_uri = if 'CONNECT' == req.request_method
|
19
|
+
"https://#{req.header["host"][0]}/"
|
20
|
+
else
|
21
|
+
req.unparsed_uri
|
22
|
+
end
|
23
|
+
|
24
|
+
proxy_line = pac.find(request_uri)
|
25
|
+
case proxy_line
|
26
|
+
when /^DIRECT/
|
27
|
+
uri = nil
|
28
|
+
when /PROXY/
|
29
|
+
proxy = /PROXY (.*);/.match(proxy_line)[1]
|
30
|
+
uri = URI.parse("http://#{proxy}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/pacproxy.rb
ADDED
data/pacproxy/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/pacproxy.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pacproxy/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "pacproxy"
|
8
|
+
spec.version = Pacproxy::VERSION
|
9
|
+
spec.authors = ["OTA Hiroshi"]
|
10
|
+
spec.email = ["ota_h@nifty.com"]
|
11
|
+
spec.summary = %q{A proxy server works with proxy.pac}
|
12
|
+
spec.description = %q{A proxy server works with proxy.pac}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'webrick', '~> 1.3.1'
|
22
|
+
spec.add_dependency 'therubyracer', '~> 0.12.1'
|
23
|
+
spec.add_dependency 'pac', '~> 1.0.0'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
26
|
+
spec.add_development_dependency 'rake'
|
27
|
+
end
|
data/proxy.pac
ADDED
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pacproxy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- OTA Hiroshi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: webrick
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.3.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.3.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: therubyracer
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.12.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.12.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pac
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: A proxy server works with proxy.pac
|
84
|
+
email:
|
85
|
+
- ota_h@nifty.com
|
86
|
+
executables:
|
87
|
+
- pacproxy
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- .gitignore
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/pacproxy
|
97
|
+
- lib/pacproxy.rb
|
98
|
+
- lib/pacproxy/pacproxy.rb
|
99
|
+
- lib/pacproxy/version.rb
|
100
|
+
- pacproxy.gemspec
|
101
|
+
- pacproxy/.gitignore
|
102
|
+
- proxy.pac
|
103
|
+
homepage: ''
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.0.14
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: A proxy server works with proxy.pac
|
127
|
+
test_files: []
|