HTTP PUT and DELETE
mark at maseurope.net
Tue Jul 24 09:44:14 CDT 2007
> I guess this will work.
> The advantage of using the httpHeaders is that libUrl will set the
> Host field in the headers automatically. It will also build the
> request line for you when you have the httpProxy set.
> By default, libUrl will just set the Host and UserAgent headers
> (and Content-Length for PUT). Unless the API rejects requests with
> the UserAgent header set (sounds unlikely), there should be no
> problem with using the httpHeaders. You can put whatever you like
> in there, one header per line.
> put "Authorization: " & myAuthFunction() into tHeaders
> put cr & "SpecialHeader: " & mySpecialFunction() after tHeaders
> set the httpHeaders to tHeaders
> put someData into url "http://whatever/....."
The trouble is that the auth scheme involves building a "canonical"
string to sign from the actual headers - so things like content-
length need to be known before the request is made. I suppose I could
build my headers for the auth function, and then feed the relevant
ones in with "set the httpHeaders"...
Or, stick with customHeaders, and as long as I'm careful about always
using the right http method, I should be alright.
The other question is how to upload a file using PUT. It's not
necessarily ideal to have to read the whole file into a variable
before PUTting it. And the question of progress monitoring. And, and,
More information about the use-livecode