gmime r1232 - in trunk: . gmime
- From: fejj svn gnome org
- To: svn-commits-list gnome org
- Subject: gmime r1232 - in trunk: . gmime
- Date: Fri, 2 May 2008 23:19:30 +0100 (BST)
Author: fejj
Date: Fri May 2 22:19:29 2008
New Revision: 1232
URL: http://svn.gnome.org/viewvc/gmime?rev=1232&view=rev
Log:
2008-05-02 Jeffrey Stedfast <fejj novell com>
* gmime/gmime-parser.c (parser_step_headers): Fix for CRLF encoded
input.
Modified:
trunk/ChangeLog
trunk/gmime/gmime-parser.c
Modified: trunk/gmime/gmime-parser.c
==============================================================================
--- trunk/gmime/gmime-parser.c (original)
+++ trunk/gmime/gmime-parser.c Fri May 2 22:19:29 2008
@@ -851,7 +851,7 @@
parser_step_headers (GMimeParser *parser)
{
struct _GMimeParserPrivate *priv = parser->priv;
- gboolean valid = TRUE, fieldname = TRUE;
+ gboolean eoln, valid = TRUE, fieldname = TRUE;
struct _header_raw *hend;
register char *inptr;
char *start, *inend;
@@ -883,10 +883,13 @@
while (inptr < inend) {
start = inptr;
- if (fieldname && *inptr != '\n') {
+ eoln = inptr[0] == '\n' || (inptr[0] == '\r' && inptr[1] == '\n');
+ if (fieldname && !eoln) {
/* scan and validate the field name */
if (*inptr != ':') {
+ /* Note: see optimization comment [1] */
*inend = ':';
+
while (*inptr != ':') {
if (is_type (*inptr, IS_SPACE | IS_CTRL)) {
valid = FALSE;
@@ -903,6 +906,7 @@
goto refill;
}
+ /* Note: see optimization comment [1] */
*inend = '\n';
} else if (*inptr == ':') {
valid = FALSE;
@@ -941,13 +945,13 @@
goto refill;
}
- /* check to see if we've reached the end of the headers */
- if (!priv->midline && (inptr == start || (len == 1 && *start == '\r')))
- goto headers_end;
-
if (inptr > start && inptr[-1] == '\r')
len--;
+ /* check to see if we've reached the end of the headers */
+ if (!priv->midline && len == 0)
+ goto headers_end;
+
header_append (priv, start, len);
/* inptr has to be less than inend - 1 */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]