Beispiel #1
0
        void Init()
        {
            if (ssl_stream != null)
            {
                ssl_stream.AuthenticateAsServer(cert, true, (SslProtocols)ServicePointManager.SecurityProtocol, false);
            }

            context_bound = false;
            i_stream      = null;
            o_stream      = null;
            prefix        = null;
            chunked       = false;
            ms            = new MemoryStream();
            position      = 0;
            input_state   = InputState.RequestLine;
            line_state    = LineState.None;
            context       = new HttpListenerContext(this);
        }
Beispiel #2
0
        private void Init()
        {
#if SSL
            if (ssl_stream != null)
            {
                ssl_stream.AuthenticateAsServer(cert, true, (SslProtocols)ServicePointManager.SecurityProtocol, false);
            }
#endif
            _contextBound = false;
            _iStream      = null;
            _oStream      = null;
            Prefix        = null;
            _chunked      = false;
            _ms           = new MemoryStream();
            _position     = 0;
            _inputState   = InputState.RequestLine;
            _lineState    = LineState.None;
            _context      = new HttpListenerContext(this);
        }
 public RequestStream GetRequestStream(bool chunked, long contentlength)
 {
     if (i_stream == null)
     {
         byte [] buffer = ms.GetBuffer();
         int     length = (int)ms.Length;
         ms = null;
         if (chunked)
         {
             this.chunked = true;
             context.Response.SendChunked = true;
             i_stream = new ChunkedInputStream(context, stream, buffer, position, length - position);
         }
         else
         {
             i_stream = new RequestStream(stream, buffer, position, length - position, contentlength);
         }
     }
     return(i_stream);
 }
Beispiel #4
0
 public RequestStream GetRequestStream(bool chunked, long contentlength)
 {
     if (this.i_stream == null)
     {
         byte[] array = this.ms.GetBuffer();
         int    num   = (int)this.ms.Length;
         this.ms = null;
         if (chunked)
         {
             this.chunked = true;
             this.context.Response.SendChunked = true;
             this.i_stream = new ChunkedInputStream(this.context, this.stream, array, this.position, num - this.position);
         }
         else
         {
             this.i_stream = new RequestStream(this.stream, array, this.position, num - this.position, contentlength);
         }
     }
     return(this.i_stream);
 }
Beispiel #5
0
 public RequestStream GetRequestStream(bool chunked, long contentlength)
 {
     if (_iStream == null)
     {
         var buffer = _ms.GetBuffer();
         var length = (int)_ms.Length;
         _ms = null;
         if (chunked)
         {
             _chunked = true;
             _context.Response.SendChunked = true;
             _iStream = new ChunkedInputStream(_context, _stream, buffer, _position, length - _position);
         }
         else
         {
             _iStream = new RequestStream(_stream, buffer, _position, length - _position, contentlength);
         }
     }
     return(_iStream);
 }
Beispiel #6
0
        private Task <Stream> GetRequestStreamTask()
        {
            CheckAbort();

            if (RequestSubmitted)
            {
                throw new InvalidOperationException(SR.net_reqsubmitted);
            }

            // Match Desktop behavior: prevent someone from getting a request stream
            // if the protocol verb/method doesn't support it. Note that this is not
            // entirely compliant RFC2616 for the aforementioned compatibility reasons.
            if (string.Equals(HttpMethod.Get.Method, _originVerb, StringComparison.OrdinalIgnoreCase) ||
                string.Equals(HttpMethod.Head.Method, _originVerb, StringComparison.OrdinalIgnoreCase) ||
                string.Equals("CONNECT", _originVerb, StringComparison.OrdinalIgnoreCase))
            {
                throw new ProtocolViolationException(SR.net_nouploadonget);
            }

            _requestStream = new RequestStream();

            return(Task.FromResult((Stream)_requestStream));
        }
Beispiel #7
0
		public RequestStream GetRequestStream (bool chunked, long contentlength)
		{
			if (i_stream == null) {
				byte [] buffer = ms.GetBuffer ();
				int length = (int) ms.Length;
				ms = null;
				if (chunked) {
					this.chunked = true;
					context.Response.SendChunked = true;
					i_stream = new ChunkedInputStream (context, stream, buffer, position, length - position);
				} else {
					i_stream = new RequestStream (stream, buffer, position, length - position, contentlength);
				}
			}
			return i_stream;
		}
Beispiel #8
0
		void Init ()
		{
			if (ssl_stream != null) {
				ssl_stream.AuthenticateAsServer (cert, true, (SslProtocols)ServicePointManager.SecurityProtocol, false);
			}

			context_bound = false;
			i_stream = null;
			o_stream = null;
			prefix = null;
			chunked = false;
			ms = new MemoryStream ();
			position = 0;
			input_state = InputState.RequestLine;
			line_state = LineState.None;
			context = new HttpListenerContext (this);
		}
Beispiel #9
0
        private Task<Stream> GetRequestStream()
        {
            CheckAbort();

            if (RequestSubmitted)
            {
                throw new InvalidOperationException(SR.net_reqsubmitted);
            }

            // Match Desktop behavior: prevent someone from getting a request stream
            // if the protocol verb/method doesn't support it. Note that this is not
            // entirely compliant RFC2616 for the aforementioned compatibility reasons.
            if (string.Equals(HttpMethod.Get.Method, _originVerb, StringComparison.OrdinalIgnoreCase) ||
                string.Equals(HttpMethod.Head.Method, _originVerb, StringComparison.OrdinalIgnoreCase) ||
                string.Equals("CONNECT", _originVerb, StringComparison.OrdinalIgnoreCase))
            {
                throw new ProtocolViolationException(SR.net_nouploadonget);
            }

            _requestStream = new RequestStream();

            return Task.FromResult((Stream)_requestStream);
        }
Beispiel #10
0
		void Init ()
		{
			context_bound = false;
			i_stream = null;
			o_stream = null;
			prefix = null;
			chunked = false;
			ms = new MemoryStream ();
			position = 0;
			input_state = InputState.RequestLine;
			line_state = LineState.None;
			context = new HttpListenerContext (this);
		}