From 37ee680d9b90fe4c4fc5be4e14f17baf49f6ce59 Mon Sep 17 00:00:00 2001 From: David Turner Date: Tue, 11 Apr 2017 14:13:57 -0400 Subject: http.postbuffer: allow full range of ssize_t values Unfortunately, in order to push some large repos where a server does not support chunked encoding, the http postbuffer must sometimes exceed two gigabytes. On a 64-bit system, this is OK: we just malloc a larger buffer. This means that we need to use CURLOPT_POSTFIELDSIZE_LARGE to set the buffer size. Signed-off-by: David Turner Reviewed-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- http.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'http.c') diff --git a/http.c b/http.c index 96d84bbed..7bccb3645 100644 --- a/http.c +++ b/http.c @@ -19,7 +19,7 @@ long int git_curl_ipresolve; #endif int active_requests; int http_is_verbose; -size_t http_post_buffer = 16 * LARGE_PACKET_MAX; +ssize_t http_post_buffer = 16 * LARGE_PACKET_MAX; #if LIBCURL_VERSION_NUM >= 0x070a06 #define LIBCURL_CAN_HANDLE_AUTH_ANY @@ -331,7 +331,9 @@ static int http_options(const char *var, const char *value, void *cb) } if (!strcmp("http.postbuffer", var)) { - http_post_buffer = git_config_int(var, value); + http_post_buffer = git_config_ssize_t(var, value); + if (http_post_buffer < 0) + warning(_("negative value for http.postbuffer; defaulting to %d"), LARGE_PACKET_MAX); if (http_post_buffer < LARGE_PACKET_MAX) http_post_buffer = LARGE_PACKET_MAX; return 0; -- cgit v1.2.1