Esempio n. 1
0
        /// <summary>
        /// Tries to parse a chunk size line for the message
        /// </summary>
        /// <returns></returns>
        private bool TryAndParseChunkSizeLine(ref HttpMessage message, HttpMessageProgressEventHandler onProgress, object stateObject)
        {
            // try and parse a token from the data
            HttpByteParserToken token = _parser.GetNextToken();

            if (token == null)
            {
                return(false);
            }

            // the first line of any message is never empty
            if (token.IsEmpty)
            {
                return(false);
            }

            // success! this line is a header
            string line = token.ToString(HttpUtils.Encoding);

            // parse the size line
            HttpChunkSizeLine chunkSizeLine = HttpChunkSizeLine.Parse(line);

            // create a new chunk
            _chunk = new HttpChunk(chunkSizeLine, null);

            // change state to processing chunk data
            _state = Processing.ChunkData;

            return(true);
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the HttpChunk class
 /// </summary>
 /// <param name="sizeLine"></param>
 /// <param name="data"></param>
 public HttpChunk(HttpChunkSizeLine sizeLine, byte[] data)
 {
     _sizeLine = sizeLine;
     _data     = data;
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the HttpChunk class
 /// </summary>
 /// <param name="size"></param>
 /// <param name="extension"></param>
 /// <param name="data"></param>
 public HttpChunk(int size, string extension, byte[] data)
 {
     _sizeLine = new HttpChunkSizeLine(size, extension);
     _data     = HttpUtils.Clone(data, 0, data.Length);
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the HttpChunk class
 /// </summary>
 /// <param name="data"></param>
 public HttpChunk(byte[] data)
 {
     _sizeLine = new HttpChunkSizeLine(data.Length, null);
     _data     = HttpUtils.Clone(data, 0, data.Length);
 }
Esempio n. 5
0
		/// <summary>
		/// Initializes a new instance of the HttpChunk class
		/// </summary>
		/// <param name="sizeLine"></param>
		/// <param name="data"></param>
		public HttpChunk(HttpChunkSizeLine sizeLine, byte[] data)
		{
			_sizeLine = sizeLine;
			_data = data;
		}
Esempio n. 6
0
		/// <summary>
		/// Initializes a new instance of the HttpChunk class
		/// </summary>
		/// <param name="size"></param>
		/// <param name="extension"></param>
		/// <param name="data"></param>
		public HttpChunk(int size, string extension, byte[] data)
		{
			_sizeLine = new HttpChunkSizeLine(size, extension);
			_data = HttpUtils.Clone(data, 0, data.Length);			
		}
Esempio n. 7
0
		/// <summary>
		/// Initializes a new instance of the HttpChunk class
		/// </summary>
		/// <param name="data"></param>
		public HttpChunk(byte[] data)
		{
			_sizeLine = new HttpChunkSizeLine(data.Length, null);
			_data = HttpUtils.Clone(data, 0, data.Length);
		}