1. 18 4月, 2010 1 次提交
  2. 10 4月, 2010 1 次提交
  3. 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
  4. 12 1月, 2010 1 次提交
  5. 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
  6. 07 6月, 2009 5 次提交
    • 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*: 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: 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*: 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
  7. 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
  8. 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
  9. 27 4月, 2008 1 次提交
    • D
      Make walker.fetch_ref() take a struct ref. · c13b2633
      Daniel Barkalow 提交于
      This simplifies a few things, makes a few things slightly more
      complicated, but, more importantly, allows that, when struct ref can
      represent a symref, http_fetch_ref() can return one.
      
      Incidentally makes the string that http_fetch_ref() gets include "refs/"
      (if appropriate), because that's how the name field of struct ref works.
      As far as I can tell, the usage in walker:interpret_target() wouldn't have
      worked previously, if it ever would have been used, which it wouldn't
      (since the fetch process uses the hash instead of the name of the ref
      there).
      Signed-off-by: NDaniel Barkalow <barkalow@iabervon.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c13b2633
  10. 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
  11. 22 1月, 2008 1 次提交
  12. 15 12月, 2007 3 次提交
  13. 10 12月, 2007 1 次提交
  14. 19 9月, 2007 2 次提交
  15. 04 5月, 2007 1 次提交
  16. 28 12月, 2006 1 次提交
    • J
      Work around http-fetch built with cURL 7.16.0 · 500ebb01
      Junio C Hamano 提交于
      It appears that curl_easy_duphandle() from libcurl 7.16.0
      returns a curl session handle which fails GOOD_MULTI_HANDLE()
      check in curl_multi_add_handle().  This causes fetch_ref() to
      fail because start_active_slot() cannot start the request.
      
      For now, check for 7.16.0 to work this issue around.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      500ebb01
  17. 20 9月, 2006 1 次提交
    • A
      Patch for http-fetch.c and older curl releases · c774b2dc
      Art Haas 提交于
      Older curl releases do not define CURLE_HTTP_RETURNED_ERROR, they
      use CURLE_HTTP_NOT_FOUND instead. Newer curl releases keep the
      CURLE_HTTP_NOT_FOUND definition but using a -DCURL_NO_OLDIES
      preprocessor flag the old name will not be present in the 'curl.h'
      header.
      
      This patch makes our code written for newer releases of the curl
      library but allow compiling against an older curl (older than
      0x070a03) by defining the missing CURLE_HTTP_RETURNED_ERROR as a
      synonym for CURLE_HTTP_NOT_FOUND.
      Signed-off-by: NArt Haas <ahaas@airmail.net>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      c774b2dc
  18. 11 3月, 2006 1 次提交
    • N
      HTTP slot reuse fixes · baa7b67d
      Nick Hengeveld 提交于
      Incorporate into http-push a fix related to accessing slot results after
      the slot was reused, and fix a case in run_active_slot where a
      finished slot wasn't detected if the slot was reused.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      baa7b67d
  19. 07 2月, 2006 1 次提交
  20. 01 2月, 2006 1 次提交
  21. 20 11月, 2005 1 次提交