summaryrefslogtreecommitdiff
path: root/pkt-line.c
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2019-02-21 20:24:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-03-03 10:00:42 (GMT)
commita97d00799a19d2516ca8fae4da9bf782ca6f2e37 (patch)
tree371a0b56606ac5dbf4e3a4c06f5f8d4bb3625ccd /pkt-line.c
parent78ad91728d859a3ddb6e86218e86f16cd3489d0a (diff)
downloadgit-a97d00799a19d2516ca8fae4da9bf782ca6f2e37.zip
git-a97d00799a19d2516ca8fae4da9bf782ca6f2e37.tar.gz
git-a97d00799a19d2516ca8fae4da9bf782ca6f2e37.tar.bz2
remote-curl: use post_rpc() for protocol v2 also
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: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pkt-line.c')
-rw-r--r--pkt-line.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkt-line.c b/pkt-line.c
index d4b71d3..60329b3 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -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";