Re: [git-users] Git http-backend shouldn't use Webdav

2015-05-26 Thread Konstantin Khomoutov
On Mon, 25 May 2015 13:44:49 -0700 (PDT)
Matthias Lantsch alasar.gogle.su...@gmail.com wrote:

[...]
 But when I am trying to push, I get a 404 header back and a return
 code 22:
  PROPFIND /git/repo/test.git/ HTTP/1.1

JFTR:

The server's part -- maps requests and URIs to actions:

$ git grep -E 'GET|POST|PROP' v1.9.5 -- http-backend.c 
v1.9.5:http-backend.c:  Expected POST with Content-Type '%s',
v1.9.5:http-backend.c:  {GET, /HEAD$, get_head},
v1.9.5:http-backend.c:  {GET, /info/refs$, get_info_refs},
v1.9.5:http-backend.c:  {GET, /objects/info/alternates$, get_text_file},
v1.9.5:http-backend.c:  {GET, /objects/info/http-alternates$, 
get_text_file},
v1.9.5:http-backend.c:  {GET, /objects/info/packs$, get_info_packs},
v1.9.5:http-backend.c:  {GET, /objects/[0-9a-f]{2}/[0-9a-f]{38}$, 
get_loose_object},
v1.9.5:http-backend.c:  {GET, /objects/pack/pack-[0-9a-f]{40}\\.pack$, 
get_pack_file},
v1.9.5:http-backend.c:  {GET, /objects/pack/pack-[0-9a-f]{40}\\.idx$, 
get_idx_file},
v1.9.5:http-backend.c:  {POST, /git-upload-pack$, service_rpc},
v1.9.5:http-backend.c:  {POST, /git-receive-pack$, service_rpc}
v1.9.5:http-backend.c:  method = GET;
v1.9.5:http-backend.c:  hdr_str(Allow, 
!strcmp(c-method
v1.9.5:http-backend.c:  GET, HEAD : 
c-method);

(As you can see, the query part of the URI is stripped before the URI path
hits this code.)

Grepping for PROPFIND:

git% git grep -F PROPFIND v1.9.5   
v1.9.5:http-push.c:#define DAV_PROPFIND PROPFIND
v1.9.5:http-push.c:#define DAV_PROPFIND_RESP .multistatus.response
v1.9.5:http-push.c:#define DAV_PROPFIND_NAME .multistatus.response.href
v1.9.5:http-push.c:#define DAV_PROPFIND_COLLECTION 
.multistatus.response.propstat.prop.re
v1.9.5:http-push.c:#define PROPFIND_SUPPORTEDLOCK_REQUEST ?xml 
version=\1.0\ encoding=
v1.9.5:http-push.c:#define PROPFIND_ALL_REQUEST ?xml version=\1.0\ 
encoding=\utf-8\ 
v1.9.5:http-push.c: if (!strcmp(ctx-name, DAV_PROPFIND_RESP)  
ls-dentry_na
v1.9.5:http-push.c: } else if (!strcmp(ctx-name, 
DAV_PROPFIND_NAME)  ctx-c
v1.9.5:http-push.c: } else if (!strcmp(ctx-name, 
DAV_PROPFIND_COLLECTION)) {
v1.9.5:http-push.c: } else if (!strcmp(ctx-name, DAV_PROPFIND_RESP)) {
v1.9.5:http-push.c: strbuf_addf(out_buffer.buf, PROPFIND_ALL_REQUEST);
v1.9.5:http-push.c: curl_setup_http(slot-curl, url, DAV_PROPFIND,
v1.9.5:http-push.c: fprintf(stderr, Unable to start PROPFIND 
request\n);
v1.9.5:http-push.c: strbuf_addf(out_buffer.buf, 
PROPFIND_SUPPORTEDLOCK_REQUEST, escap
v1.9.5:http-push.c: curl_setup_http(slot-curl, repo-url, DAV_PROPFIND,
v1.9.5:http-push.c: error(Unable to start PROPFIND request on %s, 
repo-url)

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Git http-backend shouldn't use Webdav

2015-05-26 Thread Matthias Lantsch


 I'm afraid this part is not interesting as it's already about WebDAV 
 being used, and we want to prevent this situation, right? 
 Hence, the place to debug is why WebDAV is being used in the first 
 place.

Yes of course you are correct, the goal is it not using Webdav at all.
 

 I mean, if the smart HTTP client falls back to dumb transport after 
 getting 403, then it should have performed at least a single GET/POST 
 request to hit that error condition.  Did you see it? 

Yes of course I wasn't pasting that part because I already mentioned that 
the server does NOT return a 403 to a normal GET prior (taken from the 
access.log)
But if it can be of any help, here is the full trace:
 GET /git/repo/test.git/info/refs?service=git-receive-pack HTTP/1.1
User-Agent: git/1.9.1
Host: localhost:8080
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

 HTTP/1.1 200 OK
 Date: Tue, 26 May 2015 10:55:07 GMT
* Server Apache/2.4.7 (Ubuntu) is not blacklisted
 Server: Apache/2.4.7 (Ubuntu)
 X-Powered-By: PHP/5.5.9-1ubuntu4.9
 Expires: Fri, 01 Jan 1980 00:00:00 GMT
 Pragma: no-cache
 Cache-Control: no-cache, max-age=0, must-revalidate
 Vary: Accept-Encoding
 Content-Encoding: gzip
 Content-Length: 186
 Content-Type: text/plain
 
* Connection #0 to host localhost left intact
* Couldn't find host localhost in the .netrc file; using defaults
* Found bundle for host localhost: 0x7d8210
* Re-using existing connection! (#0) with host localhost
* Connected to localhost (127.0.0.1) port 8080 (#0)
 GET /git/repo/test.git/HEAD HTTP/1.1
User-Agent: git/1.9.1
Host: localhost:8080
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

 HTTP/1.1 200 OK
 Date: Tue, 26 May 2015 10:55:07 GMT
* Server Apache/2.4.7 (Ubuntu) is not blacklisted
 Server: Apache/2.4.7 (Ubuntu)
 X-Powered-By: PHP/5.5.9-1ubuntu4.9
 Content-Length: 23
 Content-Type: text/plain
 
* Connection #0 to host localhost left intact
* Couldn't find host localhost in the .netrc file; using defaults
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
 PROPFIND /git/repo/test.git/ HTTP/1.1
User-Agent: git/1.9.1
Host: localhost:8080
Accept: */*
Depth: 0
Content-Type: text/xml
Content-Length: 165
Expect: 100-continue

 HTTP/1.1 100 Continue
* We are completely uploaded and fine
* The requested URL returned error: 404 Not Found
* Closing connection 0
error: Cannot access URL http://localhost:8080/git/repo/test.git/, return 
code 22
fatal: git-http-push failed

As you can see, no 403 header is sent back, as the access.log already 
stated.

Absolutely. 
 Well, may be unless you have truly outdated Git setup on the server. 
 I'm not even sure what version is that. 


I just checked, the git version on the server is up to date.
I thought it could be that not all Environment variables required by the 
backend to work are set, but I double checked and all those mentioned in 
the official documentation are set.
 Does it check if REMOTE_USER really is a authentificated user on the 
apache server?? (even though shouldn't matter, http.receivepack is true)

I'd try plain curl calls like 

   $ curl -X GET http://server/git/repo/test.git/info/refs?service=... 

 and see what happens. 

I was trying that and following the requests the client issued before 
receiving the error.
The first call, the one to GET 
/git/repo/test.git/info/refs?service=git-receive-pack returned the expected 
(?)  list of branches and corresponding hashes,
The second call to GET /git/repo/test.git/HEAD returns the expected output 
as well:
ref: refs/heads/master
Immediately afterwards in the client trace the PROPFIND is issued, which is 
the strange part to me :/

Maybe I should really write to the developers mailist, so that the creators 
of the backend could maybe help me.
I just reposted because I didn't see that it pasted your whole answer into 
my answer :)
Any ideas?

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [git-users] Git http-backend shouldn't use Webdav

2015-05-26 Thread Matthias Lantsch


 I'm afraid this part is not interesting as it's already about WebDAV 
 being used, and we want to prevent this situation, right? 
 Hence, the place to debug is why WebDAV is being used in the first 
 place.

Yes of course you are correct, the goal is it not using Webdav at all.
 

 I mean, if the smart HTTP client falls back to dumb transport after 
 getting 403, then it should have performed at least a single GET/POST 
 request to hit that error condition.  Did you see it? 

Yes of course I wasn't pasting that part because I already mentioned that 
the server does NOT return a 403 to a normal GET prior (taken from the 
access.log)
But if it can be of any help, here is the full trace:
 GET /git/repo/test.git/info/refs?service=git-receive-pack HTTP/1.1
User-Agent: git/1.9.1
Host: localhost:8080
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

 HTTP/1.1 200 OK
 Date: Tue, 26 May 2015 10:55:07 GMT
* Server Apache/2.4.7 (Ubuntu) is not blacklisted
 Server: Apache/2.4.7 (Ubuntu)
 X-Powered-By: PHP/5.5.9-1ubuntu4.9
 Expires: Fri, 01 Jan 1980 00:00:00 GMT
 Pragma: no-cache
 Cache-Control: no-cache, max-age=0, must-revalidate
 Vary: Accept-Encoding
 Content-Encoding: gzip
 Content-Length: 186
 Content-Type: text/plain
 
* Connection #0 to host localhost left intact
* Couldn't find host localhost in the .netrc file; using defaults
* Found bundle for host localhost: 0x7d8210
* Re-using existing connection! (#0) with host localhost
* Connected to localhost (127.0.0.1) port 8080 (#0)
 GET /git/repo/test.git/HEAD HTTP/1.1
User-Agent: git/1.9.1
Host: localhost:8080
Accept: */*
Accept-Encoding: gzip
Pragma: no-cache

 HTTP/1.1 200 OK
 Date: Tue, 26 May 2015 10:55:07 GMT
* Server Apache/2.4.7 (Ubuntu) is not blacklisted
 Server: Apache/2.4.7 (Ubuntu)
 X-Powered-By: PHP/5.5.9-1ubuntu4.9
 Content-Length: 23
 Content-Type: text/plain
 
* Connection #0 to host localhost left intact
* Couldn't find host localhost in the .netrc file; using defaults
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
 PROPFIND /git/repo/test.git/ HTTP/1.1
User-Agent: git/1.9.1
Host: localhost:8080
Accept: */*
Depth: 0
Content-Type: text/xml
Content-Length: 165
Expect: 100-continue

 HTTP/1.1 100 Continue
* We are completely uploaded and fine
* The requested URL returned error: 404 Not Found
* Closing connection 0
error: Cannot access URL http://localhost:8080/git/repo/test.git/, return 
code 22
fatal: git-http-push failed

As you can see, no 403 header is sent back, as the access.log already 
stated.

Absolutely. 
 Well, may be unless you have truly outdated Git setup on the server. 
 I'm not even sure what version is that. 


I just checked, the git version on the server is up to date.
I thought it could be that not all Environment variables required by the 
backend to work are set, but I double checked and all those mentioned in 
the official documentation are set.
 Does it check if REMOTE_USER really is a authentificated user on the 
apache server?? (even though shouldn't matter, http.receivepack is true)

I'd try plain curl calls like 

   $ curl -X GET http://server/git/repo/test.git/info/refs?service=... 

 and see what happens. 

I was trying that and following the requests the client issued before 
receiving the error.
The first call, the one to GET 
/git/repo/test.git/info/refs?service=git-receive-pack returned the expected 
(?)  list of branches and corresponding hashes,
The second call to GET /git/repo/test.git/HEAD returns the expected output 
as well:
ref: refs/heads/master
Immediately afterwards in the client trace the PROPFIND is issued, which is 
the strange part to me :/

Maybe I should really write to the developers mailist, so that the creators 
of the backend could maybe help me.
Any ideas?

Am Dienstag, 26. Mai 2015 12:42:30 UTC+2 schrieb Konstantin Khomoutov:

 On Mon, 25 May 2015 13:44:49 -0700 (PDT) 
 Matthias Lantsch alasar.go...@gmail.com javascript: wrote: 

  Hello community I have a problem with the new http-backend of git. 
  I have set up the git-http-backend to use the smart http version of 
  git. Authentification works fine, I can clone my repository over http 
  and https as expected. 
  For testing purposes, GIT_SSL_NO_VERIFY and http.receivepack are both 
  set to true. 
  But when I am trying to push, I get a 404 header back and a return 
  code 22: 
   PROPFIND /git/repo/test.git/ HTTP/1.1 

 How did you obtain there results?  Run Git client having set 

   GIT_CURL_VERBOSE=1 

 in the environment, right? 

 I then wonder where are the attempts to do GET requests against 

   git/repo/test.git/info/refs?service=git-receive-pack 

 in this log output before that PROPFIND attempt. 

 I mean, if the smart HTTP client falls back to dumb transport after 
 getting 403, then it should have performed at least a single GET/POST 
 request to hit that error condition.  Did you see it? 

 [...] 
  That of course had me confused, because PROPFIND is a 

[git-users] Git http-backend shouldn't use Webdav

2015-05-25 Thread Matthias Lantsch
Hello community I have a problem with the new http-backend of git.
I have set up the git-http-backend to use the smart http version of git.
Authentification works fine, I can clone my repository over http and https 
as expected.
For testing purposes, GIT_SSL_NO_VERIFY and http.receivepack are both set 
to true.
But when I am trying to push, I get a 404 header back and a return code 22:
 PROPFIND /git/repo/test.git/ HTTP/1.1
User-Agent: git/1.9.5.msysgit.1
Host: 10.5.1.2
Accept: */*
Depth: 0
Content-Type: text/xml
Content-Length: 167
Expect: 100-continue
 HTTP/1.1 100 Continue
* We are completely uploaded and fine
* The requested URL returned error: 404 Not Found
* Closing connection 0
error: Cannot access URL https://10.5.1.2/git/repo/test.git/, return code 22
fatal: git-http-push failed
That of course had me confused, because PROPFIND is a Webdav call and I 
thought the http backend would only use smart http (webdav is not enabled 
on the server)
In an answer *here* 
http://serverfault.com/questions/180413/authentication-for-git-push-over-http 
it confirms that Webdav should actually not even be used. It also states 
that Webdav will be used as backup if the client receives a 403 header.
But my Access log as well as the trace do not show any sign of that.
Through my hook script I got a dump of the environement that is submitted 
to the script:
export GIT_PROJECT_ROOT='/theRealPathToTheGitRoot/gitroot/'
export GIT_HTTP_EXPORT_ALL=1
export PATH_INFO='/test.git/'
export GIT_COMMITTER_NAME=''
export GIT_COMMITTER_EMAIL=''
export REMOTE_USER='Test'
export REMOTE_ADDR='10.5.2.73'
export CONTENT_TYPE='text/xml'
export QUERY_STRING='req=git/repo/test.git/'
export REQUEST_METHOD='PROPFIND'
export HTTP_ACCEPT='*/*'
export CONTENT_LENGTH=167
The error log logging the error output of the git-http-backend contains 
that:
Status: 404 Not Found
Expires: Fri, 01 Jan 1980 00:00:00 GMT
Pragma: no-cache
Cache-Control: no-cache, max-age=0, must-revalidate

Request not supported: '/theRealPathToTheGitRoot/gitroot/test.git/
Did I mess something up? I am sure that Webdav should not be required for 
the backend to work.
Environement information: 
Apache2.2
Client Git 1.9.x under Windows and Linux
Any help would be much appreciated :)
Matthias

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.