git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Docs: web server must setenv GIT_PROTOCOL for v2

From
EWEric Wong <e@80x24.org>
Date
Sep 8, 2021, 16:50 UTC
Message-ID
<20210908165057.GA14162@dcvr>
In-Reply-To
<YTiXEEEs36NCEr9S@coredump.intra.peff.net>
Jeff King <peff@peff.net> wrote:
Show 12 quoted lines
> On Wed, Sep 08, 2021 at 06:48:47AM -0400, Jeff King wrote:
> 
> > Both of the included examples here have been tested to work. The one for
> > lighttpd is a little less direct than I'd like, but I couldn't find a
> > way to directly set an environment variable to the value of a request
> > header. From my reading of the documentation, lighttpd will set
> > HTTP_GIT_PROTOCOL automatically, but git-http-backend looks only at
> > GIT_PROTOCOL. Arguably http-backend should do this translation itself.
> 
> So having discovered this, I kind of wonder if these documentation
> patches are barking up the wrong tree. There is no reason we would not
> want v2 to work out of the box (after all, it does for git://).
Agreed.
> The patch below does that (and could replace both my and Konstantin's
> documentation patches).
<snip>
Show 5 quoted lines
> -- >8 --
> Subject: [PATCH] http-backend: handle HTTP_GIT_PROTOCOL CGI variable
> 
> When a client requests the v2 protocol over HTTP, they set the
> Git-Protocol header. Webservers will generaly make that available to our
"generally"
Show 9 quoted lines
> CGI as HTTP_GIT_PROTOCOL in the environment. However, that's not
> sufficient for upload-pack, etc, to respect it; they look in
> GIT_PROTOCOL (without the HTTP_ prefix).
> 
> Either the webserver or the CGI is responsible for relaying that HTTP
> header into the GIT_PROTOCOL variable. Traditionally, our tests have
> configured the webserver to do so, but that's a burden on the server
> admin. We can make this work out of the box by having the http-backend
> CGI copy the contents.
Agreed.  I've completely overlooked GIT_PROTOCOL support, so far...

This seems to be the right thing to do; I think I'll add support for it when I spawn git-http-backend in something I work on. (I also don't currently pass all HTTP headers in env when spawning CGI, maybe I should *shrug*)

Previous: Jeff KingNext: Junio C Hamano
Message 7 of 20 in “Docs: web server must setenv GIT_PROTOCOL for v2”
  1. Docs: web server must setenv GIT_PROTOCOL for v2Konstantin Ryabitsev, Sep 4, 2021
  2. Jeff KingSep 4, 2021
  3. Junio C HamanoSep 7, 2021
  4. Konstantin RyabitsevSep 7, 2021
  5. Jeff KingSep 8, 2021
  6. Jeff KingSep 8, 2021
  7. Eric WongSep 8, 2021
  8. Junio C HamanoSep 9, 2021
  9. Junio C HamanoSep 9, 2021
  10. Jeff KingSep 10, 2021
  11. Jeff KingSep 10, 2021
  12. 1/5 t5551: test v2-to-v0 http protocol fallbackJeff King, Sep 10, 2021
  13. 2/5 http-backend: handle HTTP_GIT_PROTOCOL CGI variableJeff King, Sep 10, 2021
  14. 3/5 docs/http-backend: mention v2 protocolJeff King, Sep 10, 2021
  15. 4/5 docs/git: discuss server-side config for GIT_PROTOCOLJeff King, Sep 10, 2021
  16. 5/5 docs/protocol-v2: point readers transport config discussionJeff King, Sep 10, 2021
  17. Junio C HamanoSep 10, 2021
  18. Philippe BlainSep 9, 2021
  19. Junio C HamanoSep 10, 2021
  20. Jeff KingSep 10, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.