Library to aid multi-part form data parsing

Asmitha Karunanithi asmithakarun at
Fri Jan 17 21:41:45 AEDT 2020

Hi All,

There was a requirement to parse multipart form data during file upload for
the vendor-specific interface.

The Curl command for multiple file upload will be:

"curl -c cjar -b cjar -k -H "Content-Type: multipart/form-data" -H
"X-Auth-Token: $bmc_token" -F 'sa1=@/path/to/file1' -F sa2=@/path/to/file2'
-X POST https://$bmc/ibm/v1/files/partitions/"

The above multipart request contains the file contents separated by a
boundary and each file contains the filename, Content-Type and

There were few considerations for this and after testing those libraries,
the mimetic library seemed to fit for this purpose. Please refer to

Only a part of code from this library is used for this purpose (which is
under "mimetic" folder in this repo).

Regression tests were conducted with that part of the library that is being
used for multi-part parsing, as a part of which there was no memory leakage
found after firing a large number of requests (2000 requests in this case).

There was a difference of 71.68 KB in the openbmc flash size when this
library is pulled. The mimetic shared object files are used from

If there are other suggestions for the multi-part form data parsing or if
there are suggestions for any other test that needs to be done, please post
in the suggestions.

Thanks & Regards,
Asmitha Karunanithi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the openbmc mailing list