3

If i want to download a file from a dropbox url my http header range is ignored:

httpRequest = new HttpGet(url.toURI());
httpRequest.addHeader("Range", "bytes=" + startPos + "-"    + dwnInfo.getStopRange());
httpRequest.addHeader("Accept-Encoding", "");

So instead of making my file download in x chunks of 5mb for ex, the connection ignores the specified range and it downloads x chunks of Y mb, where y is the full size of the file.

Downloading from an amazon storange link i don't have any problems.

Anyone else encountered this situation ? This only happens from some days ago. This wasn't a issue until now.

I tried to look on dropbox dev page but didn't see anything that specifies if they removed the accepted range on urls

Tazz
  • 781
  • 1
  • 8
  • 23
  • 1
    Dropbox generally supports range retrieval both in the API and in downloadable share links. What kind of URL are you reading from? (Can you give an example or at least say how you created/acquired the URL?) – user94559 Jun 17 '14 at 15:32
  • https://www.dropbox.com/s/5c7atlfmacjf3qn/02%20Armin%20Van%20Buuren%20-%20A%20State%20Of%20Trance%20Year%20Mix%202013%20%28Cd%202%29.mp3 – Tazz Jun 18 '14 at 08:53
  • checked and it doesn't return 206 .. it returns 200, so my guess is that it doesn't support range anymore on those links – Tazz Jun 18 '14 at 08:54
  • https://twitter.com/jakubroztocil/status/435392335342362624 – Jakub Roztocil Jun 24 '14 at 22:36

1 Answers1

4

The link you gave is to an HTML page (total size ~46KB), so even if range retrieval worked there, it wouldn't be very useful.

Per https://www.dropbox.com/help/201/en, you can turn a share link into a direct link to the file by changing the domain to dl.dropboxusercontent.com, so your link becomes https://dl.dropboxusercontent.com/s/5c7atlfmacjf3qn/02%20Armin%20Van%20Buuren%20-%20A%20State%20Of%20Trance%20Year%20Mix%202013%20%28Cd%202%29.mp3, and range retrieval works for that URL.

(Here I'm using httpie.)

$ http get https://dl.dropboxusercontent.com/s/5c7atlfmacjf3qn/02%20Armin%20Van%20Buuren%20-%20A%20State%20Of%20Trance%20Year%20Mix%202013%20%28Cd%202%29.mp3 range:bytes=0-0
HTTP/1.1 206 PARTIAL CONTENT
Connection: keep-alive
Content-Length: 1
Content-Type: audio/mpeg
Date: Wed, 18 Jun 2014 14:53:32 GMT
Server: nginx
accept-ranges: bytes
cache-control: max-age=0
content-range: bytes 0-0/146014047
etag: 346n
pragma: public
set-cookie: uc_session=2cqmevWxG8lmGt743KMXebc23dRC5iuZEfm8Etx6V2VShWk60jmnUJajFnH1wRG4; Domain=dropboxusercontent.com; Path=/; secure; httponly
x-dropbox-request-id: 2f0c5986a62cf2f0b06af1704ece5bd7
x-server-response-time: 535

I
user94559
  • 59,196
  • 6
  • 103
  • 103
  • i will check and get back to you, thanks. If it will work will for any link i will accept the amswer – Tazz Jun 19 '14 at 07:50
  • to make the file download i need to add ?dl=1. This makes the new link to not accept partial content :( – Tazz Jun 19 '14 at 08:12
  • No, you don't need to add `?dl=1`. Are you having some trouble with the exact URL I gave you? – user94559 Jun 19 '14 at 15:25
  • yes ... it only downloads like 300kb, not all the file – Tazz Jun 20 '14 at 11:21
  • What tool/code are you using to download the file? "http -d get https://dl.dropboxusercontent.com/s/5c7atlfmacjf3qn/02%20Armin%20Van%20Buuren%20-%20A%20State%20Of%20Trance%20Year%20Mix%202013%20%28Cd%202%29.mp3" gives me a 139.25 MB file (146014047 bytes). – user94559 Jun 20 '14 at 15:43