Hi Alex,

Created PR-383 including the changes for the issue.

Thanks,
Serkan

17.01.2019 22:50 tarihinde Serkan Taş yazdı:
Okay I am going to work on the issue, it is over for me tonight.

Thanks,
Serkan

17.01.2019 22:46 tarihinde Alex Harui yazdı:

Sure, and/or you can change the code, make sure it works, and submit a PR.

-Alex

*From: *Serkan Taş <[email protected]>
*Reply-To: *"[email protected]" <[email protected]>
*Date: *Thursday, January 17, 2019 at 11:43 AM
*To: *"[email protected]" <[email protected]>
*Subject: *Re: Work on Emulation

May I open an issue on github ?

Here is URLLoader;

COMPILE::JS
            {
                var element:XMLHttpRequest = this.element as XMLHttpRequest;
                element.onreadystatechange = progressHandler;

                var url:String = request.url;

                /*
                var contentData:String = null;
                if (_contentData != null) {
                    if (_method == HTTPConstants.GET) {
                        if (url.indexOf('?') != -1) {
                            url += _contentData;
                        } else {
                            url += '?' + _contentData;
                        }
                    } else {
                        contentData = _contentData;
                    }
                }
                */

                element.open(request.method, request.url, true);
                // element.timeout = _timeout;

                var sawContentType:Boolean = false;
                if (request.requestHeaders) {
                    var n:int = request.requestHeaders.length;
                    for (var i:int = 0; i < n; i++) {
                        var header:HTTPHeader = request.requestHeaders[i];
                        if (header.name == HTTPHeader.CONTENT_TYPE) {
                            sawContentType = true;
                        }

element.setRequestHeader(header.name, header.value);
                    }
                }

                /*
                if (request.method != HTTPConstants.GET &&
                    !sawContentType && contentData) {
                    element.setRequestHeader(
                        HTTPHeader.CONTENT_TYPE, _contentType);
                }
                */
                /*
                if (contentData) {
                    element.send(contentData);
                } else {*/
                    element.send();
                /*
                }
                */
            }

            dispatchEvent(new Event("postSend"));
        }

17.01.2019 22:38 tarihinde Alex Harui yazdı:

    Hi Serkan,

    I think URLLoader needs to check the method and if it is POST to
    set request.data on the element.

    HTH,

    -Alex

    *From: *Serkan Taş <[email protected]>
    <mailto:[email protected]>
    *Reply-To: *"[email protected]"
    <mailto:[email protected]> <[email protected]>
    <mailto:[email protected]>
    *Date: *Thursday, January 17, 2019 at 11:23 AM
    *To: *"[email protected]" <mailto:[email protected]>
    <[email protected]> <mailto:[email protected]>
    *Subject: *Re: Work on Emulation

    Hi Alex,

    DirectHttpChannel calls URLLoader.load with */urlRequest
    /*parameter, which is correct and contains input data.

    mx.messaging.channels.DirectHTTPChannel.prototype.internalSend =
    function(msgResp) {
      var /** @type
    {mx.messaging.channels.DirectHTTPChannel.DirectHTTPMessageResponder}
    */ httpMsgResp = org.apache.royale.utils.Language.as(msgResp,
    mx.messaging.channels.DirectHTTPChannel.DirectHTTPMessageResponder,
    true);
      var /** @type {org.apache.royale.net.URLRequest} */ urlRequest;
      try {
        urlRequest =
    
this.http_$$www_adobe_com$2006$flex$mx$internal__createURLRequest(httpMsgResp.message);
      } catch (e) {
        httpMsgResp.agent.fault(e.fault, httpMsgResp.message);
        return;
      }
      var /** @type {org.apache.royale.net.URLLoader} */ urlLoader =
    httpMsgResp.urlLoader;
      urlLoader.addEventListener(mx.events.ErrorEvent.ERROR,
    org.apache.royale.utils.Language.closure(httpMsgResp.errorHandler,
    httpMsgResp, 'errorHandler'));
    urlLoader.addEventListener(mx.events.IOErrorEvent.IO_ERROR,
    org.apache.royale.utils.Language.closure(httpMsgResp.errorHandler,
    httpMsgResp, 'errorHandler'));
    urlLoader.addEventListener(mx.events.SecurityErrorEvent.SECURITY_ERROR,
    org.apache.royale.utils.Language.closure(httpMsgResp.securityErrorHandler,
    httpMsgResp, 'securityErrorHandler'));
    urlLoader.addEventListener(org.apache.royale.events.Event.COMPLETE,
    org.apache.royale.utils.Language.closure(httpMsgResp.completeHandler,
    httpMsgResp, 'completeHandler'));
    urlLoader.addEventListener(mx.events.HTTPStatusEvent.HTTP_STATUS,
    org.apache.royale.utils.Language.closure(httpMsgResp.httpStatusHandler,
    httpMsgResp, 'httpStatusHandler'));
      urlLoader.load(urlRequest);
    };

    And URLoader.load is called :

    org.apache.royale.net.URLLoader.prototype.load = function(request) {

      var /** @type {XMLHttpRequest} */ element =
    
org.apache.royale.utils.Language.as(this.org_apache_royale_net_URLLoader_element,
    XMLHttpRequest);
      element.onreadystatechange =
    org.apache.royale.utils.Language.closure(this.progressHandler,
    this, 'progressHandler');
      var /** @type {string} */ url = request.url;
      element.open(request.method, request.url, true);
      var /** @type {boolean} */ sawContentType = false;
      if (request.requestHeaders) {
        var /** @type {number} */ n = request.requestHeaders.length;
        for (var /** @type {number} */ i = 0; i < n; i++) {
          var /** @type {org.apache.royale.net.HTTPHeader} */ header
    = request.requestHeaders[i];
          if (header.name ==
    org.apache.royale.net.HTTPHeader.CONTENT_TYPE) {
            sawContentType = true;
          }
          element.setRequestHeader(header.name, header.value);
        }
      }
      element.send();
      this.dispatchEvent(new org.apache.royale.events.Event("postSend"));
    };

    element.open is called with correct url and correct method - got
    from request which correct.

    element.send() is called, but there is no place in load function
    that sets the input parameter request.data to element before
    calling send method.

    If you prefer I may create a sample project for you to check.

    Thanks,
    Serkan

    17.01.2019 22:15 tarihinde Alex Harui yazdı:

        Hi Serkan,

        I assume your goal is to get DirectHTTPChannel to work?  Or
        maybe I do not understand your scenario.  Doesn’t
        DirectHTTPChannel eventually call URLLoader.load?  It looked
        from your screenshot that the XML data was not handled
        correctly by createURLRequest.

        -Alex



Reply via email to