Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | function handleRequest(request, response) { |
michael@0 | 2 | let invalidHeaders = ["Cookie"]; |
michael@0 | 3 | let headers = {}; |
michael@0 | 4 | |
michael@0 | 5 | if (request.queryString == "expectAuth=true") { |
michael@0 | 6 | if (request.hasHeader("Authorization")) { |
michael@0 | 7 | headers["authorization"] = request.getHeader("Authorization"); |
michael@0 | 8 | } else { |
michael@0 | 9 | response.setStatusLine(null, 401, "Authentication required"); |
michael@0 | 10 | response.setHeader("WWW-Authenticate", "basic realm=\"testrealm\"", true); |
michael@0 | 11 | } |
michael@0 | 12 | } else { |
michael@0 | 13 | invalidHeaders.push("Authorization"); |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | for each (let header in invalidHeaders) { |
michael@0 | 17 | if (request.hasHeader(header)) { |
michael@0 | 18 | response.setStatusLine(null, 500, "Server Error"); |
michael@0 | 19 | headers[header.toLowerCase()] = request.getHeader(header); |
michael@0 | 20 | } |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | response.write(JSON.stringify(headers)); |
michael@0 | 24 | } |