Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using "application/octet-stream" as a content type in POST

I'm thinking about implementing an RPC mechanism over HTTP. The POST method seems to be suitable for the calls. However, since each call comes with the binary payload, there's a decision to be made about how to attach that binary data to the POST request. It seems there are two content types for POSTs of use today: application/x-www-form-urlencoded and multipart/form-data. The former seems to require percent-escaping binary data, while the latter seems to add some overhead with the boundaries/content-disposition fields.

Therefore my question is: how good is it to just use application/octet-stream as a POST content type and just include the binary payload afterwards as is? Will it go through all proxies? Will all HTTP servers be able to handle this? Is it standards-compliant? In other words, should I go for it?

like image 587
dragonroot Avatar asked Aug 05 '13 08:08

dragonroot


1 Answers

Yes, you can do that; but it would be better to use a more specific type that makes the message self-descriptive.

like image 93
Julian Reschke Avatar answered Nov 15 '22 04:11

Julian Reschke