1. 20 4月, 2010 3 次提交
    • 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
  2. 18 4月, 2010 4 次提交
  3. 12 1月, 2010 1 次提交
  4. 04 1月, 2010 1 次提交
  5. 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
  6. 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
  7. 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
  8. 15 9月, 2009 1 次提交
  9. 11 9月, 2009 1 次提交
  10. 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
  11. 19 8月, 2009 1 次提交
  12. 11 8月, 2009 3 次提交
  13. 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
  14. 07 6月, 2009 8 次提交
    • 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
    • T
      http*: add helper methods for fetching packs · 2264dfa5
      Tay Ray Chuan 提交于
      The code handling the fetching of packs in http-push.c and
      http-walker.c have been refactored into new methods and a new struct
      (http_pack_request) in http.c. They are not meant to be invoked
      elsewhere.
      
      The new methods in http.c are
       - new_http_pack_request
       - finish_http_pack_request
       - release_http_pack_request
      
      and the new struct is http_pack_request.
      
      Add a function, new_http_pack_request(), that deals with the details of
      coming up with the filename to store the retrieved packfile, resuming a
      previously aborted request, and making a new curl request. Update
      http-push.c::start_fetch_packed() and http-walker.c::fetch_pack() to
      use this.
      
      Add a function, finish_http_pack_request(), that deals with renaming
      the pack, advancing the pack list, and installing the pack. Update
      http-push.c::finish_request() and http-walker.c::fetch_pack to use
      this.
      
      Update release_request() in http-push.c and http-walker.c to invoke
      release_http_pack_request() to clean up pack request helper data.
      
      The local_stream member of the transfer_request struct in http-push.c
      has been removed, as the packfile pointer will be managed in the struct
      http_pack_request.
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2264dfa5
    • T
      http: use new http API in fetch_index() · 39dc52cf
      Tay Ray Chuan 提交于
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      39dc52cf
    • T
      http*: add http_get_info_packs · b8caac2b
      Tay Ray Chuan 提交于
      http-push.c and http-walker.c no longer have to use fetch_index or
      setup_index; they simply need to use http_get_info_packs, a new http
      method, in their fetch_indices implementations.
      
      Move fetch_index() and rename to fetch_pack_index() in http.c; this
      method is not meant to be used outside of http.c. It invokes
      end_url_with_slash with base_url; apart from that change, the code is
      identical.
      
      Move setup_index() and rename to fetch_and_setup_pack_index() in
      http.c; this method is not meant to be used outside of http.c.
      
      Do not immediately set ret to 0 in http-walker.c::fetch_indices();
      instead do it in the HTTP_MISSING_TARGET case, to make it clear that
      the HTTP_OK and HTTP_MISSING_TARGET cases both return 0.
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b8caac2b
    • M
      http.c::http_fetch_ref(): use the new http API · 0d5896e1
      Mike Hommey 提交于
      The error message ("Unable to start request") has been removed, since
      the http API already prints it.
      Signed-off-by: NMike Hommey <mh@glandium.org>
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0d5896e1
    • M
      http.c: new functions for the http API · e929cd20
      Mike Hommey 提交于
      The new functions added are:
       - http_request() (internal function)
       - http_get_strbuf()
       - http_get_file()
       - http_error()
      
      http_get_strbuf and http_get_file allow respectively to retrieve contents of
      an URL to a strbuf or an opened file handle.
      
      http_error prints out an error message containing the URL and the curl error
      (in curl_errorstr).
      Signed-off-by: NMike Hommey <mh@glandium.org>
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e929cd20
    • T
      http: create function end_url_with_slash · 5ace994f
      Tay Ray Chuan 提交于
      The logic to append a slash to the url if necessary in quote_ref_url
      (added in 113106e0 "http.c: use strbuf API in quote_ref_url") has been
      moved to a new function, end_url_with_slash.
      
      The method takes a strbuf, the URL, and the path to be appended to the
      URL. It first adds the URL to the strbuf. It then appends a slash
      if the URL does not end with a slash.
      
      The check on ref in quote_ref_url for a slash at the beginning has been
      removed as a result of using end_url_with_slash. This check is not
      needed, because slashes will be quoted anyway.
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5ace994f
    • T
      http*: move common variables and macros to http.[ch] · e9176745
      Tay Ray Chuan 提交于
      Move RANGE_HEADER_SIZE to http.h.
      
      Create no_pragma_header, the curl header list containing the header
      "Pragma:" in http.[ch]. It is allocated in http_init, and freed in
      http_cleanup. This replaces the no_pragma_header in http-push.c, and
      the no_pragma_header member in walker_data in http-walker.c.
      
      Create http_is_verbose. It is to be used by methods in http.c, and is
      modified at the entry points of http.c's users, namely http-push.c
      (when parsing options) and http-walker.c (in get_http_walker).
      Signed-off-by: NTay Ray Chuan <rctay89@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e9176745
  15. 03 4月, 2009 1 次提交
    • M
      Allow curl to rewind the read buffers · 3944ba0c
      Martin Storsjö 提交于
      When using multi-pass authentication methods, the curl library may
      need to rewind the read buffers (depending on how much already has
      been fed to the server) used for providing data to HTTP PUT, POST or
      PROPFIND, and in order to allow the library to do so, we need to tell
      it how by providing either an ioctl callback or a seek callback.
      
      This patch adds an ioctl callback, which should be usable on older
      curl versions (since 7.12.3) than the seek callback (introduced in
      curl 7.18.0).
      
      Some HTTP servers (such as Apache) give an 401 error reply immediately
      after receiving the headers (so no data has been read from the read
      buffers, and thus no rewinding is needed), but other servers (such
      as Lighttpd) only replies after the whole request has been sent and
      all data has been read from the read buffers, making rewinding necessary.
      Signed-off-by: NMartin Storsjo <martin@martin.st>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3944ba0c
  16. 13 3月, 2009 1 次提交
  17. 11 3月, 2009 2 次提交
    • J
      http authentication via prompts · c33976cb
      Junio C Hamano 提交于
      Curl is designed not to ask for password when only username is given in
      the URL, but has a way for application to feed a (username, password) pair
      to it.  With this patch, you do not have to keep your password in
      plaintext in your $HOME/.netrc file when talking with a password protected
      URL with http://<username>@<host>/path/to/repository.git/ syntax.
      
      The code handles only the http-walker side, not the push side.  At least,
      not yet.  But interested parties can add support for it.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c33976cb
    • J
      http_init(): Fix config file parsing · 7059cd99
      Junio C Hamano 提交于
      We honor the command line options, environment variables, variables in
      repository configuration file, variables in user's global configuration
      file, variables in the system configuration file, and then finally use
      built-in default.  To implement this semantics, the code should:
      
       - start from built-in default values;
      
       - call git_config() with the configuration parser callback, which
         implements "later definition overrides earlier ones" logic
         (git_config() reads the system's, user's and then repository's
         configuration file in this order);
      
       - override the result from the above with environment variables if set;
      
       - override the result from the above with command line options.
      
      The initialization code http_init() for http transfer got this wrong, and
      implemented a "first one wins, ignoring the later ones" in http_options(),
      to compensate this mistake, read environment variables before calling
      git_config().  This is all wrong.
      
      As a second class citizen, the http codepath hasn't been audited as
      closely as other parts of the system, but we should try to bring sanity to
      it, before inviting contributors to improve on it.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7059cd99
  18. 10 3月, 2009 1 次提交
  19. 08 3月, 2009 1 次提交
  20. 07 12月, 2008 1 次提交
  21. 10 9月, 2008 1 次提交
  22. 08 9月, 2008 1 次提交