This is unbelievable! Flash programmers are familiar with the example:
var req:URLRequest = new URLRequest("http://yoursite.com/yourservice.ext"); req.method = URLRequestMethod.POST; req.data = new URLVariables("name=John+Doe"); var encoder:Base64Encoder = new Base64Encoder(); encoder.encode("yourusername:yourpassword"); var credsHeader:URLRequestHeader = new URLRequestHeader("Authorization", "Basic " + encoder.toString()); req.requestHeaders.push(credsHeader); var loader:URLLoader = new URLLoader(); loader.load(req);
OK ... excellent ... it really works. As you can see, I manually add the authorization header for basic HTTP authentication. BUT ... if I change the request method from POST to GET, the header will not be generated.
Is there anyone who knows the solution? 1000x thanks!
, POST. 2007 Flash Player , Authorization header. , , . . : @derFunks, , , crossdomain.xml.
POST
Authorization header
crossdomain.xml
Authorization, , Flash Player POST. , , Flash Player Restful web-, , .
Authorization
, Flash Player HTTP. , X-Crippled-Client: true, . .
X-Crippled-Client: true
, ... !
@Flax: yup, - HTTP. , . Socket URLLoader, Socket . , HTTP- 80 (http://yoursite.com/). , HTTP-. SocketDataEvent ( ) .
, , , Parse.com Flash Player.
, , Flash GET, POST, .
req.requestHeaders.push(new URLRequestHeader("X-HTTP-Method-Override", URLRequestMethod.GET));
, , !
You can also send headers using GET methods, unless you test it on the standalone Flash Player debugger (do not test on the simple one) v.11.4.402.265 . If you open your local swf in a browser, it works fine.