{"thread":{"id":"5745","subject":"[PATCH] http/ftp: optionally ask curl to not use EPSV command","startedAt":"2006-09-28T19:26:05Z","lastAt":"2006-10-03T09:11:08Z","messageCount":5,"participants":["Sasha Khapyorsky","Junio C Hamano","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"27924","messageId":"20060928192605.GD10617@sashak.voltaire.com","threadId":"5745","inReplyTo":null,"subject":"[PATCH] http/ftp: optionally ask curl to not use EPSV command","fromName":"Sasha Khapyorsky","fromEmail":"sashak@voltaire.com","sentAt":"2006-09-28T19:26:05Z","receivedAt":"2006-09-28T19:26:05Z","isPatch":true,"sender":{"key":"sashak@voltaire.com","avatar":null},"body":"If GIT_CURL_FTP_NO_EPSV environment variable is defined, disable using\nof EPSV ftp command (PASV will be used instead). This is helpful with\nsome \"poor\" ftp servers which doesn't support EPSV mode.\n\nSigned-off-by: Sasha Khapyorsky <sashak@voltaire.com>\n---\n http.c |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/http.c b/http.c\nindex 6c1937b..a966e6d 100644\n--- a/http.c\n+++ b/http.c\n@@ -196,6 +196,9 @@ #endif\n \n \tcurl_easy_setopt(result, CURLOPT_USERAGENT, GIT_USER_AGENT);\n \n+\tif (getenv(\"GIT_CURL_FTP_NO_EPSV\"))\n+\t\tcurl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);\n+\n \treturn result;\n }\n \n-- \n1.4.2.1\n"},{"id":"27935","messageId":"7vejtvu1ja.fsf@assigned-by-dhcp.cox.net","threadId":"5745","inReplyTo":"20060928192605.GD10617@sashak.voltaire.com","subject":"Re: [PATCH] http/ftp: optionally ask curl to not use EPSV command","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-28T21:25:13Z","receivedAt":"2006-09-28T21:25:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sasha Khapyorsky <sashak@voltaire.com> writes:\n\n> If GIT_CURL_FTP_NO_EPSV environment variable is defined, disable using\n> of EPSV ftp command (PASV will be used instead). This is helpful with\n> some \"poor\" ftp servers which doesn't support EPSV mode.\n>\n> Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>\n> ---\n>  http.c |    3 +++\n>  1 files changed, 3 insertions(+), 0 deletions(-)\n>\n> diff --git a/http.c b/http.c\n> index 6c1937b..a966e6d 100644\n> --- a/http.c\n> +++ b/http.c\n> @@ -196,6 +196,9 @@ #endif\n>  \n>  \tcurl_easy_setopt(result, CURLOPT_USERAGENT, GIT_USER_AGENT);\n>  \n> +\tif (getenv(\"GIT_CURL_FTP_NO_EPSV\"))\n> +\t\tcurl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);\n> +\n>  \treturn result;\n>  }\n>  \n> -- \n> 1.4.2.1\n\nCare to match this with existing ones?\n\n$ git grep -e GIT_CURL -e GIT_SSL -e GIT_HTTP\n\ntells you how they are handled and documented.  If you spot\ninconsistencies if any (e.g. some having config entry and some\nonly environment -- I haven't checked), correcting them while\nyou are at it might be a good thing as well.\n"},{"id":"27958","messageId":"20060929000754.GK10617@sashak.voltaire.com","threadId":"5745","inReplyTo":"7vejtvu1ja.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] http/ftp: optionally ask curl to not use EPSV command","fromName":"Sasha Khapyorsky","fromEmail":"sashak@voltaire.com","sentAt":"2006-09-29T00:07:54Z","receivedAt":"2006-09-29T00:07:54Z","isPatch":true,"sender":{"key":"sashak@voltaire.com","avatar":null},"body":"On 14:25 Thu 28 Sep     , Junio C Hamano wrote:\n> Sasha Khapyorsky <sashak@voltaire.com> writes:\n> \n> > If GIT_CURL_FTP_NO_EPSV environment variable is defined, disable using\n> > of EPSV ftp command (PASV will be used instead). This is helpful with\n> > some \"poor\" ftp servers which doesn't support EPSV mode.\n> >\n> > Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>\n> > ---\n> >  http.c |    3 +++\n> >  1 files changed, 3 insertions(+), 0 deletions(-)\n> >\n> > diff --git a/http.c b/http.c\n> > index 6c1937b..a966e6d 100644\n> > --- a/http.c\n> > +++ b/http.c\n> > @@ -196,6 +196,9 @@ #endif\n> >  \n> >  \tcurl_easy_setopt(result, CURLOPT_USERAGENT, GIT_USER_AGENT);\n> >  \n> > +\tif (getenv(\"GIT_CURL_FTP_NO_EPSV\"))\n> > +\t\tcurl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);\n> > +\n> >  \treturn result;\n> >  }\n> >  \n> > -- \n> > 1.4.2.1\n> \n> Care to match this with existing ones?\n> \n> $ git grep -e GIT_CURL -e GIT_SSL -e GIT_HTTP\n> \n> tells you how they are handled and documented.  If you spot\n> inconsistencies if any (e.g. some having config entry and some\n> only environment -- I haven't checked), correcting them while\n> you are at it might be a good thing as well.\n\nMake sense. Will rework.\n\nSasha\n"},{"id":"27959","messageId":"20060929001044.GL10617@sashak.voltaire.com","threadId":"5745","inReplyTo":"20060929000754.GK10617@sashak.voltaire.com","subject":"[PATCH v2] http/ftp: optionally ask curl to not use EPSV command","fromName":"Sasha Khapyorsky","fromEmail":"sashak@voltaire.com","sentAt":"2006-09-29T00:10:44Z","receivedAt":"2006-09-29T00:10:44Z","isPatch":true,"sender":{"key":"sashak@voltaire.com","avatar":null},"body":"If http.noEPSV config variable is defined and true, or if\nGIT_CURL_FTP_NO_EPSV environment variable is defined, disable using\nof EPSV ftp command (PASV will be used instead). This is helpful with\nsome \"poor\" ftp servers which does not support EPSV mode.\n\nSigned-off-by: Sasha Khapyorsky <sashak@voltaire.com>\n---\n Documentation/config.txt |    6 ++++++\n git-clone.sh             |    4 ++++\n git-fetch.sh             |    6 +++++-\n git-ls-remote.sh         |    4 ++++\n http.c                   |   12 ++++++++++++\n 5 files changed, 31 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 98c1f3e..84e3891 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -202,6 +202,12 @@ http.lowSpeedLimit, http.lowSpeedTime::\n \tCan be overridden by the 'GIT_HTTP_LOW_SPEED_LIMIT' and\n \t'GIT_HTTP_LOW_SPEED_TIME' environment variables.\n \n+http.noEPSV::\n+\tA boolean which disables using of EPSV ftp command by curl.\n+\tThis can helpful with some \"poor\" ftp servers which doesn't\n+\tsupport EPSV mode. Can be overridden by the 'GIT_CURL_FTP_NO_EPSV'\n+\tenvironment variable. Default is false (curl will use EPSV).\n+\n i18n.commitEncoding::\n \tCharacter encoding the commit messages are stored in; git itself\n \tdoes not care per se, but this information is necessary e.g. when\ndiff --git a/git-clone.sh b/git-clone.sh\nindex e1b3bf3..3998c55 100755\n--- a/git-clone.sh\n+++ b/git-clone.sh\n@@ -31,6 +31,10 @@ clone_dumb_http () {\n \tcd \"$2\" &&\n \tclone_tmp=\"$GIT_DIR/clone-tmp\" &&\n \tmkdir -p \"$clone_tmp\" || exit 1\n+\tif [ -n \"$GIT_CURL_FTP_NO_EPSV\" -o \\\n+\t\t\"`git-repo-config --bool http.noEPSV`\" = true ]; then\n+\t\tcurl_extra_args=\"${curl_extra_args} --disable-epsv\"\n+\tfi\n \thttp_fetch \"$1/info/refs\" \"$clone_tmp/refs\" || {\n \t\techo >&2 \"Cannot get remote repository information.\n Perhaps git-update-server-info needs to be run there?\"\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 50ad101..04d4dbb 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -289,6 +289,10 @@ fetch_main () {\n \t  if [ -n \"$GIT_SSL_NO_VERIFY\" ]; then\n \t      curl_extra_args=\"-k\"\n \t  fi\n+\t  if [ -n \"$GIT_CURL_FTP_NO_EPSV\" -o \\\n+\t  \t\"`git-repo-config --bool http.noEPSV`\" = true ]; then\n+\t      noepsv_opt=\"--disable-epsv\"\n+\t  fi\n \t  max_depth=5\n \t  depth=0\n \t  head=\"ref: $remote_name\"\n@@ -300,7 +304,7 @@ fetch_main () {\n \t      $u =~ s{([^-a-zA-Z0-9/.])}{sprintf\"%%%02x\",ord($1)}eg;\n \t      print \"$u\";\n \t  ' \"$head\")\n-\t    head=$(curl -nsfL $curl_extra_args \"$remote/$remote_name_quoted\")\n+\t    head=$(curl -nsfL $curl_extra_args $noepsv_opt \"$remote/$remote_name_quoted\")\n \t    depth=$( expr \\( $depth + 1 \\) )\n \t  done\n \t  expr \"z$head\" : \"z$_x40\\$\" >/dev/null ||\ndiff --git a/git-ls-remote.sh b/git-ls-remote.sh\nindex 2c0b521..0f88953 100755\n--- a/git-ls-remote.sh\n+++ b/git-ls-remote.sh\n@@ -53,6 +53,10 @@ http://* | https://* | ftp://* )\n         if [ -n \"$GIT_SSL_NO_VERIFY\" ]; then\n             curl_extra_args=\"-k\"\n         fi\n+\tif [ -n \"$GIT_CURL_FTP_NO_EPSV\" -o \\\n+\t\t\"`git-repo-config --bool http.noEPSV`\" = true ]; then\n+\t\tcurl_extra_args=\"${curl_extra_args} --disable-epsv\"\n+\tfi\n \tcurl -nsf $curl_extra_args --header \"Pragma: no-cache\" \"$peek_repo/info/refs\" ||\n \t\techo \"failed\tslurping\"\n \t;;\ndiff --git a/http.c b/http.c\nindex 6c1937b..576740f 100644\n--- a/http.c\n+++ b/http.c\n@@ -23,6 +23,7 @@ #endif\n char *ssl_cainfo = NULL;\n long curl_low_speed_limit = -1;\n long curl_low_speed_time = -1;\n+int curl_ftp_no_epsv = 0;\n \n struct curl_slist *pragma_header;\n \n@@ -155,6 +156,11 @@ #endif\n \t\treturn 0;\n \t}\n \n+\tif (!strcmp(\"http.noepsv\", var)) {\n+\t\tcurl_ftp_no_epsv = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n \t/* Fall back on the default ones */\n \treturn git_default_config(var, value);\n }\n@@ -196,6 +202,9 @@ #endif\n \n \tcurl_easy_setopt(result, CURLOPT_USERAGENT, GIT_USER_AGENT);\n \n+\tif (curl_ftp_no_epsv)\n+\t\tcurl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);\n+\n \treturn result;\n }\n \n@@ -251,6 +260,9 @@ #ifdef USE_CURL_MULTI\n \t\tmax_requests = DEFAULT_MAX_REQUESTS;\n #endif\n \n+\tif (getenv(\"GIT_CURL_FTP_NO_EPSV\"))\n+\t\tcurl_ftp_no_epsv = 1;\n+\n #ifndef NO_CURL_EASY_DUPHANDLE\n \tcurl_default = get_curl_handle();\n #endif\n-- \n1.4.2.1\n"},{"id":"28144","messageId":"eft9eg$un0$4@sea.gmane.org","threadId":"5745","inReplyTo":"20060929001044.GL10617@sashak.voltaire.com","subject":"Re: [PATCH v2] http/ftp: optionally ask curl to not use EPSV command","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-10-03T09:11:08Z","receivedAt":"2006-10-03T09:11:08Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Sasha Khapyorsky wrote:\n\n> If http.noEPSV config variable is defined and true, or if\n> GIT_CURL_FTP_NO_EPSV environment variable is defined, disable using\n> of EPSV ftp command (PASV will be used instead). This is helpful with\n> some \"poor\" ftp servers which does not support EPSV mode.\n\nWhy the name is http.noEPSV, not ftp.noEPSV (or curl.noEPSV)?\nJust curious.\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"}]}