Exemple #1
0
        /// <summary>
        /// Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
        /// </summary>
        /// <returns>
        /// The unsigned byte cast to an Int32, or -1 if at the end of the stream.
        /// </returns>
        public override int ReadByte()
        {
            if (recvDataCache == null || !recvDataCache.IsReadable())
            {
                recvDataCache = streamSocket.Receive();
            }

            return(recvDataCache.ReadByte());
        }
Exemple #2
0
        /// <summary>
        /// Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
        /// </summary>
        /// <returns>
        /// The unsigned byte cast to an Int32, or -1 if at the end of the stream.
        /// </returns>
        public override int ReadByte()
        {
            if (recvDataCache == null || !recvDataCache.IsReadable())
            {
                recvDataCache = streamSocket.Receive();
            }

            var v = recvDataCache.ReadByte();

            if (recvDataCache.IsReadable())
            {
                return(v);
            }

            // Release cache if it is not readable. If we do not reset the cache here,
            // the cache will be used in next Read() that caused 0 bytes return.
            recvDataCache.Release();
            recvDataCache = null;
            return(v);
        }
        virtual public IHttpResponse ProcessCall(ISocketWrapper socketWrapper)
        {
            _socketWrapper = socketWrapper;

            Socket test;

            _socketWrapper.SkipByteCount(_verbLength + 1);

            var buffer = new byte[MaximumUriLength];

            _socketWrapper.Receive(buffer);

            var uri = buffer.ConvertISO_8859_1ToString();

            if (uri.Contains(Environment.NewLine) == false)
            {
                throw new BadRequestException("Uri to long");
            }
            // Return 414?

            Uri = uri.Substring(0, uri.IndexOf(' '));
            return(null);
        }