+
+ # Handle Range requests. Currently we support only 'bytes=0-....'
+ if request.headers.include? 'HTTP_RANGE'
+ if m = /^bytes=0-(\d+)/.match(request.headers['HTTP_RANGE'])
+ opts[:maxbytes] = m[1]
+ size = params[:size] || '*'
+ self.response.status = 206
+ self.response.headers['Content-Range'] = "bytes 0-#{m[1]}/#{size}"
+ end
+ end
+