How to avoid Soup.MemoryUse.COPY from python?
- From: Pascal Jacquemart <pascal fluffyspider com>
- To: "libsoup-list gnome org" <libsoup-list gnome org>
- Subject: How to avoid Soup.MemoryUse.COPY from python?
- Date: Mon, 21 Sep 2020 10:03:33 +1000
Hi there,
I am using libSoup in python to upload big files to the cloud (using Range header).
I was wondering if there is a way to avoid and extra copy of the payload.
The data is coming from a file stream and I have to assign it to the request body.
Here my code snippet:
file = Gio.File.new_for_path(filename)
stream = file.read()
status = stream.seek(start, GLib.SeekType.SET)
bytes = stream.read_bytes(end - start +1)
stream.close()
message.set_request('application/octet-stream', Soup.MemoryUse.COPY, bytes.get_data())
I believe there must be a way to pass the payload data directly using Soup.MemoryUse.TAKE or TEMPORARY, considering it already comes from GLib.bytes / GIO.FileInoutStream?
I made some research / experiments but I could not find anything relevant.
Thanks,
Pascal
[Date Prev][Date Next] [Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]