简体   繁体   中英

HTTP multipart/form-data send an array of strings

I've got a multipart/form-data which sends audio files and other meta-data as separate variables (I am using C++11 with boost::asio).

How exactly can I send and delimit an array within a specific boundary part? Do I separate the array by commas or semicolons?

I don't wanna use JSON or other more complex types, only to pass a list of words.

Can't find anything on the RFC page for HTTP specs.

HTTP form data have no concept of arrays, that is why you can't find any information about this. There is only a definition of how to separate the values from each other.

If you have eg integers, it would be very easy to use comma as the separator for array and put them into one value. Or put them in separate lines. Or use $ or | or whatever you can make sure is not present in the values, or you can escape them.

For a list of words I would put them in separate lines and send that.

The only thing you have to take care is that you don't have the boundary marker in the data.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM