From: Brandon Williams <bmwill@google.com>
To: git@vger.kernel.org
Cc: Brandon Williams <bmwill@google.com>
Subject: [PATCH 1/2] send-pack: send push options correctly in stateless-rpc case
Date: Wed, 22 Mar 2017 12:51:01 -0700 [thread overview]
Message-ID: <20170322195102.165314-2-bmwill@google.com> (raw)
In-Reply-To: <20170322195102.165314-1-bmwill@google.com>
"git send-pack --stateless-rpc" puts each request in a sequence of pkt-lines
followed by a flush-pkt. The push option code forgot about this and sends push
options and their terminating delimiter as ordinary pkt-lines that get their
length header stripped off by remote-curl before being sent to the server.
The result is multiple malformed requests, which the server rejects.
Fortunately send-pack --stateless-rpc already is aware of this "pkt-line within
pkt-line" framing for the update commands that precede push options. Handle
push options the same way.
Helped-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
---
send-pack.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/send-pack.c b/send-pack.c
index d2d2a49a0..66e652f7e 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -532,6 +532,14 @@ int send_pack(struct send_pack_args *args,
}
}
+ if (use_push_options) {
+ struct string_list_item *item;
+
+ packet_buf_flush(&req_buf);
+ for_each_string_list_item(item, args->push_options)
+ packet_buf_write(&req_buf, "%s", item->string);
+ }
+
if (args->stateless_rpc) {
if (!args->dry_run && (cmds_sent || is_repository_shallow())) {
packet_buf_flush(&req_buf);
@@ -544,18 +552,6 @@ int send_pack(struct send_pack_args *args,
strbuf_release(&req_buf);
strbuf_release(&cap_buf);
- if (use_push_options) {
- struct string_list_item *item;
- struct strbuf sb = STRBUF_INIT;
-
- for_each_string_list_item(item, args->push_options)
- packet_buf_write(&sb, "%s", item->string);
-
- write_or_die(out, sb.buf, sb.len);
- packet_flush(out);
- strbuf_release(&sb);
- }
-
if (use_sideband && cmds_sent) {
memset(&demux, 0, sizeof(demux));
demux.proc = sideband_demux;
--
2.12.1.500.gab5fba24ee-goog
next prev parent reply other threads:[~2017-03-22 19:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 19:51 [PATCH 0/2] push options across http Brandon Williams
2017-03-22 19:51 ` Brandon Williams [this message]
2017-03-22 21:15 ` [PATCH 1/2] send-pack: send push options correctly in stateless-rpc case Jonathan Nieder
2017-03-22 22:19 ` Brandon Williams
2017-03-22 19:51 ` [PATCH 2/2] remote-curl: allow push options Brandon Williams
2017-03-22 21:26 ` Junio C Hamano
2017-03-22 21:36 ` Brandon Williams
2017-03-22 21:38 ` Jonathan Nieder
2017-03-22 22:13 ` Brandon Williams
2017-03-22 21:17 ` [PATCH 0/2] push options across http Junio C Hamano
2017-03-22 21:20 ` Stefan Beller
2017-03-22 22:21 ` [PATCH v2 " Brandon Williams
2017-03-22 22:21 ` [PATCH v2 1/2] send-pack: send push options correctly in stateless-rpc case Brandon Williams
2017-03-22 22:22 ` [PATCH v2 2/2] remote-curl: allow push options Brandon Williams
2017-03-22 22:29 ` [PATCH v2 0/2] push options across http Jonathan Nieder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170322195102.165314-2-bmwill@google.com \
--to=bmwill@google.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).