If the request contains a header such as:
Authorization: Digest username="Mufasa",
realm="testrealm@host.com",
nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093"
Does node have any built-in way to extract the key value pairs? Or should I just use string.split?
Use the URL module http://nodejs.org/api/url.html
Example: http://www.host.com:8080/path?name=daniel
Takes a URL string, and return an object.
url.parse(urlStr, [parseQueryString], [slashesDenoteHost])
var server = http.createServer(function (request, response) {
var queryData = url.parse(request.url, true).query;
response.writeHead(200, {"Content-Type": "text/plain"});
response.end('Hello ' + queryData.name + '\n');
}
In this example name is mapped to daniel.