[PATCH] Support more http features: https no cert, .netrc -> auth

DORMANTno replies

From: Darrin Thompson <hidden>
Date: 2016-06-15 22:42:02
Subsystem: the rest · Maintainer: Linus Torvalds

Cause setting environment variable GIT_SSL_NO_VERIFY to turn off
curl's ssl peer verification.

Only use curl for http transfers, instead of curl and wget.

Make curl check ~/.netrc for credentials.

---
commit 229718f5723f81304c7c038c18d1e1bd630026ae
tree 501594e7b424855f08d7bef6bd4f9721d40d4a3c
parent e30e814dbfef7a6e89418863e5d7291a2d53b18f
author Darrin Thompson [off-list ref] Tue, 12 Jul 2005 16:27:05 -0500

 git-fetch-script |    7 +++++--
 http-pull.c      |    6 ++++++
 2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/git-fetch-script b/git-fetch-script
--- a/git-fetch-script
+++ b/git-fetch-script
@@ -14,8 +14,11 @@ fi
 TMP_HEAD="$GIT_DIR/TMP_HEAD"
 
 case "$merge_repo" in
-http://*)
-	head=$(wget -q -O - "$merge_repo/$merge_name") || exit 1
+http://*|https://*)
+        if [ -n "$GIT_SSL_NO_VERIFY" ]; then
+            curl_extra_args="-k"
+        fi
+	head=$(curl -ns $curl_extra_args "$merge_repo/$merge_name") || exit 1
 	echo Fetching $head using http
 	git-http-pull -v -a "$head" "$merge_repo/"
 	;;
diff --git a/http-pull.c b/http-pull.c
--- a/http-pull.c
+++ b/http-pull.c
@@ -16,6 +16,8 @@ static z_stream stream;
 static int local;
 static int zret;
 
+static int curl_ssl_verify;
+
 struct buffer
 {
         size_t posn;
@@ -173,6 +175,10 @@ int main(int argc, char **argv)
 
 	curl = curl_easy_init();
 
+	curl_ssl_verify = gitenv("GIT_SSL_NO_VERIFY") ? 0 : 1;
+	curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, curl_ssl_verify);
+	curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
+
 	base = url;
 
 	if (pull(commit_id))
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help