Giter Site home page Giter Site logo

feduxorg / proxy_pac_rb Goto Github PK

View Code? Open in Web Editor NEW

This project forked from samuelkadolph/ruby-pac

3.0 3.0 2.0 1.26 MB

proxy_pac _rb is a gem to test, compress, lint, and parse proxy auto-config files

Home Page: https://github.com/fedux-org/proxy_pac_rb

License: MIT License

Ruby 88.89% JavaScript 1.87% Shell 1.05% HTML 0.05% Gherkin 8.14%

proxy_pac_rb's People

Contributors

maxmeyer avatar net1957 avatar samuelkadolph avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

proxy_pac_rb's Issues

encoding issue on MRI ruby

on linux with MRI ruby 2.2.7-p470 i got encoding errors.

If you use a proxy file from a URL http://xxxxx/myproxy.pac it it returned as 'ASCII-8BIT' but it is really 'UTF-8' encoded. If you have some non ascii characters in the script it will fail.

I don't know if all servers have this issue or if it is related to excon gem (see excon/excon#606) or other code.

I see you have already some test for other ruby flavors.
I did simply use this monkey patch as a workaround:

# patch to correct utf8 string wrongly encoded as ASCII-8BIT
# tested on linux with ruby 2.2.7-p470
module ProxyPacRb
  # Encodes strings as UTF-8
  module Encoding
    def encode(string)
      if string.encoding.name == 'ASCII-8BIT'
        data = string.dup
        data.force_encoding('UTF-8')

        unless data.valid_encoding?
          raise ::Encoding::UndefinedConversionError, "Could not encode ASCII-8BIT data #{string.dump} as UTF-8"
        end
      else
        data = string.encode('UTF-8')
      end
      data
    end
  end
end

What do you think about that ? Have you better way to solve this ?

Regards

@maxmeyer

2 network

Is possible using 2 different network for one proxy?
for example i have 2 provider and would like using one proxy for https

problems with processing isInNet case if dnsResolve is in use

Hi,

I discovered a bug, that could be reproduced by adding the following to proxy.pac:

hostip = dnsResolve(host);
if (isInNet(hostip, "x.x.x.x", "255.255.255.255") ||
isInNet(hostip, "x.x.x.x", "255.255.255.255") ||
isInNet(hostip, "x.x.x.x", "255.255.255.255") ||
isInNet(hostip, "x.x.x.x", "255.255.255.255")) return proxy;

The debug data looks like the following:
/usr/local/rvm/gems/ruby-1.9.3-p547/gems/local_pac-0.10.2/app/controllers/lookup_controller.rb in rescue in block in class:LookupController

raise Exceptions::PacFileInvalid, name: name

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/local_pac-0.10.2/app/controllers/lookup_controller.rb in block in class:LookupController

begin

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in call

proc { |a,p| unbound_method.bind(a).call }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in block in compile!

proc { |a,p| unbound_method.bind(a).call }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in []

route_eval { block[*args] }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in block (3 levels) in route!

route_eval { block[*args] }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in route_eval

throw :halt, yield

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in block (2 levels) in route!

route_eval { block[*args] }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in block in process_route

block ? block[self, values] : yield(self, values)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in catch

catch(:pass) do

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in process_route

catch(:pass) do

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in block in route!

returned_pass_block = process_route(pattern, keys, conditions) do |*args|

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in each

routes.each do |pattern, keys, conditions, block|

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in route!

routes.each do |pattern, keys, conditions, block|

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in block in dispatch!

route!

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in block in invoke

res = catch(:halt) { yield }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in catch

res = catch(:halt) { yield }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in invoke

res = catch(:halt) { yield }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in dispatch!

invoke do

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in block in call!

invoke { dispatch! }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in block in invoke

res = catch(:halt) { yield }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in catch

res = catch(:halt) { yield }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in invoke

res = catch(:halt) { yield }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in call!

invoke { dispatch! }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in call

dup.call!(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-contrib-1.1.0/lib/rack/contrib/post_body_content_type_parser.rb in call

@app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-contrib-1.1.0/lib/rack/contrib/nested_params.rb in call

@app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-contrib-1.1.0/lib/rack/contrib/locale.rb in call

status, headers, body = @app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-1.5.2/lib/rack/deflater.rb in call

status, headers, body = @app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb in call

status, headers, body = @app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb in call

app.call env

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb in call

status, headers, body = app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-protection-1.5.3/lib/rack/protection/base.rb in call

result or app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-protection-1.5.3/lib/rack/protection/base.rb in call

result or app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb in call

status, headers, body = @app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-1.5.2/lib/rack/nulllogger.rb in call

@app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-1.5.2/lib/rack/head.rb in call

status, headers, body = @app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/show_exceptions.rb in call

@app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in call

result, callback = app.call(env), env['async.callback']

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in call

@stack.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in block in call

synchronize { prototype.call(env) }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in synchronize

yield

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in call

synchronize { prototype.call(env) }

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-1.5.2/lib/rack/builder.rb in call

to_app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-1.5.2/lib/rack/urlmap.rb in block in call

return app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-1.5.2/lib/rack/urlmap.rb in each

@mapping.each do |host, location, match, app|

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/rack-1.5.2/lib/rack/urlmap.rb in call

@mapping.each do |host, location, match, app|

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/puma-2.8.2/lib/puma/rack_patch.rb in call

status, header, body = @app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/sinatra-1.4.5/lib/sinatra/base.rb in call

call_without_check(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/puma-2.8.2/lib/puma/configuration.rb in call

@app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/puma-2.8.2/lib/puma/server.rb in handle_request

status, headers, res_body = @app.call(env)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/puma-2.8.2/lib/puma/server.rb in process_client

case handle_request(client, buffer)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/puma-2.8.2/lib/puma/server.rb in block in run

process_client client, buffer

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/puma-2.8.2/lib/puma/thread_pool.rb in call

block.call(work, *extra)

/usr/local/rvm/gems/ruby-1.9.3-p547/gems/puma-2.8.2/lib/puma/thread_pool.rb in block in spawn_thread

block.call(work, *extra)

My ruby gem-list is the following:
*** LOCAL GEMS ***

activesupport (4.2.0.beta1)
addressable (2.3.6)
backports (3.6.0)
bigdecimal (1.1.0)
bundler (1.7.2)
bundler-unload (1.0.2)
chunky_png (1.3.1)
coderay (1.1.0)
columnize (0.8.9)
compass (1.1.0.alpha.1)
compass-core (1.1.0.alpha.1)
compass-import-once (1.0.5)
debugger (1.6.8)
debugger-linecache (1.2.0)
debugger-ruby_core_source (1.3.5)
execjs (2.2.1)
executable-hooks (1.3.2)
facter (2.2.0)
ffi (1.9.3)
gem-wrappers (1.2.5)
haml (4.1.0.beta.1)
hike (1.2.3)
i18n (0.7.0.beta1)
io-console (0.3)
json (1.8.1, 1.5.5)
libv8 (3.16.14.3 x86_64-linux)
local_pac (0.10.2)
method_source (0.8.2)
minitest (5.4.1, 2.5.1)
multi_json (1.10.1)
pager (1.0.1)
phantomjs (1.9.7.1)
proxy_pac_rb (0.2.6)
pry (0.10.1)
puma (2.8.2)
rack (1.5.2)
rack-contrib (1.1.0)
rack-protection (1.5.3)
rack-test (0.6.2)
rake (0.9.2.2)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
rdoc (3.9.5)
ref (1.0.5)
rubygems-bundler (1.4.4)
rugged (0.19.0)
rvm (1.11.3.9)
sass (3.4.3)
sinatra (1.4.5)
sinatra-contrib (1.4.2)
sinatra-param (1.2.2)
slop (3.6.0)
sprockets (2.12.2)
sprockets-helpers (1.1.0)
sprockets-sass (1.2.0)
sys-proctable (0.9.4 universal-linux)
therubyracer (0.12.1)
thor (0.19.1)
thread_safe (0.3.4)
tilt (1.4.1)
tzinfo (1.2.2)
uglifier (2.5.3)

Any idea why this is happening?

Thanks in advance,
cU

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.