Esempio n. 1
0
        public override void ReceivedData(NSUrlConnection connection, NSData data)
        {
            if (result == null)
            {
                result = new byte[data.Length];
                Marshal.Copy(data.Bytes, result, 0, (int)data.Length);
            }
            else if (written + (int)data.Length > result.Length)
            {
                byte[] nb = new byte [result.Length + (int)data.Length];
                result.CopyTo(nb, 0);
                Marshal.Copy(data.Bytes, nb, result.Length, (int)data.Length);
                result = nb;
            }
            else
            {
                Marshal.Copy(data.Bytes, result, written, (int)data.Length);
            }

            written += (int)data.Length;

            if (nr.AbortRequested)
            {
                connection.Cancel();
                return;
            }

            nr.TriggerUpdate();
        }
            public override NSUrlRequest WillSendRequest(
                NSUrlConnection connection,
                NSUrlRequest request,
                NSUrlResponse response)
            {
                NSMutableUrlRequest mutableRequest = (NSMutableUrlRequest)request.MutableCopy();

                if (response != null)
                {
                    RemoveProperty("ADURLProtocol", mutableRequest);
                    _client.Redirected(_handler, mutableRequest, response);
                    connection.Cancel();
                    if (!request.Headers.ContainsKey(new NSString("x-ms-PkeyAuth")))
                    {
                        mutableRequest[BrokerConstants.ChallengeHeaderKey] = BrokerConstants.ChallengeHeaderValue;
                    }

                    return(mutableRequest);
                }

                if (!request.Headers.ContainsKey(new NSString(BrokerConstants.ChallengeHeaderKey)))
                {
                    mutableRequest[BrokerConstants.ChallengeHeaderKey] = BrokerConstants.ChallengeHeaderValue;
                }

                return(mutableRequest);
            }
Esempio n. 3
0
 private void ReceivedResponse(NSUrlConnection connection, NSUrlResponse response)
 {
     connection.Cancel();
     if (_request != null)
     {
         _renderer.LoadRequest(_request);
     }
 }
Esempio n. 4
0
 public override void StopLoading()
 {
     if (connection != null)
     {
         connection.Cancel();
         connection = null;
     }
 }
Esempio n. 5
0
 public void StartCancel()
 {
     using (var url = new NSUrl("http://www.google.com"))
         using (var r = new NSUrlRequest(url))
             using (var d = new MyDelegate())
                 using (var c = new NSUrlConnection(r, d)) {
                     c.Start();
                     c.Cancel();
                 }
 }
Esempio n. 6
0
 public void StartCancel()
 {
     using (var url = new NSUrl(NetworkResources.MicrosoftUrl))
         using (var r = new NSUrlRequest(url))
             using (var d = new MyDelegate())
                 using (var c = new NSUrlConnection(r, d)) {
                     c.Start();
                     c.Cancel();
                 }
 }
Esempio n. 7
0
 public override void FailedWithError(NSUrlConnection connection, NSError error)
 {
     handler.Client.FailedWithError(handler, error);
     connection.Cancel();
 }
Esempio n. 8
0
 public override void FinishedLoading(NSUrlConnection connection)
 {
     handler.Client.FinishedLoading(handler);
     connection.Cancel();
 }
 public override void FailedWithError(NSUrlConnection connection, NSError error)
 {
     _handler.Client.FailedWithError(_handler, error);
     connection.Cancel();
 }
 public override void FinishedLoading(NSUrlConnection connection)
 {
     _handler.Client.FinishedLoading(_handler);
     connection.Cancel();
 }
Esempio n. 11
0
 /// <summary>
 /// Should be authed now, start up the webview request again
 /// </summary>
 public override void ReceivedResponse(NSUrlConnection connection, NSUrlResponse response)
 {
     _auth = true;
     _view.LoadRequest(connection.CurrentRequest);
     connection.Cancel();
 }