Commit Graph

85 Commits

Author SHA1 Message Date
Allan Odgaard
066acad708 Remove use of WATCH_LEAKS (C++) 2020-06-05 21:22:50 +07:00
Allan Odgaard
c93030b385 Remove all debug output from custom log macros
This provided value during early development, but has been unused for years, and it would generate too much noise if converted to os_log.

So better to just remove it all and add os_log statements as needed.
2020-06-05 21:22:50 +07:00
Allan Odgaard
4ec10c0923 Don’t annotate types and classes with PUBLIC
This was required when we linked each framework as its own thing, which we do not do anymore, and if we do go back to this system, we can simply have symbols public by default.
2020-06-05 21:22:50 +07:00
Allan Odgaard
fda314ef9b Move OakDownloadManager to SoftwareUpdate framework 2020-05-24 17:27:16 +07:00
Allan Odgaard
e9a873a5d0 Rename OakNetworkManager files to OakDownloadManager 2020-05-22 21:48:09 +07:00
Allan Odgaard
bafc8f0f3e Rename OakNetworkManager class to OakDownloadManager 2020-05-22 21:48:09 +07:00
Allan Odgaard
43b6548d5e Close NSFileHandle instances obtained from NSPipe when done writing
The documentation is not clear on whether or not file handles from an NSPipe will be automatically closed, so to be safe, we close them manually.
2020-05-22 21:48:09 +07:00
Allan Odgaard
9103d32ed8 Don’t associate real name with public signing keys
They already have a unique identifier.
2020-05-10 20:07:30 +07:00
Allan Odgaard
715e65ec51 Add OakNetworkManager
This is destined to replace the existing network code based on libcurl.
2020-05-08 20:02:16 +07:00
Allan Odgaard
6fde32efac Move can_reach_host out of network framework
We only call this function from a single place, so no need to make it public API.
2020-05-04 19:20:04 +07:00
Allan Odgaard
caaa36161d Change most fprintf log statements to using os_log 2020-05-04 19:20:04 +07:00
Allan Odgaard
8697e13e69 Remove ‘post_to_server’ API (based on libcurl) 2020-05-04 19:20:04 +07:00
Allan Odgaard
75d4c29f11 Change etag network filter to a general header (capture) filter 2017-10-08 09:19:49 +02:00
mathbunnyru
440414f96c Use nullptr in all C++ files instead of NULL
This brings us a bit of extra type safety, for example where an integer is expected, nullptr should be disallowed by the compiler (unlike NULL).
2016-10-22 21:40:14 +07:00
Allan Odgaard
f78a3b2ce4 Use kCFAllocatorDefault instead of NULL 2016-10-22 16:29:19 +07:00
mathbunnyru
284b5a3896 Slight perfomance improvements 2016-10-18 23:06:48 +02:00
mathbunnyru
08ad760d5e static_cast instead of c-style cast 2016-10-18 23:06:48 +02:00
Allan Odgaard
553e89ceb6 Update include statements and link declarations 2016-09-11 12:47:39 +02:00
Allan Odgaard
0d7390cdc3 Use path::rename_or_copy for TextMate’s own data files 2016-08-29 07:48:37 +02:00
Allan Odgaard
4ab38d3cfd Use the S_IRWX[UGO] constants to set file mode 2016-08-28 17:49:17 +02:00
Allan Odgaard
dbdfa3c6af Add identifying information to perror output 2016-08-21 12:09:30 +02:00
Ronald Wampler
e50dc57db0 Manually release GCD objects in C++ libraries
Since these are pure C++ libraries, they are not managed by ARC. This commit partially reverts 469fd74a7b.
2016-07-14 12:21:28 +02:00
Allan Odgaard
4db51602b0 Remove unused load/save methods from key_chain_t 2016-06-29 11:37:29 +02:00
Allan Odgaard
469fd74a7b Rely on ARC to manage GCD types (10.8) 2016-06-22 20:43:28 +02:00
Ronald Wampler
2ffc48fda9 Don't link network framework with crypto 2016-06-14 20:49:26 +02:00
Allan Odgaard
8fe7681ebd Remove unnecessary include of oak/compat.h 2015-08-05 12:31:20 +02:00
Allan Odgaard
a2681bfdfb Use gethostuuid instead of creating our own UUID 2014-11-17 00:05:26 +01:00
Allan Odgaard
235d52db7e Remove unused include 2014-11-17 00:04:51 +01:00
Allan Odgaard
b694ba50af Don’t include framework umbrella header 2014-11-10 09:02:39 +01:00
Allan Odgaard
ebf20acc20 Prefer CFBundleShortVersionString over CFBundleVersion 2014-11-10 09:01:05 +01:00
Allan Odgaard
7cb2330aae Log error if curl_easy_init() or accept() fails 2014-09-30 14:15:11 +02:00
Allan Odgaard
854fa91f10 Only cause preferences files to be created for TextMate
This function is called when running ‘bl’ and ‘test_network’, so previously we would end up with ‘bl.plist’ and ‘test_network.plist’ in ~/Library/Preferences.
2014-08-30 16:37:50 +02:00
Ronald Wampler
df38101798 Use proper deallocator for SecKeychainItemCopyAttributesAndData
This was found using clang's static analyzer.
2014-08-15 15:21:12 -04:00
Allan Odgaard
2427464f60 Disable tar’s support for extended attributes and resource forks
A problem has been reported where tar will freeze while extracting the default bundles archive to a networked Application Support folder.

From the bug report (Michael Kuron):

File servers tested: SMB on OS X 10.9.3, AFP on OS X 10.9.3, AFP on OS X 10.6.8, SMB on Windows 2008 R2.

Multiple machines tested.

Using ‘gnutar’ from MacPorts does not show the problem.

Setting ‘COPYFILE_DISABLE=1’ before running tar does not show the problem (the workaround used in this commit).
2014-06-28 17:42:23 +02:00
Allan Odgaard
6be2935518 Type/format arguments for SecItemImport were swapped
Also collect proper error code incase the function fails.
2014-06-28 17:42:22 +02:00
Allan Odgaard
b8c1085b9e Let NSURL extract the host from REST_API
The custom code in network::can_reach_host only dealt with the scheme, not port number or user/password.
2014-04-28 18:23:50 +07:00
Allan Odgaard
39b94e6ac3 Harmonize whitespace and add trailing newline 2014-04-14 14:26:52 +07:00
Allan Odgaard
69c83e56df The ‘const’ keyword should be to the right of its type
The standard doesn’t care which side the keyword is placed on, but placing it on the right makes it easier to read types.

E.g. reading “int const* const” from right to left we get “const pointer to const integer”.
2014-03-31 08:27:19 +07:00
Allan Odgaard
c2397484b8 Use C++11 for loop
Majority of the edits done using the following ruby script:

    def update_loops(src)
      dst, cnt = '', 0

      block_indent, variable = nil, nil
      src.each_line do |line|
        if block_indent
          if line =~ /^#{block_indent}([{}\t])|^\t*$/
            block_indent = nil if $1 == '}'
            line = line.gsub(%r{ ([^a-z>]) \(\*#{variable}\) | \*#{variable}\b | \b#{variable}(->) }x) do
              $1.to_s + variable + ($2 == "->" ? "." : "")
            end
          else
            block_indent = nil
          end
        elsif line =~ /^(\t*)c?iterate\((\w+), (?!diacritics::make_range)(.*\))$/
          block_indent, variable = $1, $2
          line = "#$1for(auto const& #$2 : #$3\n"
          cnt += 1
        end
        dst << line
      end
      return dst, cnt
    end

    paths.each do |path|
      src = IO.read(path)

      cnt = 1
      while cnt != 0
        src, cnt = update_loops(src)
        STDERR << "#{path}: #{cnt}\n"
      end

      File.open(path, "w") { |io| io << src }
    end
2014-03-03 10:34:13 +07:00
Allan Odgaard
bdba01a30f Do not report “Failed: Extracting Archive” on download failure 2014-01-13 09:02:16 +07:00
Allan Odgaard
1c308c810d Use map::emplace instead of inserting std::pair (C++11) 2013-09-05 20:59:11 +02:00
Allan Odgaard
e4e80a946c Use std::make_shared 2013-09-03 12:27:20 +02:00
Allan Odgaard
de03c27a63 Update network::tbz_t API
The main issue with the old API was inability to capture error output from the tar process.
2013-08-25 21:13:06 +02:00
Allan Odgaard
bf1e92b865 Do not use global constructors for fixtures 2013-08-16 22:40:08 +02:00
Allan Odgaard
22abe6d74f Disallow curl from using signals
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).
2013-08-12 22:57:57 +02:00
Allan Odgaard
1d4358fac6 Remove unused include 2013-08-05 18:55:43 +02:00
Allan Odgaard
82e7749546 Explicitly run libcurl’s global init function
This function is not thread safe so we should not have it implicitly called, as we generally do not call the libcurl functions from the main thread.
2013-08-04 22:18:30 +02:00
Allan Odgaard
9d37cb976a Remove unnecessary call to c_str 2013-07-29 15:50:31 +02:00
Allan Odgaard
ecede39eeb Don’t pass (https) scheme to the reachability API
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.
2013-06-26 12:33:43 +02:00
Allan Odgaard
f8d71729fe Add SOCKS proxy support
This is for updating bundles and itself plus posting crash reports.

It now also ignores unknown proxy types.
2013-05-26 10:24:35 +08:00