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

Re: Why is my git-http-backend solution using WebDAV on push?

From
Jeff King <peff@peff.net>
Date
May 25, 2016, 21:38 UTC
Message-ID
<20160525213850.GB13776@sigill.intra.peff.net>
In-Reply-To
<CABwKKP958cW3a5Cjxox+1FCtNLetdufJj0rrYBouAUhJSXKKWA@mail.gmail.com>
On Wed, May 25, 2016 at 09:28:21PM +0100, Luke Madhanga wrote:
Show 9 quoted lines
> I've implemented a PHP wrapper for git http backend which works well.
> I've done this to give me advanced control of who has access to
> repositories on my server. You can see the implementation on
> http://stackoverflow.com/questions/36998492/channel-git-on-the-server-calls-through-php/37242591#37242591.
> I can pull from the server okay and all works well. However, I cannot
> push. When I read my trace code to see where it fails, I see that the
> last request is a PROPFIND request. The URL for this request does not
> have any of the usual 'info/refs' etc. that one usually gets on git
> calls.

If the git client detects that the server doesn't implement the smart-http protocol, it will automatically downgrade to the older, "dumb" protocol which is less efficient.

For fetching/cloning, this might make your test appear to work, even though it is downgrading behind the scenes. You should be able to check GIT_CURL_VERBOSE output to tell the difference; the smart protocol will POST to .../git-upload-pack, whereas the dumb protocol will download the individual packfiles and objects directly.

For pushing, the dumb protocol uses WebDAV, which is what you're seeing.

So the question is: why doesn't the client think your server is a smart server?

Just skimming your output, I'd guess:
Show 20 quoted lines
> > GET /p/git-backend/run/1/info/refs?service=git-receive-pack HTTP/1.1
> Host: xxx
> User-Agent: git/2.7.4
> Accept: */*
> Accept-Encoding: gzip
> Accept-Language: en-GB, en;q=0.9, *;q=0.8
> Pragma: no-cache
> 
> < HTTP/1.1 200 OK
> < Date: Wed, 25 May 2016 19:00:25 GMT
> < Server: Apache/2.4.18 (Ubuntu)
> < Set-Cookie: PHPSESSID=yyy; path=/
> < Expires: Fri, 01 Jan 1980 00:00:00 GMT
> < Cache-Control: no-cache, max-age=0, must-revalidate
> < Pragma: no-cache
> < Vary: Accept-Encoding
> < Content-Encoding: gzip
> < Content-Length: 109
> < Content-Type: text/plain;charset=UTF-8
> <
The content-type here should be:
  application/x-git-receive-pack-advertisement

The body content should also include "# service=git-receive-pack" on the first line, but if you are successfully calling into git-http-backend, I think it should take care of that detail.

-Peff
Previous: Luke MadhangaNext: Luke Madhanga
Message 2 of 5 in “Why is my git-http-backend solution using WebDAV on push?”
  1. Luke MadhangaMay 25, 2016
  2. Jeff KingMay 25, 2016
  3. Luke MadhangaMay 25, 2016
  4. Luke MadhangaMay 25, 2016
  5. Junio C HamanoMay 25, 2016

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.