HTTP PUT and DELETE

Dave Cragg dave.cragg at lacscentre.co.uk
Tue Jul 24 09:30:05 CDT 2007


On 24 Jul 2007, at 12:37, Mark Smith wrote:

>
> On 24 Jul 2007, at 11:47, Dave Cragg wrote:
>
>> Be careful about using libUrlSetCustomHttpHeaders. Are you sure  
>> this is what you need? If you are just setting some particular  
>> headers and not the request line itself, then you should just set  
>> the httpHeaders.
>
> It seems like it probably is necessary - the s3 REST api  
> authorization depends on exactly what is in the http headers - I'm  
> still fooling around with it, so we'll see.

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
###etc....

set the httpHeaders to tHeaders
put someData into url "http://whatever/....."

Cheers
Dave






More information about the use-livecode mailing list