Go: proposal: export net/http's httpRange and parseRange

Created on 13 Sep 2018  路  2Comments  路  Source: golang/go

The stdlib net/http package already has code to parse the "Content-Range" header.

The golang.org/x/net/webdav package wants to handle "Content-Range", and is considering rolling its own parser, regexp-based or otherwise: https://go-review.googlesource.com/c/net/+/128115

The proposal is to export net/http's httpRange (and its fields, obviously) and parseRange, possibly renaming them to ContentRange and ParseContentRange.

If we do that, we might want to consider tightening the semantics or expectations of the httpRange's start and length int64-typed fields. For example, what happens in its various methods if start + length overflows or if some field values are negative.

@bradfitz

FrozenDueToAge Proposal

Most helpful comment

Elsewhere I'd said we could move it to x/net's httpguts package. That's fine.

All 2 comments

Elsewhere I'd said we could move it to x/net's httpguts package. That's fine.

httpguts sounds perfect.

Was this page helpful?
0 / 5 - 0 ratings