Add `offset` and `count` to Path Send
This discussion exists to talk about whether the Path Send spec can be reasonably modified to support offset and count, in a similar manner to those respective variables within zerocopysend.
As a summary of the original discussion...
zerocopysendwas effectively dead on arrival due to integration challenges with existing webservers.pathsendcan be considered as an alternative that is more compatible with a variety of webservers.pathsendcurrently does not supportoffsetandcount, which makes it impossible to use with HTTP range requests.andrewgodwinagreed thatoffsetandcountcan be added topathsendif it can be implemented in a backwards compatible manner- I suggested if backwards compatibility is too challenging, then the extension namespace can be cluttered with
http.response.pathsend2
On the backward compatibility thing, I personally think is fine to add new features on top of an existing extension, given there's a way for the application to understand if those features are supported.
One idea might be to add this information to the scope, eg:
"scope": {
"extensions": {
"http.response.pathsend": {
"ranges": True
},
},
}
in such way the application knows if the server supports the additional keys in the messages and use them; the lack of that boolean means no support is given. I'd also personally prefer a single key in the message for the range, as the application should already know the total size of the file to produce valid range headers, eg:
{
"type": "http.response.pathsend",
"path": "foobar.txt",
"range": (0, 4096) # send only the first 4KB
}
That's a good idea - extensions entries were meant to be dicts exactly so we could definitely add signal in there.
What is the proper procedure for introducing this as an ASGI spec change? Should I create an informal GitHub issue within asgiref?
Apologies for my inexperience with the Django team's workflow.