[Hampshire] AJAX, digest auth, and Firefox

Top Page
Author: Hugo Mills
Date:  
To: Hants LUG
Subject: [Hampshire] AJAX, digest auth, and Firefox

Reply to this message
gpg: failed to create temporary file '/var/lib/lurker/.#lk0x57fcc100.hantslug.org.uk.11518': Permission denied
gpg: keyblock resource '/var/lib/lurker/pubring.gpg': Permission denied
gpg: Signature made Sun Jun 21 16:41:05 2009 BST
gpg: using DSA key 20ACB3BE515C238D
gpg: Can't check signature: No public key
All -

I'm trying to write an RESTful AJAX application, using HTTP digest
authentication on the REST resources. Up until now, it's been working
fine. However, today I added some code, and Firefox now asks for a
username and password using its standard login box, for most AJAX
requests.

The code I added was in one of the existing AJAX handlers, to make
a further AJAX request, based on the returned data. The code looks
something like this:


basic_ajax_get(url1, callback1);

function callback1(req)
{
    data = parse_result(req.responseText);
    url2 = some_function_of(data);
    bas0c_ajax_get(url2, callback2); // Works fine without this
}


function callback2(req)
{
    // Do other stuff here
}


function basic_ajax_get(url, callback)
{
    var req = get_ajax_object(); // Just gets a new XMLHTTPRequest object
    var account = document.getElementById("account").value
    var password = document.getElementById("password").value


    req.onreadystatechange = function() { callback(req); };
    req.open("GET", api + url, true, account, password);
    req.send("");
}



Has anyone else come across this issue? If so, do you have any idea
how might I go about fixing it?

Hugo.

-- 
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
  PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
     --- Computer Science is not about computers,  any more than ---     
                     astronomy is about telescopes.