0

I'm new to libcurl but I would like to implement the following curl command using libsoup:

curl --data-binary '@test.mp4' -H "x-file-name:test.mp4" http://server/upload

How can I do the same with libsoup? Could you give me some examples how to upload a big binary file using libsoup?

Yury
  • 9
  • 2
  • http://stackoverflow.com/questions/10178750/http-post-with-libsoup – José Fonte Apr 18 '17 at 16:28
  • thanks. Yes, I know about it. What about a big binary data, for example 200MB? How to implement that using libsoup? – Yury Apr 18 '17 at 17:08
  • You will need to load the contents of the file with [g_file_get_contents](https://developer.gnome.org/glib/stable/glib-File-Utilities.html#g-file-get-contents), which will also give you content length/size which you must use. Then 'soup_session_send (session, msg, cancellable, &error);' It's not a working example but start from there. – José Fonte Apr 18 '17 at 17:24
  • You probably want to load the file using a stream (`GInputStream`) and add it to the `SoupMessage` request body iteratively using `soup_message_body_append()` to avoid loading the whole 200MB file into memory at once. – Philip Withnall Apr 26 '17 at 13:55

0 Answers0