Beispiel #1
0
        protected void ProcessRequest(MonoWorkerRequest mwr)
        {
            if (mwr == null)
            {
                EndOfRequest(mwr);
                return;
            }

            if (!mwr.ReadRequestData())
            {
                EndOfRequest(mwr);
                return;
            }

            mwr.EndOfRequestEvent += endOfRequest;
            try {
                mwr.ProcessRequest();
            } catch (ThreadAbortException) {
                Thread.ResetAbort();
            } catch (Exception ex) {             // should "never" happen
                // we don't know what the request state is,
                // better write the exception to the console
                // than forget it.
                Console.WriteLine("Unhandled exception: {0}", ex);
                EndOfRequest(mwr);
            }
        }
Beispiel #2
0
 public void EndOfRequest(MonoWorkerRequest mwr)
 {
     try {
         mwr.CloseConnection();
     } catch {
     } finally {
         BaseRequestBroker brb = requestBroker as BaseRequestBroker;
         if (brb != null)
         {
             brb.UnregisterRequest(mwr.RequestId);
         }
     }
 }
		private static void Redirect (MonoWorkerRequest wr, string location)
		{
			string host = wr.GetKnownRequestHeader (HttpWorkerRequest.HeaderHost);
			wr.SendStatus (301, "Moved Permanently");
			wr.SendUnknownResponseHeader ("Connection", "close");
			wr.SendUnknownResponseHeader ("Date", DateTime.Now.ToUniversalTime ().ToString ("r"));
			wr.SendUnknownResponseHeader ("Location", String.Format ("http://{0}{1}", host, location));
			Encoding enc = Encoding.ASCII;
			wr.SendUnknownResponseHeader ("Content-Type", "text/html; charset=" + enc.WebName);
			string content = String.Format (content301, host, location);
			byte [] contentBytes = enc.GetBytes (content);
			wr.SendUnknownResponseHeader ("Content-Length", contentBytes.Length.ToString ());
			wr.SendResponseFromMemory (contentBytes, contentBytes.Length);
			wr.FlushResponse (true);
			wr.CloseConnection ();
		}
Beispiel #4
0
        protected void ProcessRequest(MonoWorkerRequest mwr)
        {
            if (mwr == null)
                throw new ArgumentNullException ("mwr");

            if (!mwr.ReadRequestData ()) {
                EndOfRequest (mwr);
                return;
            }

            mwr.EndOfRequestEvent += endOfRequest;
            try {
                mwr.ProcessRequest ();
            } catch (ThreadAbortException) {
                Thread.ResetAbort ();
            } catch (Exception ex) { // should "never" happen
                // we don't know what the request state is,
                // better write the exception to the console
                // than forget it.
                Logger.Write(LogLevel.Error, "Unhandled exception: {0}", ex);
                EndOfRequest (mwr);
            }
        }
Beispiel #5
0
 public void EndOfRequest(MonoWorkerRequest mwr)
 {
     try {
         mwr.CloseConnection ();
     } catch {
     } finally {
         var brb = RequestBroker as BaseRequestBroker;
         if (brb != null)
             brb.UnregisterRequest (mwr.RequestId);
     }
 }
		protected void ProcessRequest (MonoWorkerRequest mwr)
		{
			if (!mwr.ReadRequestData ()) {
				EndOfRequest (mwr);
				return;
			}
			
			mwr.EndOfRequestEvent += endOfRequest;
			try {
				mwr.ProcessRequest ();
			} catch (Exception ex) { // should "never" happen
				// we don't know what the request state is,
				// better write the exception to the console
				// than forget it.
				Console.WriteLine ("Unhandled exception: {0}", ex);
				EndOfRequest (mwr);
			}
		}