Ejemplo n.º 1
0
        private void On100Continue(object sender, ContinueEventArgs e)
        {
            var response = new Response(e.Request.HttpVersion, HttpStatusCode.Continue, "Please continue mate.");
            if (ContentLengthLimit != 0 && e.Request.ContentLength.Value > ContentLengthLimit)
            {
                _logger.Warning("Requested to send " + e.Request.ContentLength.Value + " bytes, but we only allow " + ContentLengthLimit);
                Console.WriteLine("Requested to send " + e.Request.ContentLength.Value + " bytes, but we only allow " + ContentLengthLimit);
                response.Status = HttpStatusCode.ExpectationFailed;
                response.Reason = "Too large content length";
            }

            string responseString = string.Format("{0} {1} {2}\r\n\r\n",
                                                  e.Request.HttpVersion,
                                                  (int) response.Status,
                                                  response.Reason);
            byte[] buffer = e.Request.Encoding.GetBytes(responseString);
            HttpContext.Current.Stream.Write(buffer, 0, buffer.Length);
            HttpContext.Current.Stream.Flush();
            Console.WriteLine(responseString);
            _logger.Info(responseString);
        }
Ejemplo n.º 2
0
		private void On100Continue(object sender, ContinueEventArgs e)
		{
			var response = new Response(e.Request.HttpVersion, HttpStatusCode.Continue, "Please continue mate.");
			var args = new RequestEventArgs((IHttpContext) sender, e.Request, response);
			ContinueResponseRequested(sender, args);

			string responseString = string.Format("{0} {1} {2}\r\n\r\n", "HTTP/1.0", (int) response.Status,
			                                      response.Reason);
			byte[] buffer = Encoding.ASCII.GetBytes(responseString);
			HttpContext.Current.Stream.Write(buffer, 0, buffer.Length);
			HttpContext.Current.Stream.Flush();
			_logger.Info(responseString);
		}
Ejemplo n.º 3
0
		private void On100Continue(object sender, ContinueEventArgs e)
		{
			ContinueResponseRequested(this, e);
		}