git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] git-daemon: more powerful base-path/user-path settings, using formats.
@ 2006-08-27 21:49 Jon Loeliger
  0 siblings, 0 replies; 11+ messages in thread
From: Jon Loeliger @ 2006-08-27 21:49 UTC (permalink / raw)
  To: git


The other day, Junio lamented:
> I have to admit that I kinda liked JDL's simpler one first (and
> it has been in production use for some time).  We'll see.

I think the two aspects of my implementation that are
favorable are the slightly more general table-driven string
interplotion routine and the generalization of the interface
to the upload() call here:

    @@ -310,8 +377,14 @@ #endif
    	if (len && line[len-1] == '\n')
    		line[--len] = 0;
     
    -	if (!strncmp("git-upload-pack ", line, 16))
    -		return upload(line+16);
    +	if (len != pktlen) {
    +	    parse_extra_args(line + len + 1, pktlen - len - 1);
    +	}
    +
    +	if (!strncmp("git-upload-pack ", line, 16)) {
    +		interp_table[INTERP_SLOT_DIR].value = line+16;
    +		return upload(interp_table);
    +	}


Naturally, I only placed entries into the interpolation table
that I needed to get my code working, but it could easily be
extended and filled with additional entries such as the %u for
user paths and %IP for IP address, etc.  I might even recommend
some form of lower-case-izing option too.

In any event, we should clearly attempt to unify my proposed
implementation with Pierre's proposal.

jdl

^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: [PATCH] git-daemon virtual hosting implementation.
@ 2006-08-23 20:11 Junio C Hamano
  2006-08-23 23:32 ` [PATCH] git-daemon: more powerful base-path/user-path settings, using formats Pierre Habouzit
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2006-08-23 20:11 UTC (permalink / raw)
  To: Pierre Habouzit; +Cc: git

Pierre Habouzit <madcoder@debian.org> writes:

> just add the hostname in the path when using --base-path and --user-path.
> this should be enough for most needs.
>
> Signed-off-by: Pierre Habouzit <madcoder@debian.org>
> ---
>  Here is a proposal for daemon side virtualhosting support.

> @@ -158,6 +160,11 @@ static char *path_ok(char *dir)
>  		return NULL;
>  	}
>  
> +	if (use_vhosts && !vhost) {
> +		logerror("using virtual hosting, and not host= was specified !");
> +		return NULL;
> +	}
> +

This part is objectionable -- older clients do not give "host=".
I think the plan, when virtual hosting was proposed and we added
this to the client side first, was to treat older clients as if
they specified the "primary" host.  So we would need some
mechanism to say where the repositories of the "primary" host
lives.

> +			if (use_vhosts) {
> +				loginfo("host <%s>, "
> +					"userpath <%s>, request <%s>, "
> +					"namlen %d, restlen %d, slash <%s>",
> +					vhost,
> +					user_path, dir,
> +					namlen, restlen, slash);
> +				snprintf(rpath, PATH_MAX, "%.*s/%s/%s%.*s",
> +					 namlen, dir, user_path, vhost,
> +					 restlen, slash);

I am not sure if the interaction between user-path and vhost
should go like this, but I do not think of a good alternative to
suggest right now.  Your code allows ~user/host1 and ~user/host2
to host different set of repositories, but I suspect if somebody
is setting up a virtual hosting of two hosts, he might want to
have two distinct set of users (iow to pretend that ~user exist
only on host1 but not on host2).  I dunno.

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

end of thread, other threads:[~2006-08-27 21:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-27 21:49 [PATCH] git-daemon: more powerful base-path/user-path settings, using formats Jon Loeliger
  -- strict thread matches above, loose matches on Subject: below --
2006-08-23 20:11 [PATCH] git-daemon virtual hosting implementation Junio C Hamano
2006-08-23 23:32 ` [PATCH] git-daemon: more powerful base-path/user-path settings, using formats Pierre Habouzit
2006-08-24  0:17   ` Junio C Hamano
2006-08-24  7:50     ` Pierre Habouzit
2006-08-27  6:12   ` Junio C Hamano
2006-08-27 10:28     ` Pierre Habouzit
2006-08-27 10:52       ` Junio C Hamano
2006-08-27 11:40         ` Pierre Habouzit
2006-08-27 15:30           ` Jakub Narebski
2006-08-27 16:26             ` Pierre Habouzit
2006-08-27 16:06         ` Randal L. Schwartz

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).