| 283 | } |
| 284 | |
| 285 | std::string HTMLForm::MultipartReadBuffer::readLine(bool append_crlf) |
| 286 | { |
| 287 | std::string line; |
| 288 | char ch = 0; // silence "uninitialized" warning from gcc-* |
| 289 | |
| 290 | /// If we don't append CRLF, it means that we may have to prepend CRLF from previous content line, which wasn't the boundary. |
| 291 | if (in.read(ch)) |
| 292 | line += ch; |
| 293 | if (in.read(ch)) |
| 294 | line += ch; |
| 295 | if (append_crlf && line == "\r\n") |
| 296 | return line; |
| 297 | |
| 298 | while (!in.eof()) |
| 299 | { |
| 300 | while (in.read(ch) && ch != '\r') |
| 301 | line += ch; |
| 302 | |
| 303 | if (in.eof()) break; |
| 304 | |
| 305 | chassert(ch == '\r'); |
| 306 | |
| 307 | if (in.peek(ch) && ch == '\n') |
| 308 | { |
| 309 | in.ignore(); |
| 310 | if (append_crlf) line += "\r\n"; |
| 311 | break; |
| 312 | } |
| 313 | |
| 314 | line += ch; |
| 315 | } |
| 316 | |
| 317 | return line; |
| 318 | } |
| 319 | |
| 320 | bool HTMLForm::MultipartReadBuffer::nextImpl() |
| 321 | { |