If libcurl is built with the default DNS resolver then it will handle a timeout by using SIGALRM, though since we are using threads, and signals are not compatible with threads, this may have led to a crash in Curl_resolv_timeout (for users where a DNS lookup could take longer than the timeout, presumably 300 seconds).
The reachability API does a DNS lookup on the literal string and prior to this commit, could stall for as long as it takes to lookup a non-existing host name via DNS.
We now use CFNetworkCopyProxiesForURL() to get the list of potential proxies, hopefully this will perform the proper “proxy auto discovery” (issue #973) though we still need to handle PAC ourself.
Presently we only use the first proxy found, ideally we would try them all (but this will require some API changes).
This belongs in main(), where it is already being set.
It might however be necessary to set it when running tests, although none of the tests seems to fail w/o this.
We need this in a few places and while calling Gestalt() isn’t that much code, that function is deprecated in 10.8 and the alternative is a lot more code, so we don’t want to repeat that once we update the code.
Instead of passing the file descriptor to the child, and have the child close it, we set FD_CLOEXEC on the file descriptor in the parent process.
While it limits the window in which another thread can fork() and cause the file descriptor to be “leaked”, it doesn’t eliminate the problem.
This should hopefully solve the issue with the (on some systems) fairly aggressive temp cleaner.
Also remove the archive incase the user cancels the update, now that we are extracting it to a less temporary location.
This used to contain an UUID used for identifying the client in network requests, but for majority of users, this is unset, so now we create our own UUID for the user agent string used when polling for software updates.
Since the PAC URL is user supplied it’s unknown what state it actually is in, so we try to create a CFURL object from the raw string and if that fails, we URL-escape it (though not escaping slashes and colons).
Should fix issue #228.
We now bypass the global proxy if trying to connect to localhost (as some of our tests do) and we also hand the actual target URL to the potential proxy auto configuration (PAC) script.
The cf::wrap function returns a temporary object that can be converted to a CFType, but this object’s lifetime is that of the temporary object returned. By putting the result of cf::wrap into a C array we keep the CFTypeRef around longer than the temporary object.
Previously this was under the OakSystem framework which depends on the io framework meaning that the io framework itself was unable to obtain a basic environment, which is necessary for next commit.
GlimmerBlocker (http://GlimmerBlocker.org) and other proxies may intercept the web data and replace the HTTP/1.0 response with a HTTP/1.1 response.
Modified test to accept either.