POST'ing image data using onion

21 views
Skip to first unread message

br...@beruna.org

unread,
Mar 7, 2017, 12:44:06 AM3/7/17
to onion-dev
Hi,

I am trying to wrap a (very simple!) http api around an existing library that is currently loading images from disk.

Ideally, I want to be able to post an image to an endpoint and have an in-memory file-like object that I can read from. A char* in memory would probably be fine also.

I did find the json_rpc example which was helpful; and I figured out how to get text working w/POST. I think I need to use onion_request_get_data and/or onion_block_data to access the raw responses; but I have not been able to get it working.

Appreciate any tips.

thanks,

 - bri

David Moreno Montero

unread,
Mar 7, 2017, 5:32:20 AM3/7/17
to br...@beruna.org, onion-dev
Right now, if you send a form with multipart encoding, the files are stored into a temporal file in the file system.


There were many requests to have it saved to memory, but I could not find the time to do it.

If you feel you can do this changes, a fast tip is that the choice to store it into a file is made at https://github.com/davidmoreno/onion/blob/master/src/onion/request_parser.c#L621. It should use some flag to choose if store it to a file or to a onion_dict (key filename, data an onion_block).


Regards,
David.

--
You received this message because you are subscribed to the Google Groups "onion-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to onion-dev+unsubscribe@coralbits.com.
To post to this group, send email to onio...@coralbits.com.
Visit this group at https://groups.google.com/a/coralbits.com/group/onion-dev/.
For more options, visit https://groups.google.com/a/coralbits.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages