<?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 Re: HTTP API V2 download range request: strange behaviour in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175438#M6916</link>
    <description>&lt;P&gt;Hmmm... Now it seems to me, that I have a problem with the shared NSURLSession and caching. I'll check it and report here soon.&lt;/P&gt;</description>
    <pubDate>Thu, 14 Apr 2016 14:49:32 GMT</pubDate>
    <dc:creator>Vladimir K.2</dc:creator>
    <dc:date>2016-04-14T14:49:32Z</dc:date>
    <item>
      <title>HTTP API V2 download range request: strange behaviour</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175433#M6911</link>
      <description>&lt;P&gt;Hi! I'll appreciate any help. Thank you!&lt;/P&gt;
&lt;P&gt;I'm trying to download file by chunks.&lt;/P&gt;
&lt;P&gt;URL: &lt;A href="https://content.dropboxapi.com/2/files/download" rel="nofollow noreferrer" target="_blank"&gt;https://content.dropboxapi.com/2/files/download&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;File size: 1200 bytes&lt;/P&gt;
&lt;P&gt;First time (after creation in dropbox) I read it with 3 GET requests, which contain corresponding header fields:&lt;/P&gt;
&lt;PRE&gt;Range: bytes=0-499&lt;BR /&gt;&lt;BR /&gt;Response comes with&amp;nbsp;first 500 bytes of data&lt;/PRE&gt;
&lt;PRE&gt;Range: bytes=500-999&lt;BR /&gt;&lt;BR /&gt;Response&amp;nbsp;comes with&amp;nbsp;next 500 bytes of data&lt;/PRE&gt;
&lt;PRE&gt;Range: bytes=1000-1199&lt;BR /&gt;&lt;BR /&gt;Response&amp;nbsp;comes with&amp;nbsp;last 200&amp;nbsp;bytes of data&lt;/PRE&gt;
&lt;P&gt;Everything is OK.&lt;/P&gt;
&lt;P&gt;But when I try to download this file again, something goes wrong:&lt;/P&gt;
&lt;PRE&gt;Range: bytes=0-499&lt;BR /&gt;&lt;BR /&gt;Response&amp;nbsp;comes with&amp;nbsp;last 200&amp;nbsp;bytes of data&lt;BR /&gt;Content-range field in response header: 1000-1199/1200 &lt;/PRE&gt;
&lt;PRE&gt;Range: bytes=500-999&lt;BR /&gt;&lt;BR /&gt;Response&amp;nbsp;comes with&amp;nbsp;last 200&amp;nbsp;bytes of data&lt;BR /&gt;Content-range field in response header: 1000-1199/1200&lt;/PRE&gt;
&lt;PRE&gt;Range: bytes=1000-1199&lt;BR /&gt;&lt;BR /&gt;Response&amp;nbsp;comes with&amp;nbsp;last 200&amp;nbsp;bytes of data&lt;BR /&gt;Content-range field in response header: 1000-1199/1200&lt;/PRE&gt;
&lt;P&gt;What's the problem? Can I do something with this?&lt;/P&gt;
&lt;P&gt;P.S. Actually file size is around 1.2 MB, and chunk size is 512 kB.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:34:10 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175433#M6911</guid>
      <dc:creator>Vladimir K.2</dc:creator>
      <dc:date>2019-05-29T09:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP API V2 download range request: strange behaviour</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175434#M6912</link>
      <description>&lt;P&gt;I can't seem to reproduce this behavior. Can you share the raw requests and responses so we can look into it?&amp;nbsp;Just be sure to redact the access token.&amp;nbsp;Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 03:12:51 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175434#M6912</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-04-14T03:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP API V2 download range request: strange behaviour</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175435#M6913</link>
      <description>&lt;P&gt;Here are they (for smaller file):&lt;/P&gt;
&lt;PRE&gt;GET https://content.dropboxapi.com/2/files/download?arg=%7B%22path%22:%20%22/test2.jpg%22%7D&lt;BR /&gt;{&lt;BR /&gt; Authorization = "Bearer TOKEN";&lt;BR /&gt; Range = "bytes=0-524287";&lt;BR /&gt;}&lt;/PRE&gt;
&lt;PRE&gt;206&lt;BR /&gt;}&lt;BR /&gt; "Accept-Ranges" = bytes;&lt;BR /&gt; Connection = "keep-alive";&lt;BR /&gt; "Content-Disposition" = "attachment; filename=unspecified";&lt;BR /&gt; "Content-Length" = 524288;&lt;BR /&gt; "Content-Range" = "bytes 0-524287/833408";&lt;BR /&gt; "Content-Security-Policy" = sandbox;&lt;BR /&gt; "Content-Type" = "application/octet-stream";&lt;BR /&gt; Date = "Wed, 13 Apr 2016 20:38:59 GMT";&lt;BR /&gt; "Dropbox-API-Result" = "{\"name\": \"test2.jpg\", \"path_lower\": \"/test2.jpg\", \"path_display\": \"/test2.jpg\", \"id\": \"id:hF-8wvxIrdAAAAAAAAAAVA\", \"client_modified\": \"2016-04-13T13:05:13Z\", \"server_modified\": \"2016-04-13T14:21:42Z\", \"rev\": \"10b645fbff27\", \"size\": 833408, \"media_info\": {\".tag\": \"metadata\", \"metadata\": {\".tag\": \"photo\", \"dimensions\": {\"height\": 1000, \"width\": 1000}}}}";&lt;BR /&gt; Etag = "W/\"10b645fbff27\";&lt;BR /&gt; "Original-Content-Length" = 524288;&lt;BR /&gt; Server = nginx;&lt;BR /&gt; Vary = "Dropbox-API-Arg, Authorization";&lt;BR /&gt; "X-Content-Security-Policy" = sandbox;&lt;BR /&gt; "X-Content-Type-Options" = nosniff;&lt;BR /&gt; "X-Dropbox-Request-Id" = 64ce59cda4729419d32a1cca8148e020;&lt;BR /&gt; "X-Robots-Tag" = "noindex, nofollow, noimageindex";&lt;BR /&gt; "X-WebKit-CSP" = sandbox;&lt;BR /&gt;}&lt;/PRE&gt;
&lt;PRE&gt;GET https://content.dropboxapi.com/2/files/download?arg=%7B%22path%22:%20%22/test2.jpg%22%7D&lt;BR /&gt;{&lt;BR /&gt; Authorization = "Bearer TOKEN";&lt;BR /&gt; Range = "bytes=524288-1048575";&lt;BR /&gt;}&lt;/PRE&gt;
&lt;PRE&gt;206&lt;BR /&gt;{&lt;BR /&gt; "Accept-Ranges" = bytes;&lt;BR /&gt; Connection = "keep-alive";&lt;BR /&gt; "Content-Disposition" = "attachment; filename=unspecified";&lt;BR /&gt; "Content-Length" = 309120;&lt;BR /&gt; "Content-Range" = "bytes 524288-833407/833408";&lt;BR /&gt; "Content-Security-Policy" = sandbox;&lt;BR /&gt; "Content-Type" = "application/octet-stream";&lt;BR /&gt; Date = "Wed, 13 Apr 2016 20:40:32 GMT";&lt;BR /&gt; "Dropbox-API-Result" = "{\"name\": \"test2.jpg\", \"path_lower\": \"/test2.jpg\", \"path_display\": \"/test2.jpg\", \"id\": \"id:hF-8wvxIrdAAAAAAAAAAVA\", \"client_modified\": \"2016-04-13T13:05:13Z\", \"server_modified\": \"2016-04-13T14:21:42Z\", \"rev\": \"10b645fbff27\", \"size\": 833408, \"media_info\": {\".tag\": \"metadata\", \"metadata\": {\".tag\": \"photo\", \"dimensions\": {\"height\": 1000, \"width\": 1000}}}}";&lt;BR /&gt; Etag = "W/\"10b645fbff27\";&lt;BR /&gt; "Original-Content-Length" = 309120;&lt;BR /&gt; Server = nginx;&lt;BR /&gt; Vary = "Dropbox-API-Arg, Authorization";&lt;BR /&gt; "X-Content-Security-Policy" = sandbox;&lt;BR /&gt; "X-Content-Type-Options" = nosniff;&lt;BR /&gt; "X-Dropbox-Request-Id" = a45b71c7f42234a7271bed7df03b06c3;&lt;BR /&gt; "X-Robots-Tag" = "noindex, nofollow, noimageindex";&lt;BR /&gt; "X-WebKit-CSP" = sandbox;&lt;BR /&gt;}&lt;/PRE&gt;
&lt;PRE&gt;-----------------------------------------------------------&lt;/PRE&gt;
&lt;PRE&gt;GET https://content.dropboxapi.com/2/files/download?arg=%7B%22path%22:%20%22/test2.jpg%22%7D&lt;BR /&gt;{&lt;BR /&gt; Authorization = "Bearer TOKEN";&lt;BR /&gt; Range = "bytes=0-524287";&lt;BR /&gt;}&lt;/PRE&gt;
&lt;PRE&gt;206&lt;BR /&gt;{&lt;BR /&gt; "Accept-Ranges" = bytes;&lt;BR /&gt; Connection = "keep-alive";&lt;BR /&gt; "Content-Disposition" = "attachment; filename=unspecified";&lt;BR /&gt; "Content-Length" = 309120;&lt;BR /&gt; "Content-Range" = "bytes 524288-833407/833408";&lt;BR /&gt; "Content-Security-Policy" = sandbox;&lt;BR /&gt; "Content-Type" = "application/octet-stream";&lt;BR /&gt; Date = "Wed, 13 Apr 2016 20:44:04 GMT";&lt;BR /&gt; "Dropbox-API-Result" = "{\"name\": \"test2.jpg\", \"path_lower\": \"/test2.jpg\", \"path_display\": \"/test2.jpg\", \"id\": \"id:hF-8wvxIrdAAAAAAAAAAVA\", \"client_modified\": \"2016-04-13T13:05:13Z\", \"server_modified\": \"2016-04-13T14:21:42Z\", \"rev\": \"10b645fbff27\", \"size\": 833408, \"media_info\": {\".tag\": \"metadata\", \"metadata\": {\".tag\": \"photo\", \"dimensions\": {\"height\": 1000, \"width\": 1000}}}}";&lt;BR /&gt; Etag = "W/\"10b645fbff27\";&lt;BR /&gt; "Original-Content-Length" = 309120;&lt;BR /&gt; Server = nginx;&lt;BR /&gt; Vary = "Dropbox-API-Arg, Authorization";&lt;BR /&gt; "X-Content-Security-Policy" = sandbox;&lt;BR /&gt; "X-Content-Type-Options" = nosniff;&lt;BR /&gt; "X-Dropbox-Request-Id" = 5538c11467902b81a6e7353a1d1768ed;&lt;BR /&gt; "X-Robots-Tag" = "noindex, nofollow, noimageindex";&lt;BR /&gt; "X-WebKit-CSP" = sandbox;&lt;BR /&gt;}&lt;/PRE&gt;
&lt;PRE&gt;&lt;BR /&gt;GET https://content.dropboxapi.com/2/files/download?arg=%7B%22path%22:%20%22/test2.jpg%22%7D &lt;BR /&gt;{&lt;BR /&gt; Authorization = "Bearer TOKEN";&lt;BR /&gt; Range = "bytes=309120-833407";&lt;BR /&gt;}&lt;/PRE&gt;
&lt;PRE&gt;206&lt;BR /&gt;{&lt;BR /&gt; "Accept-Ranges" = bytes;&lt;BR /&gt; Connection = "keep-alive";&lt;BR /&gt; "Content-Disposition" = "attachment; filename=unspecified";&lt;BR /&gt; "Content-Length" = 309120;&lt;BR /&gt; "Content-Range" = "bytes 524288-833407/833408";&lt;BR /&gt; "Content-Security-Policy" = sandbox;&lt;BR /&gt; "Content-Type" = "application/octet-stream";&lt;BR /&gt; Date = "Wed, 13 Apr 2016 20:46:00 GMT";&lt;BR /&gt; "Dropbox-API-Result" = "{\"name\": \"test2.jpg\", \"path_lower\": \"/test2.jpg\", \"path_display\": \"/test2.jpg\", \"id\": \"id:hF-8wvxIrdAAAAAAAAAAVA\", \"client_modified\": \"2016-04-13T13:05:13Z\", \"server_modified\": \"2016-04-13T14:21:42Z\", \"rev\": \"10b645fbff27\", \"size\": 833408, \"media_info\": {\".tag\": \"metadata\", \"metadata\": {\".tag\": \"photo\", \"dimensions\": {\"height\": 1000, \"width\": 1000}}}}";&lt;BR /&gt; Etag = "W/\"10b645fbff27\";&lt;BR /&gt; "Original-Content-Length" = 309120;&lt;BR /&gt; Server = nginx;&lt;BR /&gt; Vary = "Dropbox-API-Arg, Authorization";&lt;BR /&gt; "X-Content-Security-Policy" = sandbox;&lt;BR /&gt; "X-Content-Type-Options" = nosniff;&lt;BR /&gt; "X-Dropbox-Request-Id" = 4fc663ac6e844df8e9874e252f002373;&lt;BR /&gt; "X-Robots-Tag" = "noindex, nofollow, noimageindex";&lt;BR /&gt; "X-WebKit-CSP" = sandbox;&lt;BR /&gt;}&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Apr 2016 03:52:19 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175435#M6913</guid>
      <dc:creator>Vladimir K.2</dc:creator>
      <dc:date>2016-04-14T03:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP API V2 download range request: strange behaviour</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175436#M6914</link>
      <description>&lt;P&gt;Thanks! It looks like these aren't the actual raw requests though. How are you printing out the request headers you're sending? Can you print out the raw requests, and double check that you're sending the exact "Range" header that you're intending to?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 04:53:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175436#M6914</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-04-14T04:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP API V2 download range request: strange behaviour</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175437#M6915</link>
      <description>&lt;P&gt;I don't know how to&amp;nbsp;get raw requests, because they are generated by&amp;nbsp;the following obj-c code.&lt;/P&gt;
&lt;PRE&gt;+ (CloudHTTPResponse*) sendDownloadRequestWithToken:(NSString*)token path:(NSString*)path offset:(UInt64)offset andLength:(UInt64)length {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NSString *url = @"&lt;A href="https://content.dropboxapi.com/2/files/download" rel="nofollow noreferrer"&gt;https://content.dropboxapi.com/2/files/download&lt;/A&gt;";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NSString *json = [NSString stringWithFormat:@"{\"path\": \"%@\"}", path];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NSURL *urlWithArgs = [NSURL URLWithString:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [NSString stringWithFormat:@"%@?arg=%@", url, [json stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:urlWithArgs];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; [request setHTTPMethod:@"GET"];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; [request setValue:[NSString stringWithFormat:@"Bearer %@", token] forHTTPHeaderField:@"Authorization"];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; [request setValue:[NSString stringWithFormat:@"bytes=%llu-%llu", offset, offset+length-1] forHTTPHeaderField:@"Range"];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return [self sendRequestSynchronously:request];&lt;BR /&gt;}&lt;/PRE&gt;
&lt;PRE&gt;+ (CloudHTTPResponse*) sendRequestSynchronously:(NSURLRequest*)request {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NSLog(@"%@", [request URL]);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NSLog(@"%@", [request HTTPMethod]);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NSLog(@"%@", [request allHTTPHeaderFields]);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NSURLSession *session = [NSURLSession sharedSession];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; __block CloudHTTPResponse *httpResponse = nil;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; httpResponse = [[CloudHTTPResponse alloc] initWithHeaderFields:[(NSHTTPURLResponse *)response allHeaderFields]&lt;BR /&gt;statusCode:(int)[(NSHTTPURLResponse *)response statusCode]&lt;BR /&gt;data:data&lt;BR /&gt;andError:error];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dispatch_semaphore_signal(semaphore);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; }];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; [task resume];&lt;BR /&gt;&amp;nbsp; &amp;nbsp; dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NSLog(@"%i", httpResponse.statusCode);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; NSLog(@"%@", httpResponse.headerFields);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return httpResponse;&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;As you can see, headers are printed right before sending the request and after receiving the response.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 14:32:45 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175437#M6915</guid>
      <dc:creator>Vladimir K.2</dc:creator>
      <dc:date>2016-04-14T14:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP API V2 download range request: strange behaviour</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175438#M6916</link>
      <description>&lt;P&gt;Hmmm... Now it seems to me, that I have a problem with the shared NSURLSession and caching. I'll check it and report here soon.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 14:49:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175438#M6916</guid>
      <dc:creator>Vladimir K.2</dc:creator>
      <dc:date>2016-04-14T14:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP API V2 download range request: strange behaviour</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175439#M6917</link>
      <description>&lt;P&gt;Hooray! Local caching was the reason. All I needed to do is to create custom NSURLSession with the default configuration and change its caching policy to &lt;EM&gt;NSURLRequestReloadIgnoringLocalCacheData&lt;/EM&gt;. Now everything works fine. Thanks for trying to help me &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;
&lt;PRE&gt;NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];&lt;BR /&gt;configuration.requestCachePolicy = NSURLRequestReloadIgnoringLocalCacheData;&lt;BR /&gt;NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Apr 2016 16:46:25 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-V2-download-range-request-strange-behaviour/m-p/175439#M6917</guid>
      <dc:creator>Vladimir K.2</dc:creator>
      <dc:date>2016-04-14T16:46:25Z</dc:date>
    </item>
  </channel>
</rss>

