summaryrefslogtreecommitdiff
path: root/remote-curl.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-01-21 20:08:31 -0800
committerJunio C Hamano <gitster@pobox.com>2010-01-21 20:08:31 -0800
commit2d0d706e5fd08b751a19562974ae0b76d9db03a1 (patch)
tree8852a1b2770efa8c69dfe85b6d7ece3d8621d53b /remote-curl.c
parentb28a1ce04cdafbd3b470ec43c0f562054bd45d4d (diff)
parent19c6a4f8369f37c0df1fb57008a891eb6a6dc4bb (diff)
downloadgit-2d0d706e5fd08b751a19562974ae0b76d9db03a1.tar.gz
Merge branch 'maint'
* maint: merge-recursive: do not return NULL only to cause segfault retry request without query when info/refs?query fails
Diffstat (limited to 'remote-curl.c')
-rw-r--r--remote-curl.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/remote-curl.c b/remote-curl.c
index 1361006959..a904164e42 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -102,7 +102,7 @@ static struct discovery* discover_refs(const char *service)
struct strbuf buffer = STRBUF_INIT;
struct discovery *last = last_discovery;
char *refs_url;
- int http_ret, is_http = 0;
+ int http_ret, is_http = 0, proto_git_candidate = 1;
if (last && !strcmp(service, last->service))
return last;
@@ -121,6 +121,19 @@ static struct discovery* discover_refs(const char *service)
init_walker();
http_ret = http_get_strbuf(refs_url, &buffer, HTTP_NO_CACHE);
+
+ /* try again with "plain" url (no ? or & appended) */
+ if (http_ret != HTTP_OK) {
+ free(refs_url);
+ strbuf_reset(&buffer);
+
+ proto_git_candidate = 0;
+ strbuf_addf(&buffer, "%s/info/refs", url);
+ refs_url = strbuf_detach(&buffer, NULL);
+
+ http_ret = http_get_strbuf(refs_url, &buffer, HTTP_NO_CACHE);
+ }
+
switch (http_ret) {
case HTTP_OK:
break;
@@ -137,7 +150,8 @@ static struct discovery* discover_refs(const char *service)
last->buf_alloc = strbuf_detach(&buffer, &last->len);
last->buf = last->buf_alloc;
- if (is_http && 5 <= last->len && last->buf[4] == '#') {
+ if (is_http && proto_git_candidate
+ && 5 <= last->len && last->buf[4] == '#') {
/* smart HTTP response; validate that the service
* pkt-line matches our request.
*/