git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* HTTP redirection with git-clone/git-fetch ?
@ 2005-11-09 22:31 Josef Weidendorfer
  2005-11-10  0:24 ` Nick Hengeveld
  0 siblings, 1 reply; 4+ messages in thread
From: Josef Weidendorfer @ 2005-11-09 22:31 UTC (permalink / raw)
  To: git

Hi,

git-clone fails silently with a HTTP URL where the server
responds with a redirection (ie. header line "Location:...").
I tried to add "-L" to the curl command line in git-clone.sh,
but this is only half of a fix. Afterwards I get:

defaulting to local storage area
error: Couldn't get http://repo/project.git/refs/heads/origin for heads/origin
Failed writing body
error: Could not interpret heads/origin as something to pull

This seems because git-fetch should understand redirections, too.
I am not familiar to the curl API. So perhaps another one can try to
fix this?

Josef

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

* Re: HTTP redirection with git-clone/git-fetch ?
  2005-11-09 22:31 HTTP redirection with git-clone/git-fetch ? Josef Weidendorfer
@ 2005-11-10  0:24 ` Nick Hengeveld
  2005-11-10 13:09   ` Josef Weidendorfer
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Hengeveld @ 2005-11-10  0:24 UTC (permalink / raw)
  To: Josef Weidendorfer; +Cc: git

On Wed, Nov 09, 2005 at 11:31:36PM +0100, Josef Weidendorfer wrote:

> This seems because git-fetch should understand redirections, too.
> I am not familiar to the curl API. So perhaps another one can try to
> fix this?

This should fix it, although it still tries every GET with the original
URL which is a bit inefficient.


Configure HTTP fetch to follow redirects

Signed-off-by: Nick Hengeveld <nickh@reactrix.com>


---

 git-fetch.sh |    2 +-
 http-fetch.c |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

applies-to: bc694e972ad9e82f65359788db6ef788078a975f
deb8d58781a60d4611651478c5b08739edf981b7
diff --git a/git-fetch.sh b/git-fetch.sh
index 31e5f4c..8564cbf 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -230,7 +230,7 @@ do
 	    $u =~ s{([^-a-zA-Z0-9/.])}{sprintf"%%%02x",ord($1)}eg;
 	    print "$u";
 	' "$remote_name")
-	head=$(curl -nsf $curl_extra_args "$remote/$remote_name_quoted") &&
+	head=$(curl -nsfL $curl_extra_args "$remote/$remote_name_quoted") &&
 	expr "$head" : "$_x40\$" >/dev/null ||
 		die "Failed to fetch $remote_name from $remote"
 	echo >&2 Fetching "$remote_name from $remote" using http
diff --git a/http-fetch.c b/http-fetch.c
index ea8af1b..28d225c 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -269,6 +269,8 @@ static CURL* get_curl_handle(void)
 				 curl_low_speed_time);
 	}
 
+	curl_easy_setopt(result, CURLOPT_FOLLOWLOCATION, 1);
+
 	return result;
 }
 
---
0.99.9.GIT

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

* Re: HTTP redirection with git-clone/git-fetch ?
  2005-11-10  0:24 ` Nick Hengeveld
@ 2005-11-10 13:09   ` Josef Weidendorfer
  2005-11-11 17:38     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Josef Weidendorfer @ 2005-11-10 13:09 UTC (permalink / raw)
  To: git

On Thursday 10 November 2005 01:24, Nick Hengeveld wrote:
> On Wed, Nov 09, 2005 at 11:31:36PM +0100, Josef Weidendorfer wrote:
> 
> > This seems because git-fetch should understand redirections, too.
> > I am not familiar to the curl API. So perhaps another one can try to
> > fix this?
> 
> This should fix it, although it still tries every GET with the original
> URL which is a bit inefficient.

Thanks, I just sent a patch for git-clone, including your patch, to
Junio.

Josef

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

* Re: HTTP redirection with git-clone/git-fetch ?
  2005-11-10 13:09   ` Josef Weidendorfer
@ 2005-11-11 17:38     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2005-11-11 17:38 UTC (permalink / raw)
  To: Josef Weidendorfer, Nick Hengeveld; +Cc: git

Josef Weidendorfer <Josef.Weidendorfer@gmx.de> writes:

>> This should fix it, although it still tries every GET with the original
>> URL which is a bit inefficient.
>
> Thanks, I just sent a patch for git-clone, including your patch, to
> Junio.

Thank you both.

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

end of thread, other threads:[~2005-11-11 17:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-09 22:31 HTTP redirection with git-clone/git-fetch ? Josef Weidendorfer
2005-11-10  0:24 ` Nick Hengeveld
2005-11-10 13:09   ` Josef Weidendorfer
2005-11-11 17:38     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).