1 Reply Latest reply: Jan 10, 2011 5:50 AM by DanelKirch RSS

    Unable to URLRequest in AIR for Android

    DanelKirch Community Member

      when trying to pass requestHeaders with the call ?

       

      i got a app where user  enters login info... i then make URLRequest and pass this info with URLVariables...

      easy... site returns cookie which must be passed with future calls.

       

      so basicly when i make URLRequest and pass headers which was return at login, nothing happens.

       

      o get IOError... and it give ID 2032 which i preeety blurry

       

      if i comment out requestHeaders line... it makes call and returns data

      but not right data since cookie was left out.

       

      ive tryied to figure out how to debug this. i normally use Charles web proxy to see requests but since this is mobile app

      i cant use Charles :S

      i even tryed to run on android (FroYo) emulator but charles doesnt seem to see these requests.

      (Probably cause Emulator is using some kind of virtual firewall)

       

      so, aaaaany help on this would be appreciated!!!

        • 1. Re: Unable to URLRequest in AIR for Android (passing headers)
          DanelKirch Community Member

          Hello again,

           

          i think i got it solved.

          What exactly was the problem or what i did, im not quite sure....

           

          but the thing i tried was to pass on ONLY cookie to the request (before i passed entire received header, probably what made it all

          dis-function)

           

          so to be clear here is a example of this "solution"

           

          var header is returned header from the site after log in

          i just look if any names there has ookie in it... (there should be Set-cookie)

          if there is, i take its value and split it är new-line (if there is any, probably not, but anyway... )

          when i got value... i simply push that value into requestHeaders under Cookie.

           

                          for(var hi:* in header){
                              if(header[hi].name.indexOf('ookie') != -1){
                              var va:String =  String(header[hi].value).split('\n').join('');
                                  req.requestHeaders.push(new URLRequestHeader('Cookie',va))
                              }
                          }

           

          not so pretty to look at, but as told... just a test

          it seemes to work, few times is get data returned which seems to be null... not sure why.

           

          hope this helps anyone