bool ReadEntity() { if (AtEndBoundary) { return(false); } var entity = new MultipartHttpEntity(); // TODO: Handle split headers while (ReadNextLine() && !string.IsNullOrEmpty(_currentLine) && !AtBoundary && !AtEndBoundary) { var columnIndex = _currentLine.IndexOf(":", StringComparison.Ordinal); if (columnIndex != -1) { entity.Headers[_currentLine.Substring(0, columnIndex).Trim()] = _currentLine.Substring(columnIndex + 1).Trim(); } } if (_currentLine == null) { entity.Dispose(); return(false); } if (_currentLine.Length == 0) { entity.Stream = _reader.GetNextPart(); } CurrentEntity = entity; return(true); }
void GivenAFormEntity(string key, string value) { var entity = new MultipartHttpEntity(); entity.Headers["Content-Disposition"] = "form-data; name=\"" + key + "\""; entity.Stream = new MemoryStream(); var swriter = new StreamWriter(entity.Stream, Encoding.ASCII); swriter.Write(value); swriter.Flush(); entity.Stream.Position = 0; Entities.Add(entity); }
private bool ReadEntity() { if (this.AtEndBoundary) { return false; } var entity = new MultipartHttpEntity(); // TODO: Handle split headers while (this.ReadNextLine() && !string.IsNullOrEmpty(this.currentLine) && !this.AtBoundary && !this.AtEndBoundary) { int columnIndex = this.currentLine.IndexOf(":"); if (columnIndex != -1) { entity.Headers[this.currentLine.Substring(0, columnIndex).Trim()] = this.currentLine.Substring(columnIndex + 1).Trim(); } } if (this.currentLine == null) { return false; } if (this.currentLine.Length == 0) { entity.Stream = this.reader.GetNextPart(); } this.CurrentEntity = entity; return true; }
bool ReadEntity() { if (AtEndBoundary) return false; var entity = new MultipartHttpEntity(); // TODO: Handle split headers while (ReadNextLine() && !string.IsNullOrEmpty(_currentLine) && !AtBoundary && !AtEndBoundary) { var columnIndex = _currentLine.IndexOf(":", StringComparison.Ordinal); if (columnIndex != -1) entity.Headers[_currentLine.Substring(0, columnIndex).Trim()] = _currentLine.Substring(columnIndex + 1).Trim(); } if (_currentLine == null) { entity.Dispose(); return false; } if (_currentLine.Length == 0) entity.Stream = _reader.GetNextPart(); CurrentEntity = entity; return true; }