diff options
Diffstat (limited to 'src/headerField.cpp')
-rw-r--r-- | src/headerField.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/headerField.cpp b/src/headerField.cpp index 7d23ce84..1d33dac1 100644 --- a/src/headerField.cpp +++ b/src/headerField.cpp @@ -142,7 +142,7 @@ ref <headerField> headerField::parseNext ++pos; const string::size_type contentsStart = pos; - string::size_type contentsEnd = end; + string::size_type contentsEnd = 0; // Extract the field value while (pos < end) @@ -215,6 +215,20 @@ ref <headerField> headerField::parseNext } } + if (pos == end && contentsEnd == 0) + { + // End of data, and no CRLF was found at the end + contentsEnd = end; + } + + // Strip spaces from end of header lines + while (contentsEnd > contentsStart && + (buffer[contentsEnd - 1] == ' ' || buffer[contentsEnd - 1] == '\t' || + buffer[contentsEnd - 1] == '\r' || buffer[contentsEnd - 1] == '\n')) + { + contentsEnd--; + } + // Return a new field ref <headerField> field = headerFieldFactory::getInstance()->create(name); |