From 2422ad8d97483b908b339c0b5619e73868a1fdc7 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Sat, 24 Jan 2009 11:48:42 +0000 Subject: Make command line test suite succeed again. Patch by Bob Dionne. Closes COUCHDB-212. Thanks Bob. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@737335 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_js.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/couchdb/couch_js.c b/src/couchdb/couch_js.c index a23eb5c8..a6fbde60 100644 --- a/src/couchdb/couch_js.c +++ b/src/couchdb/couch_js.c @@ -616,6 +616,7 @@ GetHttp(JSContext *context, JSObject *obj, uintN argc, jsval *argv, jsval *rval) curl_easy_setopt(handle,CURLOPT_WRITEHEADER,b); curl_easy_setopt(handle,CURLOPT_URL,url); curl_easy_setopt(handle,CURLOPT_HTTPGET,1); + curl_easy_setopt(handle,CURLOPT_FOLLOWLOCATION,1); curl_easy_setopt(handle,CURLOPT_NOPROGRESS,1); curl_easy_setopt(handle,CURLOPT_IPRESOLVE,CURL_IPRESOLVE_V4); @@ -864,8 +865,12 @@ PutHttp(JSContext *context, JSObject *obj, uintN argc, jsval *argv, jsval *rval) b_data->pos = 0; data = JSValToChar(context,(argv+1)); + readlen = strlen(data); + + + // TODO: remove strlen - append_Buffer(b_data->buffer,data,strlen(data)); + append_Buffer(b_data->buffer,data,readlen); free(data); @@ -887,6 +892,9 @@ PutHttp(JSContext *context, JSObject *obj, uintN argc, jsval *argv, jsval *rval) curl_easy_setopt(handle,CURLOPT_READDATA,b_data); curl_easy_setopt(handle,CURLOPT_URL,url); curl_easy_setopt(handle,CURLOPT_UPLOAD,1); + curl_easy_setopt(handle,CURLOPT_INFILESIZE,readlen); + + // Curl structure struct curl_slist *slist = generateCurlHeaders(context,argv+2); @@ -900,6 +908,8 @@ PutHttp(JSContext *context, JSObject *obj, uintN argc, jsval *argv, jsval *rval) // Use only ipv4 curl_easy_setopt(handle,CURLOPT_IPRESOLVE,CURL_IPRESOLVE_V4); + + // Perform int exitcode; -- cgit v1.2.3