title: Azure File Service "PUT Range" REST API 'InvalidHeaderValue' error
body: <p>I'm trying to upload a file to Azure File Service using the REST API. After creating the file, the 'put range' request fails with 'InvalidHeaderValue'</p>
  
  <p>So far I've successfully created the file using the documentation found here.
  <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/create-file" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/rest/api/storageservices/create-file</a></p>
  
  <p>After that, I try to put content into the newly created file following the documentation found here.
  <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/put-range" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/rest/api/storageservices/put-range</a></p>
  
  <p>here is an example of the URI I'm using. It look correct next to the example in the doc.</p>
  
  <pre class="lang-py prettyprint-override"><code>uri = 'https://&lt;account&gt;.file.core.windows.net/&lt;share&gt;/&lt;directory&gt;/&lt;file&gt;?comp=range&amp;&lt;sas token&gt;'
  </code></pre>
  
  <p>I get the content of the file with...</p>
  
  <pre class="lang-py prettyprint-override"><code>with open(file.txt, mode='rb') as fh:
      data = fh.read()
  </code></pre>
  
  <p>My headers look like this...</p>
  
  <pre class="lang-py prettyprint-override"><code>headers = {
      'x-ms-write':'update',
      'x-ms-date':'Wed, 10  Apr 2019 22:14:17 GMT',
      'x-ms-version':'2018-03-28',
      'x-ms-range':'bytes=0-' + str(len(data)),
      'Content-Length':str(len(data) + 1)
  }
  </code></pre>
  
  <p>Request...</p>
  
  <pre class="lang-py prettyprint-override"><code>requests.put(url, headers=headers, data=data)
  </code></pre>
  
  <p>The response code I get back is a 400 and the return header is this...</p>
  
  <pre><code>{
  'Content-Length': '322', 
  'Content-Type': 'application/xml', 
  'Server': 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', 
  'x-ms-request-id': '23642a26-e01a-0049-35da-ef0109000000', 
  'x-ms-version': '2018-03-28', 
  'x-ms-error-code': 'InvalidHeaderValue', 
  'Date': 'Wed, 10 Apr 2019 20:14:46 GMT'
  }
  </code></pre>
  
  <p>Thanks for help in advance.</p>