Pacparser
A library to make your web software pac (proxy auto-config) files intelligent.
|
API for pacparser library, a library to use proxy auto-config (PAC) files. See project homepage: http://github.com/pacparser/pacparser for more information. More...
Typedefs | |
typedef int(* | pacparser_error_printer )(const char *fmt, va_list argp) |
Type definition for pacparser_error_printer. | |
Functions | |
int | pacparser_init (void) |
Initializes pac parser. More... | |
int | pacparser_parse_pac_file (const char *pacfile) |
Parses the given PAC file. More... | |
int | pacparser_parse_pac_string (const char *pacstring) |
Parses the given PAC script string. More... | |
int | pacparser_parse_pac (const char *pacfile) |
Parses the gievn pac file. More... | |
char * | pacparser_find_proxy (const char *url, const char *host) |
Finds proxy for the given URL and Host. More... | |
char * | pacparser_just_find_proxy (const char *pacfile, const char *url, const char *host) |
Finds proxy for the given PAC file, URL and Host. More... | |
void | pacparser_cleanup (void) |
Destroys JavaSctipt context. More... | |
void | pacparser_setmyip (const char *ip) |
Sets my IP address. More... | |
void | pacparser_set_error_printer (pacparser_error_printer func) |
Sets error printing function. More... | |
void | pacparser_enable_microsoft_extensions (void) |
(Deprecated) Enable Microsoft IPv6 PAC extensions. More... | |
char * | pacparser_version (void) |
Returns pacparser version. More... | |
API for pacparser library, a library to use proxy auto-config (PAC) files. See project homepage: http://github.com/pacparser/pacparser for more information.
int pacparser_init | ( | void | ) |
Initializes pac parser.
Initializes JavaScript engine and does few basic initializations specific to pacparser.
int pacparser_parse_pac_file | ( | const char * | pacfile | ) |
Parses the given PAC file.
pacfile | PAC file to parse. |
Reads the given PAC file and evaluates it in the JavaScript context created by pacparser_init.
int pacparser_parse_pac_string | ( | const char * | pacstring | ) |
Parses the given PAC script string.
pacstring | PAC string to parse. |
Evaulates the given PAC script string in the JavaScript context created by pacparser_init.
int pacparser_parse_pac | ( | const char * | pacfile | ) |
Parses the gievn pac file.
pacfile | PAC file to parse. |
Same as pacparser_parse_pac_file. Included only for backward compatibility.
char* pacparser_find_proxy | ( | const char * | url, |
const char * | host | ||
) |
Finds proxy for the given URL and Host.
url | URL to find proxy for. |
host | Host part of the URL. |
Finds proxy for the given URL and Host. This function should be called only after pacparser engine has been initialized (using pacparser_init) and pac script has been parsed (using pacparser_parse_pac_file or pacparser_parse_pac_string).
char* pacparser_just_find_proxy | ( | const char * | pacfile, |
const char * | url, | ||
const char * | host | ||
) |
Finds proxy for the given PAC file, URL and Host.
pacfile | PAC file to parse. |
url | URL to find proxy for. |
host | Host part of the URL. |
This function is a wrapper around functions pacparser_init, pacparser_parse_pac_file, pacparser_find_proxy and pacparser_cleanup. If you just want to find out proxy for a given set of pac file, url and host, this is the function to call. This function takes care of all the initialization and cleanup.
void pacparser_cleanup | ( | void | ) |
Destroys JavaSctipt context.
This function should be called once you're done with using pacparser engine.
void pacparser_setmyip | ( | const char * | ip | ) |
Sets my IP address.
ip | Custom IP address. |
Sets my IP address to a custom value. This is the IP address returned by myIpAddress() javascript function.
void pacparser_set_error_printer | ( | pacparser_error_printer | func | ) |
Sets error printing function.
func | Printing function. |
Sets error variadic-argument printing function. If not set the messages are printed to stderr. If messages begin with DEBUG: or WARNING:, they are not fatal error messages, otherwise they are. May be called before pacparser_init().
void pacparser_enable_microsoft_extensions | ( | void | ) |
(Deprecated) Enable Microsoft IPv6 PAC extensions.
Deprecated. IPv6 extension (*Ex functions) are enabled by default now.
char* pacparser_version | ( | void | ) |
Returns pacparser version.
Version string is determined at the time of build. If built from a released package, version corresponds to the latest release (git) tag. If built from the repository, it corresponds to the head revision of the repo.
pactester <-p pacfile> <-f urlslist> [-c client_ip] [-e]
To find out the proxy config string for the pac file "wpad.dat" and the URL "http://www.google.com ":
$ pactester -p wpad.dat -u http://www.google.com
For a client with IP address 10.0.12.123:
$ pactester -p wpad.dat -c 10.0.12.123 -u http://www.google.com
For a pac file hosted at http://wpad/wpad.dat:
$ curl -s http://wpad/wpad.dat | pactester -p - -u http://google.com
pacparser-1.3.6/docs/man/ 0000775 0000000 0000000 00000000000 12572366345 0015221 5 ustar 00root root 0000000 0000000 pacparser-1.3.6/docs/man/man1/ 0000775 0000000 0000000 00000000000 12572366345 0016055 5 ustar 00root root 0000000 0000000 pacparser-1.3.6/docs/man/man1/pactester.1 0000664 0000000 0000000 00000003372 12572366345 0020136 0 ustar 00root root 0000000 0000000 .TH "pactester" "1" "" "" "" .SH "NAME" pactester \- Tool to test proxy auto\-config (pac) files. .SH "SYNOPSIS" .B pactester <\-p pacfile> <\-u url> [\-h host] [\-c client_ip] [\-e] .PP .B pactester <\-p pacfile> <\-f urlslist> [\-c client_ip] [\-e] .SH "DESCRIPTION" pactester is a tool to test proxy auto\-config (pac) files. It returns the proxy config string for the given URL and the pac file. pactester uses pacparser C library for most of its functionality. .SH "OPTIONS" .TP .B \-p pacfile PAC file to test. Specify "-" to read from the standard input. .TP .B \-u url URL to test the PAC file for. .TP .B \-h host Host part of the URL. If not specified, it's determined from the URL. .TP .B \-c client_ip Client's IP address (as returned by the function myIpAddress() in PAC files). If not specified, it defaults to the IP address of the machine on which this tool is running. .TP .B \-e Enable Microsoft PAC extensions (dnsResolveEx, myIpAddressEx, isResolvableEx). .TP .B \-f urlslist A file containing the list of URLs to be tested. This is good for testing a PAC file against a set of URLs. .SH "EXAMPLES" .PP To find out the proxy config string for the pac file "wpad.dat" and the URL "http://www.google.com": .PP $ pactester \-p wpad.dat \-u http://www.google.com For a client with IP address 10.0.12.123: .PP $ pactester \-p wpad.dat \-c 10.0.12.123 \-u http://www.google.com For a pac file hosted at http://wpad/wpad.dat: .PP $ curl \-s http://wpad/wpad.dat | pactester \-p \- \-u http://google.com .SH "BUGS" If you have come across a bug in pactester, please submit a bug report at http://code.google.com/p/pacparser/issues/list. .SH "AUTHOR" Written by Manu Garg (http://www.manugarg.com). .SH "RESOURCES" Homepage: http://code.google.com/p/pacparser. pacparser-1.3.6/docs/man/man3/ 0000775 0000000 0000000 00000000000 12572366345 0016057 5 ustar 00root root 0000000 0000000 pacparser-1.3.6/docs/man/man3/pacparser.3 0000664 0000000 0000000 00000014017 12572366345 0020126 0 ustar 00root root 0000000 0000000 .TH "pacparser" 3 "Tue Sep 1 2015" "Pacparser" \" -*- nroff -*- .ad l .nh .SH NAME pacparser - Library to parse proxy auto-confg (PAC) files. .PP API for pacparser library, a library to use proxy auto-config (PAC) files\&. See project homepage: http://github.com/pacparser/pacparser for more information\&. .SS "Typedefs" .in +1c .ti -1c .RI "typedef int(* \fBpacparser_error_printer\fP )(const char *fmt, va_list argp)" .br .RI "\fIType definition for pacparser_error_printer\&. \fP" .in -1c .SS "Functions" .in +1c .ti -1c .RI "int \fBpacparser_init\fP (void)" .br .RI "\fIInitializes pac parser\&. \fP" .ti -1c .RI "int \fBpacparser_parse_pac_file\fP (const char *pacfile)" .br .RI "\fIParses the given PAC file\&. \fP" .ti -1c .RI "int \fBpacparser_parse_pac_string\fP (const char *pacstring)" .br .RI "\fIParses the given PAC script string\&. \fP" .ti -1c .RI "int \fBpacparser_parse_pac\fP (const char *pacfile)" .br .RI "\fIParses the gievn pac file\&. \fP" .ti -1c .RI "char * \fBpacparser_find_proxy\fP (const char *url, const char *host)" .br .RI "\fIFinds proxy for the given URL and Host\&. \fP" .ti -1c .RI "char * \fBpacparser_just_find_proxy\fP (const char *pacfile, const char *url, const char *host)" .br .RI "\fIFinds proxy for the given PAC file, URL and Host\&. \fP" .ti -1c .RI "void \fBpacparser_cleanup\fP (void)" .br .RI "\fIDestroys JavaSctipt context\&. \fP" .ti -1c .RI "void \fBpacparser_setmyip\fP (const char *ip)" .br .RI "\fISets my IP address\&. \fP" .ti -1c .RI "void \fBpacparser_set_error_printer\fP (\fBpacparser_error_printer\fP func)" .br .RI "\fISets error printing function\&. \fP" .ti -1c .RI "void \fBpacparser_enable_microsoft_extensions\fP (void)" .br .RI "\fI(Deprecated) Enable Microsoft IPv6 PAC extensions\&. \fP" .ti -1c .RI "char * \fBpacparser_version\fP (void)" .br .RI "\fIReturns pacparser version\&. \fP" .in -1c .SH "Detailed Description" .PP API for pacparser library, a library to use proxy auto-config (PAC) files\&. See project homepage: http://github.com/pacparser/pacparser for more information\&. .PP \fBAuthor:\fP .RS 4 Manu Garg manugarg@gmail.com .RE .PP .SH "Function Documentation" .PP .SS "int pacparser_init (void)" .PP Initializes pac parser\&. .PP \fBReturns:\fP .RS 4 0 on failure and 1 on success\&. .RE .PP Initializes JavaScript engine and does few basic initializations specific to pacparser\&. .SS "int pacparser_parse_pac_file (const char *pacfile)" .PP Parses the given PAC file\&. .PP \fBParameters:\fP .RS 4 \fIpacfile\fP PAC file to parse\&. .RE .PP \fBReturns:\fP .RS 4 0 on failure and 1 on success\&. .RE .PP Reads the given PAC file and evaluates it in the JavaScript context created by pacparser_init\&. .SS "int pacparser_parse_pac_string (const char *pacstring)" .PP Parses the given PAC script string\&. .PP \fBParameters:\fP .RS 4 \fIpacstring\fP PAC string to parse\&. .RE .PP \fBReturns:\fP .RS 4 0 on failure and 1 on success\&. .RE .PP Evaulates the given PAC script string in the JavaScript context created by pacparser_init\&. .SS "int pacparser_parse_pac (const char *pacfile)" .PP Parses the gievn pac file\&. .PP \fBDeprecated\fP .RS 4 Use pacparser_parse_pac_file instead\&. .PP \fBParameters:\fP .RS 4 \fIpacfile\fP PAC file to parse\&. .RE .PP \fBReturns:\fP .RS 4 0 on failure and 1 on success\&. .RE .PP .RE .PP .PP Same as pacparser_parse_pac_file\&. Included only for backward compatibility\&. .SS "char* pacparser_find_proxy (const char *url, const char *host)" .PP Finds proxy for the given URL and Host\&. .PP \fBParameters:\fP .RS 4 \fIurl\fP URL to find proxy for\&. .br \fIhost\fP Host part of the URL\&. .RE .PP \fBReturns:\fP .RS 4 proxy string on sucess and NULL on error\&. .RE .PP Finds proxy for the given URL and Host\&. This function should be called only after pacparser engine has been initialized (using pacparser_init) and pac script has been parsed (using pacparser_parse_pac_file or pacparser_parse_pac_string)\&. .SS "char* pacparser_just_find_proxy (const char *pacfile, const char *url, const char *host)" .PP Finds proxy for the given PAC file, URL and Host\&. .PP \fBParameters:\fP .RS 4 \fIpacfile\fP PAC file to parse\&. .br \fIurl\fP URL to find proxy for\&. .br \fIhost\fP Host part of the URL\&. .RE .PP \fBReturns:\fP .RS 4 proxy string on success and NULL on error\&. .RE .PP This function is a wrapper around functions pacparser_init, pacparser_parse_pac_file, pacparser_find_proxy and pacparser_cleanup\&. If you just want to find out proxy for a given set of pac file, url and host, this is the function to call\&. This function takes care of all the initialization and cleanup\&. .SS "void pacparser_cleanup (void)" .PP Destroys JavaSctipt context\&. This function should be called once you're done with using pacparser engine\&. .SS "void pacparser_setmyip (const char *ip)" .PP Sets my IP address\&. .PP \fBParameters:\fP .RS 4 \fIip\fP Custom IP address\&. .RE .PP Sets my IP address to a custom value\&. This is the IP address returned by myIpAddress() javascript function\&. .SS "void pacparser_set_error_printer (\fBpacparser_error_printer\fPfunc)" .PP Sets error printing function\&. .PP \fBParameters:\fP .RS 4 \fIfunc\fP Printing function\&. .RE .PP Sets error variadic-argument printing function\&. If not set the messages are printed to stderr\&. If messages begin with DEBUG: or WARNING:, they are not fatal error messages, otherwise they are\&. May be called before \fBpacparser_init()\fP\&. .SS "void pacparser_enable_microsoft_extensions (void)" .PP (Deprecated) Enable Microsoft IPv6 PAC extensions\&. Deprecated\&. IPv6 extension (*Ex functions) are enabled by default now\&. .SS "char* pacparser_version (void)" .PP Returns pacparser version\&. .PP \fBReturns:\fP .RS 4 version string if version defined, '' otherwise\&. .RE .PP Version string is determined at the time of build\&. If built from a released package, version corresponds to the latest release (git) tag\&. If built from the repository, it corresponds to the head revision of the repo\&. .SH "Author" .PP Generated automatically by Doxygen for Pacparser from the source code\&. pacparser-1.3.6/docs/man/man3/pacparser_cleanup.3 0000664 0000000 0000000 00000000025 12572366345 0021627 0 ustar 00root root 0000000 0000000 .so man3/pacparser.3 pacparser-1.3.6/docs/man/man3/pacparser_enable_microsoft_extensions.3 0000664 0000000 0000000 00000000025 12572366345 0025772 0 ustar 00root root 0000000 0000000 .so man3/pacparser.3 pacparser-1.3.6/docs/man/man3/pacparser_error_printer.3 0000664 0000000 0000000 00000000025 12572366345 0023074 0 ustar 00root root 0000000 0000000 .so man3/pacparser.3 pacparser-1.3.6/docs/man/man3/pacparser_find_proxy.3 0000664 0000000 0000000 00000000025 12572366345 0022361 0 ustar 00root root 0000000 0000000 .so man3/pacparser.3 pacparser-1.3.6/docs/man/man3/pacparser_init.3 0000664 0000000 0000000 00000000025 12572366345 0021143 0 ustar 00root root 0000000 0000000 .so man3/pacparser.3 pacparser-1.3.6/docs/man/man3/pacparser_just_find_proxy.3 0000664 0000000 0000000 00000000025 12572366345 0023426 0 ustar 00root root 0000000 0000000 .so man3/pacparser.3 pacparser-1.3.6/docs/man/man3/pacparser_parse_pac.3 0000664 0000000 0000000 00000000025 12572366345 0022135 0 ustar 00root root 0000000 0000000 .so man3/pacparser.3 pacparser-1.3.6/docs/man/man3/pacparser_parse_pac_file.3 0000664 0000000 0000000 00000000025 12572366345 0023134 0 ustar 00root root 0000000 0000000 .so man3/pacparser.3 pacparser-1.3.6/docs/man/man3/pacparser_parse_pac_string.3 0000664 0000000 0000000 00000000025 12572366345 0023523 0 ustar 00root root 0000000 0000000 .so man3/pacparser.3 pacparser-1.3.6/docs/man/man3/pacparser_set_error_printer.3 0000664 0000000 0000000 00000000025 12572366345 0023747 0 ustar 00root root 0000000 0000000 .so man3/pacparser.3 pacparser-1.3.6/docs/man/man3/pacparser_setmyip.3 0000664 0000000 0000000 00000000025 12572366345 0021672 0 ustar 00root root 0000000 0000000 .so man3/pacparser.3 pacparser-1.3.6/docs/man/man3/pacparser_version.3 0000664 0000000 0000000 00000000025 12572366345 0021665 0 ustar 00root root 0000000 0000000 .so man3/pacparser.3 pacparser-1.3.6/examples/ 0000775 0000000 0000000 00000000000 12572366345 0015334 5 ustar 00root root 0000000 0000000 pacparser-1.3.6/examples/fetchurl.py 0000775 0000000 0000000 00000006261 12572366345 0017532 0 ustar 00root root 0000000 0000000 #!/usr/bin/python # Copyright (C) 2008 Manu Garg. # Author: Manu Garg