From 4341abc468abc40649a300cf4db2d8fb02252998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Fri, 22 Aug 2014 20:22:54 +0000 Subject: [PATCH] [GB.NET.CURL] * BUG: HttpClient.Put() method should send its data correctly now. * NEW: HttpClient.PutFile() is a new method to send a PUT request by taking the data from a file. git-svn-id: svn://localhost/gambas/trunk@6423 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.net.curl/src/CHttpClient.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gb.net.curl/src/CHttpClient.c b/gb.net.curl/src/CHttpClient.c index 92d4a83bb..d78bfa2d0 100644 --- a/gb.net.curl/src/CHttpClient.c +++ b/gb.net.curl/src/CHttpClient.c @@ -567,7 +567,14 @@ END_METHOD BEGIN_METHOD(HttpClient_Put, GB_STRING contentType; GB_STRING data; GB_OBJECT headers; GB_STRING target) - http_send(THIS, SEND_PUT, GB.ToZeroString(ARG(contentType)), GB.ToZeroString(ARG(data)), 0, VARG(headers), MISSING(target) ? NULL : GB.ToZeroString(ARG(target))); + http_send(THIS, SEND_PUT, GB.ToZeroString(ARG(contentType)), STRING(data), LENGTH(data), VARGOPT(headers, NULL), MISSING(target) ? NULL : GB.ToZeroString(ARG(target))); + +END_METHOD + + +BEGIN_METHOD(HttpClient_PutFile, GB_STRING contentType; GB_STRING file; GB_OBJECT headers; GB_STRING target) + + http_send(THIS, SEND_PUT | SEND_FILE, GB.ToZeroString(ARG(contentType)), STRING(file), LENGTH(file), VARGOPT(headers, NULL), MISSING(target) ? NULL : GB.ToZeroString(ARG(target))); END_METHOD @@ -593,6 +600,7 @@ GB_DESC CHttpClientDesc[] = GB_METHOD("Post", NULL, HttpClient_Post, "(ContentType)s(Data)s[(Headers)String[];(TargetFile)s]"), GB_METHOD("Put", NULL, HttpClient_Put, "(ContentType)s(Data)s[(Headers)String[];(TargetFile)s]"), GB_METHOD("PostFile", NULL, HttpClient_PostFile, "(ContentType)s(Path)s[(Headers)String[];(TargetFile)s]"), + GB_METHOD("PutFile", NULL, HttpClient_PutFile, "(ContentType)s(Path)s[(Headers)String[];(TargetFile)s]"), GB_PROPERTY("Auth", "i", HttpClient_Auth), GB_PROPERTY("CookiesFile", "s",HttpClient_CookiesFile),