git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Add more curl options to git-http-pull

From
DTDarrin Thompson <darrint@progeny.com>
Date
Jun 20, 2005, 23:48 UTC
Message-ID
<1119311311.3926.26.camel@localhost.localdomain>
All,

This patch makes git-http-pull work with basic http auth and ssl when you aren't using a real cert.

Also, it makes curl's verbose output available, which is useful for debugging.

Apologies as I expect my mail client is munging this patch slightly.
Signed-off-by: Darrin Thompson <darrint at progeny com>
---

Create option to turn off ssl peer verification. Create option to provide username:password to curl. Make -v additive. When -v is specified twice, turn on CURLOPT_VERBOSE.

diff --git a/http-pull.c b/http-pull.c
--- a/http-pull.c
+++ b/http-pull.c
@@ -15,6 +15,8 @@ static z_stream stream;

 static int local;
 static int zret;
+static int curl_ssl_verify_enabled = 1;
+static char *curl_user_pwd = NULL;

 static size_t fwrite_sha1_file(void *ptr, size_t eltsize, size_t nmemb,
                               void *data) {
@@ -117,12 +119,17 @@ int main(int argc, char **argv)
                        get_tree = 1;
                        get_history = 1;
                } else if (argv[arg][1] == 'v') {
-                       get_verbosely = 1;
+                       get_verbosely += 1;
+               } else if (argv[arg][1] == 'S') {
+                        curl_ssl_verify_enabled = 0;
+               } else if (argv[arg][1] == 'u') {
+                        arg++;
+                        curl_user_pwd = argv[arg];
                }
                arg++;
        }
        if (argc < arg + 2) {
-               usage("git-http-pull [-c] [-t] [-a] [-d] [-v]
[--recover] commit-id url");
+               usage("git-http-pull [-u] user:passwd [-S] [-c] [-t]
[-a] [-d] [-v] [--recover] commit-id url");
                return 1;
        }
        commit_id = argv[arg];
@@ -131,6 +138,13 @@ int main(int argc, char **argv)
        curl_global_init(CURL_GLOBAL_ALL);

        curl = curl_easy_init();
+        if (curl_user_pwd) {
+                curl_easy_setopt(curl, CURLOPT_USERPWD, curl_user_pwd);
+        }
+        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER,
curl_ssl_verify_enabled);
+        if (get_verbosely >= 2) {
+                curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
+        }

        base = url;
Message 1 of 1 in “Add more curl options to git-http-pull”
  1. Add more curl options to git-http-pullDarrin Thompson, Jun 20, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.