fixed: PostMultiParser incorrectly logged the size of input items (those which were not files)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@633 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
9901c63ede
commit
c7f6d2727c
|
@ -238,16 +238,24 @@ size_t i;
|
|||
|
||||
void PostMultiParser::ReadContentSkipBoundary(bool has_boundary)
|
||||
{
|
||||
if( has_boundary )
|
||||
if( has_boundary && content.size() >= boundary.size() )
|
||||
{
|
||||
content.erase(content.size()-boundary.size());
|
||||
content_len -= boundary.size();
|
||||
}
|
||||
|
||||
// the last new line character doesn't belong to the content
|
||||
// this is a new line character before the boundary
|
||||
if( !content.empty() && content[content.size()-1] == 10 )
|
||||
{
|
||||
content.erase(content.size()-1);
|
||||
content_len -= 1;
|
||||
|
||||
if( line_end_dos && !content.empty() && content[content.size()-1] == 13 )
|
||||
{
|
||||
content.erase(content.size()-1);
|
||||
content_len -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,12 +268,12 @@ bool has_boundary = false;
|
|||
while( last!=-1 && !(has_boundary=HasBoundary()) )
|
||||
{
|
||||
content += last;
|
||||
content_len += 1;
|
||||
ReadChar();
|
||||
|
||||
if( content.size() > WINIX_POSTMULTI_OUTPUT_BUFFER + boundary.size() + 2 ) // +2 for the new line character
|
||||
{
|
||||
tmp_file.write(content.c_str(), WINIX_POSTMULTI_OUTPUT_BUFFER);
|
||||
content_len += WINIX_POSTMULTI_OUTPUT_BUFFER;
|
||||
content.erase(0, WINIX_POSTMULTI_OUTPUT_BUFFER);
|
||||
}
|
||||
|
||||
|
@ -283,7 +291,6 @@ bool has_boundary = false;
|
|||
if( !content.empty() )
|
||||
{
|
||||
tmp_file.write(content.c_str(), content.size());
|
||||
content_len += content.size();
|
||||
content.clear();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue