1. 17 3月, 2017 4 次提交
  2. 07 3月, 2017 1 次提交
  3. 01 3月, 2017 1 次提交
    • J
      http: attempt updating base URL only if no error · 8e27391a
      Jonathan Tan 提交于
      http.c supports HTTP redirects of the form
      
        http://foo/info/refs?service=git-upload-pack
        -> http://anything
        -> http://bar/info/refs?service=git-upload-pack
      
      (that is to say, as long as the Git part of the path and the query
      string is preserved in the final redirect destination, the intermediate
      steps can have any URL). However, if one of the intermediate steps
      results in an HTTP exception, a confusing "unable to update url base
      from redirection" message is printed instead of a Curl error message
      with the HTTP exception code.
      
      This was introduced by 2 commits. Commit c93c92f3 ("http: update base
      URLs when we see redirects", 2013-09-28) introduced a best-effort
      optimization that required checking if only the "base" part of the URL
      differed between the initial request and the final redirect destination,
      but it performed the check before any HTTP status checking was done. If
      something went wrong, the normal code path was still followed, so this
      did not cause any confusing error messages until commit 6628eb41 ("http:
      always update the base URL for redirects", 2016-12-06), which taught
      http to die if the non-"base" part of the URL differed.
      
      Therefore, teach http to check the HTTP status before attempting to
      check if only the "base" part of the URL differed. This commit teaches
      http_request_reauth to return early without updating options->base_url
      upon an error; the only invoker of this function that passes a non-NULL
      "options" is remote-curl.c (through "http_get_strbuf"), which only uses
      options->base_url for an informational message in the situations that
      this commit cares about (that is, when the return value is not HTTP_OK).
      
      The included test checks that the redirect scheme at the beginning of
      this commit message works, and that returning a 502 in the middle of the
      redirect scheme produces the correct result. Note that this is different
      from the test in commit 6628eb41 ("http: always update the base URL for
      redirects", 2016-12-06) in that this commit tests that a Git-shaped URL
      (http://.../info/refs?service=git-upload-pack) works, whereas commit
      6628eb41 tests that a non-Git-shaped URL
      (http://.../info/refs/foo?service=git-upload-pack) does not work (even
      though Git is processing that URL) and is an error that is fatal, not
      silently swallowed.
      Signed-off-by: NJonathan Tan <jonathantanmy@google.com>
      Acked-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8e27391a
  4. 28 2月, 2017 1 次提交
    • J
      http: add an "auto" mode for http.emptyauth · 40a18fc7
      Jeff King 提交于
      This variable needs to be specified to make some types of
      non-basic authentication work, but ideally this would just
      work out of the box for everyone.
      
      However, simply setting it to "1" by default introduces an
      extra round-trip for cases where it _isn't_ useful. We end
      up sending a bogus empty credential that the server rejects.
      
      Instead, let's introduce an automatic mode, that works like
      this:
      
        1. We won't try to send the bogus credential on the first
           request. We'll wait to get an HTTP 401, as usual.
      
        2. After seeing an HTTP 401, the empty-auth hack will kick
           in only when we know there is an auth method available
           that might make use of it (i.e., something besides
           "Basic" or "Digest").
      
      That should make it work out of the box, without incurring
      any extra round-trips for people hitting Basic-only servers.
      
      This _does_ incur an extra round-trip if you really want to
      use "Basic" but your server advertises other methods (the
      emptyauth hack will kick in but fail, and then Git will
      actually ask for a password).
      
      The auto mode may incur an extra round-trip over setting
      http.emptyauth=true, because part of the emptyauth hack is
      to feed this blank password to curl even before we've made a
      single request.
      Helped-by: NJohannes Schindelin <Johannes.Schindelin@gmx.de>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      40a18fc7
  5. 25 2月, 2017 11 次提交
  6. 24 2月, 2017 2 次提交
    • J
      http: restrict auth methods to what the server advertises · 840398fe
      Jeff King 提交于
      By default, we tell curl to use CURLAUTH_ANY, which does not
      limit its set of auth methods. However, this results in an
      extra round-trip to the server when authentication is
      required. After we've fed the credential to curl, it wants
      to probe the server to find its list of available methods
      before sending an Authorization header.
      
      We can shortcut this by limiting our http_auth_methods by
      what the server told us it supports. In some cases (such as
      when the server only supports Basic), that lets curl skip
      the extra probe request.
      
      The end result should look the same to the user, but you can
      use GIT_TRACE_CURL to verify the sequence of requests:
      
        GIT_TRACE_CURL=1 \
        git ls-remote https://example.com/repo.git \
        2>&1 >/dev/null |
        egrep '(Send|Recv) header: (GET|HTTP|Auth)'
      
      Before this patch, hitting a Basic-only server like
      github.com results in:
      
        Send header: GET /repo.git/info/refs?service=git-upload-pack HTTP/1.1
        Recv header: HTTP/1.1 401 Authorization Required
        Send header: GET /repo.git/info/refs?service=git-upload-pack HTTP/1.1
        Recv header: HTTP/1.1 401 Authorization Required
        Send header: GET /repo.git/info/refs?service=git-upload-pack HTTP/1.1
        Send header: Authorization: Basic <redacted>
        Recv header: HTTP/1.1 200 OK
      
      And after:
      
        Send header: GET /repo.git/info/refs?service=git-upload-pack HTTP/1.1
        Recv header: HTTP/1.1 401 Authorization Required
        Send header: GET /repo.git/info/refs?service=git-upload-pack HTTP/1.1
        Send header: Authorization: Basic <redacted>
        Recv header: HTTP/1.1 200 OK
      
      The possible downsides are:
      
        - This only helps for a Basic-only server; for a server
          with multiple auth options, curl may still send a probe
          request to see which ones are available (IOW, there's no
          way to say "don't probe, I already know what the server
          will say").
      
        - The http_auth_methods variable is global, so this will
          apply to all further requests. That's acceptable for
          Git's usage of curl, though, which also treats the
          credentials as global. I.e., in any given program
          invocation we hit only one conceptual server (we may be
          redirected at the outset, but in that case that's whose
          auth_avail field we'd see).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      840398fe
    • V
      l10n: pt_PT: update Portuguese tranlation · e06cdf12
      Vasco Almeida 提交于
      Signed-off-by: NVasco Almeida <vascomalmeida@sapo.pt>
      e06cdf12
  7. 23 2月, 2017 3 次提交
  8. 22 2月, 2017 2 次提交
  9. 21 2月, 2017 3 次提交
  10. 19 2月, 2017 3 次提交
  11. 18 2月, 2017 8 次提交
  12. 17 2月, 2017 1 次提交