public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* Git dumb HTTP protocol should use WebDAV PROPFIND method
@ 2025-09-08 12:10 Milan Hauth
  2025-09-08 18:47 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Milan Hauth @ 2025-09-08 12:10 UTC (permalink / raw)
  To: git

i am serving git repos over http with webdav extensions

read operations like git ls-remote, git fetch, git pull
should work with such an http remote
but currently (with git 2.49.0) this fails with

$ git ls-remote http://localhost/src/somerepo/
fatal: repository 'http://localhost/src/somerepo/' not found

$ git ls-remote http://localhost/src/somerepo/.git/
fatal: repository 'http://localhost/src/somerepo/.git/' not found



http server: nginx

nginx webdav module:
https://github.com/mid1221213/nginx-dav-ext-module

nginx config:

> http {
>   server {
>     listen 0.0.0.0:80;
>     root /var/www/nginx/htdocs;
>     location /src/ {
>       # PROPFIND allows directory listing
>       dav_ext_methods PROPFIND OPTIONS;
>       dav_access user:r group:r all:r;
>       autoindex on;
>       # disable index.html
>       index this_file_should_never_exist_DsMSIsKgBk;
>     }
>   }
> }

available methods can be fetched with the OPTIONS method

curl -s -i -X OPTIONS http://localhost/src/somerepo/ | grep -i ^allow:

directory listings can be fetched with the PROPFIND method

curl -s -X PROPFIND -H "Depth: 1"  http://localhost/src/somerepo/ |
grep -F 'D:displayname' | sed -E 's|.*>(.*)<.*|\1|' | LANG=C sort



workaround:

pushd /path/to/repo/.git/
git --bare update-server-info
mv hooks/post-update.sample hooks/post-update
popd
git ls-remote http://localhost/src/somerepo/.git/



continue:

Git dumb HTTP protocol should work without update-server-info
https://lore.kernel.org/git/CAGiEHCtP29bQRsEyLabNrLuiP96P-o7EEGi88B7pJbP0tfprxw@mail.gmail.com/

> reading directories is only possible with WebDAV since
> HTTP doesn't offer native directory listing.  However, we don't use
> WebDAV for fetches and other read operations and not all web servers
> support it.  We get better web server support in many cases by requiring
> that the server side do the work of updating the lists of packs and
> refs.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Git dumb HTTP protocol should use WebDAV PROPFIND method
  2025-09-08 12:10 Git dumb HTTP protocol should use WebDAV PROPFIND method Milan Hauth
@ 2025-09-08 18:47 ` Junio C Hamano
  2025-09-08 19:09   ` Milan Hauth
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2025-09-08 18:47 UTC (permalink / raw)
  To: Milan Hauth; +Cc: git

Milan Hauth <milahu@gmail•com> writes:

> workaround:
>
> pushd /path/to/repo/.git/
> git --bare update-server-info
> mv hooks/post-update.sample hooks/post-update
> popd
> git ls-remote http://localhost/src/somerepo/.git/

That is not a workaround, but the proper way the system was designed
to be used.

After all, the "dumb HTTP" support is just that.  It is known to be
ultra inefficient relative to other transport methods like "git
protocol over ssh connection", and "smart HTTP stateless
connection", and the WHOLE point of supporting "dumb HTTP" transport
is to allow a truly dumb HTTP serving infrastructure.  Letting the
clients assume that WebDAV exists on the server side defeats its
reason to exist.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Git dumb HTTP protocol should use WebDAV PROPFIND method
  2025-09-08 18:47 ` Junio C Hamano
@ 2025-09-08 19:09   ` Milan Hauth
  0 siblings, 0 replies; 3+ messages in thread
From: Milan Hauth @ 2025-09-08 19:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

> assume that WebDAV exists on the server side

no

plan A:
q: GET $url/info/refs
r: HTTP 404

plan B:
q: GET $url/.git/info/refs
r: HTTP 404

plan C:
q: OPTIONS
r: Allow: GET,HEAD,PROPFIND,OPTIONS
q: PROPFIND $url
r: ...

plan D:
q: PROPFIND $url/.git/
r: ...

(q = query, r = response)

so instead of throwing

> fatal: repository '$url' not found

git should try plan A, B, C, D, ...
to fetch data from the repo

currently, git gives up after plan A



> the WHOLE point of supporting "dumb HTTP" transport
> is to allow a truly dumb HTTP serving infrastructure

there are at least 2 variants of "dumb HTTP servers":
HTTP servers without WebDAV
HTTP servers with WebDAV



> assume that WebDAV exists on the server side

for HTTP servers without WebDAV
see my other thread

Git dumb HTTP protocol should work without update-server-info
https://lore.kernel.org/git/CAGiEHCtP29bQRsEyLabNrLuiP96P-o7EEGi88B7pJbP0tfprxw@mail.gmail.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-09-08 19:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-08 12:10 Git dumb HTTP protocol should use WebDAV PROPFIND method Milan Hauth
2025-09-08 18:47 ` Junio C Hamano
2025-09-08 19:09   ` Milan Hauth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox