1. 15 Jun, 2019 6 commits
    • config_file: use `wildmatch` to evaluate conditionals · 5811e3ba
      We currently use `p_fnmatch` to compute whether a given "gitdir:"
      or "gitdir/i:" conditional matches the current configuration file
      path. As git.git has moved to use `wildmatch` instead of
      `p_fnmatch` throughout its complete codebase, we evaluate
      conditionals inconsistently with git.git in some special cases.
      
      Convert `p_fnmatch` to use `wildmatch`. The `FNM_LEADINGDIR` flag
      cannot be translated to `wildmatch`, but in fact git.git doesn't
      use it here either. And in fact, dropping it while we go
      increases compatibility with git.git.
      Patrick Steinhardt committed
    • config_file: do not include trailing '/' for "gitdir" conditionals · cf1a114b
      When evaluating "gitdir:" and "gitdir/i:" conditionals, we
      currently compare the given pattern with the value of
      `git_repository_path`. Thing is though that `git_repository_path`
      returns the gitdir path with trailing '/', while we actually need
      to match against the gitdir without it.
      
      Fix this issue by stripping the trailing '/' previous to
      matching. Add various tests to ensure we get this right.
      Patrick Steinhardt committed
    • config_file: refactor `do_match_gitdir` to improve readability · 5d987f7d
      The function `do_match_gitdir` has some horribly named parameters
      and variables. Rename them to improve readability. Furthermore,
      fix a potentially undetected out-of-memory condition when
      appending "**" to the pattern.
      Patrick Steinhardt committed
    • global: convert trivial `fnmatch` users to use `wildcard` · de70bb46
      Upstream git.git has converted its codebase to use wildcard in
      favor of fnmatch in commit 70a8fc999d (stop using fnmatch (either
      native or compat), 2014-02-15). To keep our own regex-matching in
      line with what git does, convert all trivial instances of
      `fnmatch` usage to use `wildcard`, instead. Trivial usage is
      defined to be use of `fnmatch` with either no flags or flags that
      have a 1:1 equivalent in wildmatch (PATHNAME, IGNORECASE).
      Patrick Steinhardt committed
    • posix: remove implicit include of "fnmatch.h" · 451df793
      We're about to phase out our bundled fnmatch implementation as
      git.git has moved to wildmatch long ago in 2014. To make it
      easier to spot which files are stilll using fnmatch, remove the
      implicit "fnmatch.h" include in "posix.h" and instead include it
      explicitly.
      Patrick Steinhardt committed
    • wildmatch: import wildmatch from git.git · a9f57629
      In commit 70a8fc999d (stop using fnmatch (either native or
      compat), 2014-02-15), upstream git has switched over all code
      from their internal fnmatch copy to its new wildmatch code. We
      haven't followed suit, and thus have developed some
      incompatibilities in how we match regular expressions.
      
      Import git's wildmatch from v2.22.0 and add a test suite based on
      their t3070-wildmatch.sh tests.
      Patrick Steinhardt committed
  2. 14 Jun, 2019 8 commits
  3. 13 Jun, 2019 11 commits
  4. 11 Jun, 2019 7 commits
  5. 10 Jun, 2019 8 commits
    • http: free auth context on failure · 7ea8630e
      When we send HTTP credentials but the server rejects them, tear down the
      authentication context so that we can start fresh.  To maintain this
      state, additionally move all of the authentication handling into
      `on_auth_required`.
      Edward Thomson committed
    • http: reconnect to proxy on connection close · 005b5bc2
      When we're issuing a CONNECT to a proxy, we expect to keep-alive to the
      proxy.  However, during authentication negotiations, the proxy may close
      the connection.  Reconnect if the server closes the connection.
      Edward Thomson committed
    • http: allow server to drop a keepalive connection · d171fbee
      When we have a keep-alive connection to the server, that server may
      legally drop the connection for any reason once a successful request and
      response has occurred.  It's common for servers to drop the connection
      after some amount of time or number of requests have occurred.
      Edward Thomson committed
    • http: stop on server EOF · 9af1de5b
      We stop the read loop when we have read all the data.  We should also
      consider the server's feelings.
      
      If the server hangs up on us, we need to stop our read loop.  Otherwise,
      we'll try to read from the server - and fail - ad infinitum.
      Edward Thomson committed
    • http: teach auth mechanisms about connection affinity · 539e6293
      Instead of using `is_complete` to decide whether we have connection or
      request affinity for authentication mechanisms, set a boolean on the
      mechanism definition itself.
      Edward Thomson committed
    • http: maintain authentication across connections · 3e0b4b43
      For request-based authentication mechanisms (Basic, Digest) we should
      keep the authentication context alive across socket connections, since
      the authentication headers must be transmitted with every request.
      
      However, we should continue to remove authentication contexts for
      mechanisms with connection affinity (NTLM, Negotiate) since we need to
      reauthenticate for every socket connection.
      Edward Thomson committed
    • http: simplify authentication mechanisms · ce72ae95
      Hold an individual authentication context instead of trying to maintain
      all the contexts; we can select the preferred context during the initial
      negotiation.
      
      Subsequent authentication steps will re-use the chosen authentication
      (until such time as it's rejected) instead of trying to manage multiple
      contexts when all but one will never be used (since we can only
      authenticate with a single mechanism at a time.)
      
      Also, when we're given a 401 or 407 in the middle of challenge/response
      handling, short-circuit immediately without incrementing the retry
      count.  The multi-step authentication is expected, and not a "retry" and
      should not be penalized as such.
      
      This means that we don't need to keep the contexts around and ensures
      that we do not unnecessarily fail for too many retries when we have
      challenge/response auth on a proxy and a server and potentially
      redirects in play as well.
      Edward Thomson committed