<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic &amp;quot;The response ended prematurely&amp;quot; after one hour of a file download in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/quot-The-response-ended-prematurely-quot-after-one-hour-of-a/m-p/673260#M30371</link>
    <description>&lt;P&gt;I'm trying to download a large (80Gb) file from the Dropbox servers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After *exactly* one hour, I get an exception indicating that the Dropbox servers have dropped the connection (&lt;SPAN&gt;System.IO.IOException: The response ended prematurely. in .NET)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have tried using both the .NET HttpClient (for a shared link from dropboxusercontent.com) and the Dropbox API.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas? Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 31 Mar 2023 16:53:43 GMT</pubDate>
    <dc:creator>neilgd</dc:creator>
    <dc:date>2023-03-31T16:53:43Z</dc:date>
    <item>
      <title>"The response ended prematurely" after one hour of a file download</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/quot-The-response-ended-prematurely-quot-after-one-hour-of-a/m-p/673260#M30371</link>
      <description>&lt;P&gt;I'm trying to download a large (80Gb) file from the Dropbox servers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After *exactly* one hour, I get an exception indicating that the Dropbox servers have dropped the connection (&lt;SPAN&gt;System.IO.IOException: The response ended prematurely. in .NET)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have tried using both the .NET HttpClient (for a shared link from dropboxusercontent.com) and the Dropbox API.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any ideas? Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 16:53:43 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/quot-The-response-ended-prematurely-quot-after-one-hour-of-a/m-p/673260#M30371</guid>
      <dc:creator>neilgd</dc:creator>
      <dc:date>2023-03-31T16:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: "The response ended prematurely" after one hour of a file download</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/quot-The-response-ended-prematurely-quot-after-one-hour-of-a/m-p/673276#M30372</link>
      <description>&lt;DIV id="bodyDisplay_2" class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;P&gt;If these are failing after an hour, that would be due to the server timeout. There isn't an option to delay or prevent that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#formats" target="_blank"&gt;Content-download style&lt;/A&gt; endpoints, such as &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-download" target="_blank"&gt;/2/files/download&lt;/A&gt;, support "&lt;A href="https://www.rfc-editor.org/rfc/rfc9110.html#name-range-requests" target="_blank"&gt;range requests&lt;/A&gt;" though. I recommend using range requests to continue downloading the rest of the data if a connection fails, and repeat as needed for up to one hour per connection.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a basic example showing how to do that:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "https://content.dropboxapi.com/2/files/download");
request.Headers.Add("Authorization", "Bearer " + accessToken);
request.Headers.Add("Dropbox-API-Arg", "{\"path\":\"/test.txt\"}");  // in real code, use a JSON library to build this
request.Headers.Add("Range", "bytes=5-");  // this requests the rest of the file after the first 5 bytes

HttpResponseMessage response = await client.SendAsync(request);
Stream stream = response.Content.ReadAsStream();  // read from stream as desired&lt;/LI-CODE&gt;
&lt;P&gt;For instance, in this example, this would be helpful if the app previously only downloaded the first 5 bytes of the file, and needs the rest. In your actual use, you would programmatically set the byte range as needed based on what you successfully downloaded so far of course.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 31 Mar 2023 17:27:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/quot-The-response-ended-prematurely-quot-after-one-hour-of-a/m-p/673276#M30372</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2023-03-31T17:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: "The response ended prematurely" after one hour of a file download</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/quot-The-response-ended-prematurely-quot-after-one-hour-of-a/m-p/673287#M30373</link>
      <description>&lt;P&gt;Thank you! That works a treat.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2023 18:49:54 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/quot-The-response-ended-prematurely-quot-after-one-hour-of-a/m-p/673287#M30373</guid>
      <dc:creator>neilgd</dc:creator>
      <dc:date>2023-03-31T18:49:54Z</dc:date>
    </item>
  </channel>
</rss>

