Commit Graph

30 Commits

Author SHA1 Message Date
Allan Odgaard
dfee671b6a Don’t use POSIX_SPAWN_CLOEXEC_DEFAULT on 10.7
Using this flag on 10.7.5 seems to cause a kernel panic.

Fixes #896.
2013-03-17 15:44:06 +01:00
Allan Odgaard
398e55cdbe Add helper functions to get OS version
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.
2013-03-17 15:44:06 +01:00
Allan Odgaard
24f6f3bd2c Use posix_spawn instead of fork/exec
Using Apple’s POSIX_SPAWN_CLOEXEC_DEFAULT appears to be the only safe way to spawn a child process in a multi-threaded program.
2013-03-10 16:07:11 +01:00
Allan Odgaard
f69ac60b0c Limit file descriptors passed to child process
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.
2013-03-10 16:07:10 +01:00
Allan Odgaard
13edc6d131 Use O_CLOEXEC when opening files
This avoids leaking file descriptors into child processes, which would otherwise happen if another thread forks while the file descriptor is open.
2013-03-10 16:07:10 +01:00
Allan Odgaard
4dada34bde Make network tests concurrent 2013-03-10 16:07:10 +01:00
Allan Odgaard
710e4ffad0 Remove unused tbz (download) filter 2013-03-10 16:07:09 +01:00
Allan Odgaard
609c332e0a Parse headers received in post_to_server 2013-02-08 11:20:35 +01:00
Allan Odgaard
9eb4044fdb Switch to simpler regexp::search 2013-02-08 11:20:35 +01:00
Allan Odgaard
e75e7ec8e5 Change text::format → std::to_string (C++11) 2013-02-08 11:20:34 +01:00
Allan Odgaard
b1f19e93f2 Corrupt archive → extracting archive
This is a more correct error.

Also write exit code and potential error from tar to stderr.
2013-01-29 21:47:40 +01:00
Allan Odgaard
0208414672 Download s/w updates to cache folder
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.
2013-01-21 15:03:52 +01:00
Allan Odgaard
df914261f4 Update code to std::thread with lambda 2012-12-30 03:00:53 +01:00
Allan Odgaard
685039c0e9 Don’t rely on com.apple.CrashReporter existing
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.
2012-12-30 03:00:53 +01:00
Allan Odgaard
49c37ca864 Skip ‘null’ payload fields when posting to server 2012-09-30 15:25:44 +02:00
Allan Odgaard
22c38ebe11 Remove legacy code (10.4 compatibility)
The code itself was using Gestalt() to check OS version which is deprecated on 10.8.
2012-09-16 11:41:24 +02:00
Allan Odgaard
400be883b9 URL-escape PAC string
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.
2012-09-09 22:49:55 +02:00
Allan Odgaard
0e96a04d76 Remove compatibility checks
Since we now require 10.7 we don’t need all of this. Keeping it around is just noise that can lead to confusion about code paths.
2012-08-29 16:02:29 +02:00
Allan Odgaard
cbe91ff831 Assume compiler support for explicit keyword
Since we require a fairly recent clang for other features, there is no reason to test for this one.
2012-08-29 14:27:35 +02:00
Jacob Bandes-Storch
e3aa997b06 Use libc++: replace std::tr1 with std 2012-08-28 13:30:20 +02:00
Allan Odgaard
3415d775c5 Use symbolic name for FD_CLOEXEC
Unsure why I was using ‘1’ — perhaps the symbolic name was missing in the older SDK.
2012-08-24 16:52:45 +02:00
Allan Odgaard
236c608e86 Revert "Accept HTTP/1.1 response in network tests"
Since we bypass the system’s proxy for localhost, no-one should modify our test server’s response.

This reverts commit c98bc92b5d.
2012-08-13 20:32:35 +02:00
Allan Odgaard
f370ee13e4 Make proxy setup URL specific
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.
2012-08-13 20:32:35 +02:00
Allan Odgaard
54d157129b fixup! Use SecItemCopyMatching instead of the deprecated SecKeychainSearch
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.
2012-08-13 16:14:32 +02:00
jtbandes
7f3818fb4c Use SecItemCopyMatching instead of the deprecated SecKeychainSearch 2012-08-12 12:59:43 +02:00
jtbandes
3d3d22f509 Use Security framework instead of deprecated OpenSSL functions 2012-08-11 23:04:00 -07:00
Allan Odgaard
e680130eaf Move oak::basic_environment to the io framework
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.
2012-08-11 19:31:10 +02:00
Allan Odgaard
485bdde0f7 Move oak::c_array to oak/datatypes.h
This simple wrapper is useful in a few places so we shouldn’t need to depend on the OakSystem framework in order to use it.
2012-08-11 19:21:28 +02:00
Gerd Knops
c98bc92b5d Accept HTTP/1.1 response in network tests
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.
2012-08-10 19:09:57 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00