Beispiel #1
0
            /// <summary>
            /// 开始接收表单数据
            /// </summary>
            /// <param name="loadForm">HTTP请求表单加载接口</param>
            public void Receive(requestForm.ILoadForm loadForm)
            {
                headerReceiver headerReceiver = socket.HeaderReceiver;
                requestHeader  requestHeader  = headerReceiver.RequestHeader;

                this.loadForm = loadForm;
                contentLength = requestHeader.ContentLength;
                if (contentLength < socket.Buffer.Length)
                {
                    buffer     = socket.Buffer;
                    memoryPool = null;
                }
                else
                {
                    memoryPool = getMemoryPool(contentLength + 1);
                    buffer     = memoryPool.Get(contentLength + 1);
                }
                receiveEndIndex = headerReceiver.ReceiveEndIndex - headerReceiver.HeaderEndIndex - sizeof(int);
                System.Buffer.BlockCopy(requestHeader.Buffer, headerReceiver.HeaderEndIndex + sizeof(int), buffer, 0, receiveEndIndex);
                headerReceiver.ReceiveEndIndex = headerReceiver.HeaderEndIndex;

                if (receiveEndIndex == contentLength)
                {
                    callback();
                }
                else
                {
                    receiveStartTime = date.nowTime.Now.AddTicks(date.SecondTicks);
                    receive();
                }
            }
Beispiel #2
0
            /// <summary>
            /// 开始接收表单数据
            /// </summary>
            /// <param name="loadForm">HTTP请求表单加载接口</param>
            public void Receive(requestForm.ILoadForm loadForm)
            {
                this.loadForm = loadForm;
                try
                {
                    headerReceiver headerReceiver = socket.HeaderReceiver;
                    requestHeader  requestHeader  = headerReceiver.RequestHeader;
                    Buffer        = bigBuffers.Get();
                    boundary      = requestHeader.Boundary;
                    receiveLength = receiveEndIndex = headerReceiver.ReceiveEndIndex - headerReceiver.HeaderEndIndex - sizeof(int);
                    System.Buffer.BlockCopy(requestHeader.Buffer, headerReceiver.HeaderEndIndex + sizeof(int), Buffer, 0, receiveEndIndex);
                    headerReceiver.ReceiveEndIndex = headerReceiver.HeaderEndIndex;
                    contentLength = requestHeader.ContentLength;

                    receiveStartTime = date.nowTime.Now.AddTicks(date.SecondTicks);
                    onFirstBoundary();
                    return;
                }
                catch (Exception error)
                {
                    log.Error.Add(error, null, false);
                }
                this.error();
            }
Beispiel #3
0
 /// <summary>
 /// HTTP安全流
 /// </summary>
 private sslStream()
 {
     RequestHeader        = (HeaderReceiver = new headerReceiver(this)).RequestHeader;
     sender               = new dataSender(this);
     authenticateCallback = onAuthenticate;
 }