← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1624508] Re: Glance raises a HTTPBadRequest instead of HTTPRequestRangeNotSatisfiable (400 instead of 416)

 

Reviewed:  https://review.openstack.org/367528
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=400230cd9d72f00caf6c1d5824da906ea335a1ad
Submitter: Jenkins
Branch:    master

commit 400230cd9d72f00caf6c1d5824da906ea335a1ad
Author: Dharini Chandrasekar <dharini.chandrasekar@xxxxxxxxx>
Date:   Thu Sep 8 17:03:40 2016 +0000

    Handling HTTP range requests in Glance
    
    Currently Glance does not send Partial response codes while
    handling HTTP range requests. Also, content length is not
    appropriately set.
    
    This patch is to send partial response code and to set the correct
    content length based on the range request for image download.
    
    Upon success status code 206 is sent and the content length is set to the
    requested range.
    Upon failure, there can be 2 cases:
     * If the HTTP range request for the image download is bad (For example,
       requesting download of range of bytes 10 to 50 bytes when there are only 48
       bytes), status code is set to 416 and HTTPRequestRangeNotSatisfiable is
       raised.
     * If the content range is valid, but the request is not satisfiable due to
       glance_store side erros or privacy issues, appropriate exceptions are
       raised.
    
    APIImpact
    DocImpact
    
    Closes-Bug: #1417069
    Closes-Bug: #1624508
    Closes-Bug: #1399851
    Closes-Bug: #1618928
    
    Change-Id: I3cd47b998be79604511b3cd4879209820cf776b7


** Changed in: glance
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1624508

Title:
  Glance raises a HTTPBadRequest instead of
  HTTPRequestRangeNotSatisfiable (400 instead of 416)

Status in Glance:
  Fix Released

Bug description:
  Currently when range requests are given as a part of the HTTP header request for partial downloads of Glance images, a call to the method ``get_content_range()`` in glance/common/wsgi.py is made.
  If the request range is not satisfiable (For example a bad range like 2-4/3 or 2-/3), the ``get_content_range()`` method raises a 400 instead of a 416.

  Since this method deals only with parsing and returning the content
  range header, it is more appropriate for it to raise a
  HTTPRequestRangeNotSatisfiable with a status code of 416 instead of a
  400.

  File:
  https://github.com/openstack/glance/blob/master/glance/common/wsgi.py#L975-L983

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1624508/+subscriptions


References