XHR using user and password parameters

2011-07-11 Thread Hallvord R. M. Steen

Hi,
the current spec seems a bit hand-wavey on how headers should be sent when  
user name and password parameters are given in the open call. It just says
send Authorization headers and handle 401 Unauthorized requests  
appropriately.


Many implementations don't send the Authorize: header even if the script  
supplies user name and password, unless they have seen a 401 response.  
This seems a bit counter-intuitive to authors - if they supply a user name  
and a password, why isn't the browser actually sending it to the server? I  
think it would be simpler to author for if we sent Authorize: whenever a  
user name and password is supplied. Are there any particular reason we  
don't? Would it be seen as violating the HTTP standard's text about 401  
and Authorize: if we did spec something like that?


--
Hallvord R. M. Steen, Core Tester, Opera Software
http://www.opera.com http://my.opera.com/hallvors/



Re: XHR using user and password parameters

2011-07-11 Thread Bjoern Hoehrmann
* Hallvord R. M. Steen wrote:
Many implementations don't send the Authorize: header even if the script  
supplies user name and password, unless they have seen a 401 response.  
This seems a bit counter-intuitive to authors - if they supply a user name  
and a password, why isn't the browser actually sending it to the server? I  
think it would be simpler to author for if we sent Authorize: whenever a  
user name and password is supplied. Are there any particular reason we  
don't? Would it be seen as violating the HTTP standard's text about 401  
and Authorize: if we did spec something like that?

You need to know the authentication method in order to form the header,
you don't know whether it's Basic or Digest or some other method, and if
you did, you might still need information from the server such as the
realm. So, you need to make a failing request first, unless you limit
yourself to Basic authentication.
-- 
Björn Höhrmann · mailto:bjo...@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/