{"thread":{"id":"2041","subject":"[PATCH] Set the parallel HTTP request limit via an environment variable","startedAt":"2005-10-07T15:59:54Z","lastAt":"2005-10-07T15:59:54Z","messageCount":1,"participants":["Nick Hengeveld"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"9797","messageId":"20051007155954.GJ15593@reactrix.com","threadId":"2041","inReplyTo":null,"subject":"[PATCH] Set the parallel HTTP request limit via an environment variable","fromName":"Nick Hengeveld","fromEmail":"nickh@reactrix.com","sentAt":"2005-10-07T15:59:54Z","receivedAt":"2005-10-07T15:59:54Z","isPatch":true,"sender":{"key":"nickh@reactrix.com","avatar":null},"body":"Use an environment variable rather than a command-line argument to set the\nparallel HTTP request limit.  This allows the setting to work whether\ngit-http-fetch is run directly or via git-fetch.\n\nSigned-off-by: Nick Hengeveld <nickh@reactrix.com>\n\n\n---\n\n http-fetch.c |   17 ++++++-----------\n 1 files changed, 6 insertions(+), 11 deletions(-)\n\na508fd4ba7300476e6ad029fca10371ca869af1e\ndiff --git a/http-fetch.c b/http-fetch.c\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -1034,22 +1034,11 @@ int main(int argc, char **argv)\n \t\t\targ++;\n \t\t} else if (!strcmp(argv[arg], \"--recover\")) {\n \t\t\tget_recover = 1;\n-#ifdef USE_CURL_MULTI\n-\t\t} else if (argv[arg][1] == 'r') {\n-\t\t\tmax_requests = atoi(argv[arg + 1]);\n-\t\t\tif (max_requests < 1)\n-\t\t\t\tmax_requests = DEFAULT_MAX_REQUESTS;\n-\t\t\targ++;\n-#endif\n \t\t}\n \t\targ++;\n \t}\n \tif (argc < arg + 2) {\n-#ifdef USE_CURL_MULTI\n-\t\tusage(\"git-http-fetch [-c] [-t] [-a] [-d] [-v] [-r concurrent-request-limit] [--recover] [-w ref] commit-id url\");\n-#else\n \t\tusage(\"git-http-fetch [-c] [-t] [-a] [-d] [-v] [--recover] [-w ref] commit-id url\");\n-#endif\n \t\treturn 1;\n \t}\n \tcommit_id = argv[arg];\n@@ -1058,6 +1047,12 @@ int main(int argc, char **argv)\n \tcurl_global_init(CURL_GLOBAL_ALL);\n \n #ifdef USE_CURL_MULTI\n+\tchar *http_max_requests = getenv(\"GIT_HTTP_MAX_REQUESTS\");\n+\tif (http_max_requests != NULL)\n+\t\tmax_requests = atoi(http_max_requests);\n+\tif (max_requests < 1)\n+\t\tmax_requests = DEFAULT_MAX_REQUESTS;\n+\n \tcurlm = curl_multi_init();\n \tif (curlm == NULL) {\n \t\tfprintf(stderr, \"Error creating curl multi handle.\\n\");\n"}]}