git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
* [PATCH] fetch-pack: send server options after command
@ 2019-05-22 20:08 Jonathan Tan
  2019-05-24 19:11 ` Jonathan Nieder
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Tan @ 2019-05-22 20:08 UTC (permalink / raw)
  To: git; +Cc: Jonathan Tan

Currently, if any server options are specified during a protocol v2
fetch, server options will be sent before "command=fetch". Write server
options to the request buffer in send_fetch_request() so that the
components of the request are sent in the correct order.

The protocol documentation states that the command must come first. The
Git server implementation in serve.c (see process_request() in that
file) tolerates any order of command and capability, which is perhaps
why we haven't noticed this. This was noticed when testing against a
JGit server implementation, which follows the documentation in this
regard.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 fetch-pack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fetch-pack.c b/fetch-pack.c
index 3f24d0c8a6..1c10f54e78 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -1115,7 +1115,7 @@ static int send_fetch_request(struct fetch_negotiator *negotiator, int fd_out,
 	    server_supports_v2("server-option", 1)) {
 		int i;
 		for (i = 0; i < args->server_options->nr; i++)
-			packet_write_fmt(fd_out, "server-option=%s",
+			packet_buf_write(&req_buf, "server-option=%s",
 					 args->server_options->items[i].string);
 	}
 
-- 
2.21.0.1020.gf2820cf01a-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fetch-pack: send server options after command
  2019-05-22 20:08 [PATCH] fetch-pack: send server options after command Jonathan Tan
@ 2019-05-24 19:11 ` Jonathan Nieder
  2019-05-28 18:00   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Nieder @ 2019-05-24 19:11 UTC (permalink / raw)
  To: Jonathan Tan; +Cc: git, Junio C Hamano

Jonathan Tan wrote:

> Currently, if any server options are specified during a protocol v2
> fetch, server options will be sent before "command=fetch". Write server
> options to the request buffer in send_fetch_request() so that the
> components of the request are sent in the correct order.
>
> The protocol documentation states that the command must come first. The
> Git server implementation in serve.c (see process_request() in that
> file) tolerates any order of command and capability, which is perhaps
> why we haven't noticed this. This was noticed when testing against a
> JGit server implementation, which follows the documentation in this
> regard.
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
>  fetch-pack.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Oh, dear.  Thanks for fixing it.

Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

6e98305985 (clone: send server options when using protocol v2,
2019-04-12) is part of release candidates, but it looks like we caught
this in time to get the fix in before the release.

Should we add an interop test for this to t/interop/?

Thanks,
Jonathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fetch-pack: send server options after command
  2019-05-24 19:11 ` Jonathan Nieder
@ 2019-05-28 18:00   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2019-05-28 18:00 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Jonathan Tan, git

Jonathan Nieder <jrnieder@gmail.com> writes:

> Jonathan Tan wrote:
>
>> Currently, if any server options are specified during a protocol v2
>> fetch, server options will be sent before "command=fetch". Write server
>> options to the request buffer in send_fetch_request() so that the
>> components of the request are sent in the correct order.
>>
>> The protocol documentation states that the command must come first. The
>> Git server implementation in serve.c (see process_request() in that
>> file) tolerates any order of command and capability, which is perhaps
>> why we haven't noticed this. This was noticed when testing against a
>> JGit server implementation, which follows the documentation in this
>> regard.
>>
>> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
>> ---
>>  fetch-pack.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Oh, dear.  Thanks for fixing it.
>
> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>


Yeah, looks good.  Thanks.

>
> 6e98305985 (clone: send server options when using protocol v2,
> 2019-04-12) is part of release candidates, but it looks like we caught
> this in time to get the fix in before the release.
>
> Should we add an interop test for this to t/interop/?
>
> Thanks,
> Jonathan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-28 18:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 20:08 [PATCH] fetch-pack: send server options after command Jonathan Tan
2019-05-24 19:11 ` Jonathan Nieder
2019-05-28 18:00   ` Junio C Hamano

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git