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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 25, 2016 at 09:28:21PM +0100, Luke Madhanga wrote:

> 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:

> > 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]