XMPP::HTTPUpload
HTTPUpload is a high-level client for XEP-0363 - HTTP File Upload.
A server-provided upload service (discovered via disco#info on the service JID) grants a temporary slot: a PUT URL to push the file data to over HTTPS and a GET URL others can later fetch it from.
uploader = XMPP::HTTPUpload.new(client, "upload.example.org") return unless uploader.supported? url = uploader.upload("photo.jpg", File.size(path), "image/jpeg", File.open(path))
See: https://xmpp.org/extensions/xep-0363.html
Constants
Disco feature advertised by upload services.
Constructors
Instance methods
request_slot asks the service for a slot for a file of the given size and content type and returns the granted slot (nil on error/timeout).
supported? queries the upload service for support and returns true when the urn:xmpp:http:upload:0 feature is advertised.
upload requests a slot for the file and PUTs the given data to the granted URL over HTTPS. On a successful upload (HTTP 2xx) the GET URL is returned; nil is returned on failure.