Minor tweak to complete parsing earlier if content length is zero

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22885 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-05-10 04:45:57 +00:00
parent 5aaf7ecd23
commit 149aeb6631
2 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2006-05-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSMime.m: Check for content-length specified as
zero, and mark parsing as complete without attempting to read body.
2006-05-09 Nicolas Roard <nicolas@roard.com>
* Source/NSSortDescriptor.m: use -valueForKeyPath: instead

View file

@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>The MIME parsing system</title>
<chapter>
@ -1413,6 +1414,7 @@ wordData(NSString *word)
if (flags.inBody == 1)
{
NSDictionary *info;
GSMimeHeader *hdr;
info = [[document headersNamed: @"http"] lastObject];
if (info != nil)
@ -1436,6 +1438,17 @@ wordData(NSString *word)
}
}
}
/*
* If there is a zero content length, parsing is complete.
*/
hdr = [document headerNamed: @"content-length"];
if (hdr != nil && [[hdr value] intValue] == 0)
{
[document setContent: @""];
flags.inBody = 0;
flags.complete = 1;
return NO; // No more data needed
}
}
}