protected virtual void CreateSingleItem(Stream stream) { var count = (int)(stream.Length - stream.Position); var buffer = new byte[count]; stream.Read(buffer, 0, count); string source = Encoding.ASCII.GetString(buffer); if (IsForm()) { ParseFormFieldRequest(source); } else { Items.AddTextData(source).AfterAddData(); } }
protected virtual HttpRequestItem CreateItem(IList header, HeaderFieldList fieldList) { string source = HeaderFieldList.GetHeaderFieldValue(header, fieldList, "Content-Disposition"); if ( !HeaderFieldList.GetHeaderFieldValueItem(source, "").ToLower(CultureInfo.InvariantCulture).Equals( "form-data")) { return(Items.AddTextData("")); } string headerFieldValueItem = HeaderFieldList.GetHeaderFieldValueItem(source, "filename="); if (!StringUtils.IsEmpty(headerFieldValueItem)) { return(Items.AddSubmitFile(headerFieldValueItem, "")); } return(Items.AddFormField(HeaderFieldList.GetHeaderFieldValueItem(source, "name="), string.Empty)); }