Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | function handleRequest(request, response) |
michael@0 | 2 | { |
michael@0 | 3 | var file; |
michael@0 | 4 | getObjectState("SERVER_ROOT", function(serverRoot) |
michael@0 | 5 | { |
michael@0 | 6 | var ref = request.getHeader("Referer").split("?")[0]; |
michael@0 | 7 | // 8 is "https://".length which is the longest string before the host. |
michael@0 | 8 | var pathStart = ref.indexOf("/", 8) + 1; |
michael@0 | 9 | var pathEnd = ref.lastIndexOf("/") + 1; |
michael@0 | 10 | file = serverRoot.getFile(ref.substring(pathStart, pathEnd) + "x"); |
michael@0 | 11 | }); |
michael@0 | 12 | |
michael@0 | 13 | response.setHeader("Content-Type", "text/plain", false); |
michael@0 | 14 | response.write(file.path.substr(0, file.path.length-1)); |
michael@0 | 15 | } |