Re: [PATCH] git-daemon: more powerful base-path/user-path settings, using formats.
From: Jon Loeliger <hidden>
Date: 2016-06-15 22:42:38
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