Skip to content

Commit

Permalink
Merge pull request #101 from wikimedia/content-length
Browse files Browse the repository at this point in the history
Strip inappropriate content-length response headers
  • Loading branch information
gwicke committed Dec 31, 2014
2 parents 484a46a + 419362a commit c075063
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ function handleResponse (opts, newReq, resp, response) {
resp.writeHead(response.status, '', response.headers);
resp.end(body);
} else {
if (response.headers['content-length']) {
opts.log('warn/response/content-length', {
req: newReq,
res: response,
reason: new Error('Invalid content-length')
});
delete response.headers['content-length'];
}
resp.writeHead(response.status, '', response.headers);
resp.end();
}
Expand Down
2 changes: 1 addition & 1 deletion test/features/pagecontent/pagecontent.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = function (config) {
});
});
it('should create a new html revision using proxy handler with id 624484444', function() {
this.timeout(40000);
this.timeout(20000);
return preq.put({
uri: config.baseURL + '/test/Foo/wikitext/624484444',
headers: { 'content-type': 'text/html' },
Expand Down

0 comments on commit c075063

Please sign in to comment.