Uploaded image for project: 'Islandora'
  1. Islandora
  2. ISLANDORA-2084

Rediect (R) and externally referenced (E) datastreams fail on byte range requests



    • Type: Bug
    • Status: In Review
    • Priority: Minor
    • Resolution: Ready for Test
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:


      When a byte range request is requested for a R or E datastream it will return a 416 HTTP response code as it does not have the content length of the datastream. The expected behvior would be to let the web server of the requested resource dictate how it's served up. However, given the current expected behavior of the islandora_view_datastream function (https://github.com/Islandora/islandora/blob/7.x/includes/datastream.inc#L32) it's being served up via the getDatastreamDissemination call to Fedora (https://github.com/islandora/tuque/blob/1.x/Datastream.php#L942-L944). Similarly, the download behavior will serve up a file on download and redirecting will also make this behavior change. The change in the code will only change how byte range request on view operates.

      Looking into this uncovers another issue that likely exists with E datastreams. That is, as there is no size/content length stored on the datastream it'd be impossible for byte range requests to be resolvable. A potential solution would be to a HEAD request but Fedora did not support HEAD requests until 3.8.1 and the underlying resolution for E control groups may not itself support it. This should be discussed and addressed in another ticket.

      Test case:

      To duplicate, construct a redirect datastream in the devel block:

      $object = islandora_object_load('islandora:root');
      $ds = $object->constructDatastream('Test', 'R');
      $ds->url = 'http://www.google.com';

      Now do a CURL request against it (substitute yourhostname with the URL of the box being tested on):

      curl -i 'http://yourhoustname/islandora/object/islandora%3Aroot/datastream/Test/view' -H 'Range: bytes=0-'
      HTTP/1.1 416 Requested Range Not Satisfiable
      Date: Mon, 16 Oct 2017 18:02:23 GMT
      Server: Apache/2.4.7 (Ubuntu)
      X-Powered-By: PHP/5.5.9-1ubuntu4.19
      Expires: Sun, 19 Nov 1978 05:00:00 GMT
      Cache-Control: public, must-revalidate, max-age=0
      X-Content-Type-Options: nosniff
      Last-Modified: Mon, 16 Oct 2017 16:38:20 GMT
      Accept-Ranges: 0-0
      Content-Range: bytes 0--1/0
      Content-Length: 0
      Content-Type: text/xml

      After the pull request you'll see:

      curl -i 'http://yourhostname/islandora/object/islandora%3Aroot/datastream/Test/view' -H 'Range: bytes=0-'
      HTTP/1.1 302 Found
      Date: Mon, 16 Oct 2017 18:03:25 GMT
      Server: Apache/2.4.7 (Ubuntu)
      X-Powered-By: PHP/5.5.9-1ubuntu4.19
      Expires: Sun, 19 Nov 1978 05:00:00 GMT
      Cache-Control: no-cache, must-revalidate
      X-Content-Type-Options: nosniff
      Location: http://www.google.com
      Content-Length: 0
      Content-Type: text/xml






            • Assignee:
              jordandukart Jordan Dukart
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: