Invalidate HTTP download if error or corrupted
up vote
0
down vote
favorite
I have a Django view that uses a StreamingHttpResponse
to return a possibly large file (as a download). Near the end of streaming I check the integrity of the content against an HMAC signature. If that fails, the stream simply stops and the user still has most of the file saved. Is there any sort of way to get the browser to toss out what it's downloaded so far?
Right now I have it sending a "Content-Length" header, but the fact that it stops before it's reached that length doesn't seem to effect anything.
I read about using a "Trailer" header and then putting something in the trailer to indicate that the download should not be trusted, but I don't think there's any sort of built-in support in browsers to do anything with that (that I know of).
django http http-headers
add a comment |
up vote
0
down vote
favorite
I have a Django view that uses a StreamingHttpResponse
to return a possibly large file (as a download). Near the end of streaming I check the integrity of the content against an HMAC signature. If that fails, the stream simply stops and the user still has most of the file saved. Is there any sort of way to get the browser to toss out what it's downloaded so far?
Right now I have it sending a "Content-Length" header, but the fact that it stops before it's reached that length doesn't seem to effect anything.
I read about using a "Trailer" header and then putting something in the trailer to indicate that the download should not be trusted, but I don't think there's any sort of built-in support in browsers to do anything with that (that I know of).
django http http-headers
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a Django view that uses a StreamingHttpResponse
to return a possibly large file (as a download). Near the end of streaming I check the integrity of the content against an HMAC signature. If that fails, the stream simply stops and the user still has most of the file saved. Is there any sort of way to get the browser to toss out what it's downloaded so far?
Right now I have it sending a "Content-Length" header, but the fact that it stops before it's reached that length doesn't seem to effect anything.
I read about using a "Trailer" header and then putting something in the trailer to indicate that the download should not be trusted, but I don't think there's any sort of built-in support in browsers to do anything with that (that I know of).
django http http-headers
I have a Django view that uses a StreamingHttpResponse
to return a possibly large file (as a download). Near the end of streaming I check the integrity of the content against an HMAC signature. If that fails, the stream simply stops and the user still has most of the file saved. Is there any sort of way to get the browser to toss out what it's downloaded so far?
Right now I have it sending a "Content-Length" header, but the fact that it stops before it's reached that length doesn't seem to effect anything.
I read about using a "Trailer" header and then putting something in the trailer to indicate that the download should not be trusted, but I don't think there's any sort of built-in support in browsers to do anything with that (that I know of).
django http http-headers
django http http-headers
asked Nov 19 at 20:06
Tim Tisdall
6,82623060
6,82623060
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381878%2finvalidate-http-download-if-error-or-corrupted%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown