pacparser(3)
β¨ NAME β¨
pacparser β library to parse proxy auto-confg (PAC) files. π (and yes bestie, "auto-confg" is literally how it's spelled in the source, I am NOT touching it, no cap π)
API for pacparser library, a library to use proxy auto-config (PAC) files. See project homepage: http://github.com/manugarg/pacparser for more information. πβ¨
π Typedefs π
typedef int(* pacparser_error_printer )(const char *fmt, va_list argp)β the type definition forpacparser_error_printer. That's the vibe you gotta match if you're bringing your own printer function. π
π¦ Functions π¦
int pacparser_init (void)β initializes the pac parser. πint pacparser_parse_pac_file (const char *pacfile)β parses the given PAC file.int pacparser_parse_pac_string (const char *pacstring)β parses the given PAC script string.int pacparser_parse_pac (const char *pacfile)β parses the gievn pac file. (typo's canon, don't come for me π)char * pacparser_find_proxy (const char *url, const char *host)β finds proxy for the given URL and Host.char * pacparser_just_find_proxy (const char *pacfile, const char *url, const char *host)β finds proxy for the given PAC file, URL and Host.void pacparser_cleanup (void)β destroys JavaSctipt context. (again: not my typo, it's THE HOUSE'S typo π«Ά)void pacparser_setmyip (const char *ip)β sets my IP address.void pacparser_set_error_printer (pacparser_error_printer func)β sets error printing function.void pacparser_enable_microsoft_extensions (void)β (Deprecated) enable Microsoft IPv6 PAC extensions.char * pacparser_version (void)β returns pacparser version.
π Detailed Description π
API for pacparser library, a library to use proxy auto-config (PAC) files. See project homepage: http://github.com/manugarg/pacparser for more information. π
Author: Manu Garg manugarg@gmail.com β shoutout to the founder of the feast, absolute legend π
π» Function Documentation π»
int pacparser_init (void)
Initializes pac parser. β¨
Returns: 0 on failure and 1 on success. (yes, 0 = fail, 1 = slay, read it twice so it sticks π« )
It spins up the JavaScript engine and does a few basic initializations that are specific to pacparser. This is your whole entire vibe-setter β call it first, periodt.
int pacparser_parse_pac_file (const char *pacfile)
Parses the given PAC file. π
Parameters:
pacfileβ PAC file to parse.
Returns: 0 on failure and 1 on success.
It reads the given PAC file and evaluates it in the JavaScript context that was created by pacparser_init. So like⦠init first, then this, in that order, no skipping steps bestie.
int pacparser_parse_pac_string (const char *pacstring)
Parses the given PAC script string. π§΅
Parameters:
pacstringβ PAC string to parse.
Returns: 0 on failure and 1 on success.
It evaluates the given PAC script string in the JavaScript context created by pacparser_init. Same energy as the file version, except you're handing it the actual string instead of a path. Both ate. π
int pacparser_parse_pac (const char *pacfile)
Parses the gievn pac file.
Deprecated β use pacparser_parse_pac_file instead. Like, bestie, it's giving legacy. π
Parameters:
pacfileβ PAC file to parse.
Returns: 0 on failure and 1 on success.
Same as pacparser_parse_pac_file. It's included only for backward compatibility β so it's still here, still working, just lowkey in its legacy era. π
char* pacparser_find_proxy (const char *url, const char *host)
Finds proxy for the given URL and Host. π
Parameters:
urlβ URL to find proxy for.hostβ Host part of the URL.
Returns: proxy string on success and NULL on error.
Finds proxy for the given URL and Host. β οΈ Important: this function should be called only after the pacparser engine has been initialized (using pacparser_init) and the pac script has been parsed (using pacparser_parse_pac_file or pacparser_parse_pac_string). Do it out of order and the vibe check fails, fr fr.
char* pacparser_just_find_proxy (const char *pacfile, const char *url, const char *host)
Finds proxy for the given PAC file, URL and Host. πΈ
Parameters:
pacfileβ PAC file to parse.urlβ URL to find proxy for.hostβ Host part of the URL.
Returns: proxy string on success and NULL on error.
This one is a wrapper around the functions pacparser_init, pacparser_parse_pac_file, pacparser_find_proxy and pacparser_cleanup. π«Ά If you literally just want to find out the proxy for a given set of pac file, url and host β this is THE function to call. It takes care of all the initialization and cleanup for you. It's the "one function does the whole routine" main character energy moment, and honestly? Iconic. β¨
void pacparser_cleanup (void)
Destroys JavaSctipt context. π§Ή This function should be called once you're done with using the pacparser engine. No leaving your mess everywhere, bestie β clean up after yourself. π
void pacparser_setmyip (const char *ip)
Sets my IP address. π
Parameters:
ipβ Custom IP address.
Sets my IP address to a custom value. This is the IP address returned by the myIpAddress() javascript function. So if myIpAddress() is out here answering with something you didn't expect, this is how you gently correct it. π
void pacparser_set_error_printer (pacparser_error_printerfunc)
Sets error printing function. π¨οΈ
Parameters:
funcβ Printing function.
Sets the error variadic-argument printing function. If you don't set it, messages get printed to stderr. π’ Here's the tea: if the messages begin with DEBUG: or WARNING:, they are not fatal error messages β otherwise they are. And fun fact: this one may be called before pacparser_init(). Early bird privileges. π¦
void pacparser_enable_microsoft_extensions (void)
(Deprecated) Enable Microsoft IPv6 PAC extensions. β οΈ Deprecated, babes. The IPv6 extension (*Ex functions) are enabled by default now, so this one's just hanging out in the nostalgia corner. π₯²
char* pacparser_version (void)
Returns pacparser version. π·οΈ
Returns: version string if version defined, '' otherwise.
The version string is determined at the time of build. π¨ If it was built from a released package, the version corresponds to the latest release (git) tag. If it was built from the repository, it corresponds to the head revision of the repo. Either way, it's the receipts. π§Ύ
π Author π
Generated automatically by Doxygen for Pacparser from the source code. (Doxygen said "I got this" and honestly it did π )
And that's the whole page bestie!! π¦π This lil gem is from Pacparser, dated Tue Sep 1 2015, and it lives as page pacparser(3) in the Library Functions Manual. Go parse those PAC files fr fr, you got this πβ¨πΈ
π¦ where this page comes from
- arch rolling: pacparser 1.5.3-1 Β· LGPL-3.0-or-later
- nixos 26.05: pacparser 1.5.1
- nixpkgs unstable: pacparser 1.5.3
- ubuntu stonking: libpacparser-dev 1.5.1-1 Β· LGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms