Open randomnicode opened 4 years ago
Going to update the same topic after my review of StreamController, which again violates RFC 7233:
206 Partial Content has no meaning outside of a Range request header (in fact it is defined only in relation to the Range header in the spec itself):
The 206 (Partial Content) status code indicates that the server is
successfully fulfilling a range request for the target resource by
transferring one or more parts of the selected representation that
correspond to the satisfiable ranges found in the request's Range
header field (Section 3.1).
Yet Airsonic responds with a 206 even if Range header is not set by the client, which is in violation of the spec. The client has no reasonable expectation to receive a 206 if it didn't send a Range header. Specifically, if offsetSeconds
parameter is set, a Range seems to be artificially added to the request: https://github.com/airsonic/airsonic/blob/master/airsonic-main/src/main/java/org/airsonic/player/controller/StreamController.java#L347-L350
This should be instead returning a full 200 OK response. Byte offsets shouldn't be treated in the same way as second offsets, particularly as a parameter field. The Ranges header is meant to be extensible for units other than bytes (needs to be registered at IANA), but it needs to come from the client. In either scenario, returning 206 Partial Content when client doesn't send Ranges is not legal.
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.
Likely might be true for other controllers too, just haven't gotten to it yet.
A solution is proposed here at the airsonic-advanced fork (along with other optimizations and streamlining): https://github.com/airsonic-advanced/airsonic-advanced/pull/52
In lieu of, you could also probably get away with just adding and fixing the Content-Range response headers (just add a "/*" at the end for unknown lengths), switching the ETags to use a different representation (like file size), and fixing the media types to something coherent