Commit c42c664a authored by Junio C Hamano's avatar Junio C Hamano

Merge branch 'jt/http-auth-proto-v2-fix'

Unify RPC code for smart http in protocol v0/v1 and v2, which fixes
a bug in the latter (lack of authentication retry) and generally
improves the code base.

* jt/http-auth-proto-v2-fix:
  remote-curl: use post_rpc() for protocol v2 also
  remote-curl: refactor reading into rpc_state's buf
  remote-curl: reduce scope of rpc_state.result
  remote-curl: reduce scope of rpc_state.stdin_preamble
  remote-curl: reduce scope of rpc_state.argv
parents 12e5bdd9 a97d0079
......@@ -117,7 +117,7 @@ void packet_buf_delim(struct strbuf *buf)
strbuf_add(buf, "0001", 4);
}
static void set_packet_header(char *buf, const int size)
void set_packet_header(char *buf, const int size)
{
static char hexchar[] = "0123456789abcdef";
......
......@@ -25,6 +25,7 @@ void packet_delim(int fd);
void packet_write_fmt(int fd, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
void packet_buf_flush(struct strbuf *buf);
void packet_buf_delim(struct strbuf *buf);
void set_packet_header(char *buf, int size);
void packet_write(int fd_out, const char *buf, size_t size);
void packet_buf_write(struct strbuf *buf, const char *fmt, ...) __attribute__((format (printf, 2, 3)));
void packet_buf_write_len(struct strbuf *buf, const char *data, size_t len);
......
This diff is collapsed.
......@@ -542,7 +542,38 @@ test_expect_success 'clone with http:// using protocol v2' '
# Client requested to use protocol v2
grep "Git-Protocol: version=2" log &&
# Server responded using protocol v2
grep "git< version 2" log
grep "git< version 2" log &&
# Verify that the chunked encoding sending codepath is NOT exercised
! grep "Send header: Transfer-Encoding: chunked" log
'
test_expect_success 'clone big repository with http:// using protocol v2' '
test_when_finished "rm -f log" &&
git init "$HTTPD_DOCUMENT_ROOT_PATH/big" &&
# Ensure that the list of wants is greater than http.postbuffer below
for i in $(test_seq 1 1500)
do
# do not use here-doc, because it requires a process
# per loop iteration
echo "commit refs/heads/too-many-refs-$i" &&
echo "committer git <git@example.com> $i +0000" &&
echo "data 0" &&
echo "M 644 inline bla.txt" &&
echo "data 4" &&
echo "bla"
done | git -C "$HTTPD_DOCUMENT_ROOT_PATH/big" fast-import &&
GIT_TRACE_PACKET="$(pwd)/log" GIT_TRACE_CURL="$(pwd)/log" git \
-c protocol.version=2 -c http.postbuffer=65536 \
clone "$HTTPD_URL/smart/big" big_child &&
# Client requested to use protocol v2
grep "Git-Protocol: version=2" log &&
# Server responded using protocol v2
grep "git< version 2" log &&
# Verify that the chunked encoding sending codepath is exercised
grep "Send header: Transfer-Encoding: chunked" log
'
test_expect_success 'fetch with http:// using protocol v2' '
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment