`Content-Length` is wrong when full content is smaller than the requested Range
- Dominant language
- JavaScript
- Stars
- 51
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
```
> User-Agent: facebookexternalhit/1.1
> Accept: */*
> Accept-Encoding: deflate, gzip
> Range: bytes=0-524287
>
< HTTP/1.1 206 Partial Content
< Date: Sat, 24 Feb 2018 06:27:21 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 524288
< Connection: keep-alive
< Accept-Ranges: bytes
< Content-Range: bytes 0-524287/12338
< x-readtime: 52
```
The `Content-Length` should be the content's real size(https://github.com/koajs/koa-range/blob/master/index.js#L80) will be better when full content is smaller than the requested Range.
Also see: https://github.com/restlet/restlet-framework-java/issues/604
Contributor guide
Research direction
Inspect index.js around line 80 and reproduce the Range: bytes=0-524287 request against content whose full size is 12338 bytes. Done means the 206 response reports the actual content size in Content-Length rather than the requested range size, consistently with its Content-Range header.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100