コード例 #1
0
ファイル: HttpEntity.cs プロジェクト: headsling/manos
        private void CreateBodyHandler()
        {
            string ct;

            if (!Headers.TryGetValue("Content-Type", out ct))
            {
                body_handler = new HttpBufferedBodyHandler();
                return;
            }

            if (ct.StartsWith("application/x-www-form-urlencoded", StringComparison.InvariantCultureIgnoreCase))
            {
                body_handler = new HttpFormDataHandler();
                return;
            }

            if (ct.StartsWith("multipart/form-data", StringComparison.InvariantCultureIgnoreCase))
            {
                string boundary = ParseBoundary(ct);
                IUploadedFileCreator file_creator = GetFileCreator();

                body_handler = new HttpMultiPartFormDataHandler(boundary, ContentEncoding, file_creator);
                return;
            }

            body_handler = new HttpBufferedBodyHandler();
        }
コード例 #2
0
 protected virtual void OnFinishedReading(HttpParser parser)
 {
     if (body_handler != null)
     {
         body_handler.Finish(this);
         body_handler = null;
     }
 }
コード例 #3
0
ファイル: HttpTransaction.cs プロジェクト: davidalpert/manos
        private void CreateBodyHandler()
        {
            string ct = Request.Headers ["Content-Type"];

            if (ct != null && ct.StartsWith ("application/x-www-form-urlencoded", StringComparison.InvariantCultureIgnoreCase)) {
                body_handler = new HttpFormDataHandler ();
                return;
            }

            if (ct != null && ct.StartsWith ("multipart/form-data", StringComparison.InvariantCultureIgnoreCase)) {
                string boundary = ParseBoundary (ct);
                IUploadedFileCreator file_creator = GetFileCreator ();

                body_handler = new HttpMultiPartFormDataHandler (boundary, Request.ContentEncoding, file_creator);
                return;
            }
        }
コード例 #4
0
ファイル: HttpTransaction.cs プロジェクト: nickcanz/manos
        private void OnFinishedReading()
        {
            if (body_handler != null) {
                body_handler.Finish (this);
                body_handler = null;
            }

            try {
                Response = new HttpResponse (this, IOStream);

                Server.RunTransaction (this);
            } catch (Exception e) {
                Console.WriteLine ("Exception while running transaction");
                Console.WriteLine (e);
            }
        }