1. 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
  2. 19 8月, 2009 1 次提交
  3. 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
  4. 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
  5. 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
  6. 13 3月, 2009 1 次提交
  7. 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
  8. 10 3月, 2009 1 次提交
  9. 08 3月, 2009 1 次提交
  10. 07 12月, 2008 1 次提交
  11. 10 9月, 2008 1 次提交
  12. 08 9月, 2008 1 次提交
  13. 06 7月, 2008 1 次提交
  14. 04 7月, 2008 1 次提交
    • J
      Work around gcc warnings from curl headers · f444e528
      Junio C Hamano 提交于
      After master.k.org upgrade, I started seeing these warning messages:
      
          transport.c: In function 'get_refs_via_curl':
          transport.c:458: error: call to '_curl_easy_setopt_err_write_callback' declared with attribute warning: curl_easy_setopt expects a curl_write_callback argument for this option
      
      It appears that the curl header wants to enforce the function signature
      for callback function given to curl_easy_setopt() to be compatible with
      that of (*curl_write_callback) or fwrite.  This patch seems to work the
      issue around.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f444e528
  15. 15 6月, 2008 1 次提交
  16. 15 5月, 2008 1 次提交
  17. 27 4月, 2008 2 次提交
  18. 04 3月, 2008 1 次提交
  19. 28 2月, 2008 1 次提交
    • M
      Set proxy override with http_init() · 9fc6440d
      Mike Hommey 提交于
      In transport.c, proxy setting (the one from the remote conf) was set through
      curl_easy_setopt() call, while http.c already does the same with the
      http.proxy setting. We now just use this infrastructure instead, and make
      http_init() now take the struct remote as argument so that it can take the
      http_proxy setting from there, and any other property that would be added
      later.
      
      At the same time, we make get_http_walker() take a struct remote argument
      too, and pass it to http_init(), which makes remote defined proxy be used
      for more than get_refs_via_curl().
      
      We leave out http-fetch and http-push, which don't use remotes for the
      moment, purposefully.
      Signed-off-by: NMike Hommey <mh@glandium.org>
      Acked-by: NDaniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9fc6440d
  20. 12 2月, 2008 1 次提交
  21. 15 12月, 2007 3 次提交
  22. 10 12月, 2007 1 次提交
  23. 04 12月, 2007 1 次提交
  24. 19 9月, 2007 3 次提交
    • S
      Properly cleanup in http_cleanup so builtin-fetch does not segfault · 3278cd0a
      Shawn O. Pearce 提交于
      Junio and I both noticed that the new builtin-fetch was segfaulting
      immediately on http/https/ftp style URLs (those that went through
      libcurl and the commit walker).  Although the builtin-fetch changes
      in this area were really just minor refactorings there was one major
      change made: we invoked http_init(), http_cleanup() then http_init()
      again in the same process.
      
      When we call curl_easy_cleanup() on each active_request_slot we
      are telling libcurl we did not want that buffer to be used again.
      Unfortunately we did not also deallocate the active_request_slot
      itself nor did we NULL out active_queue_head.  This lead us to
      attempt to reuse these cleaned up libcurl handles when we later tried
      to invoke http_init() a second time to reactivate the curl library.
      The next file get operation then immediately segfaulted on most
      versions of libcurl.
      
      Properly freeing our own buffers and clearing the list causes us to
      reinitialize the curl buffers again if/when we need to use libcurl
      from within this same process.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3278cd0a
    • D
      Make function to refill http queue a callback · fc57b6aa
      Daniel Barkalow 提交于
      This eliminates the last function provided by the code using http.h as
      a global symbol, so it should be possible to have multiple programs
      using http.h in the same executable, and it also adds an argument to
      that callback, so that info can be passed into the callback without
      being global.
      Signed-off-by: NDaniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      fc57b6aa
    • D
      Refactor http.h USE_CURL_MULTI fill_active_slots(). · 45c17412
      Daniel Barkalow 提交于
      This removes all of the boilerplate and http-internal stuff from
      fill_active_slots() and makes it easy to turn into a callback.
      Signed-off-by: NDaniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      45c17412
  25. 07 6月, 2007 1 次提交
    • J
      War on whitespace · a6080a0a
      Junio C Hamano 提交于
      This uses "git-apply --whitespace=strip" to fix whitespace errors that have
      crept in to our source files over time.  There are a few files that need
      to have trailing whitespaces (most notably, test vectors).  The results
      still passes the test, and build result in Documentation/ area is unchanged.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a6080a0a