]> git.ipfire.org Git - thirdparty/git.git/blobdiff - http.c
Heavily expanded update hook to send more useful emails than the old hook
[thirdparty/git.git] / http.c
diff --git a/http.c b/http.c
index 08769cc7cd4282a485fb9cd22c4ecfa97096a419..576740feff9ffa62b65f8cdf0a38f2354872c520 100644 (file)
--- a/http.c
+++ b/http.c
@@ -23,6 +23,7 @@ char *ssl_capath = NULL;
 char *ssl_cainfo = NULL;
 long curl_low_speed_limit = -1;
 long curl_low_speed_time = -1;
+int curl_ftp_no_epsv = 0;
 
 struct curl_slist *pragma_header;
 
@@ -34,7 +35,7 @@ size_t fread_buffer(void *ptr, size_t eltsize, size_t nmemb,
        size_t size = eltsize * nmemb;
        if (size > buffer->size - buffer->posn)
                size = buffer->size - buffer->posn;
-       memcpy(ptr, buffer->buffer + buffer->posn, size);
+       memcpy(ptr, (char *) buffer->buffer + buffer->posn, size);
        buffer->posn += size;
        return size;
 }
@@ -49,7 +50,7 @@ size_t fwrite_buffer(const void *ptr, size_t eltsize,
                        buffer->size = buffer->posn + size;
                buffer->buffer = xrealloc(buffer->buffer, buffer->size);
        }
-       memcpy(buffer->buffer + buffer->posn, ptr, size);
+       memcpy((char *) buffer->buffer + buffer->posn, ptr, size);
        buffer->posn += size;
        data_received++;
        return size;
@@ -155,6 +156,11 @@ static int http_options(const char *var, const char *value)
                return 0;
        }
 
+       if (!strcmp("http.noepsv", var)) {
+               curl_ftp_no_epsv = git_config_bool(var, value);
+               return 0;
+       }
+
        /* Fall back on the default ones */
        return git_default_config(var, value);
 }
@@ -196,6 +202,9 @@ static CURL* get_curl_handle(void)
 
        curl_easy_setopt(result, CURLOPT_USERAGENT, GIT_USER_AGENT);
 
+       if (curl_ftp_no_epsv)
+               curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);
+
        return result;
 }
 
@@ -251,6 +260,9 @@ void http_init(void)
                max_requests = DEFAULT_MAX_REQUESTS;
 #endif
 
+       if (getenv("GIT_CURL_FTP_NO_EPSV"))
+               curl_ftp_no_epsv = 1;
+
 #ifndef NO_CURL_EASY_DUPHANDLE
        curl_default = get_curl_handle();
 #endif