git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Jon Loeliger <jdl@jdl.com>
Cc: git@vger.kernel.org
Subject: Re: git daemon directory munging?
Date: Sat, 3 Jun 2006 17:42:35 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0606031722340.5498@g5.osdl.org> (raw)
In-Reply-To: <E1FmgFV-0001i6-Kc@jdl.com>



On Sat, 3 Jun 2006, Jon Loeliger wrote:
>
> <jdl> Thus, I'd use something like:
>       --map-base=www.foo.com/pub/scm:/pub/foo/scm
>       --map-base=www.bar.com/pub/scm=/pub/bar/scm

The bigger problem is that nothing actually passes in the hostname to 
git-daemon in the first place. By the time the git-daemon is contacted, 
the hostname is long gone ;(

Now, you can just extend the git protocol to just pass in the host too. 

You can in fact do this in a backwards-compatible manner (old git-daemons 
will just ignore it, and new git daemons will automatically notice new 
clients) with something evil like the appended.

Not tested (and this actualyl doesn't make the daemon _use_ the data, it 
just adds a comment - the rest "is left as an exercise for the reader")

		Linus

---
diff --git a/connect.c b/connect.c
index 54f7bf7..36c5d04 100644
--- a/connect.c
+++ b/connect.c
@@ -374,7 +374,7 @@ static int git_tcp_connect(int fd[2], co
 
 	fd[0] = sockfd;
 	fd[1] = sockfd;
-	packet_write(sockfd, "%s %s\n", prog, path);
+	packet_write(sockfd, "%s %s%c%s%c%s\n", prog, path, 0, host, 0, port);
 	return 0;
 }
 
diff --git a/daemon.c b/daemon.c
index 776749e..61e0af9 100644
--- a/daemon.c
+++ b/daemon.c
@@ -267,7 +267,7 @@ static int upload(char *dir)
 static int execute(void)
 {
 	static char line[1000];
-	int len;
+	int len, n;
 
 	alarm(init_timeout ? init_timeout : timeout);
 	len = packet_read_line(0, line, sizeof(line));
@@ -276,6 +276,14 @@ static int execute(void)
 	if (len && line[len-1] == '\n')
 		line[--len] = 0;
 
+	n = strlen(line);
+	if (n != len) {
+		/* Cool, we have hidden info at the end */
+		/* Parse the hostname and the port, and */
+		/* leave some room for expansion for	*/
+		/* the future ..			*/
+	}
+
 	if (!strncmp("git-upload-pack ", line, 16))
 		return upload(line+16);
 

  reply	other threads:[~2006-06-04  0:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-04  0:13 git daemon directory munging? Jon Loeliger
2006-06-04  0:42 ` Linus Torvalds [this message]
2006-06-04  6:27   ` Junio C Hamano
2006-06-04 23:10     ` H. Peter Anvin
2006-06-04 23:08   ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2006-06-05  2:10 Jon Loeliger
2006-06-05  2:59 ` H. Peter Anvin

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=Pine.LNX.4.64.0606031722340.5498@g5.osdl.org \
    --to=torvalds@osdl.org \
    --cc=git@vger.kernel.org \
    --cc=jdl@jdl.com \
    /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).