{"thread":{"id":"11676","subject":"[PATCH] http-push and http-fetch: handle URLs without leading /","startedAt":"2008-01-19T15:22:47Z","lastAt":"2008-01-21T10:19:04Z","messageCount":13,"participants":["Grégoire Barbier","Mike Hommey","Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"65973","messageId":"1200756171-11696-1-git-send-email-gb@gbarbier.org","threadId":"11676","inReplyTo":null,"subject":"[PATCH] http-push: fix webdav lock leak.","fromName":"Grégoire Barbier","fromEmail":"gb@gbarbier.org","sentAt":"2008-01-19T15:22:47Z","receivedAt":"2008-01-19T15:22:47Z","isPatch":true,"sender":{"key":"gb@gbarbier.org","avatar":null},"body":"Releasing webdav lock even if push fails because of bad (or no) reference\non command line.\n\nTo reproduce the issue that this patch fixes, you need a test git repository\navaillable over http+webdav, let's say at http://myhost/myrepo.git/\nThen, you do this:\n$ git clone http://myhost/myrepo.git/\n$ cd myrepo\n$ git push http\nFetching remote heads...\n  refs/\n  refs/heads/\n  refs/tags/\nNo refs in common and none specified; doing nothing.\n$ git push http\nFetching remote heads...\n  refs/\n  refs/heads/\n  refs/tags/\nNo refs in common and none specified; doing nothing.\n$\n\nFinally, you look at the web server logs, and will find one LOCK query and no\nUNLOCK query, of course the second one will be in 423 return code instead of\n200:\n1.2.3.4 - gb [19/Jan/2008:14:24:56 +0100] \"LOCK /myrepo.git/info/refs HTTP/1.1\" 200 465\n(...)\n1.2.3.4 - gb [19/Jan/2008:14:25:10 +0100] \"LOCK /myrepo.git/info/refs HTTP/1.1\" 423 363\n\nWith this patch, there would have be two UNLOCKs in addition of the LOCKs\n\nFrom the user point of view:\n- If you realize that you should have typed e.g. \"git push http master\"\ninstead of \"git push http\", you will have to wait for 10 minutes for the lock\nto expire by its own.\n- Furthermore, if somebody else is dumb enough to type \"git push http\" while\nyou need to push \"master\" branch, then you'll need too to wait for 10 minutes\ntoo.\n\nSigned-off-by: Grégoire Barbier <gb@gbarbier.org>\n---\n http-push.c |   13 ++++++++-----\n 1 files changed, 8 insertions(+), 5 deletions(-)\n\ndiff --git a/http-push.c b/http-push.c\nindex eef7674..2c4e91d 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -2264,11 +2264,14 @@ int main(int argc, char **argv)\n \tif (!remote_tail)\n \t\tremote_tail = &remote_refs;\n \tif (match_refs(local_refs, remote_refs, &remote_tail,\n-\t\t       nr_refspec, (const char **) refspec, push_all))\n-\t\treturn -1;\n+\t\t       nr_refspec, (const char **) refspec, push_all)) {\n+\t\trc = -1;\n+\t\tgoto cleanup;\n+\t}\n \tif (!remote_refs) {\n \t\tfprintf(stderr, \"No refs in common and none specified; doing nothing.\\n\");\n-\t\treturn 0;\n+\t\trc = 0;\n+\t\tgoto cleanup;\n \t}\n \n \tnew_refs = 0;\n@@ -2399,10 +2402,10 @@ int main(int argc, char **argv)\n \t\t\tfprintf(stderr, \"Unable to update server info\\n\");\n \t\t}\n \t}\n-\tif (info_ref_lock)\n-\t\tunlock_remote(info_ref_lock);\n \n  cleanup:\n+\tif (info_ref_lock)\n+\t\tunlock_remote(info_ref_lock);\n \tfree(remote);\n \n \tcurl_slist_free_all(no_pragma_header);\n-- \n1.5.4.rc3.52.g9a5bd-dirty\n"},{"id":"65971","messageId":"1200756171-11696-2-git-send-email-gb@gbarbier.org","threadId":"11676","inReplyTo":"1200756171-11696-1-git-send-email-gb@gbarbier.org","subject":"[PATCH] http-push: fail when info/refs exists and is already locked","fromName":"Grégoire Barbier","fromEmail":"gb@gbarbier.org","sentAt":"2008-01-19T15:22:48Z","receivedAt":"2008-01-19T15:22:48Z","isPatch":true,"sender":{"key":"gb@gbarbier.org","avatar":null},"body":"Rationale:\n\nFailing instead of silently not updating remote refs makes the things cleare\nfor the user when trying to push on a repository while another person do (or\nwhile a dandling locks are waiting for a 10 minutes timeout).\n\nWhen silently not updating remote refs, the user does not even know that git\nhas pushed the objects but leaved the refs as they were before (e.g. a new\nbunch of commits on branch \"master\" is uploaded, however the branch by itsel\nstill points on the previous head commit).\n---\n http-push.c |    5 +++++\n 1 files changed, 5 insertions(+), 0 deletions(-)\n\ndiff --git a/http-push.c b/http-push.c\nindex 2c4e91d..e1984d3 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -2243,6 +2243,11 @@ int main(int argc, char **argv)\n \t\tinfo_ref_lock = lock_remote(\"info/refs\", LOCK_TIME);\n \t\tif (info_ref_lock)\n \t\t\tremote->can_update_info_refs = 1;\n+\t\telse {\n+\t\t\tfprintf(stderr, \"Error: cannot lock existing info/refs\\n\");\n+\t\t\trc = 1;\n+\t\t\tgoto cleanup;\n+\t\t}\n \t}\n \tif (remote->has_info_packs)\n \t\tfetch_indices();\n-- \n1.5.4.rc3.52.g9a5bd-dirty\n"},{"id":"65975","messageId":"1200756171-11696-3-git-send-email-gb@gbarbier.org","threadId":"11676","inReplyTo":"1200756171-11696-2-git-send-email-gb@gbarbier.org","subject":"[PATCH] http-push: more explicit error message with bad URL or password","fromName":"Grégoire Barbier","fromEmail":"gb@gbarbier.org","sentAt":"2008-01-19T15:22:49Z","receivedAt":"2008-01-19T15:22:49Z","isPatch":true,"sender":{"key":"gb@gbarbier.org","avatar":null},"body":"Previously, when URL or password where not set correctly (or when some network\nerrors occur), the error message was \"no DAV locking support\".\n---\n http-push.c |    6 ++++++\n http.c      |   25 +++++++++++++++++++++++++\n http.h      |    1 +\n 3 files changed, 32 insertions(+), 0 deletions(-)\n\ndiff --git a/http-push.c b/http-push.c\nindex e1984d3..c984d84 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -2228,6 +2228,12 @@ int main(int argc, char **argv)\n \n \tno_pragma_header = curl_slist_append(no_pragma_header, \"Pragma:\");\n \n+\tif (!http_test_connection(remote->url)) {\n+\t\tfprintf(stderr, \"Error: cannot access to remote URL (maybe malformed URL, network error or bad credentials)\\n\");\n+\t\trc = 1;\n+\t\tgoto cleanup;\n+\t}\n+\n \t/* Verify DAV compliance/lock support */\n \tif (!locking_available()) {\n \t\tfprintf(stderr, \"Error: no DAV locking support on remote repo %s\\n\", remote->url);\ndiff --git a/http.c b/http.c\nindex d2c11ae..8b04ae9 100644\n--- a/http.c\n+++ b/http.c\n@@ -634,3 +634,28 @@ int http_fetch_ref(const char *base, const char *ref, unsigned char *sha1)\n \tfree(url);\n \treturn ret;\n }\n+\n+int http_test_connection(const char *url)\n+{\n+\tstruct strbuf buffer = STRBUF_INIT;\n+\tstruct active_request_slot *slot;\n+\tstruct slot_results results;\n+\tint ret = 0;\n+\n+\tslot = get_active_slot();\n+\tslot->results = &results;\n+\tcurl_easy_setopt(slot->curl, CURLOPT_FILE, &buffer);\n+\tcurl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);\n+\tcurl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, NULL);\n+\tcurl_easy_setopt(slot->curl, CURLOPT_URL, url);\n+\tif (start_active_slot(slot)) {\n+\t\trun_active_slot(slot);\n+\t\tif (results.curl_result == CURLE_OK)\n+\t\t\tret = -1;\n+\t\telse\n+\t\t\terror(\"Cannot access to URL %s, return code %d\", url, results.curl_result);\n+\t} else\n+\t\terror(\"Unable to start request\");\n+\tstrbuf_release(&buffer);\n+\treturn ret;\n+}\ndiff --git a/http.h b/http.h\nindex aeba930..b353007 100644\n--- a/http.h\n+++ b/http.h\n@@ -77,6 +77,7 @@ extern void step_active_slots(void);\n \n extern void http_init(void);\n extern void http_cleanup(void);\n+extern int http_test_connection(const char *url);\n \n extern int data_received;\n extern int active_requests;\n-- \n1.5.4.rc3.52.g9a5bd-dirty\n"},{"id":"65970","messageId":"1200756171-11696-4-git-send-email-gb@gbarbier.org","threadId":"11676","inReplyTo":"1200756171-11696-3-git-send-email-gb@gbarbier.org","subject":"[PATCH] http-push and http-fetch: handle URLs without leading /","fromName":"Grégoire Barbier","fromEmail":"gb@gbarbier.org","sentAt":"2008-01-19T15:22:50Z","receivedAt":"2008-01-19T15:22:50Z","isPatch":true,"sender":{"key":"gb@gbarbier.org","avatar":null},"body":"Since HTTP/302 is not handled in the git code calling curl, URLs without\nleading / used to lead to frozen git-fetch or git-push with no error message.\n\nFurthermore, http-push freeze forces the user to interrupt it (^C) and\ntherefore to leave a dandling webdav lock that makes the remote repository\nun-pushable for 10 minutes.\n\nThe patch does not make curl calls handle HTTP/302 but instead adds a / at\nthe end of URLs that does not have it yet.\n---\n builtin-http-fetch.c |   10 ++++++++++\n http-push.c          |   11 +++++++++++\n 2 files changed, 21 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-http-fetch.c b/builtin-http-fetch.c\nindex 4a50dbd..3c1ed08 100644\n--- a/builtin-http-fetch.c\n+++ b/builtin-http-fetch.c\n@@ -9,6 +9,7 @@ int cmd_http_fetch(int argc, const char **argv, const char *prefix)\n \tconst char **write_ref = NULL;\n \tchar **commit_id;\n \tconst char *url;\n+\tchar *rewritten_url = NULL;\n \tint arg = 1;\n \tint rc = 0;\n \tint get_tree = 0;\n@@ -51,6 +52,12 @@ int cmd_http_fetch(int argc, const char **argv, const char *prefix)\n \t\tcommits = 1;\n \t}\n \turl = argv[arg];\n+        if (url && url[strlen(url)-1] != '/') {\n+                rewritten_url = malloc(strlen(url)+2);\n+                strcpy(rewritten_url, url);\n+                strcat(rewritten_url, \"/\");\n+                url = rewritten_url;\n+        }\n \n \twalker = get_http_walker(url);\n \twalker->get_tree = get_tree;\n@@ -73,5 +80,8 @@ int cmd_http_fetch(int argc, const char **argv, const char *prefix)\n \n \twalker_free(walker);\n \n+\tif (rewritten_url)\n+\t\tfree(rewritten_url);\n+\n \treturn rc;\n }\ndiff --git a/http-push.c b/http-push.c\nindex c984d84..2c27105 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -2161,6 +2161,7 @@ int main(int argc, char **argv)\n \tint i;\n \tint new_refs;\n \tstruct ref *ref;\n+\tchar *rewritten_url = NULL;\n \n \tsetup_git_directory();\n \n@@ -2228,6 +2229,14 @@ int main(int argc, char **argv)\n \n \tno_pragma_header = curl_slist_append(no_pragma_header, \"Pragma:\");\n \n+\tif (remote->url && remote->url[strlen(remote->url)-1] != '/') {\n+\t\trewritten_url = malloc(strlen(remote->url)+2);\n+\t\tstrcpy(rewritten_url, remote->url);\n+\t\tstrcat(rewritten_url, \"/\");\n+\t\tremote->url = rewritten_url;\n+\t\t++remote->path_len;\n+\t}\n+\n \tif (!http_test_connection(remote->url)) {\n \t\tfprintf(stderr, \"Error: cannot access to remote URL (maybe malformed URL, network error or bad credentials)\\n\");\n \t\trc = 1;\n@@ -2415,6 +2424,8 @@ int main(int argc, char **argv)\n \t}\n \n  cleanup:\n+\tif (rewritten_url)\n+\t\tfree(rewritten_url);\n \tif (info_ref_lock)\n \t\tunlock_remote(info_ref_lock);\n \tfree(remote);\n-- \n1.5.4.rc3.52.g9a5bd-dirty\n"},{"id":"65972","messageId":"1200756171-11696-5-git-send-email-gb@gbarbier.org","threadId":"11676","inReplyTo":"1200756171-11696-4-git-send-email-gb@gbarbier.org","subject":"[PATCH] added #define DEFAULT_MAX_REQUESTS for USE_CURL_MULTI mode","fromName":"Grégoire Barbier","fromEmail":"gb@gbarbier.org","sentAt":"2008-01-19T15:22:51Z","receivedAt":"2008-01-19T15:22:51Z","isPatch":true,"sender":{"key":"gb@gbarbier.org","avatar":null},"body":"From: Gregoire Barbier <gb@gbarbier.org>\n\nI'm not sure of which value is the good one, but 4 seems good since it's\nnot very high which would lead to resouce consumption problems.\n---\n http.c |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/http.c b/http.c\nindex 8b04ae9..7b1bcb8 100644\n--- a/http.c\n+++ b/http.c\n@@ -4,6 +4,7 @@ int data_received;\n int active_requests = 0;\n \n #ifdef USE_CURL_MULTI\n+#define DEFAULT_MAX_REQUESTS 4\n static int max_requests = -1;\n static CURLM *curlm;\n #endif\n-- \n1.5.4.rc3.52.g9a5bd-dirty\n"},{"id":"65977","messageId":"20080119152947.GA26553@glandium.org","threadId":"11676","inReplyTo":"1200756171-11696-4-git-send-email-gb@gbarbier.org","subject":"Re: [PATCH] http-push and http-fetch: handle URLs without leading /","fromName":"Mike Hommey","fromEmail":"mh@glandium.org","sentAt":"2008-01-19T15:29:48Z","receivedAt":"2008-01-19T15:29:48Z","isPatch":true,"sender":{"key":"mh@glandium.org","avatar":"https://avatars.githubusercontent.com/u/1038527?v=4"},"body":"On Sat, Jan 19, 2008 at 04:22:50PM +0100, Grégoire Barbier wrote:\n> Since HTTP/302 is not handled in the git code calling curl, URLs without\n> leading / used to lead to frozen git-fetch or git-push with no error message.\n> \n> Furthermore, http-push freeze forces the user to interrupt it (^C) and\n> therefore to leave a dandling webdav lock that makes the remote repository\n> un-pushable for 10 minutes.\n> \n> The patch does not make curl calls handle HTTP/302 but instead adds a / at\n> the end of URLs that does not have it yet.\n\nActually, it would be much better to do just that, i.e. handle HTTP 302\nreturn codes. I suspect there may be other cases leading to similar dead\nlocks with other HTTP codes. But that might just be easier to deal with\nonce my refactoring will be done ;)\n\nMike\n"},{"id":"65997","messageId":"alpine.LSU.1.00.0801192302340.5731@racer.site","threadId":"11676","inReplyTo":"1200756171-11696-1-git-send-email-gb@gbarbier.org","subject":"Re: [PATCH] http-push: fix webdav lock leak.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-01-19T23:08:42Z","receivedAt":"2008-01-19T23:08:42Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 19 Jan 2008, Grégoire Barbier wrote:\n\n> diff --git a/http-push.c b/http-push.c\n> index eef7674..2c4e91d 100644\n> --- a/http-push.c\n> +++ b/http-push.c\n> @@ -2264,11 +2264,14 @@ int main(int argc, char **argv)\n>  \tif (!remote_tail)\n>  \t\tremote_tail = &remote_refs;\n>  \tif (match_refs(local_refs, remote_refs, &remote_tail,\n> -\t\t       nr_refspec, (const char **) refspec, push_all))\n> -\t\treturn -1;\n> +\t\t       nr_refspec, (const char **) refspec, push_all)) {\n> +\t\trc = -1;\n> +\t\tgoto cleanup;\n> +\t}\n>  \tif (!remote_refs) {\n>  \t\tfprintf(stderr, \"No refs in common and none specified; doing nothing.\\n\");\n> -\t\treturn 0;\n> +\t\trc = 0;\n> +\t\tgoto cleanup;\n>  \t}\n>  \n>  \tnew_refs = 0;\n> @@ -2399,10 +2402,10 @@ int main(int argc, char **argv)\n>  \t\t\tfprintf(stderr, \"Unable to update server info\\n\");\n>  \t\t}\n>  \t}\n> -\tif (info_ref_lock)\n> -\t\tunlock_remote(info_ref_lock);\n>  \n>   cleanup:\n> +\tif (info_ref_lock)\n> +\t\tunlock_remote(info_ref_lock);\n>  \tfree(remote);\n\nThis late in the rc cycle, together with my unfamiliarity of the code and \nthe code paths in http.c and http-push.c would make me feel _much_ better \nif you could insert the \"if (info_ref_lock)\" before the returns, instead \nof replacing the returns with \"goto cleanup\"s...\n\nThanks,\nDscho\n"},{"id":"65998","messageId":"alpine.LSU.1.00.0801192310290.5731@racer.site","threadId":"11676","inReplyTo":"1200756171-11696-4-git-send-email-gb@gbarbier.org","subject":"Re: [PATCH] http-push and http-fetch: handle URLs without leading /","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-01-19T23:14:51Z","receivedAt":"2008-01-19T23:14:51Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 19 Jan 2008, Grégoire Barbier wrote:\n\n> Since HTTP/302 is not handled in the git code calling curl, URLs without\n> leading / used to lead to frozen git-fetch or git-push with no error message.\n\nJFYI these lines are a little bit too long; I would like to see them \nunwrapped with a 4-space indent on a 80-column display.\n\nI am not sure how easily Junio can fix them.\n\n\n> @@ -51,6 +52,12 @@ int cmd_http_fetch(int argc, const char **argv, const char *prefix)\n>  \t\tcommits = 1;\n>  \t}\n>  \turl = argv[arg];\n> +        if (url && url[strlen(url)-1] != '/') {\n> +                rewritten_url = malloc(strlen(url)+2);\n> +                strcpy(rewritten_url, url);\n> +                strcat(rewritten_url, \"/\");\n> +                url = rewritten_url;\n> +        }\n>  \n>  \twalker = get_http_walker(url);\n>  \twalker->get_tree = get_tree;\n\nPlease use strbuf, like so:\n\n\tstruct strbuf rewritten_url = STRBUF_INIT;\n\n\t...\n\turl = argv[arg];\n        if (url && url[strlen(url)-1] != '/') {\n\t\tstrbuf_addstr(&rewritten_url, url);\n\t\tstrbuf_addch(&rewritten_url, '/');\n\t\turl = rewritten_url.buf;\n\t}\n\t...\n\tstrbuf_release(&rewritten_url);\n\t\nBTW it seems you indented using spaces, but we like the indentation as \ntabs in git.git.\n\nOther than that, I like your patch!\n\nThanks,\nDscho\n"},{"id":"65999","messageId":"alpine.LSU.1.00.0801192315260.5731@racer.site","threadId":"11676","inReplyTo":"20080119152947.GA26553@glandium.org","subject":"Re: [PATCH] http-push and http-fetch: handle URLs without leading /","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-01-19T23:16:00Z","receivedAt":"2008-01-19T23:16:00Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 19 Jan 2008, Mike Hommey wrote:\n\n> On Sat, Jan 19, 2008 at 04:22:50PM +0100, Grégoire Barbier wrote:\n> > Since HTTP/302 is not handled in the git code calling curl, URLs \n> > without leading / used to lead to frozen git-fetch or git-push with no \n> > error message.\n> > \n> > Furthermore, http-push freeze forces the user to interrupt it (^C) and \n> > therefore to leave a dandling webdav lock that makes the remote \n> > repository un-pushable for 10 minutes.\n> > \n> > The patch does not make curl calls handle HTTP/302 but instead adds a \n> > / at the end of URLs that does not have it yet.\n> \n> Actually, it would be much better to do just that, i.e. handle HTTP 302 \n> return codes. I suspect there may be other cases leading to similar dead \n> locks with other HTTP codes. But that might just be easier to deal with \n> once my refactoring will be done ;)\n\nIndependently, it seems a good idea to not try a URL we _know_ will fail \n(read: redirect).\n\nCiao,\nDscho\n"},{"id":"66059","messageId":"7v63xo6r15.fsf@gitster.siamese.dyndns.org","threadId":"11676","inReplyTo":"1200756171-11696-3-git-send-email-gb@gbarbier.org","subject":"Re: [PATCH] http-push: more explicit error message with bad URL or password","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-20T23:00:54Z","receivedAt":"2008-01-20T23:00:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Grégoire Barbier <gb@gbarbier.org> writes:\n\n> Previously, when URL or password where not set correctly (or\n> when some network errors occur), the error message was \"no DAV\n> locking support\".\n\nThe standard \"Sign-off?\" comment aside,...\n\nI think something like this would be much less invasive and more\nto the point.\n\n-- >8 --\nhttp-push: clarify the reason of error from the initial PROPFIND request\n\nThe first thing http-push does is a PROPFIND to see if the other\nend supports locking.  The failure message we give is always\nreported as \"no DAV locking support at the remote repository\",\nregardless of the reason why we ended up not finding the locking\nsupport on the other end.\n\nThis moves the code to report \"no DAV locking support\" down the\ncodepath so that the message is issued only when we successfully\nget a response to PROPFIND and the other end say it does not\nsupport locking.  Other failures, such as connectivity glitches\nand credential mismatches, have their own error message issued\nand we will not issue \"no DAV locking\" error (we do not even\nknow if the remote end supports it).\n\n---\n\n http-push.c |   11 +++++++++--\n 1 files changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/http-push.c b/http-push.c\nindex eef7674..9f92cc1 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -1563,9 +1563,17 @@ static int locking_available(void)\n \t\t\t\tlock_flags = 0;\n \t\t\t}\n \t\t\tXML_ParserFree(parser);\n+\t\t\tif (!lock_flags)\n+\t\t\t\terror(\"Error: no DAV locking support on %s\",\n+\t\t\t\t      remote->url);\n+\n+\t\t} else {\n+\t\t\terror(\"Cannot access URL %s, return code %d\",\n+\t\t\t      remote->url, results.curl_result);\n+\t\t\tlock_flags = 0;\n \t\t}\n \t} else {\n-\t\tfprintf(stderr, \"Unable to start PROPFIND request\\n\");\n+\t\terror(\"Unable to start PROPFIND request on %s\", remote->url);\n \t}\n \n \tstrbuf_release(&out_buffer.buf);\n@@ -2230,7 +2238,6 @@ int main(int argc, char **argv)\n \n \t/* Verify DAV compliance/lock support */\n \tif (!locking_available()) {\n-\t\tfprintf(stderr, \"Error: no DAV locking support on remote repo %s\\n\", remote->url);\n \t\trc = 1;\n \t\tgoto cleanup;\n \t}\n"},{"id":"66062","messageId":"7v1w8c6nnm.fsf@gitster.siamese.dyndns.org","threadId":"11676","inReplyTo":"1200756171-11696-5-git-send-email-gb@gbarbier.org","subject":"Re: [PATCH] added #define DEFAULT_MAX_REQUESTS for USE_CURL_MULTI mode","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-21T00:13:49Z","receivedAt":"2008-01-21T00:13:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Grégoire Barbier <gb@gbarbier.org> writes:\n\n> From: Gregoire Barbier <gb@gbarbier.org>\n>\n> I'm not sure of which value is the good one, but 4 seems good since it's\n> not very high which would lead to resouce consumption problems.\n> ---\n>  http.c |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>\n> diff --git a/http.c b/http.c\n> index 8b04ae9..7b1bcb8 100644\n> --- a/http.c\n> +++ b/http.c\n> @@ -4,6 +4,7 @@ int data_received;\n>  int active_requests = 0;\n>  \n>  #ifdef USE_CURL_MULTI\n> +#define DEFAULT_MAX_REQUESTS 4\n>  static int max_requests = -1;\n>  static CURLM *curlm;\n>  #endif\n\nWhy is this needed?\n\nHow does this interact with an existing #define in http.h that\ndefines it to 5?\n"},{"id":"66106","messageId":"47946C95.4080607@gbarbier.org","threadId":"11676","inReplyTo":"7v1w8c6nnm.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] added #define DEFAULT_MAX_REQUESTS for USE_CURL_MULTI mode","fromName":"Grégoire Barbier","fromEmail":"gb@gbarbier.org","sentAt":"2008-01-21T09:57:41Z","receivedAt":"2008-01-21T09:57:41Z","isPatch":true,"sender":{"key":"gb@gbarbier.org","avatar":null},"body":"Junio C Hamano a écrit :\n> Grégoire Barbier <gb@gbarbier.org> writes:\n>   \n>> From: Gregoire Barbier <gb@gbarbier.org>\n>>\n>> I'm not sure of which value is the good one, but 4 seems good since it's\n>> not very high which would lead to resouce consumption problems.\n>> ---\n>>  http.c |    1 +\n>>  1 files changed, 1 insertions(+), 0 deletions(-)\n>>\n>> diff --git a/http.c b/http.c\n>> index 8b04ae9..7b1bcb8 100644\n>> --- a/http.c\n>> +++ b/http.c\n>> @@ -4,6 +4,7 @@ int data_received;\n>>  int active_requests = 0;\n>>  \n>>  #ifdef USE_CURL_MULTI\n>> +#define DEFAULT_MAX_REQUESTS 4\n>>  static int max_requests = -1;\n>>  static CURLM *curlm;\n>>  #endif\n>>     \n>\n> Why is this needed?\n>\n> How does this interact with an existing #define in http.h that\n> defines it to 5?\n>   \n\nOk, please forget my patch and forgive my stupidity, I've juste realized \nwhy I needed to define -DUSE_CURL_MULTI by hand in the Makefile, I'm so \nstupid...\n\nI will answers you other mail and Johannes' later.\n\n-- \nGrégoire Barbier - gb à gbarbier.org - +33 6 21 35 73 49\n"},{"id":"66111","messageId":"7vr6gbzdk7.fsf@gitster.siamese.dyndns.org","threadId":"11676","inReplyTo":"47946C95.4080607@gbarbier.org","subject":"Re: [PATCH] added #define DEFAULT_MAX_REQUESTS for USE_CURL_MULTI mode","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-21T10:19:04Z","receivedAt":"2008-01-21T10:19:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Grégoire Barbier <gb@gbarbier.org> writes:\n\n> Ok, please forget my patch and forgive my stupidity, I've juste\n> realized why I needed to define -DUSE_CURL_MULTI by hand in the\n> Makefile, I'm so stupid...\n\nNo, it is not your stupidity.\n\nThe http.h and http-*.c files assume that USE_CURL_MULTI is\ninternal and do not want the user to define that symbol from\noutside.  It should be better documented and mistakes should be\nprevented.\n\nPerhaps we need something like like this.\n\n\ndiff --git a/http.h b/http.h\nindex aeba930..046b17f 100644\n--- a/http.h\n+++ b/http.h\n@@ -8,6 +8,12 @@\n \n #include \"strbuf.h\"\n \n+/*\n+ * We detect based on the cURL version if multi-transfer is\n+ * usable in this implementation and define this symbol accordingly.\n+ */\n+#undef USE_CURL_MULTI\n+\n #if LIBCURL_VERSION_NUM >= 0x071000\n #define USE_CURL_MULTI\n #define DEFAULT_MAX_REQUESTS 5\n"}]}