Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Allow custom-set "Accept-Ranges" header #6

Merged
merged 1 commit into from

2 participants

Benjamin Flesch TJ Holowaychuk
Benjamin Flesch
bf commented

Allow the main application to deny range requests by setting response header "Accept-Ranges" to "none". This also enables a workaround for connect bug senchalabs/connect#599 which affects PDF downloads by the Adobe PDF Plugin.

Benjamin Flesch bf Allow the main application to deny range requests by setting response…
… header "Accept-Ranges" to "none". This also enables a workaround for connect bug senchalabs/connect#599 .
f2f61f6
TJ Holowaychuk tj merged commit 2ebf616 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 16, 2012
  1. Benjamin Flesch

    Allow the main application to deny range requests by setting response…

    bf authored
    … header "Accept-Ranges" to "none". This also enables a workaround for connect bug senchalabs/connect#599 .
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/send.js
2  lib/send.js
View
@@ -454,7 +454,7 @@ SendStream.prototype.type = function(path){
SendStream.prototype.setHeader = function(stat){
var res = this.res;
- res.setHeader('Accept-Ranges', 'bytes');
+ if (!res.getHeader('Accept-Ranges')) res.setHeader('Accept-Ranges', 'bytes');
if (!res.getHeader('ETag')) res.setHeader('ETag', utils.etag(stat));
if (!res.getHeader('Date')) res.setHeader('Date', new Date().toUTCString());
if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + (this._maxage / 1000));
Something went wrong with that request. Please try again.