1. 04 6月, 2019 1 次提交
  2. 01 4月, 2019 1 次提交
  3. 06 3月, 2019 1 次提交
  4. 05 3月, 2019 1 次提交
  5. 03 3月, 2019 1 次提交
    • J
      remote-curl: use post_rpc() for protocol v2 also · a97d0079
      Jonathan Tan 提交于
      When transmitting and receiving POSTs for protocol v0 and v1,
      remote-curl uses post_rpc() (and associated functions), but when doing
      the same for protocol v2, it uses a separate set of functions
      (proxy_rpc() and others). Besides duplication of code, this has caused
      at least one bug: the auth retry mechanism that was implemented in v0/v1
      was not implemented in v2.
      
      To fix this issue and avoid it in the future, make remote-curl also use
      post_rpc() when handling protocol v2. Because line lengths are written
      to the HTTP request in protocol v2 (unlike in protocol v0/v1), this
      necessitates changes in post_rpc() and some of the functions it uses;
      perform these changes too.
      
      A test has been included to ensure that the code for both the unchunked
      and chunked variants of the HTTP request is exercised.
      
      Note: stateless_connect() has been updated to use the lower-level packet
      reading functions instead of struct packet_reader. The low-level control
      is necessary here because we cannot change the destination buffer of
      struct packet_reader while it is being used; struct packet_buffer has a
      peeking mechanism which relies on the destination buffer being present
      in between a peek and a read.
      Signed-off-by: NJonathan Tan <jonathantanmy@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a97d0079
  6. 23 2月, 2019 2 次提交
    • J
      trace2: create new combined trace facility · ee4512ed
      Jeff Hostetler 提交于
      Create a new unified tracing facility for git.  The eventual intent is to
      replace the current trace_printf* and trace_performance* routines with a
      unified set of git_trace2* routines.
      
      In addition to the usual printf-style API, trace2 provides higer-level
      event verbs with fixed-fields allowing structured data to be written.
      This makes post-processing and analysis easier for external tools.
      
      Trace2 defines 3 output targets.  These are set using the environment
      variables "GIT_TR2", "GIT_TR2_PERF", and "GIT_TR2_EVENT".  These may be
      set to "1" or to an absolute pathname (just like the current GIT_TRACE).
      
      * GIT_TR2 is intended to be a replacement for GIT_TRACE and logs command
        summary data.
      
      * GIT_TR2_PERF is intended as a replacement for GIT_TRACE_PERFORMANCE.
        It extends the output with columns for the command process, thread,
        repo, absolute and relative elapsed times.  It reports events for
        child process start/stop, thread start/stop, and per-thread function
        nesting.
      
      * GIT_TR2_EVENT is a new structured format. It writes event data as a
        series of JSON records.
      
      Calls to trace2 functions log to any of the 3 output targets enabled
      without the need to call different trace_printf* or trace_performance*
      routines.
      Signed-off-by: NJeff Hostetler <jeffhost@microsoft.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ee4512ed
    • J
      remote-curl: refactor reading into rpc_state's buf · 78ad9172
      Jonathan Tan 提交于
      Currently, whenever remote-curl reads pkt-lines from its response file
      descriptor, only the payload is written to its buf, not the 4 characters
      denoting the length. A future patch will require the ability to also
      write those 4 characters, so in preparation for that, refactor this read
      into its own function.
      Signed-off-by: NJonathan Tan <jonathantanmy@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      78ad9172
  7. 15 2月, 2019 3 次提交
  8. 07 2月, 2019 2 次提交
    • J
      remote-curl: tighten "version 2" check for smart-http · cbdb8d14
      Jeff King 提交于
      In a v2 smart-http conversation, the server should reply to our initial
      request with a pkt-line saying "version 2". We check that with
      starts_with(), but really that should be the only thing in that packet.
      A response of "version 20" should not match.
      
      Let's tighten this check to use strcmp(). Note that we don't need to
      worry about a trailing newline here, because the ptk-line code will have
      chomped it for us already.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cbdb8d14
    • J
      remote-curl: refactor smart-http discovery · 8ee3e120
      Jeff King 提交于
      After making initial contact with an http server, we have to decide if
      the server supports smart-http, and if so, which version. Our rules are
      a bit inconsistent:
      
        1. For v0, we require that the content-type indicates a smart-http
           response. We also require the response to look vaguely like a
           pkt-line starting with "#". If one of those does not match, we fall
           back to dumb-http.
      
           But according to our http protocol spec[1]:
      
             Dumb servers MUST NOT return a return type starting with
             `application/x-git-`.
      
           If we see the expected content-type, we should consider it
           smart-http. At that point we can parse the pkt-line for real, and
           complain if it is not syntactically valid.
      
        2. For v2, we do not actually check the content-type. Our v2 protocol
           spec says[2]:
      
             When using the http:// or https:// transport a client makes a
             "smart" info/refs request as described in `http-protocol.txt`[...]
      
           and the http spec is clear that for a smart-http response[3]:
      
             The Content-Type MUST be `application/x-$servicename-advertisement`.
      
           So it is required according to the spec.
      
      These inconsistencies were easy to miss because of the way the original
      code was written as an inline conditional. Let's pull it out into its
      own function for readability, and improve a few things:
      
       - we now predicate the smart/dumb decision entirely on the presence of
         the correct content-type
      
       - we do a real pkt-line parse before deciding how to proceed (and die
         if it isn't valid)
      
       - use skip_prefix() for comparing service strings, instead of
         constructing expected output in a strbuf; this avoids dealing with
         memory cleanup
      
      Note that this _is_ tightening what the client will allow. It's all
      according to the spec, but it's possible that other implementations
      might violate these. However, violating these particular rules seems
      like an odd choice for a server to make.
      
      [1] Documentation/technical/http-protocol.txt, l. 166-167
      [2] Documentation/technical/protocol-v2.txt, l. 63-64
      [3] Documentation/technical/http-protocol.txt, l. 247
      Helped-by: NJosh Steadmon <steadmon@google.com>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8ee3e120
  9. 11 1月, 2019 3 次提交
  10. 03 1月, 2019 2 次提交
    • M
      pack-protocol.txt: accept error packets in any context · 2d103c31
      Masaya Suzuki 提交于
      In the Git pack protocol definition, an error packet may appear only in
      a certain context. However, servers can face a runtime error (e.g. I/O
      error) at an arbitrary timing. This patch changes the protocol to allow
      an error packet to be sent instead of any packet.
      
      Without this protocol spec change, when a server cannot process a
      request, there's no way to tell that to a client. Since the server
      cannot produce a valid response, it would be forced to cut a connection
      without telling why. With this protocol spec change, the server can be
      more gentle in this situation. An old client may see these error packets
      as an unexpected packet, but this is not worse than having an unexpected
      EOF.
      
      Following this protocol spec change, the error packet handling code is
      moved to pkt-line.c. Implementation wise, this implementation uses
      pkt-line to communicate with a subprocess. Since this is not a part of
      Git protocol, it's possible that a packet that is not supposed to be an
      error packet is mistakenly parsed as an error packet. This error packet
      handling is enabled only for the Git pack protocol parsing code
      considering this.
      Signed-off-by: NMasaya Suzuki <masayasuzuki@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2d103c31
    • M
      Use packet_reader instead of packet_read_line · 01f9ec64
      Masaya Suzuki 提交于
      By using and sharing a packet_reader while handling a Git pack protocol
      request, the same reader option is used throughout the code. This makes
      it easy to set a reader option to the request parsing code.
      Signed-off-by: NMasaya Suzuki <masayasuzuki@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      01f9ec64
  11. 10 12月, 2018 1 次提交
  12. 12 11月, 2018 1 次提交
    • T
      remote-curl.c: xcurl_off_t is not portable (on 32 bit platfoms) · cb8010bb
      Torsten Bögershausen 提交于
      When  setting
      DEVELOPER = 1
      DEVOPTS = extra-all
      
      "gcc (Raspbian 6.3.0-18+rpi1+deb9u1) 6.3.0 20170516" errors out with
      "comparison is always false due to limited range of data type"
      "[-Werror=type-limits]"
      
      It turns out that the function xcurl_off_t() has 2 flavours:
      
      - It gives a warning 32 bit systems, like Linux
      - It takes the signed ssize_t as a paramter, but the only caller is using
        a size_t (which is typically unsigned these days)
      
      The original motivation of this function is to make sure that sizes > 2GiB
      are handled correctly. The curl documentation says:
      "For any given platform/compiler curl_off_t must be typedef'ed to a 64-bit
       wide signed integral data type"
      On a 32 bit system "size_t" can be promoted into a 64 bit signed value
      without loss of data, and therefore we may see the
      "comparison is always false" warning.
      On a 64 bit system it may happen, at least in theory, that size_t is > 2^63,
      and then the promotion from an unsigned "size_t" into a signed "curl_off_t"
      may be a problem.
      
      One solution to suppress a possible compiler warning could be to remove
      the function xcurl_off_t().
      
      However, to be on the very safe side, we keep it and improve it:
      
      - The len parameter is changed from ssize_t to size_t
      - A temporally variable "size" is used, promoted int uintmax_t and the compared
        with "maximum_signed_value_of_type(curl_off_t)".
        Thanks to Junio C Hamano for this hint.
      Signed-off-by: NTorsten Bögershausen <tboegi@web.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cb8010bb
  13. 06 9月, 2018 1 次提交
  14. 09 8月, 2018 1 次提交
  15. 23 5月, 2018 2 次提交
  16. 24 4月, 2018 1 次提交
  17. 11 4月, 2018 1 次提交
  18. 16 3月, 2018 6 次提交
  19. 15 3月, 2018 2 次提交
  20. 21 2月, 2018 1 次提交
    • J
      remote-curl: unquote incoming push-options · 90dce21e
      Jeff King 提交于
      The transport-helper protocol c-style quotes the value of
      any options passed to the helper via the "option <key> <value>"
      directive. However, remote-curl doesn't actually unquote the
      push-option values, meaning that we will send the quoted
      version to the other side (whereas git-over-ssh would send
      the raw value).
      
      The pack-protocol.txt documentation defines the push-options
      as a series of VCHARs, which excludes most characters that
      would need quoting. But:
      
        1. You can still see the bug with a valid push-option that
           starts with a double-quote (since that triggers
           quoting).
      
        2. We do currently handle any non-NUL characters correctly
           in git-over-ssh. So even though the spec does not say
           that we need to handle most quoted characters, it's
           nice if our behavior is consistent between protocols.
      
      There are two new tests: the "direct" one shows that this
      already works in the non-http case, and the http one covers
      this bugfix.
      Reported-by: NJon Simons <jon@jonsimons.org>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      90dce21e
  21. 09 2月, 2018 1 次提交
  22. 09 12月, 2017 1 次提交
  23. 06 12月, 2017 1 次提交
    • J
      introduce fetch-object: fetch one promisor object · 88e2f9ed
      Jonathan Tan 提交于
      Introduce fetch-object, providing the ability to fetch one object from a
      promisor remote.
      
      This uses fetch-pack. To do this, the transport mechanism has been
      updated with 2 flags, "from-promisor" to indicate that the resulting
      pack comes from a promisor remote (and thus should be annotated as such
      by index-pack), and "no-dependents" to indicate that only the objects
      themselves need to be fetched (but fetching additional objects is
      nevertheless safe).
      
      Whenever "no-dependents" is used, fetch-pack will refrain from using any
      object flags, because it is most likely invoked as part of a dynamic
      object fetch by another Git command (which may itself use object flags).
      An alternative to this is to leave fetch-pack alone, and instead update
      the allocation of flags so that fetch-pack's flags never overlap with
      any others, but this will end up shrinking the number of flags available
      to nearly every other Git command (that is, every Git command that
      accesses objects), so the approach in this commit was used instead.
      
      This will be tested in a subsequent commit.
      Signed-off-by: NJonathan Tan <jonathantanmy@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      88e2f9ed
  24. 16 6月, 2017 1 次提交
  25. 14 4月, 2017 1 次提交
  26. 31 3月, 2017 1 次提交
    • B
      Rename sha1_array to oid_array · 910650d2
      brian m. carlson 提交于
      Since this structure handles an array of object IDs, rename it to struct
      oid_array.  Also rename the accessor functions and the initialization
      constant.
      
      This commit was produced mechanically by providing non-Documentation
      files to the following Perl one-liners:
      
          perl -pi -E 's/struct sha1_array/struct oid_array/g'
          perl -pi -E 's/\bsha1_array_/oid_array_/g'
          perl -pi -E 's/SHA1_ARRAY_INIT/OID_ARRAY_INIT/g'
      Signed-off-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      910650d2