Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google backporting #75

Open
wants to merge 69 commits into
base: master
Choose a base branch
from

Conversation

slattarini
Copy link
Contributor

Backport refactorings, enhancements (especially in tests) and c-ares integration implemented in the Google fork of pacparser.

As downloaded from
http://ftp.mozilla.org/pub/mozilla.org/js/js-1.8.0-rc1.tar.gz

Signed-off-by: Stefano Lattarini <slattarini@google.com>
This is part of the backporting of Google-specific modifications to
upstream pacparser.

Notice that the tests do not pass yet for the pactester build from the
git repository, but works from the one built from the Google-modified
version. My plan is to use the enhanced test to do the backporting in
a "test-driven" way.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Still unused, but will be later properly plumbed in as part of the
backport of Google-specific modifications.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
To enhance readability, reduce code duplication, and pave the road
for upcoming backporting of Google-specific features.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
That was the documented behavior, but the actual one was to return the
empty string -- which is also inconsistent with the myIpAddress()
behavior, which already returned return 127.0.0.1 if not able to
determine the local IP.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Same as dnsResolve(); which will allow us to reduce code duplication

Signed-off-by: Stefano Lattarini <slattarini@google.com>
For less strcpy and more sanity in the callers

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
But keep them enabled by default.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
…tions

- support bracketed IPv6 addresses in URLs (rather than choking
  on them)

- everything requiring interactions with actual DNS via c-ares
  is still dummied-out

- snatch the occasion to be more respectful of Google's coding standards
  for shell scripts in our shell-based tests

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
That is, once we actually have c-ares integration, they should do so
when the c-ares library is not available at build time.  So prepare the
existing code to handle such failures.

While at it, slightly improve some existing error messages.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Arguments to exported functions are already documented in the javadoc-style
comments preceding each declaration. And where they are not, make them so.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Also update LGPLv3 notice from the latest version at
<http://www.gnu.org/licenses/gpl-howto.html>

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Some stylistic and buglets fixes while at it.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
…queries()

Just to avoid conflicts with the slightly-modified Google's c-ares library.

Fix a couple of typofixes while at it.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Adding a new one admittedly; but I plan to use it to replace
other more complex ones as well...

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Reducing potential memory leaks and diffs with pacparser_resolve_host_ares()

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Also remove SYMBOL_CACHE_SIZE from doxygen.config, as doxygen says it has
become obsolete. And remove trailing whitespace from doxygen.config.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
…ils)

For a simplified Makefile and a saner python testing. Start adding python
tests based on PyUnit. More will follow.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
…function once

We never prevented that to have collateral effects (e.g., aborting the
program), so we cannot assume it will just return after each call.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
…emory leaks

On failure, realloc returns NULL. So imagine this scenario: realloc succeeds
the first time, foo is allocated; then it fails the second time, returns NULL,
pointer to originally allocated foo is lost: we have a memory leak.

Thanks qdii@google.com for highlighting this.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
…d in case of a setup error

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Following a suggestion from qdii@google.com

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
…fo() errors

errno is only set if the return value of getnameinfo() is EAI_SYSTEM

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
…artial

(as mangled by our processing involving pointer arithmetic)

Signed-off-by: Stefano Lattarini <slattarini@google.com>
…s during setup

Signed-off-by: Stefano Lattarini <slattarini@google.com>
…y != 0

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Some small refactorings while at it.

Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
Signed-off-by: Stefano Lattarini <slattarini@google.com>
@manugarg
Copy link
Owner

Changes in this PR are humongous and obviously old. It will be hard to merge it, but there some very useful and interesting tidbits here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants