[PATCH] Fix https interactive authentication problem
- From
- Steinmann Ruedi <ruediste@student.ethz.ch>
- Date
- Nov 23, 2011, 07:58 UTC
- Message-ID
- <F6A589D6B10801478E0DE246A9EF187C1BD5E8@MBX12.d.ethz.ch>
>From 986e29085ee2215a3e0a412ee7874dc2d0ef36be Mon Sep 17 00:00:00 2001
From: Ruedi Steinmann <ruediste@student.ethz.ch> Date: Wed, 23 Nov 2011 08:41:52 +0100 Subject: [PATCH] Fix https interactive authentication problem
Cloning a repository over https works fine when the username/password is given in the URL. But if it is queried interactively, an error occurs(see below). I found that the username/password is not set when a connection is reused.
With this patch, the username/password is set whenever a connection is reused.
Sample output showing the error:
git clone https://n.ethz.ch/student/... Cloning into ... Username: Password: error: Unable to get pack file https://n.ethz.ch/student/.../objects/pack/pack-1ced2ebff0c9fc1f07e0c7cc9dd3fc75f6ac6962.pack The requested URL returned error: 401 ... error: Fetch failed.
Signed-off-by: Ruedi Steinmann <ruediste@student.ethz.ch> --- http.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/http.c b/http.c index e6c7597..c7b3558 100644 --- a/http.c +++ b/http.c @@ -550,7 +550,10 @@ struct active_request_slot *get_active_slot(void) curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, NULL); curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0); curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1); - + + // set username and password if already set + init_curl_http_auth(slot->curl); + return slot; } -- 1.7.5.4