Giter Site home page Giter Site logo

libpac's Introduction

Libpac

This is a C library for handling proxy autoconfiguration files. You can also use it to test your PAC files.

Libpac is non-blocking and was created with non-blocking, event-based applications in mind. Since several PAC javascript functions might block, it uses a threadpool to execute your PAC javascript code. You supply a notification function to pac_init, and it will be called when a worker thread finished executing your PAC code. You can then schedule an event for your main event loop with the result.

Build

You need autoconf and automake. For the first time, you need to generate configure:

$ autoreconf -i

Then build libpac:

$ ./configure
$ make

To run tests:

$ make check

Note: with old versions, you needed --enable-deep-c-stack for the javascript engine be able to handle deeply recursive stacks (large PAC files with complex checks might require this).

Example

See tests/test_pac.c for an example on how to use libpac.

Testing your PAC file

You can use tests/test_pac to test your PAC file. It takes the path for your PAC file as its first parameter, then an URL and a hostname. E.g.:

$ ./tests/test_pac ~/pac.js http://mysite.com mysite.com
Found proxy PROXY 4.5.6.7:8080; PROXY 7.8.9.10:8080

PAC files can return one or more proxies, or "DIRECT" for a direct connection.

You can also call test_pac with multiple URL/hostname pairs:

$ ./tests/test_pac ~/pac.js http://mysite.com mysite.com http://mysite.net mysite.net
Found proxy PROXY 4.5.6.7:8080
Found proxy PROXY 7.8.9.10:8080

libpac's People

Contributors

henryprecheur avatar ldx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

libpac's Issues

Autoconf errors (undefined macros) on RHEL6.5

I am getting the following autoconf errors:

autoconf
configure.ac:11: error: possibly undefined macro: AM_INIT_AUTOMAKE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:17: error: possibly undefined macro: AC_PROG_LIBTOOL
configure.ac:29: error: possibly undefined macro: AM_CONDITIONAL

A configure script is produced, but when I run it I get the following errors:

./configure
./configure: line 1784: PKG_PROG_PKG_CONFIG: command not found
./configure: line 1786: syntax error near unexpected token foreign' ./configure: line 1786:AM_INIT_AUTOMAKE(foreign subdir-objects)'

No makefile is produced, so make errors out:

make
make: *** No targets specified and no makefile found. Stop.

RangeError: register limit - support for Arrays bigger than 255

pac_example.js.txt
Hello, I've run across an issue. The libraries explodes when the pac script has for example, an Array of more than 255 items.

Attached is an example of a PAC file. Currently the array has 256 items, and it causes libpac to throw an error. But once I comment out one or more Array items, then libpac seems fine

[PAC] Failed to evaluate PAC file: RangeError: register limit (line 262).
Segmentation fault: 11

Could you make this limit greater?

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.