git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] Allow git to use any HTTP authentication method.
@ 2009-12-28 10:54 Lénaïc Huard
  2009-12-28 12:09 ` Martin Storsjö
  2009-12-28 12:37 ` Matthieu Moy
  0 siblings, 2 replies; 11+ messages in thread
From: Lénaïc Huard @ 2009-12-28 10:54 UTC (permalink / raw
  To: git

[-- Attachment #1: Type: Text/Plain, Size: 1113 bytes --]

Hello,

As I need to access some of my git repositories behind a corporate company 
firewall, I use the http access method. And, as I don't want my passwords to be 
sent in clear text over the network, I have configured my web server to use « 
Digest » authentication instead of the old « Basic » authentication.
This authentication method is now well handled by modern software.

Unfortunately, current git version only handles « Basic » authentication.
When attempting to access my repository, I get the following error message:

error: The requested URL returned error: 401 while accessing 
http://XXX@YYY.ZZ/test.git/info/refs

The web server, on its side, has refused the transaction because of the wrong 
authentication method used:

Digest: client used wrong authentication scheme `Basic': /test.git/info/refs

The attached patch makes git configure libcurl to negotiate the most suitable 
HTTP authentication method.
Thanks to that patch, I manage to clone and fetch my git repository hosted on 
my web server requesting an authentication through the « Digest  » method.

Lénaïc.

[-- Attachment #2: 0001-Allow-git-to-use-any-HTTP-authentication-method.patch --]
[-- Type: text/x-patch, Size: 966 bytes --]

From 2acab3ae894c3ea835279a864e654e1c5e956e80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= <lenaic@lhuard.fr.eu.org>
Date: Mon, 28 Dec 2009 10:52:35 +0100
Subject: [PATCH] Allow git to use any HTTP authentication method.

By default, libcurl performs "Basic" HTTP authentication.
This method transmits passwords in clear text.
libcurl needs some settings in order to use a safest HTTP authentication
method like "Digest" for example.
---
 http.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/http.c b/http.c
index ed6414a..2d9df76 100644
--- a/http.c
+++ b/http.c
@@ -233,6 +233,10 @@ static CURL *get_curl_handle(void)
 
 	init_curl_http_auth(result);
 
+#if LIBCURL_VERSION_NUM >= 0x070a06
+	curl_easy_setopt(result, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+#endif
+
 	if (ssl_cert != NULL)
 		curl_easy_setopt(result, CURLOPT_SSLCERT, ssl_cert);
 	if (has_cert_password())
-- 
1.6.5.7


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

end of thread, other threads:[~2009-12-28 18:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-28 10:54 [PATCH] Allow git to use any HTTP authentication method Lénaïc Huard
2009-12-28 12:09 ` Martin Storsjö
2009-12-28 12:12   ` Tay Ray Chuan
2009-12-28 15:37     ` Shawn O. Pearce
2009-12-28 15:50       ` Martin Storsjö
2009-12-28 15:53         ` Shawn O. Pearce
2009-12-28 17:15           ` Tay Ray Chuan
2009-12-28 18:04             ` Junio C Hamano
2009-12-28 18:10               ` Martin Storsjö
2009-12-28 18:15               ` Shawn O. Pearce
2009-12-28 12:37 ` Matthieu Moy

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).