• J
    remote-curl: retry failed requests for auth even with gzip · 2e736fd5
    Jeff King 提交于
    Commit b81401c1 taught the post_rpc function to retry the
    http request after prompting for credentials. However, it
    did not handle two cases:
    
      1. If we have a large request, we do not retry. That's OK,
         since we would have sent a probe (with retry) already.
    
      2. If we are gzipping the request, we do not retry. That
         was considered OK, because the intended use was for
         push (e.g., listing refs is OK, but actually pushing
         objects is not), and we never gzip on push.
    
    This patch teaches post_rpc to retry even a gzipped request.
    This has two advantages:
    
      1. It is possible to configure a "half-auth" state for
         fetching, where the set of refs and their sha1s are
         advertised, but one cannot actually fetch objects.
    
         This is not a recommended configuration, as it leaks
         some information about what is in the repository (e.g.,
         an attacker can try brute-forcing possible content in
         your repository and checking whether it matches your
         branch sha1). However, it can be slightly more
         convenient, since a no-op fetch will not require a
         password at all.
    
      2. It future-proofs us should we decide to ever gzip more
         requests.
    Signed-off-by: NJeff King <peff@peff.net>
    2e736fd5
remote-curl.c 22.0 KB