1. 16 10月, 2011 2 次提交
    • J
      http_init: accept separate URL parameter · deba4937
      Jeff King 提交于
      The http_init function takes a "struct remote". Part of its
      initialization procedure is to look at the remote's url and
      grab some auth-related parameters. However, using the url
      included in the remote is:
      
        - wrong; the remote-curl helper may have a separate,
          unrelated URL (e.g., from remote.*.pushurl). Looking at
          the remote's configured url is incorrect.
      
        - incomplete; http-fetch doesn't have a remote, so passes
          NULL. So http_init never gets to see the URL we are
          actually going to use.
      
        - cumbersome; http-push has a similar problem to
          http-fetch, but actually builds a fake remote just to
          pass in the URL.
      
      Instead, let's just add a separate URL parameter to
      http_init, and all three callsites can pass in the
      appropriate information.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      deba4937
    • M
      http: use hostname in credential description · 070b4dd5
      Michael J Gruber 提交于
      Until now, a request for an http password looked like:
      
        Username:
        Password:
      
      Now it will look like:
      
        Username for 'example.com':
        Password for 'example.com':
      
      Picked-from: Jeff King <peff@peff.net>
      Signed-off-by: NMichael J Gruber <git@drmicha.warpmail.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      070b4dd5
  2. 21 7月, 2011 2 次提交
  3. 04 6月, 2011 1 次提交
  4. 05 5月, 2011 1 次提交
  5. 27 4月, 2011 1 次提交
  6. 27 11月, 2010 1 次提交
  7. 18 11月, 2010 1 次提交
  8. 28 9月, 2010 1 次提交
  9. 12 8月, 2010 1 次提交
  10. 20 4月, 2010 5 次提交
    • T
      http.c::new_http_pack_request: do away with the temp variable filename · 90d05713
      Tay Ray Chuan 提交于
      Now that the temporary variable char *filename is only used in one
      place, do away with it and just call sha1_pack_name() directly.
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Acked-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      90d05713
    • S
      http-fetch: Use temporary files for pack-*.idx until verified · 750ef425
      Shawn O. Pearce 提交于
      Verify that a downloaded pack-*.idx file is consistent and valid
      as an index file before we rename it into its final destination.
      This prevents a corrupt index file from later being treated as a
      usable file, confusing readers.
      
      Check that we do not have the pack index file before invoking
      fetch_pack_index(); that way, we can do without the has_pack_index()
      check in fetch_pack_index().
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      750ef425
    • S
      http-fetch: Use index-pack rather than verify-pack to check packs · fe72d420
      Shawn O. Pearce 提交于
      To ensure we don't leave a corrupt pack file positioned as though
      it were a valid pack file, run index-pack on the temporary pack
      before we rename it to its final name.  If index-pack crashes out
      when it discovers file corruption (e.g. GitHub's error HTML at the
      end of the file), simply delete the temporary files to cleanup.
      
      By waiting until the pack has been validated before we move it
      to its final name, we eliminate a race condition where another
      concurrent reader might try to access the pack at the same time
      that we are still trying to verify its not corrupt.
      
      Switching from verify-pack to index-pack is a change in behavior,
      but it should turn out better for users.  The index-pack algorithm
      tries to minimize disk seeks, as well as the number of times any
      given object is inflated, by organizing its work along delta chains.
      The verify-pack logic does not attempt to do this, thrashing the
      delta base cache and the filesystem cache.
      
      By recreating the index file locally, we also can automatically
      upgrade from a v1 pack table of contents to v2.  This makes the
      CRC32 data available for use during later repacks, even if the
      server didn't have them on hand.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Acked-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      fe72d420
    • S
      Allow parse_pack_index on temporary files · 7b64469a
      Shawn O. Pearce 提交于
      The easiest way to verify a pack index is to open it through the
      standard parse_pack_index function, permitting the header check
      to happen when the file is mapped.  However, the dumb HTTP client
      needs to verify a pack index before its moved into its proper file
      name within the objects/pack directory, to prevent a corrupt index
      from being made available.  So permit the caller to specify the
      exact path of the index file.
      
      For now we're still using the final destination name within the
      sole call site in http.c, but eventually we will start to parse
      the temporary path instead.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7b64469a
    • S
      http.c: Remove unnecessary strdup of sha1_to_hex result · 162eb5f8
      Shawn O. Pearce 提交于
      Most of the time the dumb HTTP transport is run without the verbose
      flag set, so we only need the result of sha1_to_hex(sha1) once, to
      construct the pack URL.  Don't bother with an unnecessary malloc,
      copy, free chain of this buffer.
      
      If verbose is set, we'll format the SHA-1 twice now.  But this
      tiny extra CPU time spent is nothing compared to the slowdown that
      is usually imposed by the verbose messages being sent to the tty,
      and is entirely trivial compared to the latency involved with the
      remote HTTP server sending something as big as a pack file.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Acked-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      162eb5f8
  11. 18 4月, 2010 4 次提交
  12. 10 4月, 2010 1 次提交
  13. 02 4月, 2010 1 次提交
    • S
      Prompt for a username when an HTTP request 401s · 42653c09
      Scott Chacon 提交于
      When an HTTP request returns a 401, Git will currently fail with a
      confusing message saying that it got a 401, which is not very
      descriptive.
      
      Currently if a user wants to use Git over HTTP, they have to use one
      URL with the username in the URL (e.g. "http://user@host.com/repo.git")
      for write access and another without the username for unauthenticated
      read access (unless they want to be prompted for the password each
      time). However, since the HTTP servers will return a 401 if an action
      requires authentication, we can prompt for username and password if we
      see this, allowing us to use a single URL for both purposes.
      
      This patch changes http_request to prompt for the username and password,
      then return HTTP_REAUTH so http_get_strbuf can try again.  If it gets
      a 401 even when a user/pass is supplied, http_request will now return
      HTTP_NOAUTH which remote_curl can then use to display a more
      intelligent error message that is less confusing.
      Signed-off-by: NScott Chacon <schacon@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      42653c09
  14. 05 3月, 2010 1 次提交
  15. 12 1月, 2010 1 次提交
  16. 04 1月, 2010 1 次提交
  17. 30 12月, 2009 1 次提交
    • J
      Remove http.authAny · 525ecd26
      Junio C Hamano 提交于
      Back when the feature to use different HTTP authentication methods was
      originally written, it needed an extra HTTP request for everything when
      the feature was in effect, because we didn't reuse curl sessions.
      
      However, b8ac9230 (Add an option for using any HTTP authentication scheme,
      not only basic, 2009-11-27) builds on top of an updated codebase that does
      reuse curl sessions; there is no need to manually avoid the extra overhead
      by making this configurable anymore.
      Acked-by: NMartin Storsjo <martin@martin.st>
      Acked-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      525ecd26
  18. 28 11月, 2009 2 次提交
    • M
      Add an option for using any HTTP authentication scheme, not only basic · b8ac9230
      Martin Storsjö 提交于
      This adds the configuration option http.authAny (overridable with
      the environment variable GIT_HTTP_AUTH_ANY), for instructing curl
      to allow any HTTP authentication scheme, not only basic (which
      sends the password in plaintext).
      
      When this is enabled, curl has to do double requests most of the time,
      in order to discover which HTTP authentication method to use, which
      lowers the performance slightly. Therefore this isn't enabled by default.
      
      One example of another authentication scheme to use is digest, which
      doesn't send the password in plaintext, but uses a challenge-response
      mechanism instead. Using digest authentication in practice requires
      at least curl 7.18.1, due to bugs in the digest handling in earlier
      versions of curl.
      Signed-off-by: NMartin Storsjö <martin@martin.st>
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b8ac9230
    • T
      http: maintain curl sessions · ad75ebe5
      Tay Ray Chuan 提交于
      Allow curl sessions to be kept alive (ie. not ended with
      curl_easy_cleanup()) even after the request is completed, the number of
      which is determined by the configuration setting http.minSessions.
      
      Add a count for curl sessions, and update it, across slots, when
      starting and ending curl sessions.
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ad75ebe5
  19. 05 11月, 2009 1 次提交
    • S
      Smart push over HTTP: client side · de1a2fdd
      Shawn O. Pearce 提交于
      The git-remote-curl backend detects if the remote server supports
      the git-receive-pack service, and if so, runs git-send-pack in a
      pipe to dump the command and pack data as a single POST request.
      
      The advertisements from the server that were obtained during the
      discovery are passed into git-send-pack before the POST request
      starts.  This permits git-send-pack to operate largely unmodified.
      
      For smaller packs (those under 1 MiB) a HTTP/1.0 POST with a
      Content-Length is used, permitting interaction with any server.
      The 1 MiB limit is arbitrary, but is sufficent to fit most deltas
      created by human authors against text sources with the occasional
      small binary file (e.g. few KiB icon image).  The configuration
      option http.postBuffer can be used to increase (or shink) this
      buffer if the default is not sufficient.
      
      For larger packs which cannot be spooled entirely into the helper's
      memory space (due to http.postBuffer being too small), the POST
      request requires HTTP/1.1 and sets "Transfer-Encoding: chunked".
      This permits the client to upload an unknown amount of data in one
      HTTP transaction without needing to pregenerate the entire pack
      file locally.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      CC: Daniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      de1a2fdd
  20. 15 9月, 2009 1 次提交
  21. 11 9月, 2009 1 次提交
  22. 29 8月, 2009 1 次提交
    • T
      http.c: set slot callback members to NULL when releasing object · 4b9fa0e3
      Tay Ray Chuan 提交于
      Set the members callback_func and callback_data of freq->slot to NULL
      when releasing a http_object_request. release_active_slot() is also
      invoked on the slot to remove the curl handle associated with the slot
      from the multi stack (CURLM *curlm in http.c).
      
      These prevent the callback function and data from being used in http
      methods (like http.c::finish_active_slot()) after a
      http_object_request has been free'd.
      
      Noticed by Ali Polatel, who later tested this patch to verify that it
      fixes the problem he saw; Dscho helped to identify the problem spot.
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4b9fa0e3
  23. 19 8月, 2009 1 次提交
  24. 11 8月, 2009 3 次提交
  25. 19 6月, 2009 3 次提交
    • M
      http.c: add http.sslCertPasswordProtected option · 754ae192
      Mark Lodato 提交于
      Add a configuration option, http.sslCertPasswordProtected, and associated
      environment variable, GIT_SSL_CERT_PASSWORD_PROTECTED, to enable SSL client
      certificate password prompt from within git.  If this option is false and
      if the environment variable does not exist, git falls back to OpenSSL's
      prompts (as in earlier versions of git).
      
      The environment variable may only be used to enable, not to disable
      git's password prompt.  This behavior mimics GIT_NO_VERIFY; the mere
      existence of the variable is all that is checked.
      Signed-off-by: NMark Lodato <lodatom@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      754ae192
    • M
      http.c: prompt for SSL client certificate password · 30dd9163
      Mark Lodato 提交于
      If an SSL client certificate is enabled (via http.sslcert or
      GIT_SSL_CERT), prompt for the certificate password rather than
      defaulting to OpenSSL's password prompt.  This causes the prompt to only
      appear once each run.  Previously, OpenSSL prompted the user *many*
      times, causing git to be unusable over HTTPS with client-side
      certificates.
      
      Note that the password is stored in memory in the clear while the
      program is running.  This may be a security problem if git crashes and
      core dumps.
      
      The user is always prompted, even if the certificate is not encrypted.
      This should be fine; unencrypted certificates are rare and a security
      risk anyway.
      Signed-off-by: NMark Lodato <lodatom@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      30dd9163
    • M
      http.c: fix compiling with libcurl 7.9.2 · ef52aafa
      Mark Lodato 提交于
      Change the minimimum required libcurl version for the http.sslKey option
      to 7.9.3.  Previously, preprocessor macros checked for >= 7.9.2, which
      is incorrect because CURLOPT_SSLKEY was introduced in 7.9.3.  This now
      allows git to compile with libcurl 7.9.2.
      Signed-off-by: NMark Lodato <lodatom@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ef52aafa
  26. 07 6月, 2009 1 次提交
    • T
      http*: add helper methods for fetching objects (loose) · 5424bc55
      Tay Ray Chuan 提交于
      The code handling the fetching of loose objects in http-push.c and
      http-walker.c have been refactored into new methods and a new struct
      (object_http_request) in http.c. They are not meant to be invoked
      elsewhere.
      
      The new methods in http.c are
       - new_http_object_request
       - process_http_object_request
       - finish_http_object_request
       - abort_http_object_request
       - release_http_object_request
      
      and the new struct is http_object_request.
      
      RANGER_HEADER_SIZE and no_pragma_header is no longer made available
      outside of http.c, since after the above changes, there are no other
      instances of usage outside of http.c.
      
      Remove members of the transfer_request struct in http-push.c and
      http-walker.c, including filename, real_sha1 and zret, as they are used
      no longer used.
      
      Move the methods append_remote_object_url() and get_remote_object_url()
      from http-push.c to http.c. Additionally, get_remote_object_url() is no
      longer defined only when USE_CURL_MULTI is defined, since
      non-USE_CURL_MULTI code in http.c uses it (namely, in
      new_http_object_request()).
      
      Refactor code from http-push.c::start_fetch_loose() and
      http-walker.c::start_object_fetch_request() that deals with the details
      of coming up with the filename to store the retrieved object, resuming
      a previously aborted request, and making a new curl request, into a new
      function, new_http_object_request().
      
      Refactor code from http-walker.c::process_object_request() into the
      function, process_http_object_request().
      
      Refactor code from http-push.c::finish_request() and
      http-walker.c::finish_object_request() into a new function,
      finish_http_object_request(). It returns the result of the
      move_temp_to_file() invocation.
      
      Add a function, release_http_object_request(), which cleans up object
      request data. http-push.c and http-walker.c invoke this function
      separately; http-push.c::release_request() and
      http-walker.c::release_object_request() do not invoke this function.
      
      Add a function, abort_http_object_request(), which unlink()s the object
      file and invokes release_http_object_request(). Update
      http-walker.c::abort_object_request() to use this.
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5424bc55