Ejemplo n.º 1
0
        /// <summary>
        /// 生成Post得到的表单和文件
        /// </summary>
        /// <param name="request">请求</param>
        /// <param name="streamReader">数据读取器</param>
        private static void GeneratePostFormAndFiles(HttpRequest request, ISessionStreamReader streamReader)
        {
            var boundary = default(string);

            if (request.IsApplicationFormRequest() == true)
            {
                HttpRequestParser.GenerateApplicationForm(request);
            }
            else if (request.IsMultipartFormRequest(out boundary) == true)
            {
                if (request.Body.Length >= boundary.Length)
                {
                    HttpRequestParser.GenerateMultipartFormAndFiles(request, streamReader, boundary);
                }
            }


            if (request.Form == null)
            {
                request.Form = new HttpNameValueCollection();
            }

            if (request.Files == null)
            {
                request.Files = new HttpFile[0];
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 生成Post得到的表单和文件
        /// </summary>
        /// <param name="request"></param>
        /// <param name="buffer"></param>
        private static void GeneratePostFormAndFiles(HttpRequest request, ReceiveBuffer buffer)
        {
            var boundary = default(string);

            if (request.IsApplicationFormRequest() == true)
            {
                HttpRequest.GenerateApplicationForm(request);
            }
            else if (request.IsMultipartFormRequest(out boundary) == true)
            {
                if (request.InputStrem.Length >= boundary.Length)
                {
                    HttpRequest.GenerateMultipartFormAndFiles(request, buffer, boundary);
                }
            }


            if (request.Form == null)
            {
                request.Form = new HttpNameValueCollection();
            }

            if (request.Files == null)
            {
                request.Files = new HttpFile[0];
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 生成Post得到的表单和文件
        /// </summary>
        /// <param name="request"></param>
        /// <param name="buffer"></param>      
        private static void GeneratePostFormAndFiles(HttpRequest request, IReceiveBuffer buffer)
        {
            var boundary = default(string);
            if (request.IsApplicationFormRequest() == true)
            {
                HttpRequest.GenerateApplicationForm(request);
            }
            else if (request.IsMultipartFormRequest(out boundary) == true)
            {
                if (request.Body.Length >= boundary.Length)
                {
                    HttpRequest.GenerateMultipartFormAndFiles(request, buffer, boundary);
                }
            }


            if (request.Form == null)
            {
                request.Form = new HttpNameValueCollection();
            }

            if (request.Files == null)
            {
                request.Files = new HttpFile[0];
            }
        }