title: cURL: HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)
body: <p>I am trying to upload a video to Youtube's API via cURL. This is my code: </p>
  
  <pre><code>curl -v -X PUT '#{upload_uri}' -H 'Authorization: Bearer #{@test_token}' -H 'Content-Length: #{File.size(@video).to_s}' -H 'Content-Type: video/*' -d @'#{@video}'
  </code></pre>
  
  <p>The response I receive is</p>
  
  <pre><code>  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 216.58.196.170...
  * TCP_NODELAY set
  * Connected to www.googleapis.com (216.58.196.170) port 443 (#0)
  ---
  ---
  * Using Stream ID: 1 (easy handle 0x7f9570000400)
  &gt; PUT /upload/youtube/v3/videos?part=snippet,status,contentDetails&amp;uploadType=resumable&amp;upload_id=&lt;id&gt; HTTP/2
  &gt; Host: www.googleapis.com
  &gt; User-Agent: curl/7.54.0
  &gt; Accept: */*
  &gt; Authorization: Bearer &lt;token&gt;
  &gt; Content-Length: 140926828
  &gt; Content-Type: video/*
  &gt; 
  * Connection state changed (MAX_CONCURRENT_STREAMS updated)!
  } [16384 bytes data]
   97 65.3M    0     0   97 64.0M      0  3704k  0:00:18  0:00:17  0:00:01 4226k* We are completely uploaded and fine
  &lt; HTTP/2 400 
  &lt; content-type: text/html; charset=UTF-8
  &lt; referrer-policy: no-referrer
  &lt; content-length: 1555
  &lt; date: Wed, 04 Mar 2020 09:21:34 GMT
  &lt; 
  * HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)
   99 65.3M    0     0  100 65.3M      0  3714k  0:00:18  0:00:18 --:--:-- 4242k
  * Closing connection 0
  * TLSv1.2 (OUT), TLS alert, Client hello (1):
  } [2 bytes data]
  curl: (92) HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)
  </code></pre>
  
  <p>I understand that this has to do with incorrect values of <code>Content-Length</code>. However, the value of this header matches the size of the file being sent as binary. </p>
  
  <p>What is causing this error then, in cURL?</p>
  
  <p>This request works perfectly fine with postman, with the same <code>Content-Length</code> provided here.</p>