예제 #1
0
 /// <summary>Creates an instance of the HttpPipeline for each call.</summary>
 /// <param name="invocationInfo">The <see cref="System.Management.Automation.InvocationInfo" /> from the cmdlet</param>
 /// <param name="correlationId">the cmdlet's correlation id.</param>
 /// <param name="processRecordId">the cmdlet's process record correlation id.</param>
 /// <param name="parameterSetName">the cmdlet's parameterset name.</param>
 /// <param name="extensibleParameters">a dict for extensible parameters</param>
 /// <returns>An instance of Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Runtime.HttpPipeline for the remote call.</returns>
 public Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Runtime.HttpPipeline CreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string processRecordId, string parameterSetName = null, global::System.Collections.Generic.IDictionary <string, object> extensibleParameters = null)
 {
     Microsoft.Azure.PowerShell.Cmdlets.ResourceMover.Runtime.HttpPipeline pipeline = null;
     BeforeCreatePipeline(invocationInfo, ref pipeline);
     pipeline = (pipeline ?? (_handler.UseProxy ? _pipelineWithProxy : _pipeline)).Clone();
     AfterCreatePipeline(invocationInfo, ref pipeline);
     pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync);
     OnNewRequest?.Invoke(invocationInfo, correlationId, processRecordId, (step) => { pipeline.Prepend(step); }, (step) => { pipeline.Append(step); });
     return(pipeline);
 }
예제 #2
0
 /// <summary>Creates an instance of the HttpPipeline for each call.</summary>
 /// <param name="invocationInfo">The <see cref="System.Management.Automation.InvocationInfo" /> from the cmdlet</param>
 /// <param name="correlationId">the cmdlet's correlation id.</param>
 /// <param name="processRecordId">the cmdlet's process record correlation id.</param>
 /// <param name="parameterSetName">the cmdlet's parameterset name.</param>
 /// <returns>An instance of Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Runtime.HttpPipeline for the remote call.</returns>
 public Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Runtime.HttpPipeline CreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string processRecordId, string parameterSetName = null)
 {
     Microsoft.Azure.PowerShell.Cmdlets.KubernetesConfiguration.Runtime.HttpPipeline pipeline = null;
     BeforeCreatePipeline(invocationInfo, ref pipeline);
     pipeline = (pipeline ?? (_handler.UseProxy ? _pipelineWithProxy : _pipeline)).Clone();
     AfterCreatePipeline(invocationInfo, ref pipeline);
     pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync);
     OnNewRequest?.Invoke(invocationInfo, correlationId, processRecordId, (step) => { pipeline.Prepend(step); }, (step) => { pipeline.Append(step); });
     return(pipeline);
 }
예제 #3
0
        private void ReadCallback(IAsyncResult ar)
        {
            // Retrieve the state object and the handler socket
            // from the asynchronous state object.
            SocketStateObject state   = (SocketStateObject)ar.AsyncState;
            Socket            handler = state.WorkSocket;

            // Read data from the client socket.
            int bytesRead = handler.EndReceive(ar);

            if (bytesRead > 0)
            {
                // There  might be more data, so store the data received so far.
                string content = Encoding.ASCII.GetString(state.Buffer, 0, bytesRead);
                OnNewRequest?.Invoke(content);

                handler.BeginReceive(state.Buffer, 0, state.BufferSize, 0, new AsyncCallback(ReadCallback), state);                 //todo use ReceiveAsync


                return;


                string response = @"HTTP/1.1 200 OK
									Date: Mon, 27 Jul 2009 12:28:53 GMT
									Server: Apache / 2.2.14(Win32)
									Last - Modified: Wed, 22 Jul 2009 19:15:56 GMT
									Content - Length: 0
									Connection: Closed
									"                                    ;


                if (!String.IsNullOrEmpty(RedirectUrl))
                {
                    response = GetResponseFromRedirect(content);
                }

                SendReply(handler, response);
            }
        }