title: Binary through http
body: <p>I'm using C++ to send post-request with binary information. The code looks like:</p>
  
  <pre><code>int binary[4] = { 1, 2, 3, 4 };
  
  std::stringstream out;
  out &lt;&lt; "POST /address HTTP/1.1\r\n";
  out &lt;&lt; "Host: localhost\r\n";
  out &lt;&lt; "Connection: Keep-Alive\r\n";
  out &lt;&lt; "Content-Type: application/octet-stream\r\n";
  out &lt;&lt; "Content-Transfer-Encoding: binary\r\n";
  out &lt;&lt; "Content-Length: " &lt;&lt; 4*sizeof(int) &lt;&lt; "\r\n\r\n";    // 4 elements of integer type
  </code></pre>
  
  <p>And sending data into opened connection in socket:</p>
  
  <pre><code>std::string headers = out.str();
  
  socket.send(headers.c_str(), headers.size());  // Send headers first
  socket.send(reinterpret_cast&lt;char*&gt;(&amp;binary[0]), bufferLength*sizeof(int));  // And array of numbers
  </code></pre>
  
  <p>But I was told, that sending pure bytes through http-protocol is wrong. Is that right? For example, I can't send 0 (<code>zero</code>), it's used by protocol.</p>
  
  <p>If that's right (because I can't handle that post-request and get the data I've sent) what could I use instead? Maybe, convert array into hex or base64url?</p>
  
  <p>Thanks.</p>