{"thread":{"id":"12336","subject":"RE: FW: git via http protocol _and_ a proxy using NTLM authentication -- git 1.5.4.2 & curl 7.18.0","startedAt":"2008-02-26T23:46:21Z","lastAt":"2008-02-27T20:39:14Z","messageCount":9,"participants":["ken.fuchs@bench.com","Mike Hommey","Junio C Hamano","Daniel Barkalow"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"70049","messageId":"AA28F077645B324881335614E4F7C428034C01@win-ex01.bench.com","threadId":"12336","inReplyTo":null,"subject":"RE: FW: git via http protocol _and_ a proxy using NTLM authentication -- git 1.5.4.2 & curl 7.18.0","fromName":"","fromEmail":"ken.fuchs@bench.com","sentAt":"2008-02-26T23:46:21Z","receivedAt":"2008-02-26T23:46:21Z","isPatch":false,"sender":{"key":"ken.fuchs@bench.com","avatar":null},"body":"> Ken Fuchs wrote:\n> \n> > +       curl_easy_setopt(result, CURLOPT_PROXYAUTH, \n> (long)CURLAUTH_NTLM);\n> > +       curl_easy_setopt(result, CURLOPT_PROXYUSERPWD,\n> > +               \"<user-id>:<password>\");\n\nDaniel Stenberg wrote:\n\n> First, you should rather allow any auth and not just the \n> specific one you want.\n> \n> Then, the userid and password is probably better passed in \n> embedded in the proxy URL as that's given on the command\n> line/environment already. Or as separate arguments.\n\nAgreed.  (I'd just like to get it working first.)\n\n> > It seems that git fetch (via HTLM proxy) works until\n> >\n> >> fatal: Couldn't find remote ref HEAD\n> \n> Well, the CURLOPT_PROXY is set in transport.c as well which \n> your patch didn't address.\n\nThanks, I just did a similar patch to transport.c:\n\n$ diff -u ../git-1.5.4.2/transport.c.orig \\\n          ../git-1.5.4.2/transport.c\n@@ -456,7 +456,8 @@\n        if (transport->remote->http_proxy)\n                curl_easy_setopt(slot->curl, CURLOPT_PROXY,\n                                 transport->remote->http_proxy);\n-\n+       curl_easy_setopt(slot->curl, CURLOPT_PROXYAUTH,\n(long)CURLAUTH_NTLM);\n+       curl_easy_setopt(slot->curl, CURLOPT_PROXYUSERPWD,\n\"<user-id>:<password>\");\n        if (start_active_slot(slot)) {\n                run_active_slot(slot);\n                if (results.curl_result != CURLE_OK) {\n$\n\n> If that's the case, I figure the verbose output \n> should've shown some auth failures with the proxy?\n\nNo, actually the last 2 lines of debug output (unchanged) is:\n\n* Connection #0 to host <proxy domain> left intact\nfatal: Couldn't find remote ref HEAD\n\nSo, the proxy communication via NTLM authentication seems to be working.\nThe patch to transport.c did not change anything as far as I can see.\n\nThe fatal error is from remote.c.  Perhaps, it also requires some\nchanges.\n\n--\n\nExample of curl (sans git) working via an NTLM proxy:\n\n$ curl --proxy-ntlm --proxy-user <user-id> \\\n    --proxy <proxy-domain>:<proxy-port> http://slashdot.org/\nEnter proxy password for user '<user-id>': <non-echoed password>\n<HTML of /. home page>\n\nThus, it seems that git could be modified to work via HTLM\nauthentication, but my simple changes to http.c and transport.c\nabove are probably not sufficient.\n\nSuggestions are most welcome.\n\nThanks,\n\nKen Fuchs\n"},{"id":"70060","messageId":"20080227072012.GA23423@glandium.org","threadId":"12336","inReplyTo":"AA28F077645B324881335614E4F7C428034C01@win-ex01.bench.com","subject":"Re: FW: git via http protocol _and_ a proxy using NTLM authentication -- git 1.5.4.2 & curl 7.18.0","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2008-02-27T07:20:12Z","receivedAt":"2008-02-27T07:20:12Z","isPatch":false,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"On Tue, Feb 26, 2008 at 05:46:21PM -0600, Ken.Fuchs@bench.com wrote:\n> > Well, the CURLOPT_PROXY is set in transport.c as well which \n> > your patch didn't address.\n> \n> Thanks, I just did a similar patch to transport.c:\n> \n> $ diff -u ../git-1.5.4.2/transport.c.orig \\\n>           ../git-1.5.4.2/transport.c\n> @@ -456,7 +456,8 @@\n>         if (transport->remote->http_proxy)\n>                 curl_easy_setopt(slot->curl, CURLOPT_PROXY,\n>                                  transport->remote->http_proxy);\n> -\n> +       curl_easy_setopt(slot->curl, CURLOPT_PROXYAUTH,\n> (long)CURLAUTH_NTLM);\n> +       curl_easy_setopt(slot->curl, CURLOPT_PROXYUSERPWD,\n> \"<user-id>:<password>\");\n>         if (start_active_slot(slot)) {\n>                 run_active_slot(slot);\n>                 if (results.curl_result != CURLE_OK) {\n> $\n\nStarting with curl 7.14.1, you're supposed to be able to use the\nhttp://user:pass@proxy/ syntax, though I'm not sure it deals well with\nNTLM domains. You can probably leave CURLOPT_PROXYUSERPWD out if you\nset your proxy url correctly.\n\nAs for CURLOPT_PROXYAUTH, it would be better to set it from another\nconfig.\n\nNote that remote.<name>.proxy config doesn't work as expected, you\nshould use http.proxy which just work (and the change in transport.c is\nuseless, then). I have, as part of by http-refactoring topic, a patch\nfor remote.<name>.proxy to work better, though it doesn't support\nchanging the proxy authentication method.\n\n> > If that's the case, I figure the verbose output \n> > should've shown some auth failures with the proxy?\n> \n> No, actually the last 2 lines of debug output (unchanged) is:\n> \n> * Connection #0 to host <proxy domain> left intact\n> fatal: Couldn't find remote ref HEAD\n> \n> So, the proxy communication via NTLM authentication seems to be working.\n> The patch to transport.c did not change anything as far as I can see.\n> \n> The fatal error is from remote.c.  Perhaps, it also requires some\n> changes.\n\nDoes your remote have a HEAD ref ?\n\nMike\n"},{"id":"70062","messageId":"20080227072952.GA27806@glandium.org","threadId":"12336","inReplyTo":"20080227072012.GA23423@glandium.org","subject":"Re: FW: git via http protocol _and_ a proxy using NTLM authentication -- git 1.5.4.2 & curl 7.18.0","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2008-02-27T07:29:52Z","receivedAt":"2008-02-27T07:29:52Z","isPatch":false,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"On Wed, Feb 27, 2008 at 08:20:12AM +0100, Mike Hommey wrote:\n> On Tue, Feb 26, 2008 at 05:46:21PM -0600, Ken.Fuchs@bench.com wrote:\n> > > Well, the CURLOPT_PROXY is set in transport.c as well which \n> > > your patch didn't address.\n> > \n> > Thanks, I just did a similar patch to transport.c:\n> > \n> > $ diff -u ../git-1.5.4.2/transport.c.orig \\\n> >           ../git-1.5.4.2/transport.c\n> > @@ -456,7 +456,8 @@\n> >         if (transport->remote->http_proxy)\n> >                 curl_easy_setopt(slot->curl, CURLOPT_PROXY,\n> >                                  transport->remote->http_proxy);\n> > -\n> > +       curl_easy_setopt(slot->curl, CURLOPT_PROXYAUTH,\n> > (long)CURLAUTH_NTLM);\n> > +       curl_easy_setopt(slot->curl, CURLOPT_PROXYUSERPWD,\n> > \"<user-id>:<password>\");\n> >         if (start_active_slot(slot)) {\n> >                 run_active_slot(slot);\n> >                 if (results.curl_result != CURLE_OK) {\n> > $\n> \n> Starting with curl 7.14.1, you're supposed to be able to use the\n> http://user:pass@proxy/ syntax, though I'm not sure it deals well with\n> NTLM domains. You can probably leave CURLOPT_PROXYUSERPWD out if you\n> set your proxy url correctly.\n> \n> As for CURLOPT_PROXYAUTH, it would be better to set it from another\n> config.\n\nOr we should set it to CURLOPT_AUTHANY by default.\n\nMike\n"},{"id":"70064","messageId":"1204097780-29581-1-git-send-email-mh@glandium.org","threadId":"12336","inReplyTo":"20080227072012.GA23423@glandium.org","subject":"[PATCH] Set proxy override with http_init()","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2008-02-27T07:36:20Z","receivedAt":"2008-02-27T07:36:20Z","isPatch":true,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"In transport.c, proxy setting (the one from the remote conf) was set through\ncurl_easy_setopt() call, while http.c already does the same with the\nhttp.proxy setting. We now just use this infrastructure instead, and make\nhttp_init() now take the proxy url as argument.\n\nAt the same time, we make get_http_walker() take a proxy argument too, and\npass it to http_init(), which makes remote defined proxy be used for more\nthan get_refs_via_curl().\n\nSigned-off-by: Mike Hommey <mh@glandium.org>\n---\n > Note that remote.<name>.proxy config doesn't work as expected, you\n > should use http.proxy which just work (and the change in transport.c is\n > useless, then). I have, as part of by http-refactoring topic, a patch\n > for remote.<name>.proxy to work better, though it doesn't support\n > changing the proxy authentication method.\n \n And here is said patch.\n\n http-push.c   |    2 +-\n http-walker.c |    4 ++--\n http.c        |   10 +++++++++-\n http.h        |    2 +-\n transport.c   |    9 ++++-----\n walker.h      |    2 +-\n 6 files changed, 18 insertions(+), 11 deletions(-)\n\ndiff --git a/http-push.c b/http-push.c\nindex 0beb740..04e056d 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -2240,7 +2240,7 @@ int main(int argc, char **argv)\n \n \tmemset(remote_dir_exists, -1, 256);\n \n-\thttp_init();\n+\thttp_init(NULL);\n \n \tno_pragma_header = curl_slist_append(no_pragma_header, \"Pragma:\");\n \ndiff --git a/http-walker.c b/http-walker.c\nindex 2c37868..02be6c8 100644\n--- a/http-walker.c\n+++ b/http-walker.c\n@@ -902,13 +902,13 @@ static void cleanup(struct walker *walker)\n \tcurl_slist_free_all(data->no_pragma_header);\n }\n \n-struct walker *get_http_walker(const char *url)\n+struct walker *get_http_walker(const char *url, const char *proxy)\n {\n \tchar *s;\n \tstruct walker_data *data = xmalloc(sizeof(struct walker_data));\n \tstruct walker *walker = xmalloc(sizeof(struct walker));\n \n-\thttp_init();\n+\thttp_init(proxy);\n \n \tdata->no_pragma_header = curl_slist_append(NULL, \"Pragma:\");\n \ndiff --git a/http.c b/http.c\nindex 519621a..89194d7 100644\n--- a/http.c\n+++ b/http.c\n@@ -219,13 +219,16 @@ static CURL* get_curl_handle(void)\n \treturn result;\n }\n \n-void http_init(void)\n+void http_init(const char *proxy)\n {\n \tchar *low_speed_limit;\n \tchar *low_speed_time;\n \n \tcurl_global_init(CURL_GLOBAL_ALL);\n \n+\tif (proxy)\n+\t\tcurl_http_proxy = xstrdup(proxy);\n+\n \tpragma_header = curl_slist_append(pragma_header, \"Pragma: no-cache\");\n \n #ifdef USE_CURL_MULTI\n@@ -315,6 +318,11 @@ void http_cleanup(void)\n \n \tcurl_slist_free_all(pragma_header);\n \tpragma_header = NULL;\n+\n+\tif (curl_http_proxy) {\n+\t\tfree(curl_http_proxy);\n+\t\tcurl_http_proxy = NULL;\n+\t}\n }\n \n struct active_request_slot *get_active_slot(void)\ndiff --git a/http.h b/http.h\nindex 9bab2c8..dcd5cea 100644\n--- a/http.h\n+++ b/http.h\n@@ -83,7 +83,7 @@ extern void add_fill_function(void *data, int (*fill)(void *));\n extern void step_active_slots(void);\n #endif\n \n-extern void http_init(void);\n+extern void http_init(const char *proxy);\n extern void http_cleanup(void);\n \n extern int data_received;\ndiff --git a/transport.c b/transport.c\nindex 397983d..26f0f02 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -442,7 +442,8 @@ static struct ref *get_refs_via_curl(struct transport *transport)\n \tstruct ref *last_ref = NULL;\n \n \tif (!transport->data)\n-\t\ttransport->data = get_http_walker(transport->url);\n+\t\ttransport->data = get_http_walker(transport->url,\n+\t\t\t\t\t\ttransport->remote->http_proxy);\n \n \trefs_url = xmalloc(strlen(transport->url) + 11);\n \tsprintf(refs_url, \"%s/info/refs\", transport->url);\n@@ -453,9 +454,6 @@ static struct ref *get_refs_via_curl(struct transport *transport)\n \tcurl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);\n \tcurl_easy_setopt(slot->curl, CURLOPT_URL, refs_url);\n \tcurl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, NULL);\n-\tif (transport->remote->http_proxy)\n-\t\tcurl_easy_setopt(slot->curl, CURLOPT_PROXY,\n-\t\t\t\t transport->remote->http_proxy);\n \n \tif (start_active_slot(slot)) {\n \t\trun_active_slot(slot);\n@@ -509,7 +507,8 @@ static int fetch_objs_via_curl(struct transport *transport,\n \t\t\t\t int nr_objs, struct ref **to_fetch)\n {\n \tif (!transport->data)\n-\t\ttransport->data = get_http_walker(transport->url);\n+\t\ttransport->data = get_http_walker(transport->url,\n+\t\t\t\t\t\ttransport->remote->http_proxy);\n \treturn fetch_objs_via_walker(transport, nr_objs, to_fetch);\n }\n \ndiff --git a/walker.h b/walker.h\nindex ea2c363..2cc448a 100644\n--- a/walker.h\n+++ b/walker.h\n@@ -32,6 +32,6 @@ int walker_fetch(struct walker *impl, int targets, char **target,\n \n void walker_free(struct walker *walker);\n \n-struct walker *get_http_walker(const char *url);\n+struct walker *get_http_walker(const char *url, const char *proxy);\n \n #endif /* WALKER_H */\n-- \n1.5.4.1.48.g0d77\n"},{"id":"70142","messageId":"7voda2us1z.fsf@gitster.siamese.dyndns.org","threadId":"12336","inReplyTo":"1204097780-29581-1-git-send-email-mh@glandium.org","subject":"Re: [PATCH] Set proxy override with http_init()","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-27T19:18:16Z","receivedAt":"2008-02-27T19:18:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mike Hommey <mh@glandium.org> writes:\n\n> In transport.c, proxy setting (the one from the remote conf) was set through\n> curl_easy_setopt() call, while http.c already does the same with the\n> http.proxy setting. We now just use this infrastructure instead, and make\n> http_init() now take the proxy url as argument.\n>\n> At the same time, we make get_http_walker() take a proxy argument too, and\n> pass it to http_init(), which makes remote defined proxy be used for more\n> than get_refs_via_curl().\n>\n> Signed-off-by: Mike Hommey <mh@glandium.org>\n> ---\n\nThanks.  I am kicking this to Daniel for a review ;-).\n"},{"id":"70153","messageId":"alpine.LNX.1.00.0802271454390.19665@iabervon.org","threadId":"12336","inReplyTo":"1204097780-29581-1-git-send-email-mh@glandium.org","subject":"Re: [PATCH] Set proxy override with http_init()","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-02-27T19:59:38Z","receivedAt":"2008-02-27T19:59:38Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Wed, 27 Feb 2008, Mike Hommey wrote:\n\n> In transport.c, proxy setting (the one from the remote conf) was set through\n> curl_easy_setopt() call, while http.c already does the same with the\n> http.proxy setting. We now just use this infrastructure instead, and make\n> http_init() now take the proxy url as argument.\n> \n> At the same time, we make get_http_walker() take a proxy argument too, and\n> pass it to http_init(), which makes remote defined proxy be used for more\n> than get_refs_via_curl().\n\nIt's a good idea, but maybe http_init() (and the call chain leading up to \nit) should take the struct remote, so that it can get anything else you \nmight also have there in the future? For that matter, is it intentional \nthat http-push ignore the proxy setting, which is equally available in \nhttp-push, but not used? If so, it should probably get a comment.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"70154","messageId":"20080227200551.GA6954@glandium.org","threadId":"12336","inReplyTo":"alpine.LNX.1.00.0802271454390.19665@iabervon.org","subject":"Re: [PATCH] Set proxy override with http_init()","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2008-02-27T20:05:51Z","receivedAt":"2008-02-27T20:05:51Z","isPatch":true,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"On Wed, Feb 27, 2008 at 02:59:38PM -0500, Daniel Barkalow wrote:\n> On Wed, 27 Feb 2008, Mike Hommey wrote:\n> \n> > In transport.c, proxy setting (the one from the remote conf) was set through\n> > curl_easy_setopt() call, while http.c already does the same with the\n> > http.proxy setting. We now just use this infrastructure instead, and make\n> > http_init() now take the proxy url as argument.\n> > \n> > At the same time, we make get_http_walker() take a proxy argument too, and\n> > pass it to http_init(), which makes remote defined proxy be used for more\n> > than get_refs_via_curl().\n> \n> It's a good idea, but maybe http_init() (and the call chain leading up to \n> it) should take the struct remote, so that it can get anything else you \n> might also have there in the future? For that matter, is it intentional \n> that http-push ignore the proxy setting, which is equally available in \n> http-push, but not used? If so, it should probably get a comment.\n\nIt is intentional, for the moment. I'll rework the patch to take the\nstruct remote, and add a comment.\n\nMike\n"},{"id":"70157","messageId":"1204144550-14175-1-git-send-email-mh@glandium.org","threadId":"12336","inReplyTo":"20080227200551.GA6954@glandium.org","subject":"[PATCH] Set proxy override with http_init()","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2008-02-27T20:35:50Z","receivedAt":"2008-02-27T20:35:50Z","isPatch":true,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"In transport.c, proxy setting (the one from the remote conf) was set through\ncurl_easy_setopt() call, while http.c already does the same with the\nhttp.proxy setting. We now just use this infrastructure instead, and make\nhttp_init() now take the struct remote as argument so that it can take the\nhttp_proxy setting from there, and any other property that would be added\nlater.\n\nAt the same time, we make get_http_walker() take a struct remote argument\ntoo, and pass it to http_init(), which makes remote defined proxy be used\nfor more than get_refs_via_curl().\n\nWe leave out http-fetch and http-push, which don't use remotes for the\nmoment, purposefully.\n\nSigned-off-by: Mike Hommey <mh@glandium.org>\n---\n\n > > It's a good idea, but maybe http_init() (and the call chain leading up to\n > > it) should take the struct remote, so that it can get anything else you\n > > might also have there in the future? For that matter, is it intentional\n > > that http-push ignore the proxy setting, which is equally available in\n > > http-push, but not used? If so, it should probably get a comment.\n > \n > It is intentional, for the moment. I'll rework the patch to take the\n > struct remote, and add a comment.\n\n And here you are. Changing const char * to struct remote * had the nice side\n effect to make me detect a missing change in builtin-http-fetch.c.\n\n builtin-http-fetch.c |    2 +-\n http-push.c          |    2 +-\n http-walker.c        |    4 ++--\n http.c               |   10 +++++++++-\n http.h               |    3 ++-\n transport.c          |    9 ++++-----\n walker.h             |    4 +++-\n 7 files changed, 22 insertions(+), 12 deletions(-)\n\ndiff --git a/builtin-http-fetch.c b/builtin-http-fetch.c\nindex 7f450c6..48128c6 100644\n--- a/builtin-http-fetch.c\n+++ b/builtin-http-fetch.c\n@@ -59,7 +59,7 @@ int cmd_http_fetch(int argc, const char **argv, const char *prefix)\n \t\turl = rewritten_url;\n \t}\n \n-\twalker = get_http_walker(url);\n+\twalker = get_http_walker(url, NULL);\n \twalker->get_tree = get_tree;\n \twalker->get_history = get_history;\n \twalker->get_all = get_all;\ndiff --git a/http-push.c b/http-push.c\nindex 0beb740..04e056d 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -2240,7 +2240,7 @@ int main(int argc, char **argv)\n \n \tmemset(remote_dir_exists, -1, 256);\n \n-\thttp_init();\n+\thttp_init(NULL);\n \n \tno_pragma_header = curl_slist_append(no_pragma_header, \"Pragma:\");\n \ndiff --git a/http-walker.c b/http-walker.c\nindex 2c37868..7bda34d 100644\n--- a/http-walker.c\n+++ b/http-walker.c\n@@ -902,13 +902,13 @@ static void cleanup(struct walker *walker)\n \tcurl_slist_free_all(data->no_pragma_header);\n }\n \n-struct walker *get_http_walker(const char *url)\n+struct walker *get_http_walker(const char *url, struct remote *remote)\n {\n \tchar *s;\n \tstruct walker_data *data = xmalloc(sizeof(struct walker_data));\n \tstruct walker *walker = xmalloc(sizeof(struct walker));\n \n-\thttp_init();\n+\thttp_init(remote);\n \n \tdata->no_pragma_header = curl_slist_append(NULL, \"Pragma:\");\n \ndiff --git a/http.c b/http.c\nindex 519621a..64c53cd 100644\n--- a/http.c\n+++ b/http.c\n@@ -219,13 +219,16 @@ static CURL* get_curl_handle(void)\n \treturn result;\n }\n \n-void http_init(void)\n+void http_init(struct remote *remote)\n {\n \tchar *low_speed_limit;\n \tchar *low_speed_time;\n \n \tcurl_global_init(CURL_GLOBAL_ALL);\n \n+\tif (remote && remote->http_proxy)\n+\t\tcurl_http_proxy = xstrdup(remote->http_proxy);\n+\n \tpragma_header = curl_slist_append(pragma_header, \"Pragma: no-cache\");\n \n #ifdef USE_CURL_MULTI\n@@ -315,6 +318,11 @@ void http_cleanup(void)\n \n \tcurl_slist_free_all(pragma_header);\n \tpragma_header = NULL;\n+\n+\tif (curl_http_proxy) {\n+\t\tfree(curl_http_proxy);\n+\t\tcurl_http_proxy = NULL;\n+\t}\n }\n \n struct active_request_slot *get_active_slot(void)\ndiff --git a/http.h b/http.h\nindex 9bab2c8..04169d5 100644\n--- a/http.h\n+++ b/http.h\n@@ -7,6 +7,7 @@\n #include <curl/easy.h>\n \n #include \"strbuf.h\"\n+#include \"remote.h\"\n \n /*\n  * We detect based on the cURL version if multi-transfer is\n@@ -83,7 +84,7 @@ extern void add_fill_function(void *data, int (*fill)(void *));\n extern void step_active_slots(void);\n #endif\n \n-extern void http_init(void);\n+extern void http_init(struct remote *remote);\n extern void http_cleanup(void);\n \n extern int data_received;\ndiff --git a/transport.c b/transport.c\nindex 397983d..86e0374 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -442,7 +442,8 @@ static struct ref *get_refs_via_curl(struct transport *transport)\n \tstruct ref *last_ref = NULL;\n \n \tif (!transport->data)\n-\t\ttransport->data = get_http_walker(transport->url);\n+\t\ttransport->data = get_http_walker(transport->url,\n+\t\t\t\t\t\ttransport->remote);\n \n \trefs_url = xmalloc(strlen(transport->url) + 11);\n \tsprintf(refs_url, \"%s/info/refs\", transport->url);\n@@ -453,9 +454,6 @@ static struct ref *get_refs_via_curl(struct transport *transport)\n \tcurl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);\n \tcurl_easy_setopt(slot->curl, CURLOPT_URL, refs_url);\n \tcurl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, NULL);\n-\tif (transport->remote->http_proxy)\n-\t\tcurl_easy_setopt(slot->curl, CURLOPT_PROXY,\n-\t\t\t\t transport->remote->http_proxy);\n \n \tif (start_active_slot(slot)) {\n \t\trun_active_slot(slot);\n@@ -509,7 +507,8 @@ static int fetch_objs_via_curl(struct transport *transport,\n \t\t\t\t int nr_objs, struct ref **to_fetch)\n {\n \tif (!transport->data)\n-\t\ttransport->data = get_http_walker(transport->url);\n+\t\ttransport->data = get_http_walker(transport->url,\n+\t\t\t\t\t\ttransport->remote);\n \treturn fetch_objs_via_walker(transport, nr_objs, to_fetch);\n }\n \ndiff --git a/walker.h b/walker.h\nindex ea2c363..e1d40de 100644\n--- a/walker.h\n+++ b/walker.h\n@@ -1,6 +1,8 @@\n #ifndef WALKER_H\n #define WALKER_H\n \n+#include \"remote.h\"\n+\n struct walker {\n \tvoid *data;\n \tint (*fetch_ref)(struct walker *, char *ref, unsigned char *sha1);\n@@ -32,6 +34,6 @@ int walker_fetch(struct walker *impl, int targets, char **target,\n \n void walker_free(struct walker *walker);\n \n-struct walker *get_http_walker(const char *url);\n+struct walker *get_http_walker(const char *url, struct remote *remote);\n \n #endif /* WALKER_H */\n-- \n1.5.4.3.195.g48d21.dirty\n"},{"id":"70158","messageId":"alpine.LNX.1.00.0802271538200.19665@iabervon.org","threadId":"12336","inReplyTo":"1204144550-14175-1-git-send-email-mh@glandium.org","subject":"Re: [PATCH] Set proxy override with http_init()","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-02-27T20:39:14Z","receivedAt":"2008-02-27T20:39:14Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Wed, 27 Feb 2008, Mike Hommey wrote:\n\n> In transport.c, proxy setting (the one from the remote conf) was set through\n> curl_easy_setopt() call, while http.c already does the same with the\n> http.proxy setting. We now just use this infrastructure instead, and make\n> http_init() now take the struct remote as argument so that it can take the\n> http_proxy setting from there, and any other property that would be added\n> later.\n> \n> At the same time, we make get_http_walker() take a struct remote argument\n> too, and pass it to http_init(), which makes remote defined proxy be used\n> for more than get_refs_via_curl().\n> \n> We leave out http-fetch and http-push, which don't use remotes for the\n> moment, purposefully.\n> \n> Signed-off-by: Mike Hommey <mh@glandium.org>\n\nAcked-by: Daniel Barkalow <barkalow@iabervon.org>\n\n\t-Daniel\n*This .sig left intentionally blank*\n"}]}