summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBryan Ischo <bryan@ischo.com>2008-07-29 03:45:19 +0000
committerBryan Ischo <bryan@ischo.com>2008-07-29 03:45:19 +0000
commit4f06cb3efa814b0bd6f2c5221137bf546c79159a (patch)
treedc040508c5c580002117b2f73386c6754d8f5528 /src
parentbb6881fd260bebf017780c46bc0cd67921e33d79 (diff)
downloadceph-libs3-4f06cb3efa814b0bd6f2c5221137bf546c79159a.tar.gz
* Workaround for buggy libcurl nonsupport for large files
* Improved libs3.h comments
Diffstat (limited to 'src')
-rw-r--r--src/request.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/request.c b/src/request.c
index 9dd2582..8ff33f1 100644
--- a/src/request.c
+++ b/src/request.c
@@ -796,11 +796,6 @@ static S3Status setup_curl(Request *request,
// Set read callback, data, and readSize
curl_easy_setopt_safe(CURLOPT_READFUNCTION, &curl_read_func);
curl_easy_setopt_safe(CURLOPT_READDATA, request);
- // xxx the following does not work in some versions of CURL.
- // CURL is retarded in how it defines large offsets, using only
- // 32 bits sometimes, when it should always use 64 via int64_t
- curl_easy_setopt_safe(CURLOPT_INFILESIZE_LARGE,
- params->toS3CallbackTotalSize);
// Set write callback and data
curl_easy_setopt_safe(CURLOPT_WRITEFUNCTION, &curl_write_func);
@@ -854,6 +849,16 @@ static S3Status setup_curl(Request *request,
values-> fieldName); \
}
+ // Would use CURLOPT_INFILESIZE_LARGE, but it is buggy in libcurl
+ if (params->httpRequestType == HttpRequestTypePUT) {
+ char header[256];
+ snprintf(header, sizeof(header), "Content-Length: %llu",
+ params->toS3CallbackTotalSize);
+ request->headers = curl_slist_append(request->headers, header);
+ request->headers = curl_slist_append(request->headers,
+ "Transfer-Encoding:");
+ }
+
append_standard_header(cacheControlHeader);
append_standard_header(contentTypeHeader);
append_standard_header(md5Header);