[luci] What about luasrc/httpclient.lua?

Jan Lühr ff at stephan.homeunix.net
Wed Feb 13 22:12:05 CET 2013


Hello,

Am 13.02.2013 um 21:48 schrieb Bryan Mayland:

> There's not much to it. It's included in the luci-lib-httpclient package (under LuCI -> Libraries in menuconfig) and you just call request_raw(url, options). There are a ton of options supported for headers, authentication, etc so it is best to just grep for what you're looking for.
> 
> File uploads you've got to do yourself. They're just a request with a body Content-Type: multipart/form-data with some the file as one of the MIME chunks.

Thanks for your reply. However, I'm still stucked at constructing the body. As far as I got, request_raw  does not provide any routines for building  multipart/form-data chunks. If I supply all data in a table, it'll be url-encoded (which is bad for larger binary files).

Are you aware of any higher-level routines using request_raw(.)? Constructing HTTP-Request bodies by hand seem to be rather error-prone (imho)  - actually, that's why I'm looking for a http-client library.

Thanks,
Keep smiling
yanosz



More information about the luci mailing list