Support Range: in cowboy_rest #306

Open
dvv opened this Issue Nov 1, 2012 · 13 comments

Comments

Projects
None yet
5 participants
Contributor

dvv commented Nov 1, 2012

Hi!

Is the subj planned?

TIA,
--Vladimir

Contributor

dvv commented Nov 2, 2012

Where is the right place to put restrictions on the range of served data?

Contributor

dvv commented Nov 2, 2012

Please, someone, review dvv/cowboy@0bf71f3 -- will this be welcome in the core? How to pass and honor Offset/Length in content_function in cosher way? tia

Owner

essen commented Nov 2, 2012

As-is no, for many reasons including adding a cowboy_util module when we have cowboy_http for all parsing needs.

But I didn't think about Ranges much yet, although we do want to support them, so it'll take a few weeks before I do a proposal including that.

Contributor

dvv commented Nov 2, 2012

i see. it was my first experience in Erlang.

Range: is the cleanest way to specify portions of data w/o abusing querystring, Content-Range: is well-suited for consistent client-side paging.

nothing pressing.

Owner

essen commented Nov 2, 2012

It's not to be used for paging though, the Range value is in bytes and represents the byte range from the entity body returned. It's mostly used for resuming downloads.

Contributor

dvv commented Nov 2, 2012

2616 defines only "bytes" item, yes. but below is quite valid case i learned from Pintura and it fits REST (thus cowboy_rest) very well:

GET /Product/?type=shoe
Range: items=10-19
Content-Range: items 10-19/100
Contributor

egobrain commented Nov 2, 2012

Range can be set not only to 'bytes'

Here is a part of RFC 2616

3.12 Range Units

HTTP/1.1 allows a client to request that only part (a range of) the
response entity be included within the response. HTTP/1.1 uses range
units in the Range (section 14.35) and Content-Range (section 14.16)
header fields. An entity can be broken down into subranges according
to various structural units.

 range-unit       = bytes-unit | other-range-unit
 bytes-unit       = "bytes"
 other-range-unit = token

The only range unit defined by HTTP/1.1 is "bytes". HTTP/1.1
implementations MAY ignore ranges specified using other units.

Using Range header is a best way to organize pagination in RESTfull API.

Owner

essen commented Nov 2, 2012

Missed the part on units. OK.

Owner

essen commented Aug 27, 2013

The Ranch stuff got merged. We're one step closer to having this done!

Hi Loïc,
Is there anything missing to support Range header in cowboy_rest? I am not sure about this but it seems this issue can be closed, isn't it?
Also, can we support returning 206 Partial content when a Content-Range header is specified in the response?
Camille

Owner

essen commented Aug 31, 2014

Well it's open because nothing has been done yet. I want full support following the rfc.

Loïc Hoguin
http://ninenines.eu

-------- Original Message --------
From:Camille Troillard notifications@github.com
Sent:Sun, 31 Aug 2014 15:58:10 +0300
To:ninenines/cowboy cowboy@noreply.github.com
Cc:Loïc Hoguin essen@ninenines.eu
Subject:Re: [cowboy] Support Range: in cowboy_rest (#306)

Hi Loïc,
Is there anything missing to support Range header in cowboy_rest? I am not sure about this but it seems this issue can be closed, isn't it?
Also, can we support returning 206 Partial content when a Content-Range header is specified in the response?
Camille


Reply to this email directly or view it on GitHub.

Sounds great, thanks!

@essen essen modified the milestone: 2.0.0 Aug 18, 2015

s-kostyaev commented Dec 10, 2016 edited

You can see partial implementation in #1059

@essen essen modified the milestone: 2.0.0, After 2.0 Feb 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment