1. 18 Oct, 2018 1 commit
  2. 28 Feb, 2018 1 commit
    • curl: explicitly initialize and cleanup global curl state · 2022b004
      Our curl-based streams make use of the easy curl interface. This
      interface automatically initializes and de-initializes the global curl
      state by calling out to `curl_global_init` and `curl_global_cleanup`.
      Thus, all global state will be repeatedly re-initialized when creating
      multiple curl streams in succession. Despite being inefficient, this is
      not thread-safe due to `curl_global_init` being not thread-safe itself.
      Thus a multi-threaded programing handling multiple curl streams at the
      same time is inherently racy.
      
      Fix the issue by globally initializing and cleaning up curl's state.
      Patrick Steinhardt committed
  3. 23 Oct, 2017 1 commit
  4. 07 Oct, 2017 1 commit
  5. 27 Sep, 2017 2 commits
  6. 03 Jul, 2017 1 commit
    • Make sure to always include "common.h" first · 0c7f49dd
      Next to including several files, our "common.h" header also declares
      various macros which are then used throughout the project. As such, we
      have to make sure to always include this file first in all
      implementation files. Otherwise, we might encounter problems or even
      silent behavioural differences due to macros or defines not being
      defined as they should be. So in fact, our header and implementation
      files should make sure to always include "common.h" first.
      
      This commit does so by establishing a common include pattern. Header
      files inside of "src" will now always include "common.h" as its first
      other file, separated by a newline from all the other includes to make
      it stand out as special. There are two cases for the implementation
      files. If they do have a matching header file, they will always include
      this one first, leading to "common.h" being transitively included as
      first file. If they do not have a matching header file, they instead
      include "common.h" as first file themselves.
      
      This fixes the outlined problems and will become our standard practice
      for header and source files inside of the "src/" from now on.
      Patrick Steinhardt committed
  7. 15 Nov, 2016 1 commit
    • curl_stream: use CURLINFO_ACTIVESOCKET if curl is recent enough · 5cbd5260
      The `CURLINFO_LASTSOCKET` information has been deprecated since
      curl version 7.45.0 as it may result in an overflow in the
      returned socket on certain systems, most importantly on 64 bit
      Windows. Instead, a new call `CURLINFO_ACTIVESOCKET` has been
      added which instead returns a `curl_socket_t`, which is always
      sufficiently long to store a socket.
      
      As we need to provide backwards compatibility with curl versions
      smaller than 7.45.0, alias CURLINFO_ACTIVESOCKET to
      CURLINFO_LASTSOCKET on platforms without CURLINFO_ACTIVESOCKET.
      Patrick Steinhardt committed
  8. 11 Nov, 2016 1 commit
    • curl_stream: check for -1 after CURLINFO_LASTSOCKET · 5ca75fd5
      We're recently trying to upgrade to the current master of libgit2
      in Cargo but we're unfortunately hitting a segfault in one of our
      tests. This particular test is just a small smoke test that https
      works (e.g. it's configured in libgit2). It attempts to clone
      from a URL which simply immediately drops connections after
      they're accepted (e.g. terminate abnormally). We expect to see a
      standard error from libgit2 but unfortunately we're seeing a
      segfault.
      
      This segfault is happening inside of the `wait_for` function of
      `curl_stream.c` at the line `FD_SET(fd, &errfd)` because `fd` is
      -1. This ends up doing an out-of-bounds array access that faults
      the program. I tracked back to where this -1 came from to the
      line here (returned by `CURLINFO_LASTSOCKET`) and added a check
      to return an error.
      Alex Crichton committed
  9. 19 Apr, 2016 2 commits
  10. 08 Feb, 2016 1 commit
  11. 17 Jan, 2016 1 commit
  12. 06 Aug, 2015 1 commit
  13. 10 Jul, 2015 1 commit
  14. 24 Jun, 2015 4 commits