1 Reply Latest reply on Jun 3, 2010 9:24 AM by Groovee2010

    Incorrect results from HttpService

    Groovee2010

      Hi,

       

      I have a simple test app that demonstrates this problem.  I have 2 different (authenticated) URLs. If I load either one, I get the correct data. But if I load URL 1 and then load URL 2, it will respond with the same data as URL 1.   I can load URL 2 over and over, even though it has substantially more data returned than URL 1, but if I then attempt to load URL 1, it will generate a 401 fault.

       

      I don't believe this is a browser caching issue because the URL's are completely different.

       

      I am using a new instance of HTTP service, so there are no stale listeners involved. And FlashBuilder 4's new network traffic monitor corroborates that I am passing the correct (different) URL and getting back the incorrect data response.

       

      Any ideas what could be going on here? Perhaps there is an architectural issue with reuse of HTTPService that I am not aware of.


      Thanks,

       

      Lance

        • 1. Re: Incorrect results from HttpService
          Groovee2010 Level 1

          Update:

           

          I have ascertained that the failure is specific to Flex/AIR passing an authentication cookie with the second (and subsequent) HttpService requests.  If this cookie is removed via Charles (web proxy) the request returns the proper data.  So without yet understanding, why this is being passed (I'm not doing it explicitly or intentionally), I need to figure out how to inhibit it from being passed, and/or have our server code modified to ignore the cookie.

           

          Perhaps someone can give a hint as to how to inhibit the authentication from creating a cookie that gets send with subsequent requests?

           

          My HttpService call is pretty straight-forward:

           

           

          var httpService:HTTPService = new HTTPService;

           

          httpService.resultFormat = "e4x";

          httpService.addEventListener(FaultEvent.FAULT, onFault);

          httpService.addEventListener(ResultEvent.RESULT, onResult);

           

          httpService.url = url;

           

           

          var encoder:Base64Encoder = new Base64Encoder();

          encoder.insertNewLines =

          false;

          encoder.encode(username +

          ":" + password);

          httpService.headers = {Authorization:

          "Basic " + encoder.toString()};

           

          httpService.method = URLRequestMethod.GET;

          httpService.request[

          "authenticate"] = true;

          httpService.request[

          "manageCookies"] = false;

           

          httpService.headers[

          "Accept"] = "text/xml";

          httpService.headers[

          "Cache-Control"] = "no-cache";

           

          httpService.send();