Skip to content

Commit

Permalink
removed content-length field for 404 returns
Browse files Browse the repository at this point in the history
  • Loading branch information
netptop committed Mar 15, 2020
1 parent bb2f472 commit cdd310a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
1 change: 1 addition & 0 deletions Proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ let Proxy = ({urlModify, httpprefix, serverName, port, cookieDomainRewrite, loca
logSave(`res.status:${res.statusCode} res.url:${res.url}, res.headers:${JSON.stringify(res.getHeaders())}`)
if (res.statusCode === 404) {
try {
delete res.headers['content-length'] //remove content-length field
res.status(404).send("")
} catch(e) {
logSave(`error: ${e}`)
Expand Down
14 changes: 0 additions & 14 deletions test/siteproxylocal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,6 @@ test('google.com regex match issue.', async () => {
expect(response.data.indexOf(`href="/https/www.google.com/g);`)).toBe(-1)
}, 30000);

test('pingcong href="/" issue.', async () => {
const url = `${httpprefix}://${serverName}:${port}/https/pincong.rocks/search/`
const response = await axios({
method: 'get',
headers: {
'Accept': `text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9`,
},
url,
})
// console.log(`${JSON.stringify(response.headers)}`)
// console.log(`${response.data}`)
expect(response.data.indexOf(`href="/"`)).toBe(-1)
}, 30000);

test('yorkbbs issue', async () => {
const url = `${httpprefix}://${serverName}:${port}/http/www.yorkbbs.ca/`
const response = await axios({
Expand Down

0 comments on commit cdd310a

Please sign in to comment.