{"thread":{"id":"14982","subject":"Re: Add Git-aware CGI for Git-aware smart HTTP transport","startedAt":"2008-08-13T14:53:41Z","lastAt":"2008-08-13T15:41:43Z","messageCount":2,"participants":["Shawn O. Pearce","H. Peter Anvin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"87054","messageId":"20080813145341.GA3782@spearce.org","threadId":"14982","inReplyTo":"48A262B9.8020608@zytor.com","subject":"Re: Add Git-aware CGI for Git-aware smart HTTP transport","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-08-13T14:53:41Z","receivedAt":"2008-08-13T14:53:41Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"[...added git ML back to thread...]\n\n\"H. Peter Anvin\" <hpa@zytor.com> wrote:\n> Shawn O. Pearce wrote:\n>> The plan I've proposed requires wedging the CGI in between the HTTP\n>> server and the repository files.  Which means older dumb clients\n>> get data by forking off the CGI, rather than letting the HTTP server\n>> stream the file itself.\n>\n> Yeah, that's quite a bit unfortunate, because it means some potentially  \n> very expensive buffering in Apache.  That's one reason to do some kind  \n> of redirection.\n\nHmm.  So what if the \"smart\" protocol used a redirect to the CGI\nand the dumb protocol didn't use any redirects at all?  I say this\nbecause I think the dumb protocol won't handle redirects well.\nIt will do them, but it would incur a redirect on every request\nit makes.\n\nSo if we have the \"smart\" protocol perform detection by trying:\n\n\tC: HEAD /path/to/repository.git/git-http-backend HTTP/1.0\n\n\tS: HTTP/1.0 302 Found\n\tS: Location: /git-http/path/to/repository.git\n\nUnder Apache this server configuration can be easily handled by a\nmod_rewrite regex:\n\n\tRewriteRule ^(/pub/scm/.*)/git-http-backend$ /git/$1 [R,L]\n\tScriptAlias /git/ /path/to/git-http-backend/\n\nIndividual users could also install the git-http-backend CGI\nright into their repository, in which case the CGI if invoked with\nno PATH_INFO can do a redirect back to itself to indicate where\nGIT_DIR is:\n\n\tC: HEAD /path/to/repository.git/git-http-backend HTTP/1.0\n\n\tS: HTTP/1.0 302 Found\n\tS: Location: /path/to/repository.git/git-http-backend/.\n\nIndividual operations can be selected by appending on the operation\nname, so <Location ~ > style rules can be used to apply access\ncontrols, such as:\n\n\t# Disallow push to any smart repository via ScriptAlias\n\t#\n\t<Location ~ ^/git/.*/receive-pack$>\n\t\tOrder Deny,Allow\n\t\tDeny from all\n\t</Location>\n\n\t# Disallow push to any smart repository with CGI in tree.\n\t#\n\t<Location ~ .*/git-http-backend/./receive-pack$>\n\t\tOrder Deny,Allow\n\t\tDeny from all\n\t</Location>\n\nSetting this up on a server which doesn't have the power of mod_regex\navailable would be tricky, as you need to link the CGI into every\nsingle repository you are serving.  I don't know (or use) many other\nHTTP servers beyond Apache so I'm not sure if they can do this.\n\n-- \nShawn.\n"},{"id":"87063","messageId":"48A300B7.10002@zytor.com","threadId":"14982","inReplyTo":"20080813145341.GA3782@spearce.org","subject":"Re: Add Git-aware CGI for Git-aware smart HTTP transport","fromName":"H. Peter Anvin","fromEmail":"hpa@zytor.com","sentAt":"2008-08-13T15:41:43Z","receivedAt":"2008-08-13T15:41:43Z","isPatch":false,"sender":{"key":"hpa@zytor.com","avatar":null},"body":"Shawn O. Pearce wrote:\n> \n> Hmm.  So what if the \"smart\" protocol used a redirect to the CGI\n> and the dumb protocol didn't use any redirects at all?  I say this\n> because I think the dumb protocol won't handle redirects well.\n> It will do them, but it would incur a redirect on every request\n> it makes.\n> \n\nThat's preferrable anyway, in my opinion.\n\n> Setting this up on a server which doesn't have the power of mod_regex\n> available would be tricky, as you need to link the CGI into every\n> single repository you are serving.  I don't know (or use) many other\n> HTTP servers beyond Apache so I'm not sure if they can do this.\n\nMany can, and even more can if we instead of git-http-backend had \nsomething which looked vaguely like a unique extension, like \n\"backend.git-http\"\n\n\t-hpa\n"}]}