pathsend support #3073
Unanswered
apawlucz-cisco
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I'm having a hard time setting up static file server using:
My requirement is the static file requests need to go through the ASGI app (
starlette) for the authorization purposes, i.e. some files cannot be seen by unauthorized users. So I can't just use the bare static file serving mechanism fromgranian.The error I'm getting now is:
In my case the chunk looks like this:
{ "type": "http.response.pathsend", "path": "<PATH_TO_STATIC_FILE>" }Corresponding part of the code in
starlette:I am aware about the discussions taking place in the past in both
starletteandgranian:And the chronological history on the
starletteside:I do understand
pathsendsupport was once added, then reverted, then added back so my understanding is it should work in the latest version (0.50.0at the time of writing this post).We do use
BaseHTTPMiddlewarein our app if this matters.After digging through I realized that here:
The
pathsendsupport was added only to the internalstarlette.middleware.base._StreamingResponse, but not the publicstarlette.responses.StreamingResponse. The case is we have one middleware which uses this publicStreamingResponsewhich causes the issue at hand. When I switch it to use internal_StreamingResponse- then all works.Our middleware is pure ASGI middleware (so doesn't use
BaseHTTPMiddleware).This is part of this middleware:
What would be a long-term solution in case like this? Using internal
_StreamingResponsedoesn't seem to be right thing to do.I believe
StreamingResponseneeds to be fixed in a similar fashion instarlette.Beta Was this translation helpful? Give feedback.
All reactions