Giter Club home page Giter Club logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
Hi,
Yes this looks even better. I will need to write some more extensive unit tests 
for this method and then see if this is all covered by the implementation.
Thanks for your good input.

Have fun,
- Rossi

Original comment by [email protected] on 24 Mar 2011 at 2:56

  • Changed state: Accepted

from proxy-vole.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
Hi, the current (SVN) Version still lacks resolving the host for isInNet. If 
host is an hostname a NumberFormatException is thrown.

Why not use a fallback method to parse the hostname (disregarding the costs for 
DNS resolving..):

private long parseIpAddressOrHostToLong(String host) {
    long result = 0;
    try {
        result = parseIpAddressToLong(host);
    } catch (NumberFormatException e) {
        result = parseIpAddressToLong(dnsResolve(host));
    }
    return result;
}

.. it's easier to implement then an automatic notification "please use the 
already resolved IP Address for all the isInNet calls" sent to the "pac script 
writer".

Original comment by [email protected] on 24 May 2012 at 9:45

from proxy-vole.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
Hi, today I stucked in this isInNet problem and this solutions worked for me, 
too! So to make it easy to the others:
1. Check out the latest SVN Version and open it in Eclipse, for example.
2. Open the com.btr.proxy.selector.pac.PacScriptMethods class.
3. Find the function isInNet and replace it with the following two funcs:

    public boolean isInNet(String host, String pattern, String mask) {
        long lhost = parseIpAddressOrHostToLong(host);
        long lpattern = parseIpAddressToLong(pattern);
        long lmask = parseIpAddressToLong(mask);
        boolean result = (lhost & lmask) == lpattern; 
        return result;
    }

    private long parseIpAddressOrHostToLong(String host) {
        long result = 0;
        try {
            result = parseIpAddressToLong(host);
        } catch (NumberFormatException e) {
            result = parseIpAddressToLong(dnsResolve(host));
        }
        return result;
    }

Thanks you, [email protected]

Тoshe

Original comment by [email protected] on 24 May 2012 at 1:53

from proxy-vole.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 28, 2024
Hi,
It took some time. Finally I fixed this (hopefully)
Please check out the newest version.

Have fun,
- Rossi

Original comment by [email protected] on 27 Jul 2012 at 9:30

  • Changed state: Fixed

from proxy-vole.

Related Issues (20)

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.