Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Libraries

    pacparser 1.3.0

    Download button

    No screenshots available
    Downloads: 664  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Poor (1.8/5)
    15 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Manu Garg | More programs
    GPL / FREE
    September 12th, 2011, 14:37 GMT [view history]
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    pacparser description

    pacparser is a C library to parse PAC (proxy auto-config) files.

    pacparser is a C library to parse PAC (proxy auto-config) files. PAC files (implemented in JavaScript) are a proxy configuration method for web access. Using them, browsers can be configured to use different proxy servers for different URLs, source IP addresses, protocols etc. PAC files can also be used for a highly available proxy setup as you can specify more than one proxy server using them.

    Needless to say, PAC files are now a widely accepted method for proxy configuration management and almost all popular browsers support them. The idea behind pacparser is to make it easy to add this PAC file parsing capability to other programs. The pacparser project comes as a shared C library with a clear API. You can use it to make any C or python (using ctypes) program PAC scripts intelligent. Some very useful targets could be popular web software like wget, curl and python-urllib.

    Usage Examples:

    Using it with python-ctypes:

    >>> from ctypes import *
    >>> pp=CDLL('./libpacparser.so')
    >>> pp.pacparser_init()
    1
    >>> pp.pacparser_parse_pac('examples/wpad.dat')
    1
    >>> pp.pacparser_find_proxy('http://www.google.com', 'www.google.com')
    136307304
    >>> string_at(136307304)
    'PROXY proxy1.manugarg.com:3128; PROXY proxy2.manugarg.com:3128; DIRECT'
    >>> pp.pacparser_cleanup()
    >>>

    Using it in C:

    manugarg@hobbiton:~$ cat pactest.c
    #include

    int pacparser_init();
    int pacparser_parse_pac(char* pacfile);
    char *pacparser_find_proxy(char *url, char *host);
    void pacparser_cleanup();

    int main(int argc, char* argv[])
    {
    char *proxy;
    pacparser_init();
    pacparser_parse_pac(argv[1]);
    proxy = pacparser_find_proxy(argv[2], argv[3]);
    printf("%sn", proxy);
    pacparser_cleanup();
    }

    manugarg@hobbiton:~$ gcc -o pactest pactest.c -lpacparser
    manugarg@hobbiton:~$ ./pactest wpad.dat http://www.google.com www.google.com
    PROXY proxy1.manugarg.com:3128; PROXY proxy2.manugarg.com:3128; DIRECT


    Product's homepage

    What's New in This Release: [ read full changelog ]

    · This version adds a feature to pacparser to allow working with the proxy auto-config (PAC) script directly (in string form) instead of requiring it to be in a file.
    · This release also adds a feature to pactester to read pac files from stdin directly, which will allow users to "pipe" pac files to pactester directly from the other programs like curl.
    · This release also has some build fixes to make pacparser build on non-Linux GNU systems like kFreeBSD and GNU Hurd.

      


    TAGS:

    C library | PAC parser | proxy auto-config | C | library | PAC

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM