toolkit/components/passwordmgr/test/formsubmit.sjs

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 {
michael@0 3 try {
michael@0 4 reallyHandleRequest(request, response);
michael@0 5 } catch (e) {
michael@0 6 response.setStatusLine("1.0", 200, "AlmostOK");
michael@0 7 response.write("Error handling request: " + e);
michael@0 8 }
michael@0 9 }
michael@0 10
michael@0 11
michael@0 12 function reallyHandleRequest(request, response) {
michael@0 13 var match;
michael@0 14 var requestAuth = true;
michael@0 15
michael@0 16 // XXX I bet this doesn't work for POST requests.
michael@0 17 var query = request.queryString;
michael@0 18
michael@0 19 var user = null, pass = null;
michael@0 20 // user=xxx
michael@0 21 match = /user=([^&]*)/.exec(query);
michael@0 22 if (match)
michael@0 23 user = match[1];
michael@0 24
michael@0 25 // pass=xxx
michael@0 26 match = /pass=([^&]*)/.exec(query);
michael@0 27 if (match)
michael@0 28 pass = match[1];
michael@0 29
michael@0 30 response.setStatusLine("1.0", 200, "OK");
michael@0 31
michael@0 32 response.setHeader("Content-Type", "application/xhtml+xml", false);
michael@0 33 response.write("<html xmlns='http://www.w3.org/1999/xhtml'>");
michael@0 34 response.write("<p>User: <span id='user'>" + user + "</span></p>\n");
michael@0 35 response.write("<p>Pass: <span id='pass'>" + pass + "</span></p>\n");
michael@0 36 response.write("</html>");
michael@0 37 }

mercurial