Hello,
I use CURLSMBS and I try to upload a file to a webserver using HTTP PUT.
The webserver is a XOJO WE server.
I use "HandleSpeciualURL" on the server side and there I read
"request.entity"
(.entity contains the data that the client has sent using PUT method)
I have tried the demo that comes with the MBS CURL plugin.
And basicially it works, I can send a small amount of data like "Hello
world"
However, if I try to upload a (text-)file with 1MB size then I receive an
error:
CURL error 42 : Aborted by callback. A callback returned "abort" to
libcurl
And CURL debugmessages suggest that it is maybe related to a "Expect:
100-continue" header problem.
I have tried to work around that "Expect: 100-continue" error using
SetOptionHTTPHeader as suggested in the MBS help - but I still get the
errors.
Here is the code I use:
dim c as MyCURL
c=new MyCURL
c.OptionVerbose=true
c.OptionUpload=true // uploading means using the PUT request unless you
tell libcurl otherwise
'c.OptionPut=true // This option is deprecated and starting with
version 7.12.1 you should instead use OptionUpload
'Using POST with HTTP 1.1 implies the use of a "Expect: 100-continue"
header. You can disable this header with OptionHTTPHeader as usual.
'If you use PUT to a HTTP 1.1 server, you can upload data without knowing
the size before starting the transfer if you use chunked encoding.
'You enable this by adding a header like "Transfer-Encoding: chunked" with
OptionHTTPHeader.
'With HTTP 1.0 or without chunked transfer, you must specify the size.
dim d as string
'd= "Hello world" // this works - the server receives this
data correctly
d=ReadFile ("c:\test.txt") // read (text-) file, 1MB
c.data=d
c.OptionInFileSize=lenb(d)
'c.OptionURL = "http://www.monkeybreadsoftware.de/cgi-bin/puttest.php"
'MBS demo
c.OptionURL = "http://myServer:8080/special/test.txt"
'try to get rid of "100-continue error" by passing an empty header
dim a(-1) as String
'a(0)=""
c.SetOptionHTTPHeader (a)
title=str(c.Perform)
MsgBox Title 'error: 42: Aborted by callback. A callback returned
"abort" to libcurl
So my question is:
How can I send a big (text-)file to a WE server using CURL?
("big" doesn't mean only 1MB..can be 200MB or more...)
Heinz
PS:
I have tried to use the WE "WebfileUploader control"..but this is very
slow - even on a LAN - and it's somehow limited in filesize (I could not
upload a file with 200MB size)
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info