Internert Explorer / Edge flex重定向发送POST方法而不是GET

时间:2017-08-30 10:52:36

标签: php flash redirect internet-explorer-11 http-status-code-302

在Internet Explorer(11)和Flash Player 26.0.0.151中执行此代码时,我有一种奇怪的情况,这里是flex代码

Flex代码:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script><![CDATA[
        import mx.rpc.events.FaultEvent;
        import mx.rpc.events.ResultEvent;
        import mx.rpc.http.HTTPService;

        private function loginUser():void {

            var http:HTTPService = new HTTPService();
            http.url = "http://localhost/flex_test/redirect.php";
            trace("calling login url " + http.url);
            http.method = "POST";
            http.addEventListener(ResultEvent.RESULT, loginSuccessHandler);
            http.addEventListener(FaultEvent.FAULT, loginFailureHandler);
            var req:URLVariables = new URLVariables();
            req.j_username = "login";
            req.j_password = "password";
            http.request = req;
            http.send();
        }

        private function loginSuccessHandler(event:ResultEvent):void {
            trace("loginSuccessHandler");
            var resultMsg:String = String(event.result);
            resultLabel.text = resultMsg;
        }

        private function loginFailureHandler(event:FaultEvent):void {
            trace("loginFailureHandler");
            trace("HTTP login error: event=" + event);
            resultLabel.text = "Error";
        }
        ]]></mx:Script>
    <mx:Button click="loginUser()" label="Say Hello"/>
    <mx:Label id="resultLabel" text=""/>
</mx:Application>

PHP代码:

1)redirect.php

 <?php 
 header('Location: http://localhost/flex_test/redirected.php');
 exit;

2)redirected.php

<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    echo "goes POST";
} else  {
    echo "goes GET";
}

使用Internet Explorer和Flash Player 25.0.0.148时,一切似乎都没问题,显示的消息是&#34; GET&#34; 即使使用Flash Player 26.0.0.151

,Firefox和Chrome也不会出现问题

你能否提出一些如何解决这个问题的建议 - 以及在IE浏览器中发送POST而不是GET的任何想法?也许这与https://nvd.nist.gov/vuln/detail/CVE-2017-3085#vulnDescriptionTitle

相关联

但是重定向后发送POST是正确的行为,即使我们将代码redirect.php修改为:

<?php
header('Location: http://plll0284/flex_test/redirected.php', true, 303);
exit;

感谢您的帮助

0 个答案:

没有答案