コード例 #1
0
        NSMutableUrlRequest CreateNativePostRequest(string url, long content_length)
        {
            NSUrl nsurl = NSUrl.FromString(url);

            if (nsurl == null)
            {
                throw new Exception("Invalid upload URL, could not create NSUrl from: '" + url + "'.");
            }

            NSMutableUrlRequest request = new NSMutableUrlRequest(nsurl);

            request.HttpMethod = "POST";

            random_input_stream = new ZInputStream(content_length);

            request.BodyStream = random_input_stream;

            if (headers != null)
            {
                foreach (var header in headers)
                {
                    request [header.Key] = header.Value;
                }
            }

            return(request);
        }
コード例 #2
0
        protected override void Dispose(bool disposing)
        {
            if (url_connection != null)
            {
                url_connection.Dispose();
                url_connection = null;
            }

            if (request != null)
            {
                if (request.BodyStream != null)
                {
                    request.BodyStream = null;
                }
                request.Dispose();
                request = null;
            }

            if (random_input_stream != null)
            {
                random_input_stream.Dispose();
                random_input_stream = null;
            }

            base.Dispose(disposing);
        }
コード例 #3
0
		protected override void Dispose (bool disposing)
		{
			if (url_connection != null) {
				url_connection.Dispose ();
				url_connection = null;
			}
			
			if (request != null) {
				request.BodyStream = null;
				request.Dispose ();
				request = null;
			}
			
			if (random_input_stream != null) {
				random_input_stream.Dispose ();
				random_input_stream = null;	
			}
			
			base.Dispose (disposing);
		}
コード例 #4
0
		NSMutableUrlRequest CreateNativePostRequest (string url, long content_length)
		{
			NSUrl nsurl = NSUrl.FromString (url);
			
			if (nsurl == null)
				throw new Exception ("Invalid upload URL, could not create NSUrl from: '" + url + "'.");
			
			NSMutableUrlRequest request = new NSMutableUrlRequest (nsurl);
					
			request.HttpMethod = "POST";

			random_input_stream = new ZInputStream (content_length);
			 
			request.BodyStream = random_input_stream;
					
			if (headers != null) {
				foreach (var header in headers) 
					request [header.Key] = header.Value;
			}

			return request;
		}