Hi, could someone explain me why do I get a broken pipe when I call some urls asynchronously from javascript, but works fine for synchronous calls? I use django-piston to create a simple read api that I call using something like
var req = new XMLHttpRequest(); req.open('GET', 'http://127.0.0.1:8000/api/user/', true, user, password); // this is an async call, because of true, if I set it to false, then everything runs fine req.setRequestHeader('Authorization', make_base_auth(user, password)); req.setRequestHeader('Content-Type', 'application/json'); req.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE; req.onload = myOnload req.onstatechange = function(aEvt) { if(req.readyState == 4) { myOnload(aEvt, req); } } req.send(null); if(req.status == 200) // do something with req.responseText Here is the output of runserver: the first call to /api/user/ is synchronous and returns fine, unlike the second one [20/Apr/2010 05:56:01] "GET /api/user/ HTTP/1.1" 200 72 Traceback (most recent call last): File "/home/nagyv/virtualenv/coosci/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 280, in run self.finish_response() File "/home/nagyv/virtualenv/coosci/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 320, in finish_response self.write(data) File "/home/nagyv/virtualenv/coosci/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 399, in write self.send_headers() File "/home/nagyv/virtualenv/coosci/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 463, in send_headers self.send_preamble() File "/home/nagyv/virtualenv/coosci/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 381, in send_preamble 'Date: %s\r\n' % http_date() File "/usr/lib/python2.5/socket.py", line 262, in write self.flush() File "/usr/lib/python2.5/socket.py", line 249, in flush self._sock.sendall(buffer) error: (32, 'Broken pipe') it would be already a great help if someone could give me some ideas at least how to find out which async call gives the broken pipe error, as when I call them synchronously, they return fine. thanks, Viktor -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.