Can I send binary data directly over HTTP?
Asked Answered
T

2

10

I mean, can I expect to work

POST / HTTP/1.1
Content-Type: application/octet-stream
Content-Length: 27

[27 bytes of binary data]

And the binary data is arbitrary binary data, not Base64 encoded with all 8 bits in use, not 7 bits. The receiving application is custom application that would know what to do with the data.

Of course, I could test, but I need to know if this is likely to work with real server and over web, not just between both client and server running on a localhost.

Tham answered 23/8, 2014 at 8:20 Comment(0)
A
9

RFC 2046 defines the octet-stream subtype as follows:

4.5.1. Octet-Stream Subtype

The "octet-stream" subtype is used to indicate that a body contains arbitrary binary data.

And RFC 2045 defines binary data in context of MIME messages as follows:

2.9. Binary Data

"Binary data" refers to data where any sequence of octets whatsoever is allowed.

Asis answered 23/8, 2014 at 8:33 Comment(4)
That's not really the reason why HTTP - indeed - can transport binary.Eluviation
@JulianReschke So what’s the actual reason?Asis
@JulianReschke That’s not really a reasonable explanation.Asis
Gumbo: well, it's the explanation. (WRT answer: you can send application/octet-stream over Mail, but you need additional encodings for that; this proves why your line of argument is totally misleading: you're looking at the wrong layer)Eluviation
E
12

Yes. HTTP/1.1 message header blocks are text, but the payload of messages can be arbitrary binary data.

Eluviation answered 23/8, 2014 at 10:4 Comment(0)
A
9

RFC 2046 defines the octet-stream subtype as follows:

4.5.1. Octet-Stream Subtype

The "octet-stream" subtype is used to indicate that a body contains arbitrary binary data.

And RFC 2045 defines binary data in context of MIME messages as follows:

2.9. Binary Data

"Binary data" refers to data where any sequence of octets whatsoever is allowed.

Asis answered 23/8, 2014 at 8:33 Comment(4)
That's not really the reason why HTTP - indeed - can transport binary.Eluviation
@JulianReschke So what’s the actual reason?Asis
@JulianReschke That’s not really a reasonable explanation.Asis
Gumbo: well, it's the explanation. (WRT answer: you can send application/octet-stream over Mail, but you need additional encodings for that; this proves why your line of argument is totally misleading: you're looking at the wrong layer)Eluviation

© 2022 - 2025 — McMap. All rights reserved.