browser/devtools/webconsole/test/test-bug-599725-response-headers.sjs

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 /*
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/publicdomain/zero/1.0/
     4  */
     6 function handleRequest(request, response)
     7 {
     8   var Etag = '"4c881ab-b03-435f0a0f9ef00"';
     9   var IfNoneMatch = request.hasHeader("If-None-Match")
    10                     ? request.getHeader("If-None-Match")
    11                     : "";
    13   var page = "<!DOCTYPE html><html><body><p>hello world!</p></body></html>";
    15   response.setHeader("Etag", Etag, false);
    17   if (IfNoneMatch == Etag) {
    18     response.setStatusLine(request.httpVersion, "304", "Not Modified");
    19   }
    20   else {
    21     response.setHeader("Content-Type", "text/html", false);
    22     response.setHeader("Content-Length", page.length + "", false);
    23     response.write(page);
    24   }
    25 }

mercurial