コード例 #1
0
        private void RequestSentHandler(object sender, RequestSentEventArgs args)
        {
            var stream = args.Stream;
            var method = stream.Headers.GetValue(":method");

            if (method == "put" || method == "post")
            {
                var    localPath    = stream.Headers.GetValue(":localPath".ToLower());
                byte[] binary       = null;
                bool   gotException = false;
                try
                {
                    binary = _fileHelper.GetFile(localPath);
                }
                catch (FileNotFoundException)
                {
                    gotException = true;
                    Http2Logger.LogError("Specified file not found: " + localPath);
                }
                if (!gotException)
                {
                    SendDataTo(args.Stream, binary);
                }
            }
        }
コード例 #2
0
 private void RequestSentHandler(object sender, RequestSentEventArgs args)
 {
     var stream = args.Stream;
     var method = stream.Headers.GetValue(":method");
     if (method == "put" || method == "post")
     {
         var localPath = stream.Headers.GetValue(":localPath".ToLower());
         byte[] binary = null;
         bool gotException = false;
         try
         {
             binary = _fileHelper.GetFile(localPath);
         }
         catch (FileNotFoundException)
         {
             gotException = true;
             Http2Logger.LogError("Specified file not found: " + localPath);
         }
         if (!gotException)
         {
             SendDataTo(args.Stream, binary);
         }
     }
 }