Esempio n. 1
0
        public string[] Get(string url)
        {
            Stream destination = new MemoryStream();

            Get(url, destination);
            destination.Position = 0L;
            var ex = new StringCollectionEx();

            ex.LoadFromStream(destination, ResponseHeader.CharSet);
            return(ex.ToArray());
        }
Esempio n. 2
0
        public string[] Put(string url, Stream source)
        {
            Stream responseBody = new MemoryStream();

            Put(url, source, responseBody);
            responseBody.Position = 0L;
            var ex = new StringCollectionEx();

            ex.LoadFromStream(responseBody, ResponseHeader.CharSet);
            return(ex.ToArray());
        }
Esempio n. 3
0
        private void ReadResponseHeader(StringCollectionEx responseHeader, MemoryStream rawData)
        {
            rawData.SetLength(0L);
            rawData.Position = 0L;
            int startPos = 0;

            statusCode = 0;
            int num2 = 0;

            responseVersion = HttpVersion;
            base.Connection.IsReadUntilClose = false;

            do
            {
                base.Connection.ReadData(rawData);
                while (true)
                {
                    num2 = Utils.IndexOfArray(Encoding.ASCII.GetBytes("\r\n\r\n"), rawData.GetBuffer(), startPos,
                                              (int)rawData.Length);
                    if (num2 <= 0)
                    {
                        break;
                    }
                    statusCode      = ExtractStatusCode(rawData.GetBuffer(), startPos);
                    responseVersion = ExtractResponseVersion(rawData.GetBuffer(), startPos);
                    if (statusCode != 100)
                    {
                        break;
                    }
                    startPos = num2 + "\r\n\r\n".Length;
                }
            } while ((statusCode == 0) || (statusCode == 100));
            rawData.Position = startPos;
            responseHeader.Clear();
            responseHeader.LoadFromStream(rawData, ((num2 + "\r\n\r\n".Length) - startPos), false, string.Empty);
            ResponseHeader.ParseHeader(responseHeader);
        }