feat: remember boundary from parsing
All checks were successful
Compilation test / build (push) Successful in 15m19s

This commit is contained in:
saturneric 2024-11-28 12:00:39 +01:00
parent 43b262bd8c
commit 193a9ee85b
2 changed files with 9 additions and 5 deletions

View File

@ -381,6 +381,10 @@ void body::parseImpl(
m_contents = make_shared <streamContentHandler>(contentStream, length, enc);
}
if (!boundary.empty()) {
m_boundary = boundary;
}
setParsedBounds(position, end);
if (newPosition) {
@ -439,8 +443,7 @@ void body::generateImpl(
if (!m_part) {
boundary = generateRandomBoundaryString();
boundary = m_boundary.empty() ? generateRandomBoundaryString() : m_boundary;
} else {
// Use current boundary string, if specified. If no "Content-Type" field is
@ -457,13 +460,13 @@ void body::generateImpl(
} else {
// No boundary string specified
boundary = generateRandomBoundaryString();
boundary = m_boundary.empty() ? generateRandomBoundaryString() : m_boundary;
}
} else {
// No Content-Type (and no boundary string specified)
boundary = generateRandomBoundaryString();
boundary = m_boundary.empty() ? generateRandomBoundaryString() : m_boundary;
}
}

View File

@ -306,7 +306,8 @@ private:
string m_prologText;
string m_epilogText;
string m_epilogText;
string m_boundary;
shared_ptr <const contentHandler> m_contents;